Java Code Examples for org.netbeans.spi.project.ActionProvider#COMMAND_TEST

The following examples show how to use org.netbeans.spi.project.ActionProvider#COMMAND_TEST . 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: TestNGExecutionManager.java    From netbeans with Apache License 2.0 6 votes vote down vote up
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;
}
 
Example 2
Source File: Actions.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public static Action testProject() {        
    Action a = new ProjectAction (
        ActionProvider.COMMAND_TEST,
        NbBundle.getMessage(Actions.class, "LBL_TestProjectAction_Name"),
        NbBundle.getMessage(Actions.class, "LBL_TestProjectAction_Name_popup"),
        null,
        null ); 
    a.putValue("iconBase","org/netbeans/modules/project/ui/resources/testProject.png"); //NOI18N
    a.putValue("noIconInMenu", Boolean.TRUE); //NOI18N
    return a;
}
 
Example 3
Source File: CoverageReportTopComponent.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private void runAllTests(ActionEvent evt) {//GEN-FIRST:event_runAllTests
    Lookup lookup = project.getLookup();
    ActionProvider actionProvider = project.getLookup().lookup(ActionProvider.class);
    CoverageProvider coverageProvider = CoverageManagerImpl.getProvider(project);
    String action = ActionProvider.COMMAND_TEST;
    if (coverageProvider != null && coverageProvider.getTestAllAction() != null) {
        action = coverageProvider.getTestAllAction();
    }
    if (actionProvider != null) {
        if (actionProvider.isActionEnabled(ActionProvider.COMMAND_TEST, lookup)) {
            actionProvider.invokeAction(action, lookup);
        }
    }
}
 
Example 4
Source File: CoverageSideBar.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private String getAllTestAction() {
    String action = ActionProvider.COMMAND_TEST;
    CoverageProvider provider = getProvider();
    if (provider != null && provider.getTestAllAction() != null) {
        action = provider.getTestAllAction();
    }
    return action;
}
 
Example 5
Source File: AndroidProjectActionProvider.java    From NBANDROID-V2 with Apache License 2.0 5 votes vote down vote up
@Override
public String[] getSupportedActions() {
    return new String[]{ActionProvider.COMMAND_REBUILD, ActionProvider.COMMAND_BUILD,
        AndroidConstants.COMMAND_BUILD_TEST,
        ActionProvider.COMMAND_CLEAN,
        ActionProvider.COMMAND_RUN,
        ActionProvider.COMMAND_TEST,
        ActionProvider.COMMAND_DEBUG,};
}
 
Example 6
Source File: Launches.java    From NBANDROID-V2 with Apache License 2.0 5 votes vote down vote up
public static MainActivityConfiguration getActivityConfiguration(String command, Project project) {
    switch (command) {
        case ActionProvider.COMMAND_RUN:
        case ActionProvider.COMMAND_TEST:
        case ActionProvider.COMMAND_TEST_SINGLE:
            return project.getLookup().lookup(RunActivityConfiguration.class);
        default:
            return project.getLookup().lookup(DebugActivityConfiguration.class);
    }
}
 
Example 7
Source File: JavaActionProvider.java    From netbeans with Apache License 2.0 4 votes vote down vote up
@NonNull
public ScriptAction createDefaultScriptAction(
        @NonNull final String command,
        final boolean javaModelSensitive,
        final boolean scanSensitive,
        final boolean enabledInCoS,
        @NonNull final Supplier<? extends String[]> targets,
        @NullAllowed final CustomFileExecutor customFileExecutor) {
    Parameters.notNull("command", command);         //NOI18N
    Parameters.notNull("targets", targets);         //NOI18N
    switch (command) {
        case ActionProvider.COMMAND_CLEAN:
            return createNonCosAction(command, false, javaModelSensitive, scanSensitive, enabledInCoS, targets, Collections.emptyMap());
        case ActionProvider.COMMAND_REBUILD:
            return createNonCosAction(command, true, javaModelSensitive, scanSensitive, enabledInCoS, targets, Collections.emptyMap());
        case ActionProvider.COMMAND_BUILD:
            return createBuildAction(javaModelSensitive, scanSensitive, enabledInCoS, targets, mfs);
        case ActionProvider.COMMAND_RUN:
        case ActionProvider.COMMAND_DEBUG:
        case ActionProvider.COMMAND_DEBUG_STEP_INTO:
        case ActionProvider.COMMAND_PROFILE:
            return createRunAction(command, javaModelSensitive, scanSensitive, enabledInCoS, targets, mfs, mainClassServices);
        case ActionProvider.COMMAND_TEST:
            return createNonCosAction(command, true, javaModelSensitive, scanSensitive, enabledInCoS, targets, Collections.singletonMap("ignore.failing.tests", "true"));  //NOI18N);
        case ActionProvider.COMMAND_COMPILE_SINGLE:
            return createCompileSingleAction(javaModelSensitive, scanSensitive, enabledInCoS, sourceRoots, testRoots, targets);
        case ActionProvider.COMMAND_RUN_SINGLE:
        case ActionProvider.COMMAND_DEBUG_SINGLE:
        case ActionProvider.COMMAND_PROFILE_SINGLE:
            return createRunSingleAction(
                    command, javaModelSensitive, scanSensitive, enabledInCoS,
                    sourceRoots, testRoots, targets, customFileExecutor);
        case ActionProvider.COMMAND_TEST_SINGLE:
            return createTestSingleAction(javaModelSensitive, scanSensitive, enabledInCoS, sourceRoots, testRoots, targets);
        case ActionProvider.COMMAND_DEBUG_TEST_SINGLE:
        case ActionProvider.COMMAND_PROFILE_TEST_SINGLE:
            return createDebugTestSingleAction(command, javaModelSensitive, scanSensitive, enabledInCoS, sourceRoots, testRoots, targets);
        case SingleMethod.COMMAND_RUN_SINGLE_METHOD:
        case SingleMethod.COMMAND_DEBUG_SINGLE_METHOD:
            return createRunSingleMethodAction(command, javaModelSensitive, scanSensitive, enabledInCoS, testRoots, targets);
        case JavaProjectConstants.COMMAND_DEBUG_FIX:
            return createDebugFixAction(command, javaModelSensitive, scanSensitive, enabledInCoS, sourceRoots, testRoots, targets);
        default:
            throw new UnsupportedOperationException(String.format("Unsupported command: %s", command)); //NOI18N
    }
}
 
Example 8
Source File: TestProjectCommand.java    From netbeans with Apache License 2.0 4 votes vote down vote up
@Override
public String getCommandId() {
    return ActionProvider.COMMAND_TEST;
}
 
Example 9
Source File: ActionProviderImpl.java    From netbeans with Apache License 2.0 4 votes vote down vote up
@NbBundle.Messages({
    "# {0} - artifactId", "TXT_Run=Run ({0})",
    "# {0} - artifactId", "TXT_Debug=Debug ({0})",
    "# {0} - artifactId", "TXT_ApplyCodeChanges=Apply Code Changes ({0})",
    "# {0} - artifactId", "TXT_Profile=Profile ({0})",
    "# {0} - artifactId", "TXT_Test=Test ({0})",
    "# {0} - artifactId", "TXT_Build=Build ({0})",
    "# {0} - artifactId", "TXT_Delete=Delete ({0})",
})

static String taskName(Project project, String action, Lookup lkp) {
    String title;
    DataObject dobj = lkp.lookup(DataObject.class);
    String dobjName = dobj != null ? dobj.getName() : "";
    Project prj = project != null ? project : lkp.lookup(Project.class);
    String prjLabel = prj != null ? ProjectUtils.getInformation(prj).getDisplayName() : "No Project on Lookup"; //NOI18N
    switch (action) {
        case ActionProvider.COMMAND_RUN:
            title = TXT_Run(prjLabel);
            break;
        case ActionProvider.COMMAND_DEBUG:
            title = TXT_Debug(prjLabel);
            break;
        case ActionProvider.COMMAND_DELETE:
            title = TXT_Delete(prjLabel);
            break;
        case ActionProvider.COMMAND_PROFILE:
            title = TXT_Profile(prjLabel);
            break;
        case ActionProvider.COMMAND_TEST:
            title = TXT_Test(prjLabel);
            break;
        case ActionProvider.COMMAND_RUN_SINGLE:
            title = TXT_Run(dobjName);
            break;
        case ActionProvider.COMMAND_DEBUG_SINGLE:
        case ActionProvider.COMMAND_DEBUG_TEST_SINGLE:
            title = TXT_Debug(dobjName);
            break;
        case ActionProvider.COMMAND_PROFILE_SINGLE:
        case ActionProvider.COMMAND_PROFILE_TEST_SINGLE:
            title = TXT_Profile(dobjName);
            break;
        case ActionProvider.COMMAND_TEST_SINGLE:
            title = TXT_Test(dobjName);
            break;
        case "debug.fix":
            title = TXT_ApplyCodeChanges(prjLabel);
            break;
        default:
            title = TXT_Build(prjLabel);
    }
    return title;
}