Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 Eclipse Example Guide Example : Java Editor. 2 Introduction l The Java Editor example : »demonstrates the standard features available for custom text.

Similar presentations


Presentation on theme: "1 Eclipse Example Guide Example : Java Editor. 2 Introduction l The Java Editor example : »demonstrates the standard features available for custom text."— Presentation transcript:

1 1 Eclipse Example Guide Example : Java Editor

2 2 Introduction l The Java Editor example : »demonstrates the standard features available for custom text editors. »shows how to register an editor for a file extension (in this case.jav) and »how to define a custom Document provider for use by that editor. »only for demonstration purposes. Java editing support is provided by the Eclipse Java Tooling.

3 3 Features demonstrated l syntax highlighting l content type sensitive content assist (JavaDoc and Java code) l communication between content outliner and editor, »i.e. content outliner selection feeds the highlight range of the editor l two different presentation modes »marking the highlight range using a visual range indicator »confining the editor to show only text within the highlight range (e.g. show a single method of a Java class) l marker handling l document sharing

4 4 How to run the editor

5 5 Principles for creating custom text editors 1. Create a document provider. 2. Create a document partitioner 3. Determine source viewer plugins to be provided 4. Create for all source viewer plugins the appropriate extensions for each supported content type 5. Build a source viewer configuration using the previously created plugins and extensions.

6 6 6. Customize the class TextEditor or AbstractTextEditor with the developed document partitioner and source viewer configuration. »Add or replace actions and adapt the construction of the editor's context menu. In the actual version, this customization must be done in a subclass. See JavaEditor in the example editor. 7. Set up an appropriate action bar contributor who contributes editor-related actions to the desktop's toolbar and menus. See JavaActionContributor in the example editor. 8. Extend the XML configuration file of the editor's plugin, so that the editor registers at the predefined editor extension point for a specific set of file extensions. Also set up the action bar contributor in the XML file. See plugin.xml of this example.

7 7 Code organization l four packages: l org.eclipse.ui.examples.javaeditor »contains all the editor specific classes. l org.eclipse.ui.examples.javaeditor.java »contains all Java specific source viewer plugins such as the JavaDamagerRepairer as well as the Java specific document partitioner. l org.eclipse.ui.examples.javaeditor.javadoc »contains all JavaDoc specific source viewer plugins such as the JavaDocDamagerRepairer. l org.eclipse.ui.examples.javaeditor.util »contains convenience classes shared by the three other packages.


Download ppt "1 Eclipse Example Guide Example : Java Editor. 2 Introduction l The Java Editor example : »demonstrates the standard features available for custom text."

Similar presentations


Ads by Google