Search in sources :

Example 11 with ILaunchConfigurationType

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

the class MavenProjectRemoteServerPublisher 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(_attrUpdateSnapshots, 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 12 with ILaunchConfigurationType

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

the class JPAPostInstallFasetListener method buildConsoleConfiguration.

protected void buildConsoleConfiguration(IProject project, String platformId) {
    ILaunchManager lm = DebugPlugin.getDefault().getLaunchManager();
    ILaunchConfigurationType lct = LaunchHelper.getHibernateLaunchConfigsType();
    String launchName = lm.generateLaunchConfigurationName(project.getName());
    ILaunchConfigurationWorkingCopy wc;
    try {
        wc = lct.newInstance(null, launchName);
        wc.setAttribute(LaunchConfiguration.ATTR_MAPPED_RESOURCE_PATHS, Collections.singletonList(new Path(project.getName()).makeAbsolute().toString()));
        wc.setAttribute(LaunchConfiguration.ATTR_MAPPED_RESOURCE_TYPES, Collections.singletonList(Integer.toString(IResource.PROJECT)));
        wc.setAttribute(IConsoleConfigurationLaunchConstants.CONFIGURATION_FACTORY, ConfigurationMode.JPA.toString());
        wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, project.getName());
        wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_DEFAULT_CLASSPATH, true);
        wc.setAttribute(IConsoleConfigurationLaunchConstants.FILE_MAPPINGS, (List<String>) null);
        wc.setAttribute(IConsoleConfigurationLaunchConstants.USE_JPA_PROJECT_PROFILE, Boolean.toString(true));
        String hibernateVersion = lookupHibernateVersion(project);
        if (HibernateJpaPlatform.HIBERNATE2_1_PLATFORM_ID.equals(platformId)) {
            wc.setAttribute(IConsoleConfigurationLaunchConstants.PERSISTENCE_UNIT_NAME, getPersistenceUnitName(project));
        }
        if (hibernateVersion != null) {
            wc.setAttribute(IConsoleConfigurationLaunchConstants.HIBERNATE_VERSION, hibernateVersion);
        } else {
            if (HibernateJpaPlatform.HIBERNATE2_1_PLATFORM_ID.equals(platformId)) {
                // $NON-NLS-1$
                wc.setAttribute(IConsoleConfigurationLaunchConstants.HIBERNATE_VERSION, "4.3");
            } else if (HibernateJpaPlatform.HIBERNATE2_0_PLATFORM_ID.equals(platformId)) {
                // $NON-NLS-1$
                wc.setAttribute(IConsoleConfigurationLaunchConstants.HIBERNATE_VERSION, "4.0");
            } else {
                // $NON-NLS-1$
                wc.setAttribute(IConsoleConfigurationLaunchConstants.HIBERNATE_VERSION, "3.6");
            }
        }
        wc.doSave();
        ProjectUtils.toggleHibernateOnProject(project, true, launchName);
    } catch (CoreException e) {
        HibernateJptPlugin.logException(e);
    }
}
Also used : Path(org.eclipse.core.runtime.Path) 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 13 with ILaunchConfigurationType

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

the class PerOpteryxLaunchConfigurationBuilder method getDefaultLaunchConfiguration.

public static ILaunchConfiguration getDefaultLaunchConfiguration(final String projectModelDir, final String sourceModelDir) throws CoreException {
    final Map<String, Object> attr = new HashMap<>();
    setDefaultConfigFiles(projectModelDir, attr);
    setDefaultGeneralOptions(attr);
    setDefaultAnalysisOptions(attr);
    setDefaultResourceOptions(attr);
    setDefaultReliabilityOptions(attr);
    // setSimuComDefaultOptions(attr);
    setLQNSDefaultOptions(attr, projectModelDir, sourceModelDir);
    setDefaultTacticsOptions(attr);
    ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
    ILaunchConfigurationType launchConfigType = launchManager.getLaunchConfigurationType(DSE_LAUNCH_TYPE_ID);
    ILaunchConfigurationWorkingCopy workingCopy = launchConfigType.newInstance(null, DEFAULT_LAUNCH_CONFIG_NAME);
    workingCopy.setAttributes(attr);
    ILaunchConfiguration launchConfig = workingCopy.doSave();
    LOG.info("Using launch configuration with attributes: " + attr.toString());
    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 14 with ILaunchConfigurationType

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

the class AddConfigurationAction method createTemporaryLaunchConfiguration.

public static ILaunchConfiguration createTemporaryLaunchConfiguration() throws CoreException {
    ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
    ILaunchConfigurationType launchConfigurationType = LaunchHelper.getHibernateLaunchConfigsType();
    String launchName = launchManager.generateLaunchConfigurationName(HibernateConsoleMessages.AddConfigurationAction_hibernate);
    // ILaunchConfiguration[] launchConfigurations = launchManager.getLaunchConfigurations( launchConfigurationType );
    ILaunchConfigurationWorkingCopy wc = launchConfigurationType.newInstance(null, launchName);
    wc.setAttribute(TEMPORARY_CONFIG_FLAG, true);
    return wc.doSave();
}
Also used : ILaunchConfigurationType(org.eclipse.debug.core.ILaunchConfigurationType) ILaunchManager(org.eclipse.debug.core.ILaunchManager) ILaunchConfigurationWorkingCopy(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)

Example 15 with ILaunchConfigurationType

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

the class LaunchHelper method findLaunchConfigurationByName.

public static ILaunchConfiguration findLaunchConfigurationByName(String launchConfigurationTypeId, String name) throws CoreException {
    Assert.isNotNull(launchConfigurationTypeId, HibernateConsoleMessages.LaunchHelper_launch_cfg_type_cannot_be_null);
    ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
    ILaunchConfigurationType launchConfigurationType = launchManager.getLaunchConfigurationType(launchConfigurationTypeId);
    ILaunchConfiguration[] launchConfigurations = launchManager.getLaunchConfigurations(launchConfigurationType);
    for (int i = 0; i < launchConfigurations.length; i++) {
        // can't believe
        // there is no
        // look up by
        // name API
        ILaunchConfiguration launchConfiguration = launchConfigurations[i];
        if (launchConfiguration.getName().equals(name)) {
            return launchConfiguration;
        }
    }
    return null;
}
Also used : ILaunchConfiguration(org.eclipse.debug.core.ILaunchConfiguration) 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