Search in sources :

Example 61 with ILaunchManager

use of org.eclipse.debug.core.ILaunchManager in project liferay-ide by liferay.

the class MavenProjectBuilder method _execMavenLaunch.

private boolean _execMavenLaunch(IProject project, String goal, IMavenProjectFacade facade, IProgressMonitor monitor) throws CoreException {
    ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
    ILaunchConfigurationType launchConfigurationType = launchManager.getLaunchConfigurationType(_launchConfigurationTypeId);
    IPath basedirLocation = project.getLocation();
    String newName = launchManager.generateLaunchConfigurationName(basedirLocation.lastSegment());
    ILaunchConfigurationWorkingCopy workingCopy = launchConfigurationType.newInstance(null, newName);
    workingCopy.setAttribute(IJavaLaunchConfigurationConstants.ATTR_VM_ARGUMENTS, "-Dmaven.multiModuleProjectDirectory");
    workingCopy.setAttribute(_attrPomDir, basedirLocation.toString());
    workingCopy.setAttribute(_attrGoals, goal);
    // workingCopy.setAttribute( ATTR_UPDATE_SNAPSHOTS, Boolean.TRUE );
    workingCopy.setAttribute(_attrWorkspaceResolution, Boolean.TRUE);
    workingCopy.setAttribute(_attrSkipTests, Boolean.TRUE);
    if (facade != null) {
        ResolverConfiguration configuration = facade.getResolverConfiguration();
        String selectedProfiles = configuration.getSelectedProfiles();
        if ((selectedProfiles != null) && (selectedProfiles.length() > 0)) {
            workingCopy.setAttribute(_attrProfiles, selectedProfiles);
        }
        new LaunchHelper().launch(workingCopy, "run", monitor);
        return true;
    } else {
        return false;
    }
}
Also used : ResolverConfiguration(org.eclipse.m2e.core.project.ResolverConfiguration) IPath(org.eclipse.core.runtime.IPath) ILaunchConfigurationType(org.eclipse.debug.core.ILaunchConfigurationType) LaunchHelper(com.liferay.ide.core.util.LaunchHelper) ILaunchManager(org.eclipse.debug.core.ILaunchManager) ILaunchConfigurationWorkingCopy(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)

Example 62 with ILaunchManager

use of org.eclipse.debug.core.ILaunchManager in project pivot by apache.

the class PivotApplicationLaunchShortcut method getExistingLaunchConfiguration.

private ILaunchConfiguration getExistingLaunchConfiguration(IType type) {
    ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
    ILaunchConfigurationType launchConfigurationType = launchManager.getLaunchConfigurationType(IJavaLaunchConfigurationConstants.ID_JAVA_APPLICATION);
    ILaunchConfiguration existingLaunchConfiguration = null;
    try {
        String applicationProjectName = type.getJavaProject().getElementName();
        String applicationTypeName = type.getFullyQualifiedName();
        ILaunchConfiguration[] launchConfigurations = DebugPlugin.getDefault().getLaunchManager().getLaunchConfigurations(launchConfigurationType);
        for (int i = 0; i < launchConfigurations.length; i++) {
            ILaunchConfiguration launchConfiguration = launchConfigurations[i];
            String mainTypeName = launchConfiguration.getAttribute(IJavaLaunchConfigurationConstants.ATTR_MAIN_TYPE_NAME, "");
            String projectName = launchConfiguration.getAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, "");
            String programArguments = launchConfiguration.getAttribute(IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS, "");
            if (mainTypeName.equals(PivotPlugin.MAIN_TYPE_NAME) && projectName.equals(applicationProjectName) && programArguments.equals(applicationTypeName)) {
                existingLaunchConfiguration = launchConfiguration;
                break;
            }
        }
    } catch (CoreException exception) {
        MessageDialog.openError(PivotPlugin.getActiveWorkbenchShell(), exception.getMessage(), exception.getStatus().getMessage());
    }
    return existingLaunchConfiguration;
}
Also used : ILaunchConfiguration(org.eclipse.debug.core.ILaunchConfiguration) CoreException(org.eclipse.core.runtime.CoreException) ILaunchConfigurationType(org.eclipse.debug.core.ILaunchConfigurationType) ILaunchManager(org.eclipse.debug.core.ILaunchManager)

Example 63 with ILaunchManager

use of org.eclipse.debug.core.ILaunchManager in project mdw-designer by CenturyLinkCloud.

the class WebLogicServerConfigurator method launchNewServerCreation.

@SuppressWarnings({ "deprecation", "rawtypes", "unchecked" })
public String launchNewServerCreation(Shell shell) {
    String serverHome = getServerSettings().getHome();
    ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager();
    ILaunchConfigurationType programType = manager.getLaunchConfigurationType(IExternalToolConstants.ID_PROGRAM_LAUNCH_CONFIGURATION_TYPE);
    try {
        ILaunchConfiguration cfg = programType.newInstance(null, "WebLogic Domain Config Wizard");
        ILaunchConfigurationWorkingCopy wc = cfg.getWorkingCopy();
        wc.setAttribute(IExternalToolConstants.ATTR_LOCATION, serverHome + "/common/bin/config.cmd");
        wc.setAttribute(IExternalToolConstants.ATTR_WORKING_DIRECTORY, serverHome + "/common/bin");
        Map envVars = new HashMap();
        envVars.put("MW_HOME", serverHome.substring(0, serverHome.lastIndexOf(System.getProperty("file.separator"))));
        wc.setAttribute("org.eclipse.debug.core.environmentVariables", envVars);
        cfg = wc.doSave();
        ILaunch launch = cfg.launch(ILaunchManager.RUN_MODE, null, false, false);
        StringBuilder errors = new StringBuilder("");
        for (IProcess process : launch.getProcesses()) errors.append(process.getStreamsProxy().getErrorStreamMonitor().getContents() + "\n");
        cfg.delete();
        if (errors.toString().trim().length() > 0)
            throw new IOException(errors.toString().trim());
        return null;
    } catch (Exception ex) {
        PluginMessages.uiError(shell, ex, "Create Domain", getServerSettings().getProject());
        return null;
    }
}
Also used : ILaunchConfiguration(org.eclipse.debug.core.ILaunchConfiguration) ILaunchConfigurationType(org.eclipse.debug.core.ILaunchConfigurationType) HashMap(java.util.HashMap) ILaunch(org.eclipse.debug.core.ILaunch) ILaunchManager(org.eclipse.debug.core.ILaunchManager) ILaunchConfigurationWorkingCopy(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy) IOException(java.io.IOException) HashMap(java.util.HashMap) Map(java.util.Map) IProcess(org.eclipse.debug.core.model.IProcess) CoreException(org.eclipse.core.runtime.CoreException) IOException(java.io.IOException) InvocationTargetException(java.lang.reflect.InvocationTargetException) ParserConfigurationException(javax.xml.parsers.ParserConfigurationException) SAXException(org.xml.sax.SAXException)

Example 64 with ILaunchManager

use of org.eclipse.debug.core.ILaunchManager in project iobserve-analysis by research-iobserve.

the class PerOpteryxLaunchConfigurationBuilder method getDefaultLaunchConfiguration.

/**
 * Returns a default launch configuration.
 *
 * @param projectModelDir
 *            The Peropteryx project dir in eclipse workspace
 * @param sourceModelDir
 *            The PCM model directory
 * @return The launch configuration
 * @throws CoreException
 *             when creating or saving the launch configuration fails
 */
public static ILaunchConfiguration getDefaultLaunchConfiguration(final String projectModelDir, final String sourceModelDir) throws CoreException {
    final Map<String, Object> attr = new HashMap<>();
    PerOpteryxLaunchConfigurationBuilder.setDefaultConfigFiles(projectModelDir, attr);
    PerOpteryxLaunchConfigurationBuilder.setDefaultGeneralOptions(attr);
    PerOpteryxLaunchConfigurationBuilder.setDefaultAnalysisOptions(attr);
    PerOpteryxLaunchConfigurationBuilder.setDefaultResourceOptions(attr);
    PerOpteryxLaunchConfigurationBuilder.setDefaultReliabilityOptions(attr);
    // setSimuComDefaultOptions(attr);
    PerOpteryxLaunchConfigurationBuilder.setLQNSDefaultOptions(attr, projectModelDir, sourceModelDir);
    PerOpteryxLaunchConfigurationBuilder.setDefaultTacticsOptions(attr);
    final ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
    final ILaunchConfigurationType launchConfigType = launchManager.getLaunchConfigurationType(PerOpteryxLaunchConfigurationBuilder.DSE_LAUNCH_TYPE_ID);
    final ILaunchConfigurationWorkingCopy workingCopy = launchConfigType.newInstance(null, PerOpteryxLaunchConfigurationBuilder.DEFAULT_LAUNCH_CONFIG_NAME);
    workingCopy.setAttributes(attr);
    final ILaunchConfiguration launchConfig = workingCopy.doSave();
    return launchConfig;
}
Also used : ILaunchConfiguration(org.eclipse.debug.core.ILaunchConfiguration) HashMap(java.util.HashMap) ILaunchConfigurationType(org.eclipse.debug.core.ILaunchConfigurationType) ILaunchManager(org.eclipse.debug.core.ILaunchManager) ILaunchConfigurationWorkingCopy(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)

Example 65 with ILaunchManager

use of org.eclipse.debug.core.ILaunchManager in project egit by eclipse.

the class LaunchFinder method findLaunch.

private static ILaunchConfiguration findLaunch(Set<IProject> projects, IProgressMonitor monitor) {
    ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
    ILaunch[] launches = launchManager.getLaunches();
    SubMonitor progress = SubMonitor.convert(monitor, UIText.LaunchFinder_SearchLaunchConfiguration, launches.length);
    for (ILaunch launch : launches) {
        if (progress.isCanceled()) {
            break;
        }
        if (launch.isTerminated()) {
            progress.worked(1);
            continue;
        }
        ISourceLocator locator = launch.getSourceLocator();
        if (locator instanceof ISourceLookupDirector) {
            ISourceLookupDirector director = (ISourceLookupDirector) locator;
            ISourceContainer[] containers = director.getSourceContainers();
            if (isAnyProjectInSourceContainers(containers, projects, progress.newChild(1))) {
                return launch.getLaunchConfiguration();
            }
        } else {
            progress.worked(1);
        }
    }
    return null;
}
Also used : ISourceLookupDirector(org.eclipse.debug.core.sourcelookup.ISourceLookupDirector) ILaunch(org.eclipse.debug.core.ILaunch) SubMonitor(org.eclipse.core.runtime.SubMonitor) ILaunchManager(org.eclipse.debug.core.ILaunchManager) ISourceContainer(org.eclipse.debug.core.sourcelookup.ISourceContainer) ISourceLocator(org.eclipse.debug.core.model.ISourceLocator)

Aggregations

ILaunchManager (org.eclipse.debug.core.ILaunchManager)78 ILaunchConfigurationType (org.eclipse.debug.core.ILaunchConfigurationType)53 ILaunchConfigurationWorkingCopy (org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)41 ILaunchConfiguration (org.eclipse.debug.core.ILaunchConfiguration)37 CoreException (org.eclipse.core.runtime.CoreException)28 ArrayList (java.util.ArrayList)15 ILaunch (org.eclipse.debug.core.ILaunch)14 IPath (org.eclipse.core.runtime.IPath)9 File (java.io.File)7 HashMap (java.util.HashMap)6 Path (org.eclipse.core.runtime.Path)6 IProject (org.eclipse.core.resources.IProject)5 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)5 IOException (java.io.IOException)4 Map (java.util.Map)4 IStatus (org.eclipse.core.runtime.IStatus)4 LinkedList (java.util.LinkedList)3 Status (org.eclipse.core.runtime.Status)3 IProcess (org.eclipse.debug.core.model.IProcess)3 IProcess2 (org.talend.core.model.process.IProcess2)3