Search in sources :

Example 26 with ILaunchConfigurationType

use of org.eclipse.debug.core.ILaunchConfigurationType in project webtools.servertools by eclipse.

the class ServerType method supportsLaunchMode.

/**
 * Returns true if this server can start or may already be started
 * in the given mode, and false if not. Uses the launchMode attribute,
 * which may contain the strings "run", "debug", and/or "profile".
 *
 * @param launchMode String
 * @return boolean
 */
public boolean supportsLaunchMode(String launchMode) {
    try {
        ILaunchConfigurationType configType = getLaunchConfigurationType();
        if (configType != null)
            return configType.supportsMode(launchMode);
        String mode = element.getAttribute("launchModes");
        if (mode == null)
            return false;
        return mode.indexOf(launchMode) >= 0;
    } catch (Exception e) {
        return false;
    }
}
Also used : ILaunchConfigurationType(org.eclipse.debug.core.ILaunchConfigurationType) CoreException(org.eclipse.core.runtime.CoreException)

Example 27 with ILaunchConfigurationType

use of org.eclipse.debug.core.ILaunchConfigurationType in project jbosstools-openshift by jbosstools.

the class ExternalLaunchUtil method findExternalToolsLaunchConfig.

public static ILaunchConfigurationWorkingCopy findExternalToolsLaunchConfig(IServer s, String launchName) throws CoreException {
    ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager();
    ILaunchConfigurationType type = manager.getLaunchConfigurationType(EXTERNAL_TOOLS);
    ILaunchConfiguration[] all = manager.getLaunchConfigurations(type);
    for (int i = 0; i < all.length; i++) {
        if (all[i].getName().equals(launchName)) {
            return all[i].getWorkingCopy();
        }
    }
    ILaunchConfigurationWorkingCopy wc = type.newInstance(null, launchName);
    return wc;
}
Also used : ILaunchConfiguration(org.eclipse.debug.core.ILaunchConfiguration) ILaunchConfigurationType(org.eclipse.debug.core.ILaunchConfigurationType) ILaunchManager(org.eclipse.debug.core.ILaunchManager) ILaunchConfigurationWorkingCopy(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)

Example 28 with ILaunchConfigurationType

use of org.eclipse.debug.core.ILaunchConfigurationType in project jbosstools-openshift by jbosstools.

the class DebugLaunchConfigs method getRemoteDebuggerLaunchConfiguration.

public ILaunchConfiguration getRemoteDebuggerLaunchConfiguration(IServer server) throws CoreException {
    ILaunchConfigurationType launchConfigurationType = launchManager.getLaunchConfigurationType(ID_REMOTE_JAVA_APPLICATION);
    ILaunchConfiguration[] launchConfigs = launchManager.getLaunchConfigurations(launchConfigurationType);
    String name = getRemoteDebuggerLaunchConfigurationName(server);
    Optional<ILaunchConfiguration> maybeLaunch = Stream.of(launchConfigs).filter(lc -> name.equals(lc.getName())).findFirst();
    return maybeLaunch.orElse(null);
}
Also used : MultiStatus(org.eclipse.core.runtime.MultiStatus) ID_REMOTE_JAVA_APPLICATION(org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants.ID_REMOTE_JAVA_APPLICATION) DebugPlugin(org.eclipse.debug.core.DebugPlugin) Collection(java.util.Collection) IServer(org.eclipse.wst.server.core.IServer) HashMap(java.util.HashMap) CoreException(org.eclipse.core.runtime.CoreException) OpenShiftCoreActivator(org.jboss.tools.openshift.internal.core.OpenShiftCoreActivator) ILaunchConfigurationWorkingCopy(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy) ILaunchConfigurationType(org.eclipse.debug.core.ILaunchConfigurationType) ILaunchManager(org.eclipse.debug.core.ILaunchManager) ArrayList(java.util.ArrayList) ILaunchConfiguration(org.eclipse.debug.core.ILaunchConfiguration) Objects(java.util.Objects) DebugException(org.eclipse.debug.core.DebugException) List(java.util.List) IStatus(org.eclipse.core.runtime.IStatus) Stream(java.util.stream.Stream) ILaunch(org.eclipse.debug.core.ILaunch) IProject(org.eclipse.core.resources.IProject) Map(java.util.Map) Optional(java.util.Optional) IJavaLaunchConfigurationConstants(org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants) ILaunchConfiguration(org.eclipse.debug.core.ILaunchConfiguration) ILaunchConfigurationType(org.eclipse.debug.core.ILaunchConfigurationType)

Example 29 with ILaunchConfigurationType

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

the class PivotApplicationLaunchShortcut method createLaunchConfiguration.

protected ILaunchConfiguration createLaunchConfiguration(IType type) {
    ILaunchConfiguration launchConfiguration = null;
    try {
        String applicationProjectName = type.getJavaProject().getElementName();
        String applicationTypeName = type.getFullyQualifiedName();
        ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
        ILaunchConfigurationType configurationType = launchManager.getLaunchConfigurationType(IJavaLaunchConfigurationConstants.ID_JAVA_APPLICATION);
        String name = launchManager.generateUniqueLaunchConfigurationNameFrom(type.getElementName());
        ILaunchConfigurationWorkingCopy workingLaunchConfiguration = configurationType.newInstance(null, name);
        workingLaunchConfiguration.setAttribute(IJavaLaunchConfigurationConstants.ATTR_MAIN_TYPE_NAME, PivotPlugin.MAIN_TYPE_NAME);
        workingLaunchConfiguration.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, applicationProjectName);
        workingLaunchConfiguration.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS, applicationTypeName);
        workingLaunchConfiguration.setMappedResources(new IResource[] { type.getUnderlyingResource() });
        launchConfiguration = workingLaunchConfiguration.doSave();
    } catch (CoreException exception) {
        MessageDialog.openError(PivotPlugin.getActiveWorkbenchShell(), exception.getMessage(), exception.getStatus().getMessage());
    }
    return launchConfiguration;
}
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) ILaunchConfigurationWorkingCopy(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)

Example 30 with ILaunchConfigurationType

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

the class PivotScriptApplicationLaunchShortcut method getExistingLaunchConfiguration.

private ILaunchConfiguration getExistingLaunchConfiguration(IFile file) {
    ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
    ILaunchConfigurationType launchConfigurationType = launchManager.getLaunchConfigurationType(IJavaLaunchConfigurationConstants.ID_JAVA_APPLICATION);
    ILaunchConfiguration existingLaunchConfiguration = null;
    try {
        String fileProjectName = file.getProject().getName();
        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(fileProjectName) && programArguments.equals(getProgramArguments(file))) {
                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)

Aggregations

ILaunchConfigurationType (org.eclipse.debug.core.ILaunchConfigurationType)86 ILaunchConfigurationWorkingCopy (org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)57 ILaunchManager (org.eclipse.debug.core.ILaunchManager)52 ILaunchConfiguration (org.eclipse.debug.core.ILaunchConfiguration)48 CoreException (org.eclipse.core.runtime.CoreException)41 ArrayList (java.util.ArrayList)20 IPath (org.eclipse.core.runtime.IPath)8 HashMap (java.util.HashMap)6 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)6 Path (org.eclipse.core.runtime.Path)6 ILaunch (org.eclipse.debug.core.ILaunch)6 File (java.io.File)5 Map (java.util.Map)5 IProject (org.eclipse.core.resources.IProject)5 List (java.util.List)4 IResource (org.eclipse.core.resources.IResource)4 IStatus (org.eclipse.core.runtime.IStatus)4 IOException (java.io.IOException)3 WorkflowProject (com.centurylink.mdw.plugin.project.model.WorkflowProject)2 LaunchHelper (com.liferay.ide.core.util.LaunchHelper)2