Package org.eclipse.jdt.launching

Examples of org.eclipse.jdt.launching.IVMRunner


        String mainTypeName = verifyMainTypeName(configuration);

        IVMInstall vm = verifyVMInstall(configuration);

        IVMRunner runner = vm.getVMRunner(ILaunchManager.DEBUG_MODE); // we always run in debug mode
        if (runner == null) {
            abort(MessageFormat.format("JRE {0} does not support debug mode.", new String[] { vm.getName()}), null,
                    IJavaLaunchConfigurationConstants.ERR_VM_RUNNER_DOES_NOT_EXIST);
        }

        File workingDir = verifyWorkingDirectory(configuration);
        String workingDirName = null;
        if (workingDir != null) {
            workingDirName = workingDir.getAbsolutePath();
        }

        // Environment variables
        String[] envp = DebugPlugin.getDefault().getLaunchManager().getEnvironment(configuration);

        // Program & VM args (and set Prose path property)
        String pgmArgs = getProgramArguments(configuration);
        String vmArgs = getVMArguments(configuration);
        ExecutionArguments execArgs = new ExecutionArguments(vmArgs, pgmArgs);

        // VM-specific attributes
        Map vmAttributesMap = getVMSpecificAttributesMap(configuration);

        // Classpath
        String[] classpath = getClasspath(configuration);

        // Create VM config
        VMRunnerConfiguration runConfig = new VMRunnerConfiguration(mainTypeName, classpath);
        runConfig.setProgramArguments(execArgs.getProgramArgumentsArray());
        runConfig.setEnvironment(envp);
        runConfig.setVMArguments(execArgs.getVMArgumentsArray());
        runConfig.setWorkingDirectory(workingDirName);
        runConfig.setVMSpecificAttributesMap(vmAttributesMap);

        // Bootpath
        runConfig.setBootClassPath(getBootpath(configuration));

        // check for cancellation
        if (monitor.isCanceled()) { return; }

        // stop in main
        prepareStopInMain(configuration);

        // done the verification phase
        monitor.worked(1);

        monitor.subTask("Creating source locator...");
        // set the default source locator if required
        setDefaultSourceLocator(launch, configuration);
        monitor.worked(1);

        // Launch the configuration - 1 unit of work
        runner.run(runConfig, launch, monitor);

        // check for cancellation
        if (monitor.isCanceled()) { return; }

        if (configuration.getAttribute(ProseLaunchConfiguration.ATTR_LAUNCH_PROSE_SERVER, true))
View Full Code Here


    public void insertAspect(IType aspect, String address, boolean active, String txId) throws CoreException {
        IJavaProject project = aspect.getJavaProject();

        IVMInstall vmInstall = getVMInstall(project);
        if (vmInstall == null) return;
        IVMRunner vmRunner = vmInstall.getVMRunner(ILaunchManager.RUN_MODE);
        if (vmRunner == null) return;

        String[] classPath = computeClasspath(project);
        VMRunnerConfiguration vmConfig = new VMRunnerConfiguration(MAIN_CLASS, classPath);

        List args = new ArrayList();
        String path = ProsePlugin.getDefault().getProsePath();
        args.add("-Dch.ethz.inf.project.home=" + path);
        args.add("-Djava.security.policy=" + path + "testpolicy");
        args.add(getRmiCodebase(classPath));
        args.add("-Dprose.instance=" + (active? "activeInstance" : "testInstance"));
        args.add("-Dprose.address=" + address);
        args.add("-Dinsert=" + aspect.getFullyQualifiedName());
        if (txId != null) args.add("-DtxId=" + txId);
        vmConfig.setVMArguments((String[]) args.toArray(new String[] {}));

        ILaunch launch = new Launch(null, ILaunchManager.RUN_MODE, null);
        vmRunner.run(vmConfig, launch, null);
        DebugPlugin.getDefault().getLaunchManager().addLaunch(launch);
    }
View Full Code Here

        vmconfig.setEnvironment(getEnvironment(config));
        vmconfig.setProgramArguments(LaunchHelper.getProgramArgs(config));

        IVMInstall install = getVMInstall(config);

        IVMRunner runner = install.getVMRunner(mode);

        setDefaultSourceLocator(launch, config);

        SigilCore.log("VM=" + install.getName());
        SigilCore.log("Main=" + vmconfig.getClassToLaunch());
        SigilCore.log("VMArgs=" + Arrays.asList(vmconfig.getVMArguments()));
        SigilCore.log("Boot Classpath=" + Arrays.asList(vmconfig.getBootClassPath()));
        SigilCore.log("Classpath=" + Arrays.asList(vmconfig.getClassPath()));
        SigilCore.log("Args=" + Arrays.asList(vmconfig.getProgramArguments()));
        SigilCore.log("Working Dir=" + vmconfig.getWorkingDirectory());

        runner.run(vmconfig, launch, monitor);

        Client client = connect(config);

        BundleForm form = LaunchHelper.getBundleForm(config);
View Full Code Here

             .getBreakpoints(IDroolsDebugConstants.ID_DROOLS_DEBUG_MODEL);
    }

    public IVMRunner getVMRunner(ILaunchConfiguration configuration, String mode) throws CoreException {
        IVMInstall vm = verifyVMInstall(configuration);
        IVMRunner runner = new DroolsVMDebugger(vm);
        if (runner == null) {
            abort(MessageFormat.format(LaunchingMessages.JavaLocalApplicationLaunchConfigurationDelegate_0, vm.getName(), mode), null, IJavaLaunchConfigurationConstants.ERR_VM_RUNNER_DOES_NOT_EXIST);
        }
        return runner;
    }
View Full Code Here

             .getBreakpoints(IDroolsDebugConstants.ID_DROOLS_DEBUG_MODEL);
    }

    public IVMRunner getVMRunner(ILaunchConfiguration configuration, String mode) throws CoreException {
        IVMInstall vm = verifyVMInstall(configuration);
        IVMRunner runner = new DroolsVMDebugger(vm);
        if (runner == null) {
            abort(MessageFormat.format(LaunchingMessages.JavaLocalApplicationLaunchConfigurationDelegate_0, vm.getName(), mode), null, IJavaLaunchConfigurationConstants.ERR_VM_RUNNER_DOES_NOT_EXIST);
        }
        return runner;
    }
View Full Code Here


            MunitEclipseUpdater.launch();

            String mainTypeName = verifyMainTypeName(configuration);
            IVMRunner runner = getVMRunner(configuration, mode);

            File workingDir = verifyWorkingDirectory(configuration);
            String workingDirName = null;
            if (workingDir != null)
            {
                workingDirName = workingDir.getAbsolutePath();
            }

            String[] envp = getEnvironment(configuration);

            ArrayList vmArguments = new ArrayList();
            ArrayList programArguments = new ArrayList();
            programArguments.add("-resource");
            programArguments.add(configuration.getAttribute("resource", ""));
            programArguments.add("-path");
            programArguments.add(configuration.getAttribute("Mpath", ""));
            programArguments.add("-port");
            programArguments.add(String.valueOf(MunitEclipseUpdater.getInstance().getPort()));

            // VM-specific attributes
            Map vmAttributesMap = getVMSpecificAttributesMap(configuration);

            for (int i = 0; i < entries.length; i++)
            {
                IClasspathEntry entry = entries[i];
                if (entry.getEntryKind() == IClasspathEntry.CPE_SOURCE)
                {
                    IPath path = entry.getPath();
                    IFolder sourceFolder = root.getFolder(path);
                    if (!sourceFolder.getLocation().toString().contains("test/munit"))
                    {
                        try
                        {
                            IFolder folder = root.getFolder(entry.getOutputLocation());
                            for (IResource resource : folder.members())
                            {
                                try
                                {
                                    resource.copy(munitOutputFolder, IFolder.SHALLOW, monitor);
                                }
                                catch (Throwable e)
                                {

                                }
                            }

                        }
                        catch (Throwable y)
                        {

                        }

                    }

                }
            }
            String[] classpath = getClasspath(configuration);
            // ClasspathgetC
            List<String> classPathAsList = new ArrayList<String>(Arrays.asList(classpath));
            try
            {
                URL[] urlClasspath = new ClasspathProvider().getClassPath(getJavaProject(configuration));
                for (URL url : urlClasspath)
                {
                    classPathAsList.add(url.getFile());
                }
            }
            catch (MalformedURLException e)
            {
                e.printStackTrace();
            }


            // Create VM config
            VMRunnerConfiguration runConfig = new VMRunnerConfiguration("org.mule.munit.runner.remote.MunitRemoteRunner", classPathAsList.toArray(new String[] {}));
            runConfig.setVMArguments((String[]) vmArguments.toArray(new String[vmArguments.size()]));
            runConfig.setProgramArguments((String[]) programArguments.toArray(new String[programArguments.size()]));
            runConfig.setEnvironment(envp);
            runConfig.setWorkingDirectory(workingDirName);
            runConfig.setVMSpecificAttributesMap(vmAttributesMap);

            // Bootpath
            runConfig.setBootClassPath(getBootpath(configuration));


            // check for cancellation
            if (monitor.isCanceled())
            {
                return;
            }

            // done the verification phase
            monitor.worked(1);

            setDefaultSourceLocator(launch, configuration);
            monitor.worked(1);

            runner.run(runConfig, launch, monitor);


            if (monitor.isCanceled())
            {
                return;
View Full Code Here

    }
   
    monitor.subTask("Building configuration..."); //$NON-NLS-1$
           
    String mainTypeName = verifyMainTypeName(configuration);
    IVMRunner runner = getVMRunner(configuration, mode);

    File workingDir = verifyWorkingDirectory(configuration);
    String workingDirName = null;
    if (workingDir != null) {
      workingDirName = workingDir.getAbsolutePath();
    }
   
    // Environment variables
    String[] envp= getEnvironment(configuration);
   
    // Program & VM args
    String pgmArgs = getBehaviorLocator(configuration);
    String vmArgs = getVMArguments(configuration);
    ExecutionArguments execArgs = new ExecutionArguments(vmArgs, pgmArgs);
   
    // VM-specific attributes
    Map vmAttributesMap = getVMSpecificAttributesMap(configuration);
   
    // Classpath
    String[] classpath = getClasspath(configuration);
   
    // Create VM config
    VMRunnerConfiguration runConfig = new VMRunnerConfiguration(mainTypeName, classpath);
    runConfig.setProgramArguments(execArgs.getProgramArgumentsArray());
    runConfig.setEnvironment(envp);
    runConfig.setVMArguments(execArgs.getVMArgumentsArray());
    runConfig.setWorkingDirectory(workingDirName);
    runConfig.setVMSpecificAttributesMap(vmAttributesMap);

    // Bootpath
    runConfig.setBootClassPath(getBootpath(configuration));
   
    // check for cancellation
    if (monitor.isCanceled()) {
      return;
    }   
   
    // stop in main
    prepareStopInMain(configuration);
   
    // done the verification phase
    monitor.worked(1);
   
    monitor.subTask("Launching..."); //$NON-NLS-1$
    // set the default source locator if required
    setDefaultSourceLocator(launch, configuration);
    monitor.worked(1);   
   
    // Launch the configuration - 1 unit of work
    runner.run(runConfig, launch, monitor);
   
    // check for cancellation
    if (monitor.isCanceled()) {
      return;
   
View Full Code Here

 
  public void launch(ILaunchConfiguration configuration, String mode,
      ILaunch launch, IProgressMonitor monitor) throws CoreException {
   
    IVMInstall install = getVMInstall(configuration);
    IVMRunner runner = install.getVMRunner(launch.getLaunchMode());
    if (runner == null) {
      abort("VM not found", null, IJavaLaunchConfigurationConstants.ERR_VM_RUNNER_DOES_NOT_EXIST);
    }
   
    //int port= SocketUtil.findFreePort();
    VMRunnerConfiguration runConfig = launchTypes(configuration, mode);
    setDefaultSourceLocator(launch, configuration);
   
    runner.run(runConfig, launch, monitor);
  }
View Full Code Here

        throws CoreException {

        // Verify the configuration
        String mainTypeName = verifyMainTypeName(configuration);
        IVMInstall vm = verifyVMInstall(configuration);
        IVMRunner runner = vm.getVMRunner(mode);

        ExecutionArguments execArgs =
            new ExecutionArguments(getVMArguments(configuration), getProgramArguments(configuration));
        Map vmAttributesMap = getVMSpecificAttributesMap(configuration);
        String[] classpath = getClasspath(configuration);

        File workingDir = verifyWorkingDirectory(configuration);
        String workingDirName = null;
        if (workingDir != null)
            workingDirName = workingDir.getAbsolutePath();

        // Create a VM runner configuration
        VMRunnerConfiguration runConfig = new VMRunnerConfiguration(mainTypeName, classpath);
        runConfig.setProgramArguments(execArgs.getProgramArgumentsArray());
        runConfig.setVMArguments(execArgs.getVMArgumentsArray());
        runConfig.setVMSpecificAttributesMap(vmAttributesMap);
        runConfig.setWorkingDirectory(workingDirName);
        runConfig.setBootClassPath(getBootpath(configuration));

        // Run!!
        runner.run(runConfig, launch, monitor);
    }
View Full Code Here

        throws CoreException {

        // Verify the configuration
        String mainTypeName = verifyMainTypeName(configuration);
        IVMInstall vm = verifyVMInstall(configuration);
        IVMRunner runner = vm.getVMRunner(mode);

        ExecutionArguments execArgs =
            new ExecutionArguments(getVMArguments(configuration), getProgramArguments(configuration));
        Map vmAttributesMap = getVMSpecificAttributesMap(configuration);
        String[] classpath = getClasspath(configuration);

        File workingDir = verifyWorkingDirectory(configuration);
        String workingDirName = null;
        if (workingDir != null)
            workingDirName = workingDir.getAbsolutePath();

        // Create a VM runner configuration
        VMRunnerConfiguration runConfig = new VMRunnerConfiguration(mainTypeName, classpath);
        runConfig.setProgramArguments(execArgs.getProgramArgumentsArray());
        runConfig.setVMArguments(execArgs.getVMArgumentsArray());
        runConfig.setVMSpecificAttributesMap(vmAttributesMap);
        runConfig.setWorkingDirectory(workingDirName);
        runConfig.setBootClassPath(getBootpath(configuration));

        // Run!!
        runner.run(runConfig, launch, monitor);
    }
View Full Code Here

TOP

Related Classes of org.eclipse.jdt.launching.IVMRunner

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.