org.netbeans.modules.groovy.grails.api.GrailsPlatform.getDefault() - java examples

Here are the examples of the java api org.netbeans.modules.groovy.grails.api.GrailsPlatform.getDefault() taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

7 Examples 7

19 View Complete Implementation : GrailsPluginSupport.java
Copyright Apache License 2.0
Author : apache
public List<GrailsPlugin> loadInstalledPlugins() {
    Version version = GrailsPlatform.getDefault().getVersion();
    if (Version.VERSION_1_1.compareTo(version) <= 0) {
        return loadInstalledPlugins11();
    }
    return loadInstalledPlugins10();
}

19 View Complete Implementation : GrailsPluginSupport.java
Copyright Apache License 2.0
Author : apache
public boolean uninstallPlugins(Collection<GrailsPlugin> selectedPlugins) {
    Version version = GrailsPlatform.getDefault().getVersion();
    if (Version.VERSION_1_1.compareTo(version) <= 0) {
        return uninstallPlugins11(selectedPlugins);
    }
    return uninstallPlugins10(selectedPlugins);
}

17 View Complete Implementation : PanelOptionsVisual.java
Copyright Apache License 2.0
Author : apache
@Override
void read(WizardDescriptor settings) {
    GrailsPlatform.getDefault().addChangeListener(this);
}

17 View Complete Implementation : PanelOptionsVisual.java
Copyright Apache License 2.0
Author : apache
@Override
void store(WizardDescriptor settings) {
    GrailsPlatform.getDefault().removeChangeListener(this);
}

13 View Complete Implementation : GrailsActionProvider.java
Copyright Apache License 2.0
Author : apache
@Override
public void invokeAction(String command, Lookup context) throws IllegalArgumentException {
    final GrailsPlatform runtime = GrailsPlatform.getDefault();
    // If the runtime is not configured and we are performing anything except delete show warning
    if (!runtime.isConfigured() && !COMMAND_DELETE.equals(command)) {
        ConfigurationSupport.showConfigurationWarning(runtime);
        return;
    }
    switch(command) {
        case COMMAND_RUN:
            LifecycleManager.getDefault().saveAll();
            executeRunAction();
            break;
        case COMMAND_DEBUG:
            LifecycleManager.getDefault().saveAll();
            executeRunAction(true);
            break;
        case COMMAND_GRAILS_SHELL:
            // NOI18N
            executeSimpleAction("shell");
            break;
        case COMMAND_TEST:
            // NOI18N
            executeSimpleAction("test-app");
            break;
        case COMMAND_CLEAN:
            // NOI18N
            executeSimpleAction("clean");
            break;
        case COMMAND_COMPILE:
            // NOI18N
            executeSimpleAction("compile");
            break;
        case COMMAND_UPGRADE:
            // NOI18N
            executeSimpleAction("upgrade");
            break;
        case COMMAND_DELETE:
            DefaultProjectOperations.performDefaultDeleteOperation(project);
            break;
        case COMMAND_BUILD:
            // NOI18N
            executeSimpleAction("war");
            break;
    }
}

9 View Complete Implementation : GenerateAction.java
Copyright Apache License 2.0
Author : apache
protected void performAction(Node[] activatedNodes) {
    final GrailsPlatform runtime = GrailsPlatform.getDefault();
    if (!runtime.isConfigured()) {
        ConfigurationSupport.showConfigurationWarning(runtime);
        return;
    }
    DataObject dataObject = activatedNodes[0].getLookup().lookup(DataObject.clreplaced);
    GrailsProject prj = (GrailsProject) FileOwnerQuery.getOwner(dataObject.getFolder().getPrimaryFile());
    FileObject domainDir = prj.getProjectDirectory().getFileObject(DOMAIN_DIR);
    if (domainDir == null) {
        return;
    }
    String relativePath = FileUtil.getRelativePath(domainDir, dataObject.getPrimaryFile());
    if (relativePath == null) {
        return;
    }
    // replace slashes and cut off the extension
    // NOI18N
    StringBuilder builder = new StringBuilder(relativePath.replace('/', '.'));
    builder.setLength(builder.length() - dataObject.getPrimaryFile().getNameExt().length());
    builder.append(dataObject.getPrimaryFile().getName());
    ProjectInformation inf = prj.getLookup().lookup(ProjectInformation.clreplaced);
    // NOI18N
    String displayName = inf.getDisplayName() + " (" + command + ")";
    Callable<Process> callable = ExecutionSupport.getInstance().createSimpleCommand(command, GrailsProjectConfig.forProject(prj), // NOI18N
    builder.toString());
    ExecutionDescriptor descriptor = prj.getCommandSupport().getDescriptor(command);
    ExecutionService service = ExecutionService.newService(callable, descriptor, displayName);
    service.run();
}

9 View Complete Implementation : GrailsCommandAction.java
Copyright Apache License 2.0
Author : apache
@Override
public void performAction() {
    final GrailsPlatform runtime = GrailsPlatform.getDefault();
    if (!runtime.isConfigured()) {
        ConfigurationSupport.showConfigurationWarning(runtime);
        return;
    }
    final GrailsProject project = inferGrailsProject();
    if (project == null) {
        return;
    }
    GrailsCommandChooser.CommandDescriptor commandDescriptor = GrailsCommandChooser.select(project);
    if (commandDescriptor == null) {
        return;
    }
    ProjectInformation inf = ProjectUtils.getInformation(project);
    // NOI18N
    String displayName = inf.getDisplayName() + " (" + commandDescriptor.getGrailsCommand().getCommand() + ")";
    final String[] params;
    // FIXME all parameters in one String should we split it ?
    if (commandDescriptor.getCommandParams() != null && !"".equals(commandDescriptor.getCommandParams().trim())) {
        params = new String[] { commandDescriptor.getCommandParams() };
    } else {
        params = new String[] {};
    }
    Callable<Process> callable;
    ExecutionDescriptor descriptor;
    final boolean debug = commandDescriptor.isDebug();
    if (GrailsPlatform.IDE_RUN_COMMAND.equals(commandDescriptor.getGrailsCommand().getCommand())) {
        final GrailsServerState serverState = project.getLookup().lookup(GrailsServerState.clreplaced);
        Process process = null;
        if (serverState != null && serverState.isRunning()) {
            if (!debug) /*|| debug == serverState.isDebug()*/
            {
                URL url = serverState.getRunningUrl();
                if (url != null) {
                    GrailsCommandSupport.showURL(url, debug, project);
                }
                return;
            } else {
                process = serverState.getProcess();
                if (process != null) {
                    process.destroy();
                }
            }
        }
        final Process oldProcess = process;
        callable = new Callable<Process>() {

            public Process call() throws Exception {
                if (oldProcess != null) {
                    oldProcess.waitFor();
                }
                Callable<Process> inner = ExecutionSupport.getInstance().createRunApp(GrailsProjectConfig.forProject(project), debug, params);
                Process process = inner.call();
                final GrailsServerState serverState = project.getLookup().lookup(GrailsServerState.clreplaced);
                if (serverState != null) {
                    serverState.setProcess(process);
                    serverState.setDebug(debug);
                }
                return process;
            }
        };
        descriptor = project.getCommandSupport().getRunDescriptor(debug);
    } else {
        callable = ExecutionSupport.getInstance().createSimpleCommand(commandDescriptor.getGrailsCommand().getCommand(), debug, GrailsProjectConfig.forProject(project), params);
        descriptor = project.getCommandSupport().getDescriptor(commandDescriptor.getGrailsCommand().getCommand(), debug);
    }
    ExecutionService service = ExecutionService.newService(callable, descriptor, displayName);
    service.run();
}