Java 类org.eclipse.debug.core.Launch 实例源码

项目:eclemma    文件:SessionManagerTest.java   
@Test
public void testRemoveSessionsFor1() {
  ILaunch launch0 = new Launch(null, null, null);
  ILaunch launch1 = new Launch(null, null, null);
  ICoverageSession s0 = new DummySession();
  ICoverageSession s1 = new DummySession();
  manager.addSession(s0, false, launch0);
  manager.addSession(s1, true, launch1);
  listener.clear();

  manager.removeSessionsFor(launch1);

  assertEquals(Arrays.asList(s0), manager.getSessions());
  assertSame(s0, manager.getActiveSession());
  reflistener.sessionRemoved(s1);
  reflistener.sessionActivated(s0);
  assertEquals(reflistener, listener);
}
项目:eclemma    文件:SessionManagerTest.java   
@Test
public void testRemoveSessionsFor2() {
  ILaunch launch0 = new Launch(null, null, null);
  ILaunch launch1 = new Launch(null, null, null);
  ILaunch launch2 = new Launch(null, null, null);
  ICoverageSession s0 = new DummySession();
  ICoverageSession s1 = new DummySession();
  manager.addSession(s0, false, launch0);
  manager.addSession(s1, true, launch1);
  listener.clear();

  manager.removeSessionsFor(launch2);

  assertEquals(Arrays.asList(s0, s1), manager.getSessions());
  assertSame(s1, manager.getActiveSession());
  assertEquals(reflistener, listener);
}
项目:eclemma    文件:SessionManagerTest.java   
@Test
public void testRemoveSessionsFor3() {
  ILaunch launch0 = new Launch(null, null, null);
  ILaunch launch1 = new Launch(null, null, null);
  ICoverageSession s0 = new DummySession();
  ICoverageSession s1 = new DummySession();
  ICoverageSession s2 = new DummySession();
  manager.addSession(s0, true, launch0);
  manager.addSession(s1, true, launch1);
  manager.addSession(s2, true, launch1);
  listener.clear();

  manager.removeSessionsFor(launch1);

  assertEquals(Arrays.asList(s0), manager.getSessions());
  assertSame(s0, manager.getActiveSession());
  reflistener.sessionRemoved(s1);
  reflistener.sessionRemoved(s2);
  reflistener.sessionActivated(s0);
  assertEquals(reflistener, listener);
}
项目:thym    文件:ExternalProcessUtility.java   
/**
 * Executes the given command and returns a handle to the 
 * process. Should only be used if access to {@link IProcess}
 * instance is desired. 
 * 
 * @param command
 * @param workingDirectory
 * @param monitor
 * @param envp
 * @param launchConfiguration
 * @param outStreamListener
 * @param errorStreamListener
 * @return the process
 * @throws CoreException
 */
public IProcess exec(String[] command, File workingDirectory, IProgressMonitor monitor, 
        String[] envp, ILaunchConfiguration launchConfiguration, 
        IStreamListener outStreamListener, IStreamListener errorStreamListener ) throws CoreException{

    checkCommands(command);
    checkWorkingDirectory(workingDirectory);
    if(monitor == null ){
        monitor = new NullProgressMonitor();
    }
    if (envp == null && launchConfiguration != null ){
        envp = DebugPlugin.getDefault().getLaunchManager().getEnvironment(launchConfiguration);
    }
    if (monitor.isCanceled()) {
        return null;
    }
    Process process = DebugPlugin.exec(command, workingDirectory, envp);

    Map<String, String> processAttributes = generateProcessAttributes(command, launchConfiguration);
    Launch launch = new Launch(launchConfiguration, "run", null);
    IProcess prcs = DebugPlugin.newProcess(launch, process, command[0], processAttributes);
    setTracing(command, outStreamListener, errorStreamListener, prcs);
    DebugPlugin.getDefault().getLaunchManager().addLaunch(launch);
    return prcs;
}
项目:eclipse-weblogic-plugin    文件:WeblogicLauncher.java   
/**
 * @param label
 * @param classToLaunch
 * @param classpath
 * @param bootClasspath
 * @param vmArgs
 * @param prgArgs
 * @param workDir
 * @param sourceLocator
 * @param debug
 * @param showInDebugger
 * @throws CoreException
 */
public void runVM(final String label, final String classToLaunch, final String[] classpath, final String[] bootClasspath, final String[] vmArgs,
        final String[] prgArgs, final String workDir, final ISourceLocator sourceLocator, final boolean debug, final boolean showInDebugger)
        throws CoreException {
    final IVMInstall vmInstall = this.getVMInstall();
    String mode = ILaunchManager.DEBUG_MODE;
    if (debug && classToLaunch.equals(WEBLOGIC_MAIN_CLASS)) {
        mode = ILaunchManager.DEBUG_MODE;
    } else {
        mode = ILaunchManager.RUN_MODE;
    }
    final IVMRunner vmRunner = vmInstall.getVMRunner(mode);

    final ILaunchConfigurationType launchType = DebugPlugin.getDefault().getLaunchManager()
            .getLaunchConfigurationType(IJavaLaunchConfigurationConstants.ID_JAVA_APPLICATION);
    final ILaunchConfigurationWorkingCopy config = launchType.newInstance(null, label);
    config.setAttribute(IDebugUIConstants.ATTR_PRIVATE, true);
    config.setAttribute(ILaunchConfiguration.ATTR_SOURCE_LOCATOR_ID, "org.eclipse.jdt.launching.sourceLocator.JavaSourceLookupDirector");
    DebugUITools.setLaunchPerspective(launchType, mode, IDebugUIConstants.PERSPECTIVE_DEFAULT);
    final Launch launch = new Launch(config, mode, sourceLocator);

    config.doSave();
    if (vmRunner != null) {
        final VMRunnerConfiguration vmConfig = new VMRunnerConfiguration(classToLaunch, classpath);
        vmConfig.setVMArguments(vmArgs);
        vmConfig.setProgramArguments(prgArgs);
        if (workDir != null) {
            vmConfig.setWorkingDirectory(workDir);
        }
        if (bootClasspath.length == 0) {
            vmConfig.setBootClassPath(null);
        } else {
            vmConfig.setBootClassPath(bootClasspath);
        }
        vmRunner.run(vmConfig, launch, null);
    }
    if (showInDebugger) {
        DebugPlugin.getDefault().getLaunchManager().addLaunch(launch);
    }
}
项目:statecharts    文件:SCTSourceDisplayDispatcher.java   
protected SCTDebugTarget unwrapTarget(Object element) {
    if (element instanceof Launch) {
        IDebugTarget debugTarget = ((Launch) element).getDebugTarget();
        if (debugTarget instanceof SCTDebugTarget)
            return (SCTDebugTarget) debugTarget;
    } else if (element instanceof SCTDebugElement) {
        return (SCTDebugTarget) ((SCTDebugElement) element).getDebugTarget();
    }
    return null;

}
项目:testability-explorer    文件:TestabilityLauncher.java   
public ILaunch getLaunch(ILaunchConfiguration configuration, String mode) {
  if (TestabilityConstants.TESTABILITY.equals(mode)) {
    return new Launch(configuration, mode, null);
  } else {
    throw new IllegalStateException(
        "Cannot launch testability configuration when not in testability mode.");
  }
}
项目:Pydev    文件:PydevIProcessFactory.java   
/**
 * @param launch
 * @param process
 * @param clientPort
 * @param interpreter
 * @param frame
 * @param env
 * @param cmdLine
 */
public PydevConsoleLaunchInfo(Launch launch, Process process, int clientPort, IInterpreterInfo interpreter,
        PyStackFrame frame, String[] cmdLine, String[] env, String encoding) {
    this.launch = launch;
    this.process = process;
    this.clientPort = clientPort;
    this.interpreter = interpreter;
    this.frame = frame;
    this.cmdLine = cmdLine;
    this.env = env;
    this.encoding = encoding;
}
项目:Pydev    文件:PyUnitLaunch.java   
public static IPyUnitLaunch fromIO(String mode, String memento) {
    if (memento != null && mode != null) {
        try {
            ILaunchConfiguration launchConfiguration = DebugPlugin.getDefault().getLaunchManager()
                    .getLaunchConfiguration(memento);
            return new PyUnitLaunch(new Launch(launchConfiguration, mode, new PySourceLocator()),
                    launchConfiguration);
        } catch (Exception e) {
            Log.log(e);
        }
    }
    // Something went wrong or the info is not complete: create a launch that can't really be launched.
    return new PyUnitLaunch(null, null);
}
项目:brjs-JsTestDriver    文件:JsTestDriverLaunchConfigurationDelegate.java   
@Override
public ILaunch getLaunch(ILaunchConfiguration configuration, String mode) throws CoreException {
  if (ILaunchManager.RUN_MODE.equals(mode)) {
    return new Launch(configuration, mode, null);
  } else {
    throw new CoreException(new Status(IStatus.ERROR, Activator.PLUGIN_ID,
        "Can only launch JS Test Driver configuration from Run mode"));
  }
}
项目:APICloud-Studio    文件:ExternalWebServer.java   
/**
 * @param program
 * @param arguments
 * @param workingDirectory
 * @return created process
 * @throws CoreException
 */
private IProcess exec(String[] arguments, IPath workingDirectory) throws CoreException
{

    File workingDir = null;
    if (workingDirectory != null)
    {
        workingDir = workingDirectory.toFile();
        if (!workingDir.isDirectory())
        {
            workingDir = null;
        }
    }

    // FIXME Make a launch configuration? Doing this low-level stuff by hand is error-prone...
    Process p = DebugPlugin.exec(arguments, workingDir);
    IProcess process = null;
    if (p != null)
    {
        // Do a quick check to see if the execution immediately failed, meaning we probably have a busted command.
        try
        {
            int exitValue = p.exitValue();
            if (exitValue != 0)
            {
                throw new CoreException(ProcessUtil.processResult(p));
            }
        }
        catch (IllegalThreadStateException e)
        {
            // ignore
        }
        fLaunch = new Launch(null, ILaunchManager.RUN_MODE, null);
        fLaunch.setAttribute(DebugPlugin.ATTR_LAUNCH_TIMESTAMP, Long.toString(System.currentTimeMillis()));
        getLaunchManager().addLaunch(fLaunch);
        process = DebugPlugin.newProcess(fLaunch, p,
                MessageFormat.format("{0} - {1}", getType().getName(), getName())); //$NON-NLS-1$
        process.setAttribute(IProcess.ATTR_CMDLINE, renderCommandLine(arguments));

        if (fLaunchListener == null)
        {
            fLaunchListener = new LaunchListener();
        }
        getLaunchManager().addLaunchListener(fLaunchListener);
    }

    return process;
}
项目:goclipse    文件:LangLaunchConfigurationDelegate.java   
protected ILaunch getLaunchForRunMode(ILaunchConfiguration configuration, String mode) throws CoreException {
    return new Launch(configuration, mode, null);
}