|
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-2000 Sun * Microsystems, Inc. All Rights Reserved. */ package org.netbeans.modules.editor.java; import java.awt.event.ActionEvent; import java.util.Set; import org.openide.util.actions.CallableSystemAction; import org.openide.util.HelpCtx; import org.openide.util.NbBundle; import org.netbeans.editor.ext.ListCompletionView; import javax.swing.SwingUtilities; import org.netbeans.api.java.classpath.ClassPath; import org.netbeans.api.java.classpath.GlobalPathRegistry; /** * Open java source according to the given expression. * * @author Miloslav Metelka * @version 1.0 */ public class JavaFastOpenAction extends CallableSystemAction { private static JavaFastOpenAction instance; private static final String HELP_ID = "editing.fastopen"; // NOI18N public void actionPerformed(ActionEvent e) { SwingUtilities.invokeLater (new Runnable() { public void run() { NbJavaJMIFastOpen.showFastOpen(); } }); } public static synchronized JavaFastOpenAction getInstance(){ if (instance == null){ instance = new JavaFastOpenAction(); instance.putValue(org.netbeans.editor.ext.ExtKit.TRIMMED_TEXT, NbBundle.getBundle(JavaKit.class).getString("goto-class-trimmed")); //NOI18N } return instance; } public String getName() { return NbBundle.getBundle(JavaFastOpenAction.class).getString("NAME_JavaFastOpenAction"); // NOI18N } public HelpCtx getHelpCtx() { return new HelpCtx(HELP_ID); } /** Actually perform the action. * This is the method which should be called programmatically. * Presenters in {@link Actions} use this. */ public void performAction() { } public boolean isEnabled() { /* If there are no paths in registry, the action shoud be disabled (#46632)*/ Set sources = GlobalPathRegistry.getDefault().getPaths(ClassPath.SOURCE); Set compile = GlobalPathRegistry.getDefault().getPaths(ClassPath.COMPILE); Set boot = GlobalPathRegistry.getDefault().getPaths(ClassPath.BOOT); return !(sources.isEmpty() && compile.isEmpty() && boot.isEmpty()); } } |
... 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.