||
Skip to end of metadata
Go to start of metadata

Developer Studio Kernel includes a sample plug-in project, which demonstrates the usage of the Web editor framework. 

  1. Download the samplewebeditor.zip file and extract it to a desired workspace. 
  2. In an Eclipse Luna SR2 instance (with WSO2 Developer Studio Kernel installed), click File > Import > Existing Projects into Workspace to import the project. After importing, the following project structure is created.


     
  3. As shown above, the SampleWebEditor folder contains a simple Web application (which only uses front end technologies), which is used as an editor for Developer Studio Kernel. 
  4. In the plugin.xml file, this Web application is added as an embedded Web application for Developer Studio Kernel by using the org.wso2.developerstudio.embedded.webap extension point provided by Developer Studio Kernel.


     
  5. A SampleTextAreaWebEditor.java editor class is created for the Web application by extending the org.wso2.developerstudio.eclipse.webui.core.editor.AbstractWebBasedEditor class. Implement the getWebAppID abstract method and return the unique ID you passed to the extension point while adding the Web application in the previous step.

  6. Assign this editor to a particular file type to ensure that Eclipse launches this editor by default when opening that type of file. In the plugin.xml file, this editor is registered using the org.eclipse.ui.editors extension point provided by Eclipse.  

     

A new editor has been created and assigned to the files with the .webeditor extension. (Note that binding the editor to a file using the content type of file rather than the extension type is also possible for more advanced use cases).

Follow the steps below to test the plug-in:

  1. Click Run > Run Configurations.
  2. Create a new run configuration for Eclipse Application.
  3. Run the plug-in using the created run configuration.
  4. Create an empty project in an open Eclipse instance.
  5. Create a new file with the .webeditor extension under the project created in the previous step.
  6. Double-click the file and it opens in the sample Web based editor you created.

     
  • No labels