|
What this is
Other links
The source code/* * Sun Public License Notice * * The contents of this file are subject to the Sun Public License * Version 1.0 (the "License"). You may not use this file except in * compliance with the License. A copy of the License is available at * http://www.sun.com/ * * The Original Code is NetBeans. The Initial Developer of the Original * Code is Sun Microsystems, Inc. Portions Copyright 1997-2002 Sun * Microsystems, Inc. All Rights Reserved. */ package org.netbeans.modules.refactoring.ui; import javax.swing.*; import org.netbeans.modules.java.JavaDataObject; import org.netbeans.modules.refactoring.api.ui.RefactoringAction; import org.openide.loaders.DataObject; import org.openide.nodes.Node; import org.openide.util.NbBundle; public class NavigatorAction extends AbstractAction implements RefactoringAction { // private static NavigatorWindow nw = null; private Node activeNode = null; public NavigatorAction() { super(NbBundle.getMessage(NavigatorAction.class, "LBL_OpenInNavigator"), null); } public void actionPerformed(java.awt.event.ActionEvent e) { // if (nw == null) { // nw = new NavigatorWindow(); // } // if (!nw.isOpened()) { // // dock it into output window area and display // Workspace workspace = WindowManager.getDefault().getCurrentWorkspace(); // Mode mode = workspace.findMode("editor"); // NOI18N // if (mode != null) { // output windows is opened // mode.dockInto(nw); // TODO: put view here // } // nw.open(workspace); // } // ElementImpl impl = (ElementImpl) activeNode.getCookie(Element.Impl.class); // RefBaseObject representedObject = null; // if (impl!=null) { // representedObject = impl.getJavaElement(); // } else { // JavaDataObject o = (JavaDataObject) activeNode.getCookie(DataObject.class); // Codebase cb = ProjectModel.getDefault().findParentCodebase(o); // ClassResource cr = cb.findResource(o.getPrimaryFile().getPath()); // representedObject = null; // if (cr != null) { // for (Iterator it = cr.getDefinedClasses().iterator(); it.hasNext();) { // JavaClass cls = (JavaClass) it.next(); // if (activeNode.getName().equals(cls.getName())) { // representedObject = cls; // break; // } // } // } // } // if (representedObject != null) { // nw.selectObject(representedObject); // } // nw.requestFocus(); } public void initialize(int location) { } public void processContext(Node[] activatedNodes, javax.swing.text.JTextComponent textComponent) { boolean result = false; if ((activatedNodes.length == 1) && (activatedNodes[0].getCookie(DataObject.class) instanceof JavaDataObject)) { result = true; activeNode = activatedNodes[0]; } setEnabled(result); } } |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.