Java Code Examples for org.openide.explorer.ExplorerManager#Provider
The following examples show how to use
org.openide.explorer.ExplorerManager#Provider .
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: ErrorNavigatorProviderImpl.java From netbeans with Apache License 2.0 | 6 votes |
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 2
Source File: ElementNavigatorProviderImpl.java From netbeans with Apache License 2.0 | 6 votes |
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 3
Source File: ClasspathNavigatorProviderImpl.java From netbeans with Apache License 2.0 | 6 votes |
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 4
Source File: TreeNavigatorProviderImpl.java From netbeans with Apache License 2.0 | 6 votes |
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 5
Source File: AntNavigatorPanel.java From netbeans with Apache License 2.0 | 6 votes |
public JComponent getComponent() { if (panel == null) { final ListView view = new ListView(); view.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); class Panel extends JPanel implements ExplorerManager.Provider, Lookup.Provider { // Make sure action context works correctly: { setLayout(new BorderLayout()); add(view, BorderLayout.CENTER); } public ExplorerManager getExplorerManager() { return manager; } @Override public boolean requestFocusInWindow() { return view.requestFocusInWindow(); } public Lookup getLookup() { return lookup; } } panel = new Panel(); } return panel; }
Example 6
Source File: OutlineViewDragSupport.java From netbeans with Apache License 2.0 | 5 votes |
@Override public void dragDropEnd(DragSourceDropEvent dsde) { // get the droped nodes Node[] dropedNodes = exDnD.getDraggedNodes(); super.dragDropEnd(dsde); // if any original glass pane was stored (the DnD was broken e.g. by Esc) if (DropGlassPane.isOriginalPaneStored()) { // give back the orig glass pane DropGlassPane.putBackOriginal(); // DnD is not active exDnD.setDnDActive(false); } // select the droped nodes try { if (dropedNodes != null) { ExplorerManager.Provider panel = (ExplorerManager.Provider) SwingUtilities.getAncestorOfClass( ExplorerManager.Provider.class, view ); if (panel != null) { panel.getExplorerManager().setSelectedNodes(dropedNodes); } } } catch (Exception e) { // don't care } // TODO // notify tree cell editor that DnD operationm is active // no more // TreeCellEditor tce = tree.getCellEditor(); // // if (tce instanceof TreeViewCellEditor) { // ((TreeViewCellEditor) tce).setDnDActive(false); // } }
Example 7
Source File: TreeViewDragSupport.java From netbeans with Apache License 2.0 | 5 votes |
@Override public void dragDropEnd(DragSourceDropEvent dsde) { // get the droped nodes Node[] dropedNodes = exDnD.getDraggedNodes(); super.dragDropEnd(dsde); // if any original glass pane was stored (the DnD was broken e.g. by Esc) if (DropGlassPane.isOriginalPaneStored()) { // give back the orig glass pane DropGlassPane.putBackOriginal(); // DnD is not active exDnD.setDnDActive(false); } // select the droped nodes try { if (dropedNodes != null) { ExplorerManager.Provider panel = (ExplorerManager.Provider) SwingUtilities.getAncestorOfClass( ExplorerManager.Provider.class, view ); if (panel != null) { panel.getExplorerManager().setSelectedNodes(dropedNodes); } } } catch (Exception e) { // don't care } // notify tree cell editor that DnD operationm is active // no more TreeCellEditor tce = tree.getCellEditor(); if (tce instanceof TreeViewCellEditor) { ((TreeViewCellEditor) tce).setDnDActive(false); } }
Example 8
Source File: NodeOperationImpl.java From netbeans with Apache License 2.0 | 4 votes |
/** Not instantiatable outside */ private ExplorerProviderFwd (Component innerComp, ExplorerManager.Provider explProvider) { super(innerComp); this.explProvider = explProvider; }
Example 9
Source File: BreadCrumbComponent.java From netbeans with Apache License 2.0 | 4 votes |
private void expand(int startX, final Node what) { if (what.getChildren().getNodesCount() == 0) return ; final ExplorerManager expandManager = new ExplorerManager(); class Expanded extends JPanel implements ExplorerManager.Provider { public Expanded(LayoutManager layout) { super(layout); } @Override public ExplorerManager getExplorerManager() { return expandManager; } } final JPanel expanded = new Expanded(new BorderLayout()); expanded.setBorder(new LineBorder(Color.BLACK, 1)); final ListView listView = new ListView() { { int nodesCount = what.getChildren().getNodesCount(); if (nodesCount >= MAX_ROWS_IN_POP_UP) { list.setVisibleRowCount(MAX_ROWS_IN_POP_UP); } else { list.setVisibleRowCount(nodesCount); NodeRenderer nr = new NodeRenderer(); int i = 0; int width = getPreferredSize().width; for (Node n : what.getChildren().getNodes()) { if (nr.getListCellRendererComponent(list, n, i, false, false).getPreferredSize().width > width) { Dimension pref = getPreferredSize(); pref.height += getHorizontalScrollBar().getPreferredSize().height; setPreferredSize(pref); break; } } } } }; listView.setPopupAllowed(false); expanded.add(listView, BorderLayout.CENTER); expandManager.setRootContext(what); Point place = new Point(startX, 0); SwingUtilities.convertPointToScreen(place, this); expanded.validate(); final Popup popup = PopupFactory.getSharedInstance().getPopup(this, expanded, place.x, place.y - expanded.getPreferredSize().height); final AWTEventListener multicastListener = new AWTEventListener() { @Override public void eventDispatched(AWTEvent event) { if (event instanceof MouseEvent && ((MouseEvent) event).getClickCount() > 0) { Object source = event.getSource(); while (source instanceof Component) { if (source == expanded) return ; //accept source = ((Component) source).getParent(); } popup.hide(); Toolkit.getDefaultToolkit().removeAWTEventListener(this); } } }; Toolkit.getDefaultToolkit().addAWTEventListener(multicastListener, AWTEvent.MOUSE_EVENT_MASK); expandManager.addPropertyChangeListener(new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { if (ExplorerManager.PROP_SELECTED_NODES.equals(evt.getPropertyName())) { Node[] selected = expandManager.getSelectedNodes(); if (selected.length == 1) { open(selected[0]); popup.hide(); Toolkit.getDefaultToolkit().removeAWTEventListener(multicastListener); } } } }); popup.show(); }
Example 10
Source File: HgProjectUtils.java From netbeans with Apache License 2.0 | 4 votes |
private static synchronized ExplorerManager.Provider findDefault( String tcID ) { TopComponent tc = WindowManager.getDefault().findTopComponent( tcID ); return (ExplorerManager.Provider) tc; }
Example 11
Source File: ChaseStackGenerator.java From Llunatic with GNU General Public License v3.0 | 4 votes |
public void register(ExplorerManager.Provider provider) { this.provider = provider; registerBean(ChaseStepNode.class); }