Search in sources :

Example 56 with ILaunchConfigurationWorkingCopy

use of org.eclipse.debug.core.ILaunchConfigurationWorkingCopy in project ow by vtst.

the class LessCompilerLaunchShortcut method adaptLaunchConfiguration.

protected ILaunchConfiguration adaptLaunchConfiguration(ILaunchConfiguration config, IFile selectedFile, String mode) throws CoreException {
    if (selectedFile.equals(configHelper.inputFile.getFileValue(config)))
        return config;
    ILaunchConfigurationWorkingCopy configwc = castILaunchConfigurationWorkingCopy(config);
    configHelper.inputFile.setFileValue(configwc, selectedFile);
    configHelper.outputFile.setValue(configwc, configHelper.getAutoOutputFile(configwc));
    return configwc;
}
Also used : ILaunchConfigurationWorkingCopy(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)

Example 57 with ILaunchConfigurationWorkingCopy

use of org.eclipse.debug.core.ILaunchConfigurationWorkingCopy in project generator by mybatis.

the class GeneratorLaunchShortcut method createConfiguration.

private ILaunchConfiguration createConfiguration(IFile file) throws CoreException {
    ILaunchConfigurationType configType = getLaunchConfigurationType();
    String variableExpression = VariablesPlugin.getDefault().getStringVariableManager().generateVariableExpression("workspace_loc", //$NON-NLS-1$
    file.getFullPath().toPortableString());
    //$NON-NLS-1$
    String namePrefix = String.format("%s-%s", file.getProject().getName(), file.getName());
    ILaunchConfigurationWorkingCopy wc = configType.newInstance(null, getLaunchManager().generateLaunchConfigurationName(namePrefix));
    wc.setAttribute(GeneratorLaunchConstants.ATTR_CONFIGURATION_FILE_NAME, variableExpression);
    wc.setMappedResources(new IResource[] { file.getProject() });
    wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, getJavaProjectNameFromResource(file));
    ILaunchConfiguration config = wc.doSave();
    return config;
}
Also used : ILaunchConfiguration(org.eclipse.debug.core.ILaunchConfiguration) ILaunchConfigurationType(org.eclipse.debug.core.ILaunchConfigurationType) ILaunchConfigurationWorkingCopy(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)

Example 58 with ILaunchConfigurationWorkingCopy

use of org.eclipse.debug.core.ILaunchConfigurationWorkingCopy in project tdi-studio-se by Talend.

the class JobLaunchShortcutManager method renameJobLaunch.

/**
     * 
     * cli Comment method "renameJobLaunch".
     */
public static void renameJobLaunch(IRepositoryViewObject obj, String oldLabel) {
    if (obj == null) {
        return;
    }
    Property property = obj.getProperty();
    if (property == null || !(property.getItem() instanceof ProcessItem)) {
        return;
    }
    String newLabel = property.getLabel();
    if (!newLabel.equals(oldLabel)) {
        Project project = ProjectManager.getInstance().getProject(property);
        if (project == null) {
            return;
        }
        final String objProjectName = project.getLabel();
        final String id = property.getId();
        final String version = property.getVersion();
        ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
        if (launchManager == null) {
            return;
        }
        try {
            for (ILaunchConfiguration configuration : launchManager.getLaunchConfigurations()) {
                String jobId = configuration.getAttribute(TalendDebugUIConstants.JOB_ID, (String) null);
                String jobVersion = configuration.getAttribute(TalendDebugUIConstants.JOB_VERSION, (String) null);
                String projectName = configuration.getAttribute(TalendDebugUIConstants.CURRENT_PROJECT_NAME, (String) null);
                // ILaunchConfigurationType type = launchManager
                // .getLaunchConfigurationType(TalendDebugUIConstants.JOB_DEBUG_LAUNCH_CONFIGURATION_TYPE);
                ILaunchConfigurationType type = configuration.getType();
                if (type != null && TalendDebugUIConstants.JOB_DEBUG_LAUNCH_CONFIGURATION_TYPE.equals(type.getIdentifier()) && objProjectName.equals(projectName) && id.equals(jobId) && version.equals(jobVersion) && type != null) {
                    //$NON-NLS-1$
                    String displayName = newLabel + " " + jobVersion;
                    ILaunchConfigurationWorkingCopy workingCopy = configuration.getWorkingCopy();
                    workingCopy.setAttribute(TalendDebugUIConstants.JOB_NAME, newLabel);
                    // workingCopy.setAttribute(TalendDebugUIConstants.JOB_ID, jobId);
                    // update to new version
                    workingCopy.setAttribute(TalendDebugUIConstants.JOB_VERSION, jobVersion);
                    // workingCopy.setAttribute(TalendDebugUIConstants.CURRENT_PROJECT_NAME, projectName);
                    workingCopy.rename(displayName);
                    workingCopy.doSave();
                    break;
                }
            }
            clearUnusedLaunchs();
        } catch (CoreException e) {
        // nothing to do
        }
    }
}
Also used : Project(org.talend.core.model.properties.Project) ILaunchConfiguration(org.eclipse.debug.core.ILaunchConfiguration) ProcessItem(org.talend.core.model.properties.ProcessItem) CoreException(org.eclipse.core.runtime.CoreException) ILaunchConfigurationType(org.eclipse.debug.core.ILaunchConfigurationType) ILaunchManager(org.eclipse.debug.core.ILaunchManager) ILaunchConfigurationWorkingCopy(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy) Property(org.talend.core.model.properties.Property)

Example 59 with ILaunchConfigurationWorkingCopy

use of org.eclipse.debug.core.ILaunchConfigurationWorkingCopy in project tdi-studio-se by Talend.

the class JavaProcessor method saveLaunchConfiguration.

/*
     * (non-Javadoc)
     * 
     * @see org.talend.designer.runprocess.IProcessor#saveLaunchConfiguration()
     */
@Override
public Object saveLaunchConfiguration() throws CoreException {
    /*
         * When launch debug progress, just share all libraries between farther job and child jobs
         */
    // computeLibrariesPath(this.getProcess().getNeededLibraries(true));
    ILaunchConfiguration config = null;
    ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
    String projectName = this.getCodeProject().getName();
    ILaunchConfigurationType type = launchManager.getLaunchConfigurationType(IJavaLaunchConfigurationConstants.ID_JAVA_APPLICATION);
    if (type != null) {
        ILaunchConfigurationWorkingCopy wc = type.newInstance(null, launchManager.generateUniqueLaunchConfigurationNameFrom(this.getCodePath().lastSegment()));
        wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, projectName);
        wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_MAIN_TYPE_NAME, this.getMainClass());
        wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_STOP_IN_MAIN, true);
        wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS, CTX_ARG + context.getName());
        config = wc.doSave();
    }
    return config;
}
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 60 with ILaunchConfigurationWorkingCopy

use of org.eclipse.debug.core.ILaunchConfigurationWorkingCopy in project tdi-studio-se by Talend.

the class JavaProcessor method saveLaunchConfigurationWithParam.

// generate the ILaunchConfiguration with the parameter string.
@Override
public Object saveLaunchConfigurationWithParam(String parameterStr) throws CoreException {
    /*
         * When launch debug progress, just share all libraries between farther job and child jobs
         */
    // computeLibrariesPath(this.getProcess().getNeededLibraries(true));
    ILaunchConfiguration config = null;
    ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
    String projectName = this.getCodeProject().getName();
    ILaunchConfigurationType type = launchManager.getLaunchConfigurationType(IJavaLaunchConfigurationConstants.ID_JAVA_APPLICATION);
    if (type != null) {
        ILaunchConfigurationWorkingCopy wc = type.newInstance(null, launchManager.generateUniqueLaunchConfigurationNameFrom(this.getCodePath().lastSegment()));
        wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, projectName);
        wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_MAIN_TYPE_NAME, this.getMainClass());
        wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_STOP_IN_MAIN, true);
        wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS, CTX_ARG + context.getName() + parameterStr);
        config = wc.doSave();
    }
    return config;
}
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)

Aggregations

ILaunchConfigurationWorkingCopy (org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)119 Test (org.junit.Test)75 ILaunch (org.eclipse.debug.core.ILaunch)52 IProcess (org.eclipse.debug.core.model.IProcess)49 ILaunchConfiguration (org.eclipse.debug.core.ILaunchConfiguration)29 ILaunchConfigurationType (org.eclipse.debug.core.ILaunchConfigurationType)18 CoreException (org.eclipse.core.runtime.CoreException)16 IPath (org.eclipse.core.runtime.IPath)12 ILaunchManager (org.eclipse.debug.core.ILaunchManager)10 AbstractTest (org.eclipse.linuxtools.profiling.tests.AbstractTest)8 IProject (org.eclipse.core.resources.IProject)7 Shell (org.eclipse.swt.widgets.Shell)7 ArrayList (java.util.ArrayList)6 Path (org.eclipse.core.runtime.Path)6 ILaunchConfigurationTab (org.eclipse.debug.ui.ILaunchConfigurationTab)5 Version (org.osgi.framework.Version)5 IResource (org.eclipse.core.resources.IResource)4 Launch (org.eclipse.debug.core.Launch)3 MassifViewPart (org.eclipse.linuxtools.internal.valgrind.massif.MassifViewPart)3 Button (org.eclipse.swt.widgets.Button)3