Creating an Editor extension

From Aptana Development

This page describes how to create an extension for an Aptana Editor.

Instructions

Use the image below as a reference as you follow the instructions in this section.

SQL Editor extension point definition

  1. Open the plugin.xml'Bold text' file for the plugin.
  2. Activate the Extensions tab.
  3. Click Add...
  4. Select the org.eclipse.ui.editors extension point. In the future, this wizard will have an Aptana Editor template.
  5. Click Finish.
  6. Right-click the new extension and select New > Editor from the context menu.
  7. Fill in the extension element details.
  8. Our ids follow the com.aptana.ide.editors.XXX naming scheme where XXX is the name of your editor.
    1. The "name" will be used in the UI. We're currently following the Aptana XXX Editor. XXX is the name of you editor's language.
    2. Browse for an icon file. This will be used when displaying the file in Projects and File View. You'll want to create an "icons" folder at the top-level of your plug-in project and place your image there. Our current naming convention uses the file extension: XXX.png, for example. Note that you need to make sure that your icon directory is selected under the "Build Binary" section of the "Build" tab in your plugin.xml file.
    3. Enter the file extension for this language, excluding the leading period. Note that you can add multiple extensions to this field, delimited by commas.
    4. Browse to the class that implements your editor, or click the "class:" label. By default, the wizard will set the superclass to "org.eclipse.ui.part.EditorPart"; however, you want to use "com.aptana.ide.editors.unified.UnifiedEditor" as your base class. Our current naming convention for editor classes is XXXEditor, where XXX is the abbreviated name for your language.

      If you created your editor class in the last step, then you need to following the additional steps described in Creating an Aptana Editor class before proceeding.

      "command" and "launcher: should remain empty.

    5. Browse to "com.aptana.ide.editors.unified.actions.UnifiedActionContributor" for the "contribureClass".
    6. If you want this editor to be the default editor for its file extensions, then set "default" to true.
    7. The remaining fields, "filenames", "symbolicFontName", and "matchingStrategy", should remain empty.

Now you can use your editor in the IDE. You will need to run the IDE via ide.product in the com.aptana.ide.rcp plug-in so that the run configuration includes your new plug-in.

You won't see much happening, but the most visible item is that any file in the ProjectView or FileView using your extension should show your custom icon. You can set a breakpoint in your editor's constructor and run the IDE in a debugging environment. That will confirm that your editor is being instantiated when its file types are being opened.

Related Topics



Aptana Developer Home