Search in sources :

Example 1 with Resolver

use of org.eclipse.jst.server.generic.internal.xml.Resolver in project webtools.servertools by eclipse.

the class ExternalServerBehaviour method setupStopLaunchConfiguration.

/**
 * Sets up the launch configuration for stopping the server.
 */
protected void setupStopLaunchConfiguration(GenericServerRuntime runtime, ILaunchConfigurationWorkingCopy wc) {
    clearDebuggingConfig();
    ServerRuntime serverDef = getServerDefinition();
    Resolver resolver = serverDef.getResolver();
    wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_WORKING_DIRECTORY, resolver.resolveProperties(serverDef.getStop().getWorkingDirectory()));
    String external = resolver.resolveProperties(getExternalForOS(serverDef.getStop().getExternal()));
    wc.setAttribute(ExternalLaunchConfigurationDelegate.COMMANDLINE, external);
    // just use commandline for now
    Map environVars = getEnvironmentVariables(getServerDefinition().getStop());
    if (!environVars.isEmpty()) {
        wc.setAttribute(ILaunchManager.ATTR_ENVIRONMENT_VARIABLES, environVars);
    }
    wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS, resolver.resolveProperties(serverDef.getStop().getProgramArgumentsAsString()));
    wc.setAttribute(ExternalLaunchConfigurationDelegate.EXECUTABLE_NAME, external);
    wc.setAttribute(ATTR_SERVER_ID, getServer().getId());
}
Also used : Resolver(org.eclipse.jst.server.generic.internal.xml.Resolver) ServerRuntime(org.eclipse.jst.server.generic.servertype.definition.ServerRuntime) Map(java.util.Map)

Example 2 with Resolver

use of org.eclipse.jst.server.generic.internal.xml.Resolver in project webtools.servertools by eclipse.

the class ExternalServerBehaviour method setupLaunchConfiguration.

/**
 * Override superclass method to correctly setup the launch configuration for starting an external
 * server.
 * @param workingCopy
 * @param monitor
 * @throws CoreException
 */
public void setupLaunchConfiguration(ILaunchConfigurationWorkingCopy workingCopy, IProgressMonitor monitor) throws CoreException {
    clearDebuggingConfig();
    ServerRuntime serverDef = getServerDefinition();
    Resolver resolver = serverDef.getResolver();
    workingCopy.setAttribute(IJavaLaunchConfigurationConstants.ATTR_WORKING_DIRECTORY, resolver.resolveProperties(serverDef.getStart().getWorkingDirectory()));
    String external = resolver.resolveProperties(getExternalForOS(serverDef.getStart().getExternal()));
    workingCopy.setAttribute(ExternalLaunchConfigurationDelegate.COMMANDLINE, external);
    workingCopy.setAttribute(ExternalLaunchConfigurationDelegate.DEBUG_PORT, resolver.resolveProperties(serverDef.getStart().getDebugPort()));
    workingCopy.setAttribute(ExternalLaunchConfigurationDelegate.HOST, getServer().getHost());
    // just use the commandline for now
    workingCopy.setAttribute(ExternalLaunchConfigurationDelegate.EXECUTABLE_NAME, external);
    Map environVars = getEnvironmentVariables(getServerDefinition().getStart());
    if (!environVars.isEmpty()) {
        workingCopy.setAttribute(ILaunchManager.ATTR_ENVIRONMENT_VARIABLES, environVars);
    }
    String existingProgArgs = workingCopy.getAttribute(IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS, (String) null);
    String serverProgArgs = getProgramArguments();
    if (existingProgArgs == null || existingProgArgs.indexOf(serverProgArgs) < 0) {
        workingCopy.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS, serverProgArgs);
    }
}
Also used : Resolver(org.eclipse.jst.server.generic.internal.xml.Resolver) ServerRuntime(org.eclipse.jst.server.generic.servertype.definition.ServerRuntime) Map(java.util.Map)

Aggregations

Map (java.util.Map)2 Resolver (org.eclipse.jst.server.generic.internal.xml.Resolver)2 ServerRuntime (org.eclipse.jst.server.generic.servertype.definition.ServerRuntime)2