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() . 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: Atoum.java    From netbeans with 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
Source File: PhpExecutable.java    From netbeans with 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 3
Source File: Doctrine2CommandSupport.java    From netbeans with Apache License 2.0 6 votes vote down vote up
@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 4
Source File: BaseCodeceptionAction.java    From netbeans with 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);
    }
}
 
Example 5
Source File: PhpDocumentorProvider.java    From netbeans with 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 6
Source File: DependenciesPanel.java    From netbeans with 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 7
Source File: AddDependencyPanel.java    From netbeans with 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 8
Source File: BaseComposerAction.java    From netbeans with 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 9
Source File: CakePHP3FrameworkCommandSupport.java    From cakephp3-netbeans with Apache License 2.0 5 votes vote down vote up
@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 10
Source File: ClearCacheAction.java    From netbeans with 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 11
Source File: SymfonyCommandSupport.java    From netbeans with 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 12
Source File: SymfonyCommandSupport.java    From netbeans with 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 13
Source File: SymfonyCommand.java    From netbeans with 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 14
Source File: ApiGenProvider.java    From netbeans with 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 15
Source File: ZendCommand.java    From netbeans with 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 16
Source File: ZendCommandSupport.java    From netbeans with 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 17
Source File: ZendCommandSupport.java    From netbeans with 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 18
Source File: CakePHP3FrameworkCommandSupport.java    From cakephp3-netbeans with 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 {
        Cake3Script.forPhpModule(phpModule, false).runCommand(phpModule, params, postExecution);
    } catch (InvalidPhpExecutableException ex) {
        UiUtils.invalidScriptProvided(ex.getLocalizedMessage(), getOptionsPath());
    }
}
 
Example 19
Source File: RunFileActionProvider.java    From netbeans with 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 20
Source File: InternalWebServer.java    From netbeans with 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());
}