Java Code Examples for org.openide.explorer.ExplorerManager#find()

The following examples show how to use org.openide.explorer.ExplorerManager#find() . 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: DiffResultsView.java    From netbeans with Apache License 2.0 6 votes vote down vote up
@Override
public void ancestorAdded(AncestorEvent event) {
    ExplorerManager em = ExplorerManager.find(treeView);
    em.addPropertyChangeListener(this);
    if (dividerSet) {
        if (lastDividerLoc != 0) {
            EventQueue.invokeLater(new Runnable() {
                @Override
                public void run () {
                    diffView.setDividerLocation(lastDividerLoc);
                }
            });
        }
    } else {
        EventQueue.invokeLater(new Runnable() {
            @Override
            public void run() {
                dividerSet = true;
                diffView.setDividerLocation(0.33);
            }
        });
    }
}
 
Example 2
Source File: OutlineTable.java    From netbeans with Apache License 2.0 6 votes vote down vote up
/** Converts path of strings to TreePath if exists null otherwise
 */
private TreePath stringPath2TreePath (String[] sp) {
    ExplorerManager em = ExplorerManager.find (this);
    try {
        Node n = NodeOp.findPath (em.getRootContext (), sp); 
        
        // Create the tree path
        TreeNode tns[] = new TreeNode [sp.length + 1];
        
        for (int i = sp.length; i >= 0; i--) {
            tns[i] = Visualizer.findVisualizer (n);
            n = n.getParentNode ();
        }                
        return new TreePath (tns);
    } catch (NodeNotFoundException e) {
        return null;
    }
}
 
Example 3
Source File: DiffResultsView.java    From netbeans with Apache License 2.0 6 votes vote down vote up
@Override
public void ancestorAdded(AncestorEvent event) {
    ExplorerManager em = ExplorerManager.find(treeView);
    em.addPropertyChangeListener(this);
    if (dividerSet) {
        if (lastDividerLoc != 0) {
            EventQueue.invokeLater(new Runnable() {
                @Override
                public void run () {
                    diffView.setDividerLocation(lastDividerLoc);
                }
            });
        }
    } else {
        EventQueue.invokeLater(new Runnable() {
            @Override
            public void run() {
                dividerSet = true;
                diffView.setDividerLocation(0.33);
            }
        });
    }
}
 
Example 4
Source File: DiffResultsView.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
public void ancestorRemoved(AncestorEvent event) {
    if (dividerSet) {
        lastDividerLoc = diffView.getDividerLocation();
    }
    ExplorerManager em = ExplorerManager.find(treeView);
    em.removePropertyChangeListener(this);
}
 
Example 5
Source File: McTreeViewPanel.java    From Llunatic with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onChaseResultUpdate(McChaseResult result) {
    this.result = result;
    ChaseTreeRoot resultNode = result.getNode();
    explorerManager = ExplorerManager.find(this);
    statefulView.setRootNode(explorerManager, resultNode);
}
 
Example 6
Source File: ProjectsView.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
public void addNotify() {
    ExplorerManager em = ExplorerManager.find(this);
    em.setRootContext(rootNode);
    em.setExploredContext(rootNode);
    expandNode(rootNode);
    super.addNotify();
}
 
Example 7
Source File: DiffTreeTable.java    From netbeans with Apache License 2.0 5 votes vote down vote up
void setSelection (RepositoryRevision.Event... events) {
    List<Node> nodes = new ArrayList<Node>(events.length);
    for (RepositoryRevision.Event event : events) {
        RevisionNode node = (RevisionNode) getNode(rootNode, event);
        if (node != null) {
            nodes.add(node);
        }
    }
    ExplorerManager em = ExplorerManager.find(this);
    try {
        em.setSelectedNodes(nodes.toArray(new Node[nodes.size()]));
    } catch (PropertyVetoException e) {
        ErrorManager.getDefault().notify(e);
    }
}
 
Example 8
Source File: TableView.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/** Registers in the tree of components.
 */
private void lookupExplorerManager () {
    // Enter key in the tree

    if (managerListener == null) {
        managerListener = new TableSelectionListener();
    }
    
    ExplorerManager newManager = ExplorerManager.find(this);
    if (newManager != manager) {
        if (manager != null) {
            manager.removeVetoableChangeListener (wlvc);
            manager.removePropertyChangeListener (wlpc);
        }

        manager = newManager;

        manager.addVetoableChangeListener(wlvc = WeakListeners.vetoableChange(managerListener, manager));
        manager.addPropertyChangeListener(wlpc = WeakListeners.propertyChange(managerListener, manager));

        synchronizeRootContext();
        synchronizeSelectedNodes ();
    }

    // Sometimes the listener is registered twice and we get the 
    // selection events twice. Removing the listener before adding it
    // should be a safe fix.
    table.getSelectionModel().removeListSelectionListener(managerListener);
    table.getSelectionModel().addListSelectionListener(managerListener);
}
 
Example 9
Source File: DiffResultsView.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
public void ancestorRemoved(AncestorEvent event) {
    if (dividerSet) {
        lastDividerLoc = diffView.getDividerLocation();
    }
    ExplorerManager em = ExplorerManager.find(treeView);
    em.removePropertyChangeListener(this);
    cancelBackgroundTasks();
}
 
Example 10
Source File: DiffTreeTable.java    From netbeans with Apache License 2.0 5 votes vote down vote up
void setSelection(RepositoryRevision container) {
    RevisionNode node = (RevisionNode) getNode(rootNode, container);
    if (node == null) return;
    ExplorerManager em = ExplorerManager.find(this);
    try {
        em.setSelectedNodes(new Node [] { node });
    } catch (PropertyVetoException e) {
        Subversion.LOG.log(Level.SEVERE, null, e);
    }
}
 
Example 11
Source File: DiffTreeTable.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public void setResults(List<RepositoryRevision> results) {
    this.results = results;
    rootNode = new RevisionsRootNode();
    ExplorerManager em = ExplorerManager.find(this);
    if (em != null) {
        em.setRootContext(rootNode);
    }
}
 
Example 12
Source File: DiffTreeTable.java    From netbeans with Apache License 2.0 5 votes vote down vote up
void setSelection (RepositoryRevision.Event... events) {
    List<Node> nodes = new ArrayList<Node>(events.length);
    for (RepositoryRevision.Event event : events) {
        RevisionNode node = (RevisionNode) getNode(rootNode, event);
        if (node != null) {
            nodes.add(node);
        }
    }
    ExplorerManager em = ExplorerManager.find(this);
    try {
        em.setSelectedNodes(nodes.toArray(new Node[nodes.size()]));
    } catch (PropertyVetoException e) {
        ErrorManager.getDefault().notify(e);
    }
}
 
Example 13
Source File: DiffTreeTable.java    From netbeans with Apache License 2.0 5 votes vote down vote up
void setSelection(RepositoryRevision container) {
    RevisionNode node = (RevisionNode) getNode(rootNode, container);
    if (node == null) return;
    ExplorerManager em = ExplorerManager.find(this);
    try {
        em.setSelectedNodes(new Node [] { node });
    } catch (PropertyVetoException e) {
        ErrorManager.getDefault().notify(e);
    }
}
 
Example 14
Source File: TreeViewTest.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
public void addNotify() {
    super.addNotify();
    explManager = ExplorerManager.find(this);
    explManager.setRootContext(rootNode);
    collapse();
}
 
Example 15
Source File: OutlineView.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/** Registers in the tree of components.
 */
private void lookupExplorerManager () {
// Enter key in the tree

    if (managerListener == null) {
        managerListener = new TableSelectionListener();
    }
    
    ExplorerManager newManager = ExplorerManager.find(this);
    if (newManager != manager) {
        if (manager != null) {
            manager.removeVetoableChangeListener (wlvc);
            manager.removePropertyChangeListener (wlpc);
        }

        manager = newManager;

        manager.addVetoableChangeListener(wlvc = WeakListeners.vetoableChange(managerListener, manager));
        manager.addPropertyChangeListener(wlpc = WeakListeners.propertyChange(managerListener, manager));
    }
    outline.setExplorerManager(newManager);
    
    synchronizeRootContext();
    synchronizeSelectedNodes(true);
    
    // Sometimes the listener is registered twice and we get the 
    // selection events twice. Removing the listener before adding it
    // should be a safe fix.
    outline.getSelectionModel().removeListSelectionListener(managerListener);
    outline.getSelectionModel().addListSelectionListener(managerListener);
}
 
Example 16
Source File: McTreeViewPanel.java    From Llunatic with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void addNotify() {
    super.addNotify();
    this.explorerManager = ExplorerManager.find(this);
}
 
Example 17
Source File: DiffTreeTable.java    From netbeans with Apache License 2.0 4 votes vote down vote up
@Override
public void addNotify() {
    super.addNotify();
    ExplorerManager em = ExplorerManager.find(this);
    em.setRootContext(rootNode);
}
 
Example 18
Source File: DiffTreeTable.java    From netbeans with Apache License 2.0 4 votes vote down vote up
@Override
public void addNotify() {
    super.addNotify();
    ExplorerManager em = ExplorerManager.find(this);
    em.setRootContext(rootNode);
}
 
Example 19
Source File: DiffTreeTable.java    From netbeans with Apache License 2.0 4 votes vote down vote up
@Override
public void addNotify() {
    super.addNotify();
    ExplorerManager em = ExplorerManager.find(this);
    em.setRootContext(rootNode);
}
 
Example 20
Source File: McStackNodesViewPanel.java    From Llunatic with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void addNotify() {
    super.addNotify();
    this.explorerManager = ExplorerManager.find(this);
}