Ext java-editor
Upcoming SlideShare
Loading in...5
×
 

Ext java-editor

on

  • 603 views

 

Statistics

Views

Total Views
603
Views on SlideShare
598
Embed Views
5

Actions

Likes
0
Downloads
6
Comments
0

1 Embed 5

http://www.linkedin.com 5

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Ext java-editor Ext java-editor Presentation Transcript

    • Extending the Java Editor 1. Project templates 2. File templates 3. Editor actions 4. File actions 5. Code generators 6. Error annotations
    • Module Development Tools
    • Project Templates
    • Project Templates @TemplateRegistration( folder = "Project/Samples/Standard", displayName = "#MyApp_displayName", description = "MyAppDescription.html", iconBase = "org/nb/alpha/deps/MyApp.png", content = "MyAppProject.zip") 1. public class MyAppWizardIterator implements WizardDescriptor.InstantiatingIterator {
    • File Templates
    • File Templates @TemplateRegistration( folder = "Other", content = "AbcTemplate.abc") package org.nb.alpha.deps; import org.netbeans.api.templates.TemplateRegistration;
    • Editor Actions
    • Editor Actions @ActionID( category = "Tools", id = "org.nb.alpha.deps.SomeAction" ) @ActionRegistration( displayName = "#CTL_SomeAction" ) @ActionReferences({ @ActionReference(path = "Menu/File", position = 0), @ActionReference(path = "Editors/text/x-java/Popup", position = 400) }) @Messages("CTL_SomeAction=Some") public final class SomeAction implements ActionListener { private final DataObject context; public SomeAction(DataObject context) { this.context = context; } @Override public void actionPerformed(ActionEvent ev) { // TODO use context } }
    • File Actions
    • File Actions @ActionID( category = "Tools", id = "org.nb.alpha.deps.AnotherAction" ) @ActionRegistration( iconBase = "org/nb/alpha/deps/icon.png", displayName = "#CTL_AnotherAction" ) @ActionReferences({ @ActionReference(path = "Menu/File", position = 0), @ActionReference(path = "Loaders/text/x-java/Actions", position = 0) }) @Messages("CTL_AnotherAction=Another") public final class AnotherAction implements ActionListener { private final DataObject context; public AnotherAction(DataObject context) { this.context = context; } @Override public void actionPerformed(ActionEvent ev) { // TODO use context } }
    • Code Generators
    • Code Generators public class ActionPerformedGenerator implements CodeGenerator { JTextComponent textComp; private ActionPerformedGenerator(Lookup context) { textComp = context.lookup(JTextComponent.class); } @MimeRegistration(mimeType = "text/x-java", service = CodeGenerator.Factory.class) public static class Factory implements CodeGenerator.Factory { public List<? extends CodeGenerator> create(Lookup context) { return Collections.singletonList(new ActionPerformedGenerator(context)); } } public String getDisplayName() { return "Action Performed Generator"; } public void invoke() { //do something with the text component... } }
    • Error Annotations
    • Error Annotations <folder name="Editors"> <folder name="AnnotationTypes"> <file name="org-netbeans-modules-yourfirstannotation.xml" url="HTMLAnnotation.xml"> </file> </folder> </folder> <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE type PUBLIC "-//NetBeans//DTD annotation type 1.1//EN" "http://www.netbeans.org/dtds/annotation-type-1_1.dtd"> <type name="org-netbeans-modules-yourfirstannotation" description_key="yourfirstannotation" localizing_bundle="org.netbeans.modules.yourfirstannotation.Bundle" visible="true" glyph="nbresloc:/org/netbeans/modules/java/resources/error-glyph.gif" highlight="#66CC33" type="line" browseable="false" severity="ok" />