Create a Visual File Editor

Sometimes you want to edit certain file types in the IDE, but do it with a visual editor, instead of a text editor. One example could be an SVG Editor. You probably prefer visually editing your graphics to editing the XML. To acchieve this used to be difficult in the past, because NetBeans Editor API is centered around Text Editors. With NetBeans 7.2 it became very simple.

Just go to “New File” -> “Module Development” ->”FileType” and make sure you check “use MultiView” in the Wizard. This will create a DataObject including an annotated method:


@MultiViewElement.Registration(
 displayName = "#LBL_test_EDITOR",
 iconBase = "de/eppleton/physics/editor/scene/apply.png",
 mimeType = "text/x-bla",
 persistenceType = TopComponent.PERSISTENCE_ONLY_OPENED,
 preferredID = "test",
 position = 1000)
 @Messages("LBL_test_EDITOR=Source")
 public static MultiViewEditorElement createEditor(Lookup lkp) {
 return new MultiViewEditorElement(lkp);
 }

Delete this method and the Text Editor will be gone. All that is left will be the VisualElement, which you can design in any way you like to.

 

Dieser Eintrag wurde in netbeans geschrieben. Link merken.

Hinterlasse eine Antwort

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind markiert *

Du kannst folgende HTML-Tags benutzen: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>