本文整理汇总了Java中org.netbeans.spi.project.ActionProvider类的典型用法代码示例。如果您正苦于以下问题:Java ActionProvider类的具体用法?Java ActionProvider怎么用?Java ActionProvider使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ActionProvider类属于org.netbeans.spi.project包,在下文中一共展示了ActionProvider类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getActions
import org.netbeans.spi.project.ActionProvider; //导入依赖的package包/类
@Override
public Action[] getActions(boolean context) {
SingleMethod sm = new SingleMethod(getTestcase().getClassFileObject(), getTestcase().getTestName());
ic.add(sm);
ic.add(getTestcase());
List<Action> actions = new ArrayList<Action>();
Action preferred = getPreferredAction();
if (preferred != null) {
actions.add(preferred);
}
for (ActionProvider ap : Lookup.getDefault().lookupAll(ActionProvider.class)) {
List<String> supportedActions = Arrays.asList(ap.getSupportedActions());
if (!getTestcase().isConfigMethod() && supportedActions.contains(SingleMethod.COMMAND_RUN_SINGLE_METHOD)) {
actions.add(new TestMethodNodeAction(ap, Lookups.singleton(sm), SingleMethod.COMMAND_RUN_SINGLE_METHOD, "LBL_RerunTest"));
}
if (!getTestcase().isConfigMethod() && supportedActions.contains(SingleMethod.COMMAND_DEBUG_SINGLE_METHOD)) {
actions.add(new TestMethodNodeAction(ap, Lookups.singleton(sm), SingleMethod.COMMAND_DEBUG_SINGLE_METHOD, "LBL_DebugTest"));
}
}
actions.addAll(Arrays.asList(super.getActions(context)));
return actions.toArray(new Action[actions.size()]);
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:24,代码来源:TestNGMethodNode.java
示例2: setUp
import org.netbeans.spi.project.ActionProvider; //导入依赖的package包/类
protected void setUp() throws Exception {
super.setUp();
System.setProperty("sync.project.execution", "true");
targetsRun.clear();
buildXml = simple.getProjectDirectory().getFileObject("build.xml");
assertNotNull("found build.xml", buildXml);
ap = simple.getLookup().lookup(ActionProvider.class);
assertNotNull("have an action provider", ap);
FileObject myAppJava = simple.getProjectDirectory().getFileObject("src/org/foo/myapp/MyApp.java");
assertNotNull("have MyApp.java", myAppJava);
myAppJavaDO = DataObject.find(myAppJava);
FileObject someFileJava = simple.getProjectDirectory().getFileObject("src/org/foo/myapp/SomeFile.java");
assertNotNull("have SomeFile.java", someFileJava);
someFileJavaDO = DataObject.find(someFileJava);
FileObject someResourceTxt = simple.getProjectDirectory().getFileObject("src/org/foo/myapp/some-resource.txt");
assertNotNull("have some-resource.txt", someResourceTxt);
someResourceTxtDO = DataObject.find(someResourceTxt);
FileObject specialTaskJava = simple.getProjectDirectory().getFileObject("antsrc/org/foo/ant/SpecialTask.java");
assertNotNull("have SpecialTask.java", specialTaskJava);
specialTaskJavaDO = DataObject.find(specialTaskJava);
lvp = simple.getLookup().lookup(LogicalViewProvider.class);
assertNotNull("have a LogicalViewProvider", lvp);
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:24,代码来源:ActionsTest.java
示例3: getActionNames
import org.netbeans.spi.project.ActionProvider; //导入依赖的package包/类
private String[] getActionNames(String[] targetNames) {
String[] actions = new String[targetNames.length];
for (int i = 0; i < targetNames.length; i++) {
if (targetNames[i].equals("test-single")) { //NOI18N
actions[i] = ActionProvider.COMMAND_TEST_SINGLE;
} else if (targetNames[i].equals("debug-test")) { //NOI18N
actions[i] = ActionProvider.COMMAND_DEBUG_TEST_SINGLE;
} else if (targetNames[i].equals("test-unit")) { //NOI18N
actions[i] = ActionProvider.COMMAND_TEST;
} else if (targetNames[i].equals("test-method")) { //NOI18N
actions[i] = SingleMethod.COMMAND_RUN_SINGLE_METHOD;
} else if (targetNames[i].equals("debug-test-single-nb")) { //NOI18N
String testMethods = properties.getProperty("test.methods");//NOI18N
if (testMethods != null) {
actions[i] = SingleMethod.COMMAND_DEBUG_SINGLE_METHOD;
} else {
actions[i] = ActionProvider.COMMAND_DEBUG_TEST_SINGLE;
}
} else {
actions[i] = targetNames[i];
}
}
return actions;
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:25,代码来源:TestNGExecutionManager.java
示例4: canRunNoLock
import org.netbeans.spi.project.ActionProvider; //导入依赖的package包/类
/**
* Checks if a given command can be run at the moment from the perspective of the test userdir lock file.
* Cf. #63652, #72397, #141069, #207530.
* @param command as in {@link ActionProvider}
* @param lock from {@link NbModuleProject#getTestUserDirLockFile} or {@link SuiteProject#getTestUserDirLockFile}
* @return true if the command is unrelated, there is no lock file, or the lock file is stale and can be safely deleted;
* false (after showing a warning dialog) if the command must not proceed
*/
@Messages({
"ERR_module_already_running=The application is already running within the test user directory. You must shut it down before trying to run it again.",
"ERR_ModuleIsBeingRun=Cannot copy/move/rename/delete a module or suite while the application is running; shut it down first."
})
static boolean canRunNoLock(String command, File lock) {
if (command.equals(ActionProvider.COMMAND_RUN) ||
command.equals(ActionProvider.COMMAND_DEBUG) ||
command.equals(ActionProvider.COMMAND_PROFILE)) {
if (isLocked(lock)) {
DialogDisplayer.getDefault().notify(new NotifyDescriptor.Message(ERR_module_already_running()));
return false;
}
} else if (ActionProvider.COMMAND_DELETE.equals(command) ||
ActionProvider.COMMAND_RENAME.equals(command) ||
ActionProvider.COMMAND_MOVE.equals(command) ||
ActionProvider.COMMAND_COPY.equals(command)) {
if (isLocked(lock)) {
DialogDisplayer.getDefault().notify(new NotifyDescriptor.Message(ERR_ModuleIsBeingRun()));
return false;
}
}
return true;
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:32,代码来源:ModuleActions.java
示例5: runAction
import org.netbeans.spi.project.ActionProvider; //导入依赖的package包/类
private void runAction(String action) {
Project project = getProject();
if (project != null) {
Lookup lookup = project.getLookup();
if (fileForDocument != null) {
try {
DataObject dobj = DataObject.find(fileForDocument);
lookup = dobj.getLookup();
} catch (DataObjectNotFoundException ex) {
Exceptions.printStackTrace(ex);
}
}
ActionProvider provider = project.getLookup().lookup(ActionProvider.class);
if (provider != null) {
if (provider.isActionEnabled(action, lookup)) {
provider.invokeAction(action, lookup);
}
}
}
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:22,代码来源:CoverageSideBar.java
示例6: testDeleteOfEmptySuite
import org.netbeans.spi.project.ActionProvider; //导入依赖的package包/类
@RandomlyFails // NB-Core-Build #9919: Unstable, NB-Core-Build #9918 on the same sources passed
public void testDeleteOfEmptySuite() throws Exception {
SuiteProject suite = generateSuite("suite");
suite.open();
SuiteActions ap = (SuiteActions) suite.getLookup().lookup(ActionProvider.class);
assertNotNull("have an action provider", ap);
assertTrue("delete action is enabled", ap.isActionEnabled(ActionProvider.COMMAND_DELETE, null));
FileObject prjDir = suite.getProjectDirectory();
// build project
ap.invokeActionImpl(ActionProvider.COMMAND_BUILD, suite.getLookup()).waitFinished();
assertNotNull("suite was build", prjDir.getFileObject("build"));
FileObject[] expectedMetadataFiles = {
prjDir.getFileObject(GeneratedFilesHelper.BUILD_XML_PATH),
prjDir.getFileObject("nbproject"),
};
assertEquals("correct metadata files", Arrays.asList(expectedMetadataFiles), ProjectOperations.getMetadataFiles(suite));
assertTrue("no data files", ProjectOperations.getDataFiles(suite).isEmpty());
// It is hard to simulate exact scenario invoked by user. Let's test at least something.
ProjectOperations.notifyDeleting(suite);
prjDir.getFileSystem().refresh(true);
assertNull(prjDir.getFileObject("build"));
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:27,代码来源:SuiteOperationsTest.java
示例7: commandSupported
import org.netbeans.spi.project.ActionProvider; //导入依赖的package包/类
/**
* Tests whether given command is available on the project and whether
* the action as to be enabled in current Context
* @param project Project to test
* @param command Command for test
* @param context Lookup representing current context or null if context
* does not matter.
*/
public static boolean commandSupported( Project project, String command, Lookup context ) {
//We have to look whether the command is supported by the project
ActionProvider ap = project.getLookup().lookup(ActionProvider.class);
if ( ap != null ) {
List<String> commands = Arrays.asList(ap.getSupportedActions());
if ( commands.contains( command ) ) {
try {
if (context == null || ap.isActionEnabled(command, context)) {
//System.err.println("cS: true project=" + project + " command=" + command + " context=" + context);
return true;
}
} catch (IllegalArgumentException x) {
Logger.getLogger(ActionsUtil.class.getName()).log(Level.INFO, "#213589: possible race condition in MergedActionProvider", x);
}
}
}
//System.err.println("cS: false project=" + project + " command=" + command + " context=" + context);
return false;
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:28,代码来源:ActionsUtil.java
示例8: isActionEnabled
import org.netbeans.spi.project.ActionProvider; //导入依赖的package包/类
public boolean isActionEnabled(String command, Lookup context) throws IllegalArgumentException {
boolean supported = false;
for (ActionProvider ap : delegates()) {
if (Arrays.asList(ap.getSupportedActions()).contains(command)) {
supported = true;
boolean enabled = ap.isActionEnabled(command, context);
LOG.log(Level.FINE, "delegate {0} says enabled={1} for {2} in {3}", new Object[] {ap, enabled, command, context});
if (enabled) {
return true;
}
}
}
if (supported) {
return false;
} else {
// Not supported by anyone.
throw new IllegalArgumentException(command);
}
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:20,代码来源:LookupMergerImpl.java
示例9: deleteProject
import org.netbeans.spi.project.ActionProvider; //导入依赖的package包/类
public static synchronized Action deleteProject() {
final Action a = new ProjectAction(
ActionProvider.COMMAND_DELETE,
NbBundle.getMessage(Actions.class, "LBL_DeleteProjectAction_Name"),
null,
null );
try {
final Action delete = org.openide.awt.Actions.forID("Edit", "org.openide.actions.DeleteAction");
a.putValue(Action.ACCELERATOR_KEY, delete.getValue(Action.ACCELERATOR_KEY));
delete.addPropertyChangeListener(new PropertyChangeListener() {
public @Override void propertyChange(PropertyChangeEvent evt) {
a.putValue(Action.ACCELERATOR_KEY, delete.getValue(Action.ACCELERATOR_KEY));
}
});
} catch (Exception x) {
Exceptions.printStackTrace(x);
}
return a;
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:22,代码来源:Actions.java
示例10: canDestroy
import org.netbeans.spi.project.ActionProvider; //导入依赖的package包/类
@Override
public boolean canDestroy() {
Project p = getLookup().lookup(Project.class);
if (p == null) {
return false;
}
ActionProvider ap = p.getLookup().lookup(ActionProvider.class);
String[] sa = ap != null ? ap.getSupportedActions() : new String[0];
int k = sa.length;
for (int i = 0; i < k; i++) {
if (ActionProvider.COMMAND_DELETE.equals(sa[i])) {
return ap.isActionEnabled(ActionProvider.COMMAND_DELETE, getLookup());
}
}
return false;
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:19,代码来源:ProjectsRootNode.java
示例11: hasAction
import org.netbeans.spi.project.ActionProvider; //导入依赖的package包/类
public static boolean hasAction(Project project, String actionName) {
ActionProvider ap = project.getLookup().lookup(ActionProvider.class);
if (ap == null) {
return false; // return false if no ActionProvider available
}
String[] actions = ap.getSupportedActions();
for (int i = 0; i < actions.length; i++) {
if ((actions[i] != null) && actionName.equals(actions[i])) {
return true;
}
}
return false;
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:18,代码来源:ProjectUtilities.java
示例12: supportsProfileFile
import org.netbeans.spi.project.ActionProvider; //导入依赖的package包/类
static boolean supportsProfileFile(String command, FileObject file) {
Project p = file == null ? null : FileOwnerQuery.getOwner(file);
if (p == null) return false;
ActionProvider ap = p.getLookup().lookup(ActionProvider.class);
try {
if (ap != null && contains(ap.getSupportedActions(), command)) {
ProjectProfilingSupport ppp = ProjectProfilingSupport.get(p);
return ppp.isProfilingSupported() && ppp.isFileObjectSupported(file) &&
ap.isActionEnabled(command, getContext(file, p, command));
}
} catch (IllegalArgumentException e) {
// command not supported
}
return false;
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:17,代码来源:FileSensitivePerformer.java
示例13: rerun
import org.netbeans.spi.project.ActionProvider; //导入依赖的package包/类
public void rerun() {
if ((properties.getProperty("test.includes") != null && properties.getProperty("test.includes").endsWith(".xml")) || //NOI18N
(properties.getProperty("test.class") != null && properties.getProperty("test.class").endsWith(".xml"))) { //NOI18N
if (properties.getProperty("continue.after.failing.tests") == null) { //NOI18N
properties.setProperty("continue.after.failing.tests", "true"); //NOI18N
}
try {
runAnt(FileUtil.toFileObject(scriptFile), targets, properties);
} catch (IOException ex) {
LOGGER.log(Level.SEVERE, ex.getMessage(), ex);
}
} else {
Project project = testSession.getProject();
if(ProjectManager.getDefault().isValid(project)) {
ActionProvider actionProvider = project.getLookup().lookup(ActionProvider.class);
String[] actionNames = getActionNames(targets);
if (actionProvider != null) {
if (Arrays.asList(actionProvider.getSupportedActions()).contains(actionNames[0])
&& actionProvider.isActionEnabled(actionNames[0], lookup)) {
actionProvider.invokeAction(actionNames[0], lookup);
}
}
}
}
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:26,代码来源:TestNGExecutionManager.java
示例14: profileProjectPopup
import org.netbeans.spi.project.ActionProvider; //导入依赖的package包/类
@Messages({
"LBL_ProfileProject=Profile"
})
@ActionID(category="Profile", id="org.netbeans.modules.profiler.actions.ProfileProjectPopup")
@ActionRegistration(displayName="#LBL_ProfileProject", lazy=false, asynchronous=true)
@ActionReferences({
@ActionReference(path="Projects/org-netbeans-modules-java-j2seproject/Actions", position=1000),
@ActionReference(path="Projects/org-netbeans-modules-java-j2semodule/Actions", position=1000),
@ActionReference(path="Projects/org-netbeans-modules-apisupport-project/Actions", position=900),
@ActionReference(path="Projects/org-netbeans-modules-apisupport-project-suite/Actions", position=1000),
@ActionReference(path="Projects/org-netbeans-modules-web-project/Actions", position=1000)
})
public static Action profileProjectPopup() {
Action delegate = ProjectSensitiveActions.projectSensitiveAction(
ProjectSensitivePerformer.profileProject(ActionProvider.COMMAND_PROFILE),
NbBundle.getMessage(AntActions.class, "LBL_ProfileProject"), // NOI18N
null
);
return delegate;
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:22,代码来源:AntActions.java
示例15: profileSingle
import org.netbeans.spi.project.ActionProvider; //导入依赖的package包/类
@Messages("LBL_ProfileFile=Profile &File")
@ActionID(category="Profile", id="org.netbeans.modules.profiler.actions.ProfileSingle")
@ActionRegistration(displayName="#LBL_ProfileFile", lazy=false)
@ActionReferences({
@ActionReference(path="Loaders/text/x-java/Actions", position=1200),
@ActionReference(path="Loaders/text/x-jsp/Actions", position=800),
@ActionReference(path="Menu/Profile", position=110)
})
public static Action profileSingle() {
Action delegate = FileSensitiveActions.fileSensitiveAction(
new FileSensitivePerformer(ActionProvider.COMMAND_PROFILE_SINGLE),
Bundle.LBL_ProfileFile(),
null);
return delegate;
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:17,代码来源:AntActions.java
示例16: actionPerformed
import org.netbeans.spi.project.ActionProvider; //导入依赖的package包/类
@Override
public void actionPerformed(ActionEvent ev) {
Project project = HotProject.getProject();
if ( project instanceof MakeProject ) {
try {
final MakeProject makeProject = (MakeProject) project;
if ( rebuildRequired(makeProject) ) {
projectActionEventListener = (action) -> runProgrammer( makeProject );
ProjectActionSupport.getInstance().addProjectActionEventListener( projectActionEventListener, PROJECT_EVENTS );
MakeActionProvider actionProvider = makeProject.getLookup().lookup(MakeActionProvider.class);
actionProvider.invokeAction(ActionProvider.COMMAND_BUILD, makeProject.getLookup());
} else {
runProgrammer(makeProject);
}
} catch (IOException ex) {
Exceptions.printStackTrace(ex);
}
}
}
开发者ID:chipKIT32,项目名称:chipKIT-importer,代码行数:20,代码来源:RunPic32ProgAction.java
示例17: isProtectedWait
import org.netbeans.spi.project.ActionProvider; //导入依赖的package包/类
private boolean isProtectedWait(Project proj, RunConfig config) {
String action = config.getActionName();
if(action == null || proj == null || !RunUtils.isCompileOnSaveEnabled(proj)) {
return false;
}
switch(action) {
case ActionProvider.COMMAND_RUN:
case ActionProvider.COMMAND_RUN_SINGLE:
case ActionProvider.COMMAND_DEBUG:
case ActionProvider.COMMAND_DEBUG_SINGLE:
case ActionProviderImpl.DEBUG_MAIN:
case ActionProviderImpl.RUN_MAIN:
return true;
default:
return false;
}
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:18,代码来源:AbstractOutputHandler.java
示例18: isActionEnabled
import org.netbeans.spi.project.ActionProvider; //导入依赖的package包/类
public boolean isActionEnabled(String command, Lookup context) throws IllegalArgumentException {
if (command.equals(ActionProvider.COMMAND_COMPILE_SINGLE)) {
return findPackageRoot(context) != null;
} else if (command.equals(ActionProvider.COMMAND_DEBUG)) {
return true;
} else if (command.equals(ActionProvider.COMMAND_PROFILE)) {
return true;
} else if (command.equals(ActionProvider.COMMAND_RUN_SINGLE)) {
return (findPackageRoot(context) != null) && isSingleJavaFileSelected(context);
} else if (command.equals(ActionProvider.COMMAND_DEBUG_SINGLE)) {
return (findPackageRoot(context) != null) && isSingleJavaFileSelected(context);
} else if (command.equals(ActionProvider.COMMAND_PROFILE_SINGLE)) {
return (findPackageRoot(context) != null) && isSingleJavaFileSelected(context);
} else {
throw new IllegalArgumentException(command);
}
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:18,代码来源:JavaActions.java
示例19: testGetSupportedActions
import org.netbeans.spi.project.ActionProvider; //导入依赖的package包/类
public void testGetSupportedActions() throws Exception {
assertEquals("initially all context-sensitive actions supported",
Arrays.asList(new String[] {
ActionProvider.COMMAND_COMPILE_SINGLE,
ActionProvider.COMMAND_DEBUG,
ActionProvider.COMMAND_PROFILE,
ActionProvider.COMMAND_RUN_SINGLE,
ActionProvider.COMMAND_DEBUG_SINGLE,
ActionProvider.COMMAND_PROFILE_SINGLE
}),
Arrays.asList(ja.getSupportedActions()));
/* Not really necessary; once there is a binding, the main ant/freeform Actions will mask this anyway:
ja.addBinding(ActionProvider.COMMAND_COMPILE_SINGLE, "target", "prop", "${dir}", null, "relative-path", null);
assertEquals("binding a context-sensitive action makes it not be supported any longer",
Collections.EMPTY_LIST,
Arrays.asList(ja.getSupportedActions()));
*/
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:19,代码来源:JavaActionsTest.java
示例20: createConcealedProperties
import org.netbeans.spi.project.ActionProvider; //导入依赖的package包/类
@NonNull
@Override
@SuppressWarnings("fallthrough")
public Set<String> createConcealedProperties(@NonNull final String command, @NonNull final Lookup context) {
Parameters.notNull("command", command); //NOI18N
Parameters.notNull("context", context); //NOI18N
switch (command) {
case ActionProvider.COMMAND_RUN:
case ActionProvider.COMMAND_DEBUG:
case ActionProvider.COMMAND_PROFILE:
final RemotePlatform rp = Utilities.getRemotePlatform(prj);
if (rp != null) {
final ConnectionMethod.Authentification.Kind kind = rp.getConnectionMethod().getAuthentification().getKind();
switch (kind) {
case PASSWORD:
return Collections.singleton(PROP_PASSWD);
case KEY:
return Collections.singleton(PROP_PASSPHRASE);
default:
throw new IllegalStateException(kind.name());
}
}
default:
return Collections.<String>emptySet();
}
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:27,代码来源:RemoteBuildPropertiesProvider.java
注:本文中的org.netbeans.spi.project.ActionProvider类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论