Java Code Examples for org.eclipse.debug.core.ILaunchConfigurationWorkingCopy#setAttribute()

The following examples show how to use org.eclipse.debug.core.ILaunchConfigurationWorkingCopy#setAttribute() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TestabilityLaunchConfigurationTab.java    From testability-explorer with Apache License 2.0 6 votes vote down vote up
public void setDefaults(ILaunchConfigurationWorkingCopy configuration) {
  configuration.setAttribute(TestabilityConstants.CONFIGURATION_ATTR_PROJECT_NAME, "");
  configuration.setAttribute(TestabilityConstants.CONFIGURATION_ATTR_REPORT_FOLDER_NAME, "");
  configuration.setAttribute(TestabilityConstants.CONFIGURATION_ATTR_CYCLOMATIC_COST,
      TestabilityConstants.CYCLOMATIC_COST);
  configuration.setAttribute(TestabilityConstants.CONFIGURATION_ATTR_GLOBAL_STATE_COST,
      TestabilityConstants.GLOBAL_STATE_COST);
  configuration.setAttribute(TestabilityConstants.CONFIGURATION_ATTR_MAX_EXCELLENT_COST,
      TestabilityConstants.MAX_EXCELLENT_COST);
  configuration.setAttribute(TestabilityConstants.CONFIGURATION_ATTR_MAX_ACCEPTABLE_COST,
      TestabilityConstants.MAX_ACCEPTABLE_COST);
  configuration.setAttribute(TestabilityConstants.CONFIGURATION_ATTR_MAX_CLASSES_IN_REPORT,
      TestabilityConstants.MAX_CLASSES_TO_SHOW_IN_ISSUES_REPORTER);
  configuration.setAttribute(TestabilityConstants.CONFIGURATION_ATTR_WHITELIST,
      TestabilityConstants.WHITELIST);
  configuration.setAttribute(TestabilityConstants.CONFIGURATION_ATTR_RUN_ON_BUILD,
      false);
}
 
Example 2
Source File: LaunchShortcut.java    From xds-ide with Eclipse Public License 1.0 6 votes vote down vote up
private ILaunchConfiguration createConfiguration(IProject iProject) {
	ILaunchConfiguration config = null;
	try {
	    XdsProjectConfiguration xdsProjectSettings = new XdsProjectConfiguration(iProject);
		
		ILaunchConfigurationType configType = getConfigurationType(LAUNCH_CONFIG_TYPE_ID);		
		ILaunchConfigurationWorkingCopy wc = configType.newInstance(null, 
				DebugPlugin.getDefault().getLaunchManager().generateLaunchConfigurationName(iProject.getName())); 
		wc.setAttribute(ILaunchConfigConst.ATTR_PROJECT_NAME, iProject.getName());
		wc.setAttribute(ILaunchConfigConst.ATTR_EXECUTABLE_PATH, xdsProjectSettings.getExePath());
           wc.setAttribute(ILaunchConfigConst.ATTR_PROGRAM_ARGUMENTS, StringUtils.EMPTY);
           wc.setAttribute(ILaunchConfigConst.ATTR_DEBUGGER_ARGUMENTS, StringUtils.EMPTY);
           wc.setAttribute(ILaunchConfigConst.ATTR_SIMULATOR_ARGUMENTS, StringUtils.EMPTY);
		if (TextEncoding.isCodepageSupported(EncodingUtils.DOS_ENCODING)) {
   			wc.setAttribute(DebugPlugin.ATTR_CONSOLE_ENCODING, EncodingUtils.DOS_ENCODING);
		} 
        
		wc.setMappedResources(new IResource[] {iProject});
		config = wc.doSave();		
	} catch (CoreException e) {
		MessageDialog.openError(getShell(), Messages.Common_Error, Messages.LaunchShortcut_CantCreateLaunchCfg + ": " + e); //$NON-NLS-1$
	}
	return config;
}
 
Example 3
Source File: GenerateUml2SolidityCodeConfigurationTab.java    From uml2solidity with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public void performApply(ILaunchConfigurationWorkingCopy configuration) {
	configuration.setAttribute(GenerateUml2Solidity.MODEL_URI, modelText.getText());
	configuration.setAttribute(CONTRACT_FILE_HEADER, fileHeaderText.getText());
	configuration.setAttribute(GENERATE_MIX, btnGenerateMixConfig.getSelection());
	configuration.setAttribute(GENERATE_HTML, btnGenerateMixHtml.getSelection());
	configuration.setAttribute(GENERATE_CONTRACT_FILES, btnGenerateSolidityCode.getSelection());
	configuration.setAttribute(GENERATION_TARGET, generationDirectoryText.getText());
	configuration.setAttribute(CONTRACT_FILE_HEADER, fileHeaderText.getText());

	configuration.setAttribute(ENABLE_VERSION, btnVersionAbove.getSelection());
	configuration.setAttribute(VERSION_PRAGMA, versionText.getText());
	
	configuration.setAttribute(COMPILE_CONTRACTS, btnCompile.getSelection());
	configuration.setAttribute(COMPILER_PROGRAMM, compiler_text.getText());
	configuration.setAttribute(COMPILER_TARGET, compiler_out_text.getText());
	
	for (Entry<String, Button> e : compileOptions.entrySet()) {
		configuration.setAttribute(e.getKey(), e.getValue().getSelection());
	}

}
 
Example 4
Source File: TypeScriptCompilerLaunchHelper.java    From typescript.java with MIT License 5 votes vote down vote up
public static void launch(IFile tsconfigFile, String mode) {
	ILaunchConfigurationType tscLaunchConfigurationType = DebugPlugin.getDefault().getLaunchManager()
			.getLaunchConfigurationType(TypeScriptCompilerLaunchConstants.LAUNCH_CONFIGURATION_ID);
	try {
		// Check if configuration already exists
		ILaunchConfiguration[] configurations = DebugPlugin.getDefault().getLaunchManager()
				.getLaunchConfigurations(tscLaunchConfigurationType);

		ILaunchConfiguration existingConfiguraion = chooseLaunchConfiguration(configurations, tsconfigFile);

		if (existingConfiguraion != null) {
			ILaunchConfigurationWorkingCopy wc = existingConfiguraion.getWorkingCopy();
			existingConfiguraion = wc.doSave();
			DebugUITools.launch(existingConfiguraion, mode);
			// Creating Launch Configuration from scratch
		} else {
			IProject project = tsconfigFile.getProject();
			ILaunchConfigurationWorkingCopy newConfiguration = createEmptyLaunchConfiguration(
					project.getName() + " [" + tsconfigFile.getProjectRelativePath().toString() + "]"); //$NON-NLS-1$ //$NON-NLS-2$
			newConfiguration.setAttribute(TypeScriptCompilerLaunchConstants.BUILD_PATH, getBuildPath(tsconfigFile));
			newConfiguration.doSave();
			DebugUITools.launch(newConfiguration, mode);
		}

	} catch (CoreException e) {
		TypeScriptCorePlugin.logError(e, e.getMessage());
	}

}
 
Example 5
Source File: LauncherTabArguments.java    From xds-ide with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void setDefaults(ILaunchConfigurationWorkingCopy config) {
	config.setAttribute(ILaunchConfigConst.ATTR_PROGRAM_ARGUMENTS, ""); //$NON-NLS-1$
	config.setAttribute(ILaunchConfigConst.ATTR_DEBUGGER_ARGUMENTS, ""); //$NON-NLS-1$
	config.setAttribute(ILaunchConfigConst.ATTR_SIMULATOR_ARGUMENTS, ""); //$NON-NLS-1$
	fWorkingDirectoryBlock.setDefaults(config);
}
 
Example 6
Source File: HybrisJunitLaunchShortcut.java    From hybris-commerce-eclipse-plugin with Apache License 2.0 5 votes vote down vote up
@Override
protected ILaunchConfigurationWorkingCopy createLaunchConfiguration(IJavaElement p_element) throws CoreException
{
   ILaunchConfigurationWorkingCopy config = super.createLaunchConfiguration(p_element);
   config.setAttribute(JUnitLaunchConfigurationConstants.ATTR_TEST_RUNNER_KIND, "com.hybris.junit.kind");
   return config;
}
 
Example 7
Source File: GenerateJSCodeConfigurationTab.java    From uml2solidity with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void setDefaults(ILaunchConfigurationWorkingCopy configuration) {
	IPreferenceStore store = PreferenceConstants.getPreferenceStore(null);

	configuration.setAttribute(JS_FILE_HEADER, store.getString(JS_FILE_HEADER));
	configuration.setAttribute(GENERATE_JS_CONTROLLER, store.getBoolean(GENERATE_JS_CONTROLLER));
	configuration.setAttribute(GENERATE_JS_CONTROLLER_TARGET, store.getString(GENERATE_JS_CONTROLLER_TARGET));
	configuration.setAttribute(GENERATE_JS_TEST, store.getBoolean(GENERATE_JS_TEST));
	configuration.setAttribute(GENERATE_JS_TEST_TARGET, store.getString(GENERATE_JS_TEST_TARGET));
	configuration.setAttribute(GENERATE_WEB3, store.getBoolean(GENERATE_WEB3));
}
 
Example 8
Source File: AndroidSimOptionsTab.java    From thym with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void performApply(ILaunchConfigurationWorkingCopy configuration) {
	configuration.setAttribute(HybridProjectLaunchConfigConstants.ATTR_BUILD_SCOPE, textProject.getText());
	String avd = AVDCombo.getText();
	if(avd != null && avd.isEmpty()){
		avd = null;
	}
	configuration.setAttribute(ATTR_AVD_NAME, avd);
	configuration.setAttribute(ATTR_LOGCAT_FILTER, logFilterTxt.getText());
}
 
Example 9
Source File: DsfGdbAdaptor.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Builds a launcher and launches a Post-mortem GDB session, based on a
 * previously-gathered GDB Tracepoint file.  The information used to
 * create the launcher is provided to the constructor of this class,
 * at instantiation time.
 * <p>
 * Note: Requires GDB 7.2 or later
 */
private void launchDGBPostMortemTrace() throws CoreException {
    fIsTimeoutEnabled = Platform.getPreferencesService().getBoolean(GdbPlugin.PLUGIN_ID, IGdbDebugPreferenceConstants.PREF_COMMAND_TIMEOUT, false, null);
    if (fIsTimeoutEnabled) {
        fTimeout = Platform.getPreferencesService().getInt(GdbPlugin.PLUGIN_ID, IGdbDebugPreferenceConstants.PREF_COMMAND_TIMEOUT_VALUE, IGdbDebugPreferenceConstants.COMMAND_TIMEOUT_VALUE_DEFAULT, null);
    }

    ILaunchConfigurationType configType = DebugPlugin
            .getDefault()
            .getLaunchManager()
            .getLaunchConfigurationType("org.eclipse.cdt.launch.postmortemLaunchType"); //$NON-NLS-1$
    ILaunchConfigurationWorkingCopy wc = configType.newInstance(null, fTraceFile);

    wc.setAttribute("org.eclipse.cdt.dsf.gdb.DEBUG_NAME", gdb72Executable); //$NON-NLS-1$
    wc.setAttribute("org.eclipse.cdt.dsf.gdb.POST_MORTEM_TYPE", "TRACE_FILE"); //$NON-NLS-1$ //$NON-NLS-2$
    wc.setAttribute("org.eclipse.cdt.launch.ATTR_BUILD_BEFORE_LAUNCH_ATTR", 0); //$NON-NLS-1$
    wc.setAttribute("org.eclipse.cdt.launch.COREFILE_PATH", fTraceFilePath); //$NON-NLS-1$
    wc.setAttribute("org.eclipse.cdt.launch.DEBUGGER_START_MODE", "core"); //$NON-NLS-1$ //$NON-NLS-2$
    wc.setAttribute("org.eclipse.cdt.launch.PROGRAM_NAME", tracedExecutable); //$NON-NLS-1$
    // So that the GDB launch is synchronous
    wc.setAttribute("org.eclipse.debug.ui.ATTR_LAUNCH_IN_BACKGROUND", false); //$NON-NLS-1$

    if (!sourceLocator.isEmpty()) {
        wc.setAttribute("org.eclipse.debug.core.source_locator_memento", sourceLocator); //$NON-NLS-1$
    }

    // Launch GDB session
    fLaunch = wc.doSave().launch("debug", null); //$NON-NLS-1$
    isTerminating = false;

    if (fLaunch instanceof GdbLaunch) {
        fSessionId = ((GdbLaunch) fLaunch).getSession().getId();
    }

    fDsfSession = ((GdbLaunch) fLaunch).getSession();
    fDsfSession.addServiceEventListener(this, null);

    // Find the number of frames contained in the tracepoint file
    fNumberOfFrames = findNumFrames();
}
 
Example 10
Source File: JVoiceXmlBrowserUI.java    From JVoiceXML with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * Convenience method to set a configuration value from a text.
 * 
 * @param configuration
 *            The configuration.
 * @param attribute
 *            Name of the attribute,
 * @param text
 *            The text.
 */
private void setAttribute(
        final ILaunchConfigurationWorkingCopy configuration,
        final String attribute, final Text text) {
    if ((configuration == null) || (text == null)) {
        return;
    }

    final String value = text.getText();
    configuration.setAttribute(attribute, value);
}
 
Example 11
Source File: ScriptLaunchShortcut.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * @param fileName
 * @return
 */
protected static ILaunchConfiguration createConfiguration( String fileName )
{
	// String fileName = input.getPath( ).toOSString( );
	// int index = fileName.indexOf( File.separator );
	String name = "New_configuration";//$NON-NLS-1$

	name = DebugPlugin.getDefault( )
			.getLaunchManager( )
			.generateUniqueLaunchConfigurationNameFrom( name );
	ILaunchConfiguration config = null;
	ILaunchConfigurationWorkingCopy wc = null;
	try
	{
		ILaunchConfigurationType configType = getConfigurationType( );
		wc = configType.newInstance( null,
				getLaunchManager( ).generateUniqueLaunchConfigurationNameFrom( name ) );
		wc.setAttribute( IReportLaunchConstants.ATTR_REPORT_FILE_NAME,
				fileName );

		config = wc.doSave( );
	}
	catch ( CoreException exception )
	{
		logger.warning( exception.getMessage( ) );
	}
	return config;
}
 
Example 12
Source File: CargoRunDelegate.java    From corrosion with Eclipse Public License 2.0 5 votes vote down vote up
private static ILaunchConfiguration getLaunchConfiguration(IResource resource) {
	ILaunchConfiguration launchConfiguration = RustLaunchDelegateTools.getLaunchConfiguration(resource,
			CARGO_RUN_LAUNCH_CONFIG_TYPE);
	if (launchConfiguration instanceof ILaunchConfigurationWorkingCopy) {
		ILaunchConfigurationWorkingCopy wc = (ILaunchConfigurationWorkingCopy) launchConfiguration;
		wc.setAttribute(RustLaunchDelegateTools.PROJECT_ATTRIBUTE, resource.getProject().getName());
	}
	return launchConfiguration;
}
 
Example 13
Source File: LocalMapReduceLaunchTabGroup.java    From RDFS with Apache License 2.0 5 votes vote down vote up
public void performApply(ILaunchConfigurationWorkingCopy configuration) {
  configuration.setAttribute("org.apache.hadoop.eclipse.launch.mapper",
      mapperClass.getText());
  configuration.setAttribute(
      "org.apache.hadoop.eclipse.launch.reducer", reducerClass
          .getText());
  configuration.setAttribute(
      "org.apache.hadoop.eclipse.launch.combiner", combinerClass
          .getText());
}
 
Example 14
Source File: CommonVoiceXMLBrowserTab.java    From JVoiceXML with GNU Lesser General Public License v2.1 5 votes vote down vote up
public void performApply(ILaunchConfigurationWorkingCopy configuration) {
    configuration.setAttribute(IVoiceXMLBrowserConstants.LAUNCH_URL,
            urlText.getText().trim());
    int idx = browserCombo.getSelectionIndex();
    if (idx == -1 || browserIds == null || browserIds.length < (idx - 1)) {
        return;
    }
    configuration.setAttribute(IVoiceXMLBrowserConstants.LAUNCH_BROWSER_ID,
            browserIds[idx]);
    if (currentBrowserUI != null) {
        currentBrowserUI.performApply(configuration);
    }
}
 
Example 15
Source File: LauncherTabArguments.java    From xds-ide with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public void performApply(ILaunchConfigurationWorkingCopy configuration) {
	configuration.setAttribute(ILaunchConfigConst.ATTR_PROGRAM_ARGUMENTS, argsCmdline.getText());
	fWorkingDirectoryBlock.performApply(configuration);
}
 
Example 16
Source File: CargoTestTab.java    From corrosion with Eclipse Public License 2.0 4 votes vote down vote up
@Override
public void setDefaults(ILaunchConfigurationWorkingCopy configuration) {
	super.setDefaults(configuration);
	configuration.setAttribute(CargoTestDelegate.TEST_NAME_ATTRIBUTE, ""); //$NON-NLS-1$
}
 
Example 17
Source File: LaunchConfigurationConfigurator.java    From sarl with Apache License 2.0 4 votes vote down vote up
@Override
public void setAgentLaunchingArguments(ILaunchConfigurationWorkingCopy configuration, String arguments) {
	configuration.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS, arguments);
}
 
Example 18
Source File: VMArgumentsBlock.java    From Pydev with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public void performApply(ILaunchConfigurationWorkingCopy configuration) {
    configuration.setAttribute(Constants.ATTR_VM_ARGUMENTS, getAttributeValueFrom(fVMArgumentsText));
}
 
Example 19
Source File: LaunchUtils.java    From goclipse with Eclipse Public License 1.0 4 votes vote down vote up
public static void setOptionalValue(ILaunchConfigurationWorkingCopy config, String keyIsDefault, String key, 
		String value) {
	config.setAttribute(keyIsDefault, value == null);
	config.setAttribute(key, value);
}
 
Example 20
Source File: LaunchConfigurationConfigurator.java    From sarl with Apache License 2.0 2 votes vote down vote up
/** Change the main java class within the given configuration.
 *
 * @param wc the configuration to change.
 * @param name the qualified name of the main Java class.
 * @since 0.7
 */
protected static void setMainJavaClass(ILaunchConfigurationWorkingCopy wc, String name) {
	wc.setAttribute(
			IJavaLaunchConfigurationConstants.ATTR_MAIN_TYPE_NAME,
			name);
}