Java Code Examples for org.netbeans.modules.php.api.util.UiUtils#invalidScriptProvided()

The following examples show how to use org.netbeans.modules.php.api.util.UiUtils#invalidScriptProvided() . These examples are extracted from open source projects. 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 Project: netbeans   File: Atoum.java    License: Apache License 2.0 6 votes vote down vote up
@CheckForNull
public static Atoum getForPhpModule(PhpModule phpModule, boolean showCustomizer) {
    if (validatePhpModule(phpModule) != null) {
        if (showCustomizer) {
            UiUtils.invalidScriptProvided(phpModule, AtoumCustomizer.IDENTIFIER, null);
        }
        return null;
    }
    // atoum
    String path;
    if (AtoumPreferences.isAtoumEnabled(phpModule)) {
        // custom atoum
        path = AtoumPreferences.getAtoumPath(phpModule);
    } else {
        // default atoum
        String error = validateDefault();
        if (error != null) {
            if (showCustomizer) {
                UiUtils.invalidScriptProvided(error, AtoumOptionsPanelController.OPTIONS_SUB_PATH);
            }
            return null;
        }
        path = AtoumOptions.getInstance().getAtoumPath();
    }
    return new Atoum(path);
}
 
Example 2
@Override
protected List<FrameworkCommand> getFrameworkCommandsInternal() {
    Doctrine2Script doctrine2;
    try {
        doctrine2 = Doctrine2Script.getDefault();
    } catch (InvalidPhpExecutableException ex) {
        UiUtils.invalidScriptProvided(ex.getLocalizedMessage(), Doctrine2OptionsPanelController.OPTIONS_SUBPATH);
        return null;
    }

    List<Doctrine2CommandVO> commandsVO = doctrine2.getCommands(phpModule);
    if (commandsVO == null) {
        // some error
        return null;
    }
    List<FrameworkCommand> commands = new ArrayList<>(commandsVO.size());
    for (Doctrine2CommandVO command : commandsVO) {
        commands.add(new Doctrine2Command(command.getCommand(), command.getDescription(), command.getHelp()));
    }
    return commands;
}
 
Example 3
Source Project: netbeans   File: PhpExecutable.java    License: Apache License 2.0 6 votes vote down vote up
@CheckForNull
private Future<Integer> runInternal(ExecutionDescriptor executionDescriptor, ExecutionDescriptor.InputProcessorFactory2 outProcessorFactory, boolean debug) {
    Parameters.notNull("executionDescriptor", executionDescriptor); // NOI18N
    String error;
    if (validationHandler == null) {
        error = PhpExecutableValidator.validateCommand(executable, executableName);
    } else {
        error = PhpExecutableValidator.validateCommand(executable, validationHandler);
    }
    if (error != null) {
        if (warnUser) {
            // optionsSubcategory should be taken from executionDescriptor (unfortunately not possible)
            UiUtils.invalidScriptProvided(error, optionsSubcategory);
        }
        return null;
    }
    ProcessBuilder processBuilder = getProcessBuilder(debug);
    if (processBuilder == null) {
        return null;
    }
    executionDescriptor = getExecutionDescriptor(executionDescriptor, outProcessorFactory);
    return ExecutionService.newService(processBuilder, executionDescriptor, getDisplayName()).run();
}
 
Example 4
Source Project: netbeans   File: PhpDocumentorProvider.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void generateDocumentation(PhpModule phpModule) {
    try {
        PhpDocScript.getDefault().generateDocumentation(phpModule);
    } catch (InvalidPhpExecutableException ex) {
        UiUtils.invalidScriptProvided(ex.getLocalizedMessage(), PhpDocScript.OPTIONS_SUB_PATH);
    }
}
 
Example 5
Source Project: netbeans   File: InternalWebServer.java    License: Apache License 2.0 5 votes vote down vote up
@NbBundle.Messages({
    "# {0} - project name",
    "InternalWebServer.output.title=Internal WebServer ({0})"
})
private Future<Integer> createProcess() {
    // validate
    PhpInterpreter phpInterpreter;
    try {
        phpInterpreter = PhpInterpreter.getDefault();
    } catch (InvalidPhpExecutableException ex) {
        UiUtils.invalidScriptProvided(ex.getLocalizedMessage());
        return null;
    }
    RunConfigInternal runConfig = RunConfigInternal.forProject(project);
    if (RunConfigInternalValidator.validateCustomizer(runConfig) != null) {
        PhpProjectUtils.openCustomizerRun(project);
        return null;
    }
    // run
    return new PhpExecutable(phpInterpreter.getInterpreter())
            .viaAutodetection(false)
            .viaPhpInterpreter(false)
            .workDir(runConfig.getWorkDir())
            .additionalParameters(getParameters(runConfig))
            .displayName(Bundle.InternalWebServer_output_title(project.getName()))
            .run(getDescriptor());
}
 
Example 6
Source Project: netbeans   File: RunFileActionProvider.java    License: Apache License 2.0 5 votes vote down vote up
private FileRunner createFileRunner(File file, RunFileArgs args) {
    PhpInterpreter phpInterpreter;
    try {
        phpInterpreter = PhpInterpreter.getDefault();
    } catch (InvalidPhpExecutableException ex) {
        UiUtils.invalidScriptProvided(ex.getLocalizedMessage());
        return null;
    }
    return new FileRunner(file)
            .command(phpInterpreter.getInterpreter())
            .workDir(args.getWorkDir())
            .phpArgs(args.getPhpOpts())
            .fileArgs(args.getRunArgs());
}
 
Example 7
@Override
public void runCommand(CommandDescriptor commandDescriptor, Runnable postExecution) {
    String[] commands = commandDescriptor.getFrameworkCommand().getCommands();
    String[] commandParams = commandDescriptor.getCommandParams();
    List<String> params = new ArrayList<>(commands.length + commandParams.length);
    params.addAll(Arrays.asList(commands));
    params.addAll(Arrays.asList(commandParams));
    try {
        Cake3Script.forPhpModule(phpModule, false).runCommand(phpModule, params, postExecution);
    } catch (InvalidPhpExecutableException ex) {
        UiUtils.invalidScriptProvided(ex.getLocalizedMessage(), getOptionsPath());
    }
}
 
Example 8
Source Project: netbeans   File: ZendCommandSupport.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void runCommand(CommandDescriptor commandDescriptor, Runnable postExecution) {
    String[] commands = commandDescriptor.getFrameworkCommand().getCommands();
    String[] commandParams = commandDescriptor.getCommandParams();
    List<String> params = new ArrayList<>(commands.length + commandParams.length);
    params.addAll(Arrays.asList(commands));
    params.addAll(Arrays.asList(commandParams));
    try {
        ZendScript.getDefault().runCommand(phpModule, params, postExecution);
    } catch (InvalidPhpExecutableException ex) {
        UiUtils.invalidScriptProvided(ex.getLocalizedMessage(), ZendScript.getOptionsSubPath());
    }
}
 
Example 9
Source Project: netbeans   File: ZendCommandSupport.java    License: Apache License 2.0 5 votes vote down vote up
@Override
protected List<FrameworkCommand> getFrameworkCommandsInternal() {
    try {
        return ZendScript.getDefault().getCommands(phpModule);
    } catch (InvalidPhpExecutableException ex) {
        UiUtils.invalidScriptProvided(ex.getLocalizedMessage(), ZendScript.getOptionsSubPath());
    }
    return null;
}
 
Example 10
Source Project: netbeans   File: ZendCommand.java    License: Apache License 2.0 5 votes vote down vote up
@Override
protected String getHelpInternal() {
    PhpModule module = phpModule.get();
    if (module == null) {
        return ""; // NOI18N
    }
    try {
        return ZendScript.getDefault().getHelp(module, Arrays.<String>asList(getCommands()));
    } catch (InvalidPhpExecutableException ex) {
        UiUtils.invalidScriptProvided(ex.getLocalizedMessage(), ZendScript.getOptionsSubPath());
    }
    return ""; // NOI18N
}
 
Example 11
Source Project: netbeans   File: ApiGenProvider.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void generateDocumentation(PhpModule phpModule) {
    try {
        ApiGenScript.getDefault().generateDocumentation(phpModule);
    } catch (InvalidPhpExecutableException ex) {
        UiUtils.invalidScriptProvided(ex.getLocalizedMessage(), ApiGenOptionsPanelController.OPTIONS_SUBPATH);
    }
}
 
Example 12
Source Project: netbeans   File: SymfonyCommand.java    License: Apache License 2.0 5 votes vote down vote up
@Override
protected String getHelpInternal() {
    PhpModule module = phpModule.get();
    if (module == null) {
        return ""; // NOI18N
    }
    try {
        return SymfonyScript.forPhpModule(module, false).getHelp(module, getCommands());
    } catch (InvalidPhpExecutableException ex) {
        UiUtils.invalidScriptProvided(ex.getLocalizedMessage(), SymfonyScript.OPTIONS_SUB_PATH);
    }
    return ""; // NOI18N
}
 
Example 13
Source Project: netbeans   File: SymfonyCommandSupport.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void runCommand(CommandDescriptor commandDescriptor, Runnable postExecution) {
    String[] commands = commandDescriptor.getFrameworkCommand().getCommands();
    String[] commandParams = commandDescriptor.getCommandParams();
    List<String> params = new ArrayList<>(commands.length + commandParams.length);
    params.addAll(Arrays.asList(commands));
    params.addAll(Arrays.asList(commandParams));
    try {
        SymfonyScript.forPhpModule(phpModule, false).runCommand(phpModule, params, postExecution);
    } catch (InvalidPhpExecutableException ex) {
        UiUtils.invalidScriptProvided(ex.getLocalizedMessage(), SymfonyScript.OPTIONS_SUB_PATH);
    }
}
 
Example 14
Source Project: netbeans   File: SymfonyCommandSupport.java    License: Apache License 2.0 5 votes vote down vote up
@Override
protected List<FrameworkCommand> getFrameworkCommandsInternal() {
    try {
        return SymfonyScript.forPhpModule(phpModule, true).getCommands(phpModule);
    } catch (InvalidPhpExecutableException ex) {
        UiUtils.invalidScriptProvided(ex.getLocalizedMessage(), SymfonyScript.OPTIONS_SUB_PATH);
    }
    return null;
}
 
Example 15
Source Project: netbeans   File: ClearCacheAction.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void actionPerformed(PhpModule phpModule) {
    if (!SymfonyPhpFrameworkProvider.getInstance().isInPhpModule(phpModule)) {
        return;
    }

    try {
        SymfonyScript.forPhpModule(phpModule, false).clearCache(phpModule);
    } catch (InvalidPhpExecutableException ex) {
        UiUtils.invalidScriptProvided(ex.getLocalizedMessage(), SymfonyScript.OPTIONS_SUB_PATH);
    }
}
 
Example 16
@Override
protected List<FrameworkCommand> getFrameworkCommandsInternal() {
    try {
        return Cake3Script.forPhpModule(phpModule, true).getCommands(phpModule);
    } catch (InvalidPhpExecutableException ex) {
        UiUtils.invalidScriptProvided(ex.getLocalizedMessage(), getOptionsPath());
    }
    return Collections.emptyList();
}
 
Example 17
Source Project: netbeans   File: BaseComposerAction.java    License: Apache License 2.0 5 votes vote down vote up
@NbBundle.Messages("BaseComposerAction.error.composer.notValid=Composer is not valid.")
@Override
public final void actionPerformed(ActionEvent e) {
    PhpModule phpModule = PhpModule.Factory.inferPhpModule();
    if (phpModule == null) {
        return;
    }
    try {
        runCommand(phpModule);
    } catch (InvalidPhpExecutableException ex) {
        UiUtils.invalidScriptProvided(Bundle.BaseComposerAction_error_composer_notValid(), ComposerOptionsPanelController.OPTIONS_SUBPATH);
    }
}
 
Example 18
Source Project: netbeans   File: AddDependencyPanel.java    License: Apache License 2.0 5 votes vote down vote up
@NbBundle.Messages("AddDependencyPanel.error.composer.notValid=Composer is not valid.")
@CheckForNull
Composer getComposer() {
    try {
        return Composer.getDefault();
    } catch (InvalidPhpExecutableException ex) {
        UiUtils.invalidScriptProvided(Bundle.AddDependencyPanel_error_composer_notValid(), ComposerOptionsPanelController.OPTIONS_SUBPATH);
    }
    return null;
}
 
Example 19
Source Project: netbeans   File: DependenciesPanel.java    License: Apache License 2.0 5 votes vote down vote up
@NbBundle.Messages("DependenciesPanel.error.composer.notValid=Composer is not valid.")
@CheckForNull
Composer getComposer() {
    try {
        return Composer.getDefault();
    } catch (InvalidPhpExecutableException ex) {
        UiUtils.invalidScriptProvided(Bundle.DependenciesPanel_error_composer_notValid(), ComposerOptionsPanelController.OPTIONS_SUBPATH);
    }
    return null;
}
 
Example 20
Source Project: netbeans   File: BaseCodeceptionAction.java    License: Apache License 2.0 5 votes vote down vote up
@NbBundle.Messages("BaseCodeceptionAction.error.codeception.notValid=Codeception is not valid.")
@Override
public final void actionPerformed(ActionEvent e) {
    try {
        runCommand();
    } catch (InvalidPhpExecutableException ex) {
        UiUtils.invalidScriptProvided(Bundle.BaseCodeceptionAction_error_codeception_notValid(), CodeceptionOptionsPanelController.OPTIONS_SUB_PATH);
    }
}