org.openide.explorer.ExplorerUtils Java Examples

The following examples show how to use org.openide.explorer.ExplorerUtils. 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: TransactionView.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private void initialize() {

	mgr = new ExplorerManager();
	mgr.addPropertyChangeListener(this);
	mgr.setRootContext(controller.getRoot());

        // following line tells the top component which lookup should be associated with it
        associateLookup (ExplorerUtils.createLookup (mgr, getActionMap ()));

        setLayout(new java.awt.BorderLayout());
	tree = new BeanTreeView();
	tree.setDefaultActionAllowed(true);
	tree.getAccessibleContext().setAccessibleDescription(NbBundle.getBundle(TransactionView.class).getString("ACS_MON_treeName"));
	tree.getAccessibleContext().setAccessibleName(NbBundle.getBundle(TransactionView.class).getString("ACS_MON_treeDesc"));

	createLogPanel(); 
	createDataPanel(); 
	splitPanel = 
	    new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, logPanel, dataPanel); 
	splitPanel.setDividerLocation((int)(logD.getWidth()));
	splitPanel.setResizeWeight(dividerRatio);
	splitPanel.setDividerSize(1); 
	splitPanel.setOneTouchExpandable(true); 
	this.add(splitPanel);
	setName(NbBundle.getBundle(TransactionView.class).getString("MON_Title"));
    }
 
Example #2
Source File: BytecodeViewTopComponent.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
private BytecodeViewTopComponent() {
    initComponents();
    setName(NbBundle.getMessage(BytecodeViewTopComponent.class, "CTL_BytecodeViewTopComponent"));
    setToolTipText(NbBundle.getMessage(BytecodeViewTopComponent.class, "HINT_BytecodeViewTopComponent"));

    manager = new ExplorerManager();
    rootNode = new MethodNode(null, null, "");
    manager.setRootContext(rootNode);

    setLayout(new BorderLayout());

    treeView = new BeanTreeView();
    treeView.setRootVisible(false);
    this.add(BorderLayout.CENTER, treeView);
    associateLookup(ExplorerUtils.createLookup(manager, getActionMap()));
}
 
Example #3
Source File: BytecodeViewTopComponent.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
private BytecodeViewTopComponent() {
    initComponents();
    setName(NbBundle.getMessage(BytecodeViewTopComponent.class, "CTL_BytecodeViewTopComponent"));
    setToolTipText(NbBundle.getMessage(BytecodeViewTopComponent.class, "HINT_BytecodeViewTopComponent"));

    manager = new ExplorerManager();
    rootNode = new MethodNode(null, null, "");
    manager.setRootContext(rootNode);

    setLayout(new BorderLayout());

    treeView = new BeanTreeView();
    treeView.setRootVisible(false);
    this.add(BorderLayout.CENTER, treeView);
    associateLookup(ExplorerUtils.createLookup(manager, getActionMap()));
}
 
Example #4
Source File: BytecodeViewTopComponent.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
private BytecodeViewTopComponent() {
    initComponents();
    setName(NbBundle.getMessage(BytecodeViewTopComponent.class, "CTL_BytecodeViewTopComponent"));
    setToolTipText(NbBundle.getMessage(BytecodeViewTopComponent.class, "HINT_BytecodeViewTopComponent"));

    manager = new ExplorerManager();
    rootNode = new MethodNode(null, null, "");
    manager.setRootContext(rootNode);

    setLayout(new BorderLayout());

    treeView = new BeanTreeView();
    treeView.setRootVisible(false);
    this.add(BorderLayout.CENTER, treeView);
    associateLookup(ExplorerUtils.createLookup(manager, getActionMap()));
}
 
Example #5
Source File: BytecodeViewTopComponent.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
private BytecodeViewTopComponent() {
    initComponents();
    setName(NbBundle.getMessage(BytecodeViewTopComponent.class, "CTL_BytecodeViewTopComponent"));
    setToolTipText(NbBundle.getMessage(BytecodeViewTopComponent.class, "HINT_BytecodeViewTopComponent"));

    manager = new ExplorerManager();
    rootNode = new MethodNode(null, null, "");
    manager.setRootContext(rootNode);

    setLayout(new BorderLayout());

    treeView = new BeanTreeView();
    treeView.setRootVisible(false);
    this.add(BorderLayout.CENTER, treeView);
    associateLookup(ExplorerUtils.createLookup(manager, getActionMap()));
}
 
Example #6
Source File: BytecodeViewTopComponent.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
private BytecodeViewTopComponent() {
    initComponents();
    setName(NbBundle.getMessage(BytecodeViewTopComponent.class, "CTL_BytecodeViewTopComponent"));
    setToolTipText(NbBundle.getMessage(BytecodeViewTopComponent.class, "HINT_BytecodeViewTopComponent"));

    manager = new ExplorerManager();
    rootNode = new MethodNode(null, null, "");
    manager.setRootContext(rootNode);

    setLayout(new BorderLayout());

    treeView = new BeanTreeView();
    treeView.setRootVisible(false);
    this.add(BorderLayout.CENTER, treeView);
    associateLookup(ExplorerUtils.createLookup(manager, getActionMap()));
}
 
Example #7
Source File: BytecodeViewTopComponent.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
private BytecodeViewTopComponent() {
    initComponents();
    setName(NbBundle.getMessage(BytecodeViewTopComponent.class, "CTL_BytecodeViewTopComponent"));
    setToolTipText(NbBundle.getMessage(BytecodeViewTopComponent.class, "HINT_BytecodeViewTopComponent"));

    manager = new ExplorerManager();
    rootNode = new MethodNode(null, null, "");
    manager.setRootContext(rootNode);

    setLayout(new BorderLayout());

    treeView = new BeanTreeView();
    treeView.setRootVisible(false);
    this.add(BorderLayout.CENTER, treeView);
    associateLookup(ExplorerUtils.createLookup(manager, getActionMap()));
}
 
Example #8
Source File: BookmarksView.java    From netbeans with Apache License 2.0 6 votes vote down vote up
BookmarksView() {
//        getActionMap().put("rename", SystemAction.get(RenameAction.class));
        nodeTree = new BookmarksNodeTree();
        explorerManager = new ExplorerManager();
        explorerManager.setRootContext(nodeTree.rootNode());
        ActionMap actionMap = getActionMap();
        actionMap.put("delete", ExplorerUtils.actionDelete(explorerManager, false)); //NOI18N
        associateLookup(ExplorerUtils.createLookup(explorerManager, actionMap));
        explorerManager.addPropertyChangeListener(this);

        // Ctrl+T will toggle the tree/table view
        InputMap inputMap = getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
        inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_T, KeyEvent.CTRL_DOWN_MASK), "toggle-view"); //NOI18N
        actionMap.put("toggle-view", new AbstractAction() { //NOI18N
            @Override
            public void actionPerformed(ActionEvent e) {
                setTreeViewVisible(!treeViewShowing);
            }
        });
        setIcon(ImageUtilities.loadImage("org/netbeans/modules/editor/bookmarks/resources/bookmark_16.png")); // NOI18N
    }
 
Example #9
Source File: ErrorNavigatorProviderImpl.java    From netbeans with Apache License 2.0 6 votes vote down vote up
public JComponent getComponent() {
    if (panel == null) {
        final BeanTreeView view = new BeanTreeView();
        view.setRootVisible(false);
        view.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
        class Panel extends JPanel implements ExplorerManager.Provider, Lookup.Provider {
            // Make sure action context works correctly:
            private final Lookup lookup = ExplorerUtils.createLookup(manager, new ActionMap());
            {
                setLayout(new BorderLayout());
                add(view, BorderLayout.CENTER);
            }
            public ExplorerManager getExplorerManager() {
                return manager;
            }
            public Lookup getLookup() {
                return lookup;
            }
        }
        panel = new Panel();
    }
    return panel;
}
 
Example #10
Source File: ClasspathNavigatorProviderImpl.java    From netbeans with Apache License 2.0 6 votes vote down vote up
public JComponent getComponent() {
    if (panel == null) {
        final PropertySheetView view = new PropertySheetView();
        class Panel extends JPanel implements ExplorerManager.Provider, Lookup.Provider {
            // Make sure action context works correctly:
            private final Lookup lookup = ExplorerUtils.createLookup(manager, new ActionMap());
            {
                setLayout(new BorderLayout());
                add(view, BorderLayout.CENTER);
            }
            public ExplorerManager getExplorerManager() {
                return manager;
            }
            public Lookup getLookup() {
                return lookup;
            }
        }
        panel = new Panel();
    }
    return panel;
}
 
Example #11
Source File: TreeNavigatorProviderImpl.java    From netbeans with Apache License 2.0 6 votes vote down vote up
public JComponent getComponent() {
    if (panel == null) {
        final BeanTreeView view = new BeanTreeView();
        view.setRootVisible(true);
        view.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
        class Panel extends JPanel implements ExplorerManager.Provider, Lookup.Provider {
            // Make sure action context works correctly:
            private final Lookup lookup = ExplorerUtils.createLookup(manager, new ActionMap());
            {
                setLayout(new BorderLayout());
                add(view, BorderLayout.CENTER);
            }
            public ExplorerManager getExplorerManager() {
                return manager;
            }
            public Lookup getLookup() {
                return lookup;
            }
        }
        panel = new Panel();
    }
    return panel;
}
 
Example #12
Source File: ElementNavigatorProviderImpl.java    From netbeans with Apache License 2.0 6 votes vote down vote up
public JComponent getComponent() {
    if (panel == null) {
        final BeanTreeView view = new BeanTreeView();
        view.setRootVisible(true);
        view.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
        class Panel extends JPanel implements ExplorerManager.Provider, Lookup.Provider {
            // Make sure action context works correctly:
            private final Lookup lookup = ExplorerUtils.createLookup(manager, new ActionMap());
            {
                setLayout(new BorderLayout());
                add(view, BorderLayout.CENTER);
            }
            public ExplorerManager getExplorerManager() {
                return manager;
            }
            public Lookup getLookup() {
                return lookup;
            }
        }
        panel = new Panel();
    }
    return panel;
}
 
Example #13
Source File: AbstractSearchResultsPanel.java    From netbeans with Apache License 2.0 6 votes vote down vote up
/**
 * Creates new form AbstractSearchResultsPanel
 */
public AbstractSearchResultsPanel(SearchComposition<?> searchComposition,
        SearchProvider.Presenter searchProviderPresenter) {
    this.searchComposition = searchComposition;
    this.searchProviderPresenter = searchProviderPresenter;
    initComponents();
    explorerManager = new ExplorerManager();

    ActionMap map = this.getActionMap();
    // map delete key to delete action
    map.put("delete", //NOI18N
            ExplorerUtils.actionDelete(explorerManager, false));
    map.put(DefaultEditorKit.copyAction,
            ExplorerUtils.actionCopy(explorerManager));
    map.put(DefaultEditorKit.cutAction,
            ExplorerUtils.actionCut(explorerManager));

    lookup = ExplorerUtils.createLookup(explorerManager,
            ResultView.getInstance().getActionMap());
    initActions();
    initToolbar();
    initSelectionListeners();
}
 
Example #14
Source File: TemplatesPanel.java    From netbeans with Apache License 2.0 6 votes vote down vote up
/** Creates new form TemplatesPanel */
public TemplatesPanel (String pathToSelect) {
    
    ActionMap map = getActionMap ();
    map.put (DefaultEditorKit.copyAction, ExplorerUtils.actionCopy (getExplorerManager ()));
    map.put (DefaultEditorKit.cutAction, ExplorerUtils.actionCut (getExplorerManager ()));
    map.put (DefaultEditorKit.pasteAction, ExplorerUtils.actionPaste (getExplorerManager ()));
    map.put ("delete", ExplorerUtils.actionDelete (getExplorerManager (), true)); // NOI18N
    
    initComponents ();
    createTemplateView ();
    treePanel.add (view, BorderLayout.CENTER);
    
    associateLookup (ExplorerUtils.createLookup (getExplorerManager (), map));
    initialize (pathToSelect);
    
}
 
Example #15
Source File: CatalogPanel.java    From netbeans with Apache License 2.0 6 votes vote down vote up
/** Creates new form CatalogPanel */
public CatalogPanel() {
    
    ActionMap map = getActionMap();
    map.put(DefaultEditorKit.copyAction, ExplorerUtils.actionCopy(getExplorerManager()));
    map.put(DefaultEditorKit.cutAction, ExplorerUtils.actionCut(getExplorerManager()));
    map.put(DefaultEditorKit.pasteAction, ExplorerUtils.actionPaste(getExplorerManager()));
    map.put("delete", ExplorerUtils.actionDelete(getExplorerManager(), true)); // NOI18N
    
    initComponents();
    createCatalogView();
    treePanel.add(view, BorderLayout.CENTER);
    
    associateLookup(ExplorerUtils.createLookup(getExplorerManager(), map));
    initialize();
    
}
 
Example #16
Source File: ServicesTab.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private ServicesTab() {
    manager = new ExplorerManager();
    manager.setRootContext(new ServicesNode());
    ActionMap map = getActionMap();
    map.put(DefaultEditorKit.copyAction, ExplorerUtils.actionCopy(manager));
    map.put(DefaultEditorKit.cutAction, ExplorerUtils.actionCut(manager));
    map.put(DefaultEditorKit.pasteAction, ExplorerUtils.actionPaste(manager));
    map.put("delete", ExplorerUtils.actionDelete(manager, false));
    associateLookup(ExplorerUtils.createLookup(manager, map));
    view = new BeanTreeView();
    view.setRootVisible(false);
    setLayout(new BorderLayout());
    add(view);
    setName(ID);
    setDisplayName(NbBundle.getMessage(ServicesTab.class, "LBL_Services"));
}
 
Example #17
Source File: ExplorerEGTaskTopComponent.java    From BART with MIT License 6 votes vote down vote up
public ExplorerEGTaskTopComponent() {
    initComponents();
    setDisplayName(Bundle.CTL_ExplorerEGTaskTopComponent());
    setName(ViewResource.TOP_NAME_ExplorerEGTaskTopComponent);
    setToolTipText(Bundle.HINT_ExplorerEGTaskTopComponent());
    setBackground(Color.WHITE);
    setLayout(new BorderLayout());
    btvw = new BeanTreeView();
    add(btvw, BorderLayout.CENTER);
    ActionMap  map = this.getActionMap();
    //map.put(DefaultEditorKit.copyAction, ExplorerUtils.actionCopy(m));
    //map.put(DefaultEditorKit.cutAction, ExplorerUtils.actionCut(m));
    //map.put(DefaultEditorKit.pasteAction, ExplorerUtils.actionPaste(m));
    map.put("delete", ExplorerUtils.actionDelete(ex, true));
    setRootContext(new SimpleBaseNode());
    associateLookup(ExplorerUtils.createLookup(ex, getActionMap()));
}
 
Example #18
Source File: BytecodeViewTopComponent.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
private BytecodeViewTopComponent() {
    initComponents();
    setName(NbBundle.getMessage(BytecodeViewTopComponent.class, "CTL_BytecodeViewTopComponent"));
    setToolTipText(NbBundle.getMessage(BytecodeViewTopComponent.class, "HINT_BytecodeViewTopComponent"));

    manager = new ExplorerManager();
    rootNode = new MethodNode(null, null, "");
    manager.setRootContext(rootNode);

    setLayout(new BorderLayout());

    treeView = new BeanTreeView();
    treeView.setRootVisible(false);
    this.add(BorderLayout.CENTER, treeView);
    associateLookup(ExplorerUtils.createLookup(manager, getActionMap()));
}
 
Example #19
Source File: FilterTopComponent.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
private FilterTopComponent() {
    filterSettingsChangedEvent = new ChangedEvent<FilterTopComponent>(this);
    initComponents();
    setName(NbBundle.getMessage(FilterTopComponent.class, "CTL_FilterTopComponent"));
    setToolTipText(NbBundle.getMessage(FilterTopComponent.class, "HINT_FilterTopComponent"));
    //        setIcon(Utilities.loadImage(ICON_PATH, true));

    sequence = new FilterChain();
    filterChain = new FilterChain();
    initFilters();
    manager = new ExplorerManager();
    manager.setRootContext(new AbstractNode(new FilterChildren()));
    associateLookup(ExplorerUtils.createLookup(manager, getActionMap()));
    view = new CheckListView();

    ToolbarPool.getDefault().setPreferredIconSize(16);
    Toolbar toolBar = new Toolbar();
    Border b = (Border) UIManager.get("Nb.Editor.Toolbar.border"); //NOI18N
    toolBar.setBorder(b);
    comboBox = new JComboBox();
    toolBar.add(comboBox);
    this.add(toolBar, BorderLayout.NORTH);
    toolBar.add(SaveFilterSettingsAction.get(SaveFilterSettingsAction.class));
    toolBar.add(RemoveFilterSettingsAction.get(RemoveFilterSettingsAction.class));
    toolBar.addSeparator();
    toolBar.add(MoveFilterUpAction.get(MoveFilterUpAction.class).createContextAwareInstance(this.getLookup()));
    toolBar.add(MoveFilterDownAction.get(MoveFilterDownAction.class).createContextAwareInstance(this.getLookup()));
    toolBar.add(RemoveFilterAction.get(RemoveFilterAction.class).createContextAwareInstance(this.getLookup()));
    toolBar.add(NewFilterAction.get(NewFilterAction.class));
    this.add(view, BorderLayout.CENTER);

    filterSettings = new ArrayList<FilterSetting>();
    updateComboBox();

    comboBox.addActionListener(comboBoxActionListener);
    setChain(filterChain);
}
 
Example #20
Source File: OutlineTopComponent.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private void initListView() {
    manager = new ExplorerManager();
    root = new FolderNode(document);
    manager.setRootContext(root);
    ((BeanTreeView) this.treeView).setRootVisible(false);

    associateLookup(ExplorerUtils.createLookup(manager, getActionMap()));
}
 
Example #21
Source File: FilterTopComponent.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private FilterTopComponent() {
    filterSettingsChangedEvent = new ChangedEvent<>(this);
    initComponents();
    setName(NbBundle.getMessage(FilterTopComponent.class, "CTL_FilterTopComponent"));
    setToolTipText(NbBundle.getMessage(FilterTopComponent.class, "HINT_FilterTopComponent"));
    //        setIcon(Utilities.loadImage(ICON_PATH, true));

    sequence = new FilterChain();
    filterChain = new FilterChain();
    initFilters();
    manager = new ExplorerManager();
    manager.setRootContext(new AbstractNode(new FilterChildren()));
    associateLookup(ExplorerUtils.createLookup(manager, getActionMap()));
    view = new CheckListView();

    ToolbarPool.getDefault().setPreferredIconSize(16);
    Toolbar toolBar = new Toolbar();
    Border b = (Border) UIManager.get("Nb.Editor.Toolbar.border"); //NOI18N
    toolBar.setBorder(b);
    comboBox = new JComboBox();
    toolBar.add(comboBox);
    this.add(toolBar, BorderLayout.NORTH);
    toolBar.add(SaveFilterSettingsAction.get(SaveFilterSettingsAction.class));
    toolBar.add(RemoveFilterSettingsAction.get(RemoveFilterSettingsAction.class));
    toolBar.addSeparator();
    toolBar.add(NewFilterAction.get(NewFilterAction.class));
    toolBar.add(RemoveFilterAction.get(RemoveFilterAction.class).createContextAwareInstance(this.getLookup()));
    toolBar.add(MoveFilterUpAction.get(MoveFilterUpAction.class).createContextAwareInstance(this.getLookup()));
    toolBar.add(MoveFilterDownAction.get(MoveFilterDownAction.class).createContextAwareInstance(this.getLookup()));
    this.add(view, BorderLayout.CENTER);

    filterSettings = new ArrayList<>();
    updateComboBox();

    comboBox.addActionListener(comboBoxActionListener);
    setChain(filterChain);
}
 
Example #22
Source File: FilterTopComponent.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
private FilterTopComponent() {
    filterSettingsChangedEvent = new ChangedEvent<FilterTopComponent>(this);
    initComponents();
    setName(NbBundle.getMessage(FilterTopComponent.class, "CTL_FilterTopComponent"));
    setToolTipText(NbBundle.getMessage(FilterTopComponent.class, "HINT_FilterTopComponent"));
    //        setIcon(Utilities.loadImage(ICON_PATH, true));

    sequence = new FilterChain();
    filterChain = new FilterChain();
    initFilters();
    manager = new ExplorerManager();
    manager.setRootContext(new AbstractNode(new FilterChildren()));
    associateLookup(ExplorerUtils.createLookup(manager, getActionMap()));
    view = new CheckListView();

    ToolbarPool.getDefault().setPreferredIconSize(16);
    Toolbar toolBar = new Toolbar();
    Border b = (Border) UIManager.get("Nb.Editor.Toolbar.border"); //NOI18N
    toolBar.setBorder(b);
    comboBox = new JComboBox();
    toolBar.add(comboBox);
    this.add(toolBar, BorderLayout.NORTH);
    toolBar.add(SaveFilterSettingsAction.get(SaveFilterSettingsAction.class));
    toolBar.add(RemoveFilterSettingsAction.get(RemoveFilterSettingsAction.class));
    toolBar.addSeparator();
    toolBar.add(MoveFilterUpAction.get(MoveFilterUpAction.class).createContextAwareInstance(this.getLookup()));
    toolBar.add(MoveFilterDownAction.get(MoveFilterDownAction.class).createContextAwareInstance(this.getLookup()));
    toolBar.add(RemoveFilterAction.get(RemoveFilterAction.class).createContextAwareInstance(this.getLookup()));
    toolBar.add(NewFilterAction.get(NewFilterAction.class));
    this.add(view, BorderLayout.CENTER);

    filterSettings = new ArrayList<FilterSetting>();
    updateComboBox();

    comboBox.addActionListener(comboBoxActionListener);
    setChain(filterChain);
}
 
Example #23
Source File: OutlineTable.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
public void removeNotify () {
    super.removeNotify ();
    TopComponent.getRegistry ().removePropertyChangeListener (this);
    ExplorerUtils.activateActions(getExplorerManager (), false);
    getExplorerManager ().removePropertyChangeListener (this);
    setModel(null);
}
 
Example #24
Source File: OutlineTable.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
public void addNotify () {
    TopComponent.getRegistry ().addPropertyChangeListener (this);
    ExplorerUtils.activateActions(getExplorerManager (), true);
    getExplorerManager ().addPropertyChangeListener (this);
    super.addNotify ();
}
 
Example #25
Source File: OutlineTable.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
public void propertyChange (PropertyChangeEvent evt) {
    String propertyName = evt.getPropertyName ();
    TopComponent tc = (TopComponent) SwingUtilities.
        getAncestorOfClass (TopComponent.class, this);
    if (tc == null) {
        return;
    }
    if (propertyName.equals (TopComponent.Registry.PROP_CURRENT_NODES)) {
        ExplorerUtils.activateActions(getExplorerManager(), equalNodes());
    } else
    if (propertyName.equals (ExplorerManager.PROP_SELECTED_NODES)) {
        tc.setActivatedNodes ((Node[]) evt.getNewValue ());
    }
}
 
Example #26
Source File: SceneExplorerTopComponent.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private void initActions() {
    CutAction cut = SystemAction.get(CutAction.class);
    getActionMap().put(cut.getActionMapKey(), ExplorerUtils.actionCut(explorerManager));
    CopyAction copy = SystemAction.get(CopyAction.class);
    getActionMap().put(copy.getActionMapKey(), ExplorerUtils.actionCopy(explorerManager));
    PasteAction paste = SystemAction.get(PasteAction.class);
    getActionMap().put(paste.getActionMapKey(), ExplorerUtils.actionPaste(explorerManager));
    DeleteAction delete = SystemAction.get(DeleteAction.class);
    getActionMap().put(delete.getActionMapKey(), ExplorerUtils.actionDelete(explorerManager, true));
}
 
Example #27
Source File: ClassMemberPanelUI.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/** Creates new form ClassMemberPanelUi */
public ClassMemberPanelUI(final Language language) {
    
    initComponents();
    
    // Tree view of the elements
    elementView = createBeanTreeView();        
    add(elementView, BorderLayout.CENTER);
           
    filters = new ClassMemberFilters( this );
    filters.getInstance().hookChangeListener(this);

    // See http://www.netbeans.org/issues/show_bug.cgi?id=186407
    // Making the calls to getStructure() out of AWT EDT
    RP.post(new UpdateFilterState(language));
    
                        // filters
                        filtersPanel = new TapPanel();
                        filtersLbl = new JLabel(NbBundle.getMessage(ClassMemberPanelUI.class, "LBL_Filter")); //NOI18N
                        filtersLbl.setBorder(new EmptyBorder(0, 5, 5, 0));
                        filtersPanel.add(filtersLbl);
                        filtersPanel.setOrientation(TapPanel.DOWN);
                        // tooltip
                        KeyStroke toggleKey = KeyStroke.getKeyStroke(KeyEvent.VK_T,
                                Toolkit.getDefaultToolkit().getMenuShortcutKeyMask());
                        String keyText = Utilities.keyToString(toggleKey);
                        filtersPanel.setToolTipText(NbBundle.getMessage(ClassMemberPanelUI.class, "TIP_TapPanel", keyText));
                        filtersPanel.add(filters.getComponent());
                        add(filtersPanel, BorderLayout.SOUTH);  
    manager.setRootContext(ElementNode.getWaitNode());
    
    lookup = ExplorerUtils.createLookup(manager, getActionMap());       
}
 
Example #28
Source File: FilterTopComponent.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
private FilterTopComponent() {
    filterSettingsChangedEvent = new ChangedEvent<FilterTopComponent>(this);
    initComponents();
    setName(NbBundle.getMessage(FilterTopComponent.class, "CTL_FilterTopComponent"));
    setToolTipText(NbBundle.getMessage(FilterTopComponent.class, "HINT_FilterTopComponent"));
    //        setIcon(Utilities.loadImage(ICON_PATH, true));

    sequence = new FilterChain();
    filterChain = new FilterChain();
    initFilters();
    manager = new ExplorerManager();
    manager.setRootContext(new AbstractNode(new FilterChildren()));
    associateLookup(ExplorerUtils.createLookup(manager, getActionMap()));
    view = new CheckListView();

    ToolbarPool.getDefault().setPreferredIconSize(16);
    Toolbar toolBar = new Toolbar();
    Border b = (Border) UIManager.get("Nb.Editor.Toolbar.border"); //NOI18N
    toolBar.setBorder(b);
    comboBox = new JComboBox();
    toolBar.add(comboBox);
    this.add(toolBar, BorderLayout.NORTH);
    toolBar.add(SaveFilterSettingsAction.get(SaveFilterSettingsAction.class));
    toolBar.add(RemoveFilterSettingsAction.get(RemoveFilterSettingsAction.class));
    toolBar.addSeparator();
    toolBar.add(MoveFilterUpAction.get(MoveFilterUpAction.class).createContextAwareInstance(this.getLookup()));
    toolBar.add(MoveFilterDownAction.get(MoveFilterDownAction.class).createContextAwareInstance(this.getLookup()));
    toolBar.add(RemoveFilterAction.get(RemoveFilterAction.class).createContextAwareInstance(this.getLookup()));
    toolBar.add(NewFilterAction.get(NewFilterAction.class));
    this.add(view, BorderLayout.CENTER);

    filterSettings = new ArrayList<FilterSetting>();
    updateComboBox();

    comboBox.addActionListener(comboBoxActionListener);
    setChain(filterChain);
}
 
Example #29
Source File: KnockoutPanel.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a lookup provider (that provides the lookup that corresponds
 * to the selected tab).
 * 
 * @param actionMap action map to use in the creation of returned lookups.
 * @return lookup provider.
 */
Lookup.Provider createLookupProvider(ActionMap actionMap) {
    final Lookup bindingContextLookup = ExplorerUtils.createLookup(manager, actionMap);
    final Lookup unusedBindingLookup = ExplorerUtils.createLookup(unusedBindingsPanel.getExplorerManager(), actionMap);
    return new Lookup.Provider() {
        @Override
        public Lookup getLookup() {
            synchronized (KnockoutPanel.this) {
                return bindingContextShown ? bindingContextLookup : unusedBindingLookup;
            }
        }
    };
}
 
Example #30
Source File: ToolBarDesignEditor.java    From netbeans with Apache License 2.0 5 votes vote down vote up
ToolBarView(final ExplorerManager manager, org.openide.nodes.Node root, javax.swing.Action helpAction) {
    super();
    this.manager=manager;
    this.helpAction=helpAction;
    // same as before...
    
    setLayout(new java.awt.GridBagLayout());
    ActionMap map = getActionMap();
    // ...and initialization of lookup variable
    lookup = ExplorerUtils.createLookup (manager, map);

    ChoiceView cView = new ChoiceView();
    ((NodeListModel)(cView.getModel())).setNode(root);
    setFloatable(false);
    ((NodeListModel)(cView.getModel())).setDepth(5);
    
    java.awt.GridBagConstraints gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.insets = new java.awt.Insets(0, 2, 4, 0);
    add(cView,gridBagConstraints);
    
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.weightx = 1.0;
    JPanel filler = new JPanel();
    add(filler,gridBagConstraints);
    
    javax.swing.JButton helpButton = new javax.swing.JButton(helpAction);
    helpButton.setText("");
    helpButton.setContentAreaFilled(false);
    helpButton.setFocusPainted(false);
    helpButton.setBorderPainted(false);
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 2;
    gridBagConstraints.gridy = 0;
    //gridBagConstraints.weightx = 1.0;
    add(helpButton,gridBagConstraints);
}