Example usage for com.google.gwt.eclipse.core.launch.processors NoServerArgumentProcessor hasNoServerArg

List of usage examples for com.google.gwt.eclipse.core.launch.processors NoServerArgumentProcessor hasNoServerArg

Introduction

In this page you can find the example usage for com.google.gwt.eclipse.core.launch.processors NoServerArgumentProcessor hasNoServerArg.

Prototype

public static boolean hasNoServerArg(List<String> args) 

Source Link

Usage

From source file:com.google.gdt.eclipse.suite.launch.processors.PortArgumentProcessor.java

License:Open Source License

public void update(ILaunchConfigurationWorkingCopy launchConfig, IJavaProject javaProject,
        List<String> programArgs, List<String> vmArgs) throws CoreException {

    boolean isAuto = WebAppLaunchConfigurationWorkingCopy.getAutoPortSelection(launchConfig);
    String port = WebAppLaunchConfigurationWorkingCopy.getServerPort(launchConfig);

    PortParser parser = PortParser.parse(programArgs);

    int insertionIndex = parser.isPresent
            ? LaunchConfigurationProcessorUtilities.removeArgsAndReturnInsertionIndex(
                    programArgs, parser.portArgIndex, parser.portArgStyle.isPortASeparateArg)
            : 0;/*  ww  w.j  av a  2 s .c o m*/

    if (!NoServerArgumentProcessor.hasNoServerArg(programArgs)) {
        IProject project = javaProject.getProject();
        boolean isGwtProject = GWTNature.isGWTProject(project);
        boolean isGaeProject = GaeNature.isGaeProject(project);
        PortArgStyle portArgStyle = null;

        if (isGwtProject) {
            portArgStyle = PortArgStyle.GWT;
        } else if (isGaeProject) {
            // Prefer the style that existed in the args previously
            portArgStyle = parser.portArgStyle != null && parser.portArgStyle.isGae() ? parser.portArgStyle
                    : PortArgStyle.GAE_LONG;
        } else {
            // This processor is not applicable for the given project
            return;
        }

        List<String> portArgs = portArgStyle.getPortArgs(isAuto, port);
        if (portArgs != null) {
            programArgs.addAll(insertionIndex, portArgs);
        }
    }
}

From source file:com.google.gdt.eclipse.suite.launch.ui.tabs.WebAppServerTab.java

License:Open Source License

@Override
public void persistFromArguments(List<String> args, ILaunchConfigurationWorkingCopy config) {

    boolean runServer = false;
    try {/*from w w w.  j a  v  a  2 s . com*/
        runServer = LaunchConfigurationAttributeUtilities.getBoolean(config, WebAppLaunchAttributes.RUN_SERVER);
    } catch (CoreException e) {
        // ignored, just use false
    }

    PortParser portParser = PortParser.parse(args);
    WebAppLaunchConfigurationWorkingCopy.setAutoPortSelection(config,
            (!portParser.isPresent || portParser.isAuto) && runServer);

    if (portParser.isPresent && !portParser.isAuto) {
        WebAppLaunchConfigurationWorkingCopy.setServerPort(config, portParser.port);
    }

    boolean shouldRunServer = !NoServerArgumentProcessor.hasNoServerArg(args);
    WebAppLaunchConfigurationWorkingCopy.setRunServer(config, shouldRunServer);
}

From source file:com.google.gdt.eclipse.suite.launch.ui.WebAppServerTab.java

License:Open Source License

public void persistFromArguments(List<String> args, ILaunchConfigurationWorkingCopy config) {

    boolean runServer = false;
    try {/*from w  w  w . j  a  va2 s. c o m*/
        runServer = LaunchConfigurationAttributeUtilities.getBoolean(config, WebAppLaunchAttributes.RUN_SERVER);
    } catch (CoreException e) {
        // ignored, just use false
    }

    PortParser portParser = PortParser.parse(args);
    WebAppLaunchConfigurationWorkingCopy.setAutoPortSelection(config,
            (!portParser.isPresent || portParser.isAuto) && runServer);

    if (portParser.isPresent && !portParser.isAuto) {
        WebAppLaunchConfigurationWorkingCopy.setServerPort(config, portParser.port);
    }

    boolean shouldRunServer = !NoServerArgumentProcessor.hasNoServerArg(args);
    WebAppLaunchConfigurationWorkingCopy.setRunServer(config, shouldRunServer);
}

From source file:com.google.gdt.eclipse.suite.launch.WebAppLaunchDelegate.java

License:Open Source License

/**
 * Publish any {@link IModule}s that the project has if it is not using a
 * managed war directory and it is running a server.
 *///from   www.j  ava  2s.c o  m
public static void maybePublishModulesToWarDirectory(ILaunchConfiguration configuration,
        IProgressMonitor monitor, IJavaProject javaProject, boolean forceFullPublish)
        throws CoreException, IOException {

    if (javaProject == null) {
        // No Java Project
        return;
    }

    IProject project = javaProject.getProject();

    List<String> args = LaunchConfigurationProcessorUtilities.parseProgramArgs(configuration);
    if (WebAppUtilities.hasManagedWarOut(project) || NoServerArgumentProcessor.hasNoServerArg(args)) {
        // Project has a managed war directory or it is running in noserver
        // mode
        return;
    }

    WarParser parser = WarArgumentProcessor.WarParser.parse(args, javaProject);
    if (parser.resolvedUnverifiedWarDir == null) {
        // Invalid war directory
        return;
    }

    IModule[] modules = ServerUtil.getModules(project);
    if (modules.length > 0) {
        Path unmanagedWarPath = new Path(parser.resolvedUnverifiedWarDir);
        WtpPublisher.publishModulesToWarDirectory(project, modules, unmanagedWarPath, forceFullPublish,
                monitor);
    }
}