org.openide.util.actions.NodeAction Java Examples

The following examples show how to use org.openide.util.actions.NodeAction. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: OutlineTopComponent.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
private void initToolbar() {

        Toolbar toolbar = new Toolbar();
        Border b = (Border) UIManager.get("Nb.Editor.Toolbar.border"); //NOI18N
        toolbar.setBorder(b);
        this.add(toolbar, BorderLayout.NORTH);

        toolbar.add(ImportAction.get(ImportAction.class));
        toolbar.add(((NodeAction) RemoveAction.get(RemoveAction.class)).createContextAwareInstance(this.getLookup()));
        toolbar.add(RemoveAllAction.get(RemoveAllAction.class));

        toolbar.add(((NodeAction) SaveAsAction.get(SaveAsAction.class)).createContextAwareInstance(this.getLookup()));
        toolbar.add(SaveAllAction.get(SaveAllAction.class));

        toolbar.add(StructuredViewAction.get(StructuredViewAction.class).getToolbarPresenter());

        for (Toolbar tb : ToolbarPool.getDefault().getToolbars()) {
            tb.setVisible(false);
        }

        initOrganizers();
    }
 
Example #2
Source File: OutlineTopComponent.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
private void initToolbar() {

        Toolbar toolbar = new Toolbar();
        Border b = (Border) UIManager.get("Nb.Editor.Toolbar.border"); //NOI18N
        toolbar.setBorder(b);
        this.add(toolbar, BorderLayout.NORTH);

        toolbar.add(ImportAction.get(ImportAction.class));
        toolbar.add(((NodeAction) RemoveAction.get(RemoveAction.class)).createContextAwareInstance(this.getLookup()));
        toolbar.add(RemoveAllAction.get(RemoveAllAction.class));

        toolbar.add(((NodeAction) SaveAsAction.get(SaveAsAction.class)).createContextAwareInstance(this.getLookup()));
        toolbar.add(SaveAllAction.get(SaveAllAction.class));

        toolbar.add(StructuredViewAction.get(StructuredViewAction.class).getToolbarPresenter());

        for (Toolbar tb : ToolbarPool.getDefault().getToolbars()) {
            tb.setVisible(false);
        }

        initOrganizers();
    }
 
Example #3
Source File: OutlineTopComponent.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
private void initToolbar() {

        Toolbar toolbar = new Toolbar();
        Border b = (Border) UIManager.get("Nb.Editor.Toolbar.border"); //NOI18N
        toolbar.setBorder(b);
        this.add(toolbar, BorderLayout.NORTH);

        toolbar.add(ImportAction.get(ImportAction.class));
        toolbar.add(((NodeAction) RemoveAction.get(RemoveAction.class)).createContextAwareInstance(this.getLookup()));
        toolbar.add(RemoveAllAction.get(RemoveAllAction.class));

        toolbar.add(((NodeAction) SaveAsAction.get(SaveAsAction.class)).createContextAwareInstance(this.getLookup()));
        toolbar.add(SaveAllAction.get(SaveAllAction.class));

        toolbar.add(StructuredViewAction.get(StructuredViewAction.class).getToolbarPresenter());

        for (Toolbar tb : ToolbarPool.getDefault().getToolbars()) {
            tb.setVisible(false);
        }

        initOrganizers();
    }
 
Example #4
Source File: OutlineTopComponent.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
private void initToolbar() {

        Toolbar toolbar = new Toolbar();
        Border b = (Border) UIManager.get("Nb.Editor.Toolbar.border"); //NOI18N
        toolbar.setBorder(b);
        this.add(toolbar, BorderLayout.NORTH);

        toolbar.add(ImportAction.get(ImportAction.class));
        toolbar.add(((NodeAction) RemoveAction.get(RemoveAction.class)).createContextAwareInstance(this.getLookup()));
        toolbar.add(RemoveAllAction.get(RemoveAllAction.class));

        toolbar.add(((NodeAction) SaveAsAction.get(SaveAsAction.class)).createContextAwareInstance(this.getLookup()));
        toolbar.add(SaveAllAction.get(SaveAllAction.class));

        toolbar.add(StructuredViewAction.get(StructuredViewAction.class).getToolbarPresenter());

        for (Toolbar tb : ToolbarPool.getDefault().getToolbars()) {
            tb.setVisible(false);
        }

        initOrganizers();
    }
 
Example #5
Source File: OutlineTopComponent.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
private void initToolbar() {

        Toolbar toolbar = new Toolbar();
        Border b = (Border) UIManager.get("Nb.Editor.Toolbar.border"); //NOI18N
        toolbar.setBorder(b);
        this.add(toolbar, BorderLayout.NORTH);

        toolbar.add(ImportAction.get(ImportAction.class));

        toolbar.add(((NodeAction) SaveAsAction.get(SaveAsAction.class)).createContextAwareInstance(this.getLookup()));
        toolbar.add(SaveAllAction.get(SaveAllAction.class));

        toolbar.add(((NodeAction) RemoveAction.get(RemoveAction.class)).createContextAwareInstance(this.getLookup()));
        toolbar.add(RemoveAllAction.get(RemoveAllAction.class));

        toolbar.add(GarbageCollectAction.get(GarbageCollectAction.class).getToolbarPresenter());

        for (Toolbar tb : ToolbarPool.getDefault().getToolbars()) {
            tb.setVisible(false);
        }
    }
 
Example #6
Source File: OutlineTopComponent.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
private void initToolbar() {

        Toolbar toolbar = new Toolbar();
        Border b = (Border) UIManager.get("Nb.Editor.Toolbar.border"); //NOI18N
        toolbar.setBorder(b);
        this.add(toolbar, BorderLayout.NORTH);

        toolbar.add(ImportAction.get(ImportAction.class));
        toolbar.add(((NodeAction) RemoveAction.get(RemoveAction.class)).createContextAwareInstance(this.getLookup()));
        toolbar.add(RemoveAllAction.get(RemoveAllAction.class));

        toolbar.add(((NodeAction) SaveAsAction.get(SaveAsAction.class)).createContextAwareInstance(this.getLookup()));
        toolbar.add(SaveAllAction.get(SaveAllAction.class));

        toolbar.add(StructuredViewAction.get(StructuredViewAction.class).getToolbarPresenter());

        for (Toolbar tb : ToolbarPool.getDefault().getToolbars()) {
            tb.setVisible(false);
        }

        initOrganizers();
    }
 
Example #7
Source File: OutlineTopComponent.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
private void initToolbar() {

        Toolbar toolbar = new Toolbar();
        Border b = (Border) UIManager.get("Nb.Editor.Toolbar.border"); //NOI18N
        toolbar.setBorder(b);
        this.add(toolbar, BorderLayout.NORTH);

        toolbar.add(ImportAction.get(ImportAction.class));
        toolbar.add(((NodeAction) RemoveAction.get(RemoveAction.class)).createContextAwareInstance(this.getLookup()));
        toolbar.add(RemoveAllAction.get(RemoveAllAction.class));

        toolbar.add(((NodeAction) SaveAsAction.get(SaveAsAction.class)).createContextAwareInstance(this.getLookup()));
        toolbar.add(SaveAllAction.get(SaveAllAction.class));

        toolbar.add(StructuredViewAction.get(StructuredViewAction.class).getToolbarPresenter());

        for (Toolbar tb : ToolbarPool.getDefault().getToolbars()) {
            tb.setVisible(false);
        }

        initOrganizers();
    }
 
Example #8
Source File: OutlineTopComponent.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
private void initToolbar() {

        Toolbar toolbar = new Toolbar();
        Border b = (Border) UIManager.get("Nb.Editor.Toolbar.border"); //NOI18N
        toolbar.setBorder(b);
        this.add(toolbar, BorderLayout.NORTH);

        toolbar.add(ImportAction.get(ImportAction.class));
        toolbar.add(((NodeAction) RemoveAction.get(RemoveAction.class)).createContextAwareInstance(this.getLookup()));
        toolbar.add(RemoveAllAction.get(RemoveAllAction.class));

        toolbar.add(((NodeAction) SaveAsAction.get(SaveAsAction.class)).createContextAwareInstance(this.getLookup()));
        toolbar.add(SaveAllAction.get(SaveAllAction.class));

        toolbar.add(StructuredViewAction.get(StructuredViewAction.class).getToolbarPresenter());

        for (Toolbar tb : ToolbarPool.getDefault().getToolbars()) {
            tb.setVisible(false);
        }

        initOrganizers();
    }
 
Example #9
Source File: JavaRefactoringGlobalAction.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private boolean isMethodOverridden(NodeAction d, String name) {
    try {
        Method m = d.getClass().getMethod(name, new Class[0]);

        return m.getDeclaringClass() != CallableSystemAction.class;
    } catch (java.lang.NoSuchMethodException ex) {
        ex.printStackTrace();
        throw new IllegalStateException("Error searching for method " + name + " in " + d); // NOI18N
    }
}
 
Example #10
Source File: JavaRefactoringGlobalAction.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private boolean isMethodOverridden(NodeAction d, String name) {
    try {
        Method m = d.getClass().getMethod(name, new Class[0]);

        return m.getDeclaringClass() != CallableSystemAction.class;
    } catch (java.lang.NoSuchMethodException ex) {
        ex.printStackTrace();
        throw new IllegalStateException("Error searching for method " + name + " in " + d); // NOI18N
    }
}
 
Example #11
Source File: RefactoringGlobalAction.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private boolean isMethodOverridden(NodeAction d, String name) {
    try {
        Method m = d.getClass().getMethod(name, new Class[0]);

        return m.getDeclaringClass() != CallableSystemAction.class;
    } catch (java.lang.NoSuchMethodException ex) {
        ex.printStackTrace();
        throw new IllegalStateException("Error searching for method " + name + " in " + d); // NOI18N
    }
}
 
Example #12
Source File: HtmlRefactoringGlobalAction.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private boolean isMethodOverridden(NodeAction d, String name) {
    try {
        Method m = d.getClass().getMethod(name, new Class[0]);

        return m.getDeclaringClass() != CallableSystemAction.class;
    } catch (java.lang.NoSuchMethodException ex) {
        ex.printStackTrace();
        throw new IllegalStateException("Error searching for method " + name + " in " + d); // NOI18N
    }
}
 
Example #13
Source File: IndexedEditorPanel.java    From netbeans with Apache License 2.0 4 votes vote down vote up
/** Creates new form IndexedEditorPanel */
public IndexedEditorPanel(Node node, Node.Property[] props) {
    treeTableView1 = new TreeTableView();

    // install proper border
    setBorder((Border) UIManager.get("Nb.ScrollPane.border")); // NOI18N
    initComponents();
    propertiesLabel.setLabelFor(treeTableView1);

    jPanel2.setLayout(new java.awt.BorderLayout());
    jPanel2.add(treeTableView1);

    detailsPanel.setLayout(new java.awt.BorderLayout());
    getExplorerManager().setRootContext(node);

    rootNode = node;
    prop = props[0];
    getExplorerManager().addPropertyChangeListener(this);
    treeTableView1.setProperties(props);
    treeTableView1.setRootVisible(false);
    treeTableView1.setDefaultActionAllowed(false);
    treeTableView1.setTreePreferredWidth(200);

    node.addPropertyChangeListener(this);

    try {
        ClassLoader l = Lookup.getDefault().lookup(ClassLoader.class);
        if (l == null) {
            l = Thread.currentThread().getContextClassLoader();
        }
        if (l == null) {
            l = getClass().getClassLoader();
        }
        
        selectedLookup = org.openide.util.lookup.Lookups.proxy(this);

        NodeAction globalMoveUp = SystemAction.get(Class.forName("org.openide.actions.MoveUpAction", true, l).asSubclass(NodeAction.class)); // NOI18N
        NodeAction globalMoveDown = SystemAction.get(Class.forName("org.openide.actions.MoveDownAction", true, l).asSubclass(NodeAction.class)); // NOI18N
        NodeAction globalNewAction = SystemAction.get(Class.forName("org.openide.actions.NewAction", true, l).asSubclass(NodeAction.class)); // NOI18N

        // Get context aware instances.
        moveUp = globalMoveUp.createContextAwareInstance(selectedLookup);
        moveDown = globalMoveDown.createContextAwareInstance(selectedLookup);
        newAction = globalNewAction.createContextAwareInstance(selectedLookup);
    } catch (ClassNotFoundException cnfe) {
        LOG.log(Level.INFO, "Maybe missing openide.actions module?", cnfe);
    }

    java.util.ResourceBundle bundle = NbBundle.getBundle(IndexedEditorPanel.class);
    treeTableView1.getAccessibleContext().setAccessibleDescription(bundle.getString("ACSD_Properties"));
    newButton.getAccessibleContext().setAccessibleDescription(bundle.getString("ACSD_New"));
    deleteButton.getAccessibleContext().setAccessibleDescription(bundle.getString("ACSD_Delete"));
    upButton.getAccessibleContext().setAccessibleDescription(bundle.getString("ACSD_MoveUp"));
    downButton.getAccessibleContext().setAccessibleDescription(bundle.getString("ACSD_MoveDown"));
    getAccessibleContext().setAccessibleDescription(bundle.getString("ACSD_IndexedEditorPanel"));
}
 
Example #14
Source File: NewAction.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public DelegateAction(NodeAction a, Lookup actionContext) {
    this.delegate = a;
    this.model = new ActSubMenuModel(actionContext);
}