Examples of ILaunchConfigurationWorkingCopy


Examples of org.eclipse.debug.core.ILaunchConfigurationWorkingCopy

    }
    else {
      mode = ILaunchManager.RUN_MODE;
    }

    ILaunchConfigurationWorkingCopy config = createConfig(label, vmInstall, classToLaunch, classpath, bootClasspath, vmArgs, prgArgs, debug, showInDebugger, saveConfig);

    return config.launch(mode, null);
  }
View Full Code Here

Examples of org.eclipse.debug.core.ILaunchConfigurationWorkingCopy

   private static ILaunchConfigurationWorkingCopy createConfig(String label, IVMInstall vmInstall, String classToLaunch, List<IPath> classpath, String[] bootClasspath, String vmArgs, String prgArgs, boolean debug, boolean showInDebugger, boolean saveConfig) throws CoreException {
    ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager();
    ILaunchConfigurationType launchType = manager.getLaunchConfigurationType(IJavaLaunchConfigurationConstants.ID_JAVA_APPLICATION);
   
    ILaunchConfigurationWorkingCopy config = launchType.newInstance(null, label);
    config.setAttribute(IJavaLaunchConfigurationConstants.ATTR_JRE_CONTAINER_PATH, JavaRuntime.newJREContainerPath(vmInstall).toString());
   
    config.setAttribute(IDebugUIConstants.ATTR_PRIVATE, true);
    config.setAttribute(ILaunchConfiguration.ATTR_SOURCE_LOCATOR_ID, "org.eclipse.jdt.launching.sourceLocator.JavaSourceLookupDirector");
   
   
    ISourceLookupDirector locator = (ISourceLookupDirector) getSourceLocator(config, false);
    config.setAttribute(ILaunchConfiguration.ATTR_SOURCE_LOCATOR_MEMENTO, locator.getMemento());
   
    List<String> classpathMementos = new ArrayList<String>();
   
    Iterator<IPath> classPathEntries = classpath.iterator();
    while (classPathEntries.hasNext()) {
      IPath cpPath = classPathEntries.next();
      IRuntimeClasspathEntry cpEntry = JavaRuntime.newArchiveRuntimeClasspathEntry(cpPath);   
      cpEntry.setClasspathProperty(IRuntimeClasspathEntry.USER_CLASSES);
      classpathMementos.add(cpEntry.getMemento());
    }
   
    if (bootClasspath.length == 0) {   
      IPath systemLibsPath = new Path(JavaRuntime.JRE_CONTAINER);
      IRuntimeClasspathEntry systemLibsEntry = JavaRuntime.newRuntimeContainerClasspathEntry(systemLibsPath,IRuntimeClasspathEntry.STANDARD_CLASSES);
      classpathMementos.add(systemLibsEntry.getMemento());
    } else {
      for (int i = 0; i < bootClasspath.length; i++) {
        IRuntimeClasspathEntry cpEntry = JavaRuntime.newArchiveRuntimeClasspathEntry(new Path(bootClasspath[i]));
        cpEntry.setClasspathProperty(IRuntimeClasspathEntry.BOOTSTRAP_CLASSES);
        classpathMementos.add(cpEntry.getMemento());
      }
    }

    config.setAttribute(IJavaLaunchConfigurationConstants.ATTR_DEFAULT_CLASSPATH, false);
    config.setAttribute(IJavaLaunchConfigurationConstants.ATTR_CLASSPATH, classpathMementos);
    config.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS, prgArgs);
    config.setAttribute(IJavaLaunchConfigurationConstants.ATTR_VM_ARGUMENTS, vmArgs);
    config.setAttribute(IJavaLaunchConfigurationConstants.ATTR_MAIN_TYPE_NAME, classToLaunch);

    /*
    if(saveConfig) {
      getSourceLocator(config, false);
      config.doSave();
View Full Code Here

Examples of org.eclipse.debug.core.ILaunchConfigurationWorkingCopy

     * @param type Type for which a new configuration is created
     * @return New configuration
     */
    protected ILaunchConfiguration createConfiguration(IType type) {
        ILaunchConfiguration config = null;
        ILaunchConfigurationWorkingCopy wc = null;
        try {
            ILaunchConfigurationType configType = getProseLaunchConfigType();
            wc = configType.newInstance(null, getLaunchManager().generateUniqueLaunchConfigurationNameFrom(type.getElementName()));
        } catch (CoreException exception) {
            reportCreatingConfiguration(exception);
            return null;
        }
        wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_MAIN_TYPE_NAME, type.getFullyQualifiedName());
        wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, type.getJavaProject().getElementName());
        wc.setAttribute(ProseLaunchConfiguration.ATTR_LAUNCH_PROSE_SERVER, true);
        try {
            config = wc.doSave();
        } catch (CoreException exception) {
            reportCreatingConfiguration(exception);
        }
        return config;
    }
View Full Code Here

Examples of org.eclipse.debug.core.ILaunchConfigurationWorkingCopy

    protected void launch(IPath targetPath, String mode) {
        IPath tp = targetPath.makeRelative();
        try {
            ILaunchConfiguration config = findLaunchConfig(tp);
            if (config == null) {
                ILaunchConfigurationWorkingCopy wc = createConfiguration(tp);
                config = wc.doSave();
            }
            DebugUITools.launch(config, mode);
        } catch (Exception e) {
            e.printStackTrace();
        }
View Full Code Here

Examples of org.eclipse.debug.core.ILaunchConfigurationWorkingCopy

    protected ILaunchConfigurationWorkingCopy createConfiguration(IPath targetPath) throws CoreException {
        ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager();
        ILaunchConfigurationType configType = manager.getLaunchConfigurationType(launchId);

        ILaunchConfigurationWorkingCopy wc;
        wc = configType.newInstance(null, manager.generateUniqueLaunchConfigurationNameFrom(targetPath.lastSegment()));
        wc.setAttribute(LaunchConstants.ATTR_LAUNCH_TARGET, targetPath.toString());
        wc.setAttribute(LaunchConstants.ATTR_CLEAN, LaunchConstants.DEFAULT_CLEAN);
        wc.setAttribute(LaunchConstants.ATTR_DYNAMIC_BUNDLES, LaunchConstants.DEFAULT_DYNAMIC_BUNDLES);

        IResource targetResource = ResourcesPlugin.getWorkspace().getRoot().findMember(targetPath);
        if (targetResource != null && targetResource.exists()) {
            wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, LaunchUtils.getLaunchProjectName(targetResource));
        }

        return wc;
    }
View Full Code Here

Examples of org.eclipse.debug.core.ILaunchConfigurationWorkingCopy

    }
  }

  public void setRunConfVmArgs(final ILaunchConfiguration conf, final String vmargs) throws CoreException
  {
    ILaunchConfigurationWorkingCopy confWc = conf.getWorkingCopy();
    confWc.setAttribute(JunitLaunchListener.VM_ARGS, vmargs);
    confWc.doSave();
  }
View Full Code Here

Examples of org.eclipse.debug.core.ILaunchConfigurationWorkingCopy

    protected void launchJavaElement(IJavaElement element, String mode) throws CoreException {
        IPath projectPath = element.getJavaProject().getProject().getFullPath().makeRelative();

        ILaunchConfiguration config = findLaunchConfig(projectPath);
        if (config == null) {
            ILaunchConfigurationWorkingCopy wc = createConfiguration(projectPath);
            wc.doSave();

            customise(element, wc);
            config = wc;
        } else {
            ILaunchConfigurationWorkingCopy wc = config.getWorkingCopy();
            customise(element, wc);
            config = wc;
        }
        DebugUITools.launch(config, mode);
    }
View Full Code Here

Examples of org.eclipse.debug.core.ILaunchConfigurationWorkingCopy

    protected void launch(IPath targetPath, String mode) {
        IPath tp = targetPath.makeRelative();
        try {
            ILaunchConfiguration config = findLaunchConfig(tp);
            if (config == null) {
                ILaunchConfigurationWorkingCopy wc = createConfiguration(tp);
                config = wc.doSave();
            }
            DebugUITools.launch(config, mode);
        } catch (Exception e) {
            e.printStackTrace();
        }
View Full Code Here

Examples of org.eclipse.debug.core.ILaunchConfigurationWorkingCopy

    protected ILaunchConfigurationWorkingCopy createConfiguration(IPath targetPath) throws CoreException {
        ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager();
        ILaunchConfigurationType configType = manager.getLaunchConfigurationType(launchId);

        ILaunchConfigurationWorkingCopy wc;
        wc = configType.newInstance(null, manager.generateLaunchConfigurationName(targetPath.lastSegment()));
        wc.setAttribute(LaunchConstants.ATTR_LAUNCH_TARGET, targetPath.toString());
        wc.setAttribute(LaunchConstants.ATTR_CLEAN, LaunchConstants.DEFAULT_CLEAN);
        wc.setAttribute(LaunchConstants.ATTR_DYNAMIC_BUNDLES, LaunchConstants.DEFAULT_DYNAMIC_BUNDLES);

        IResource targetResource = ResourcesPlugin.getWorkspace().getRoot().findMember(targetPath);
        if (targetResource != null && targetResource.exists()) {
            wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, LaunchUtils.getLaunchProjectName(targetResource));
        }

        return wc;
    }
View Full Code Here

Examples of org.eclipse.debug.core.ILaunchConfigurationWorkingCopy

        type = configType[i];
      }
    }
    try {
      if (type != null) {
        ILaunchConfigurationWorkingCopy wc = type.newInstance(null,
            getLaunchManager()
                .generateUniqueLaunchConfigurationNameFrom(
                    file.getName()));
        wc.setAttribute(
            PerlLaunchConfigurationConstants.ATTR_STARTUP_FILE,
            projectName);
        wc.setAttribute(
            PerlLaunchConfigurationConstants.ATTR_PROJECT_NAME,
            file.getProject().getName());
        wc.setAttribute(
            PerlLaunchConfigurationConstants.ATTR_WORKING_DIRECTORY,
            (String) null);
        config = wc.doSave();
      }
    } catch (CoreException e) {
      PerlDebugPlugin.log(e);
    }
    return config;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.