1 / 7

Eclipse Example Guide

Eclipse Example Guide. Example : Java Editor. Introduction. 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

sheena
Download Presentation

Eclipse Example Guide

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Eclipse Example Guide Example : Java Editor

  2. Introduction • 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. Features demonstrated • syntax highlighting • content type sensitive content assist (JavaDoc and Java code) • communication between content outliner and editor, • i.e. content outliner selection feeds the highlight range of the editor • 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) • marker handling • document sharing

  4. How to run the editor

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

  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. Code organization • four packages: • org.eclipse.ui.examples.javaeditor • contains all the editor specific classes. • 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. • org.eclipse.ui.examples.javaeditor.javadoc • contains all JavaDoc specific source viewer plugins such as the JavaDocDamagerRepairer. • org.eclipse.ui.examples.javaeditor.util • contains convenience classes shared by the three other packages.

More Related