org.eclipse.debug.core.ILaunchConfigurationWorkingCopy Java Examples

The following examples show how to use org.eclipse.debug.core.ILaunchConfigurationWorkingCopy. 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: NoServerArgumentProcessor.java    From gwt-eclipse-plugin with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public void update(ILaunchConfigurationWorkingCopy launchConfig, IJavaProject javaProject,
    List<String> programArgs, List<String> vmArgs) throws CoreException {
  // No compiler arg processing
  if (GwtLaunchConfigurationProcessorUtilities.isCompiler(launchConfig)) {
    return;
  }

  IProject project = javaProject.getProject();
  int noServerArgIndex = programArgs.indexOf(ARG_NO_SERVER);

  int insertionIndex =
      LaunchConfigurationProcessorUtilities.removeArgsAndReturnInsertionIndex(programArgs,
          noServerArgIndex, false);
  if (!WebAppLaunchConfiguration.getRunServer(launchConfig) && GWTNature.isGWTProject(project)) {
    programArgs.add(insertionIndex, ARG_NO_SERVER);
  }
}
 
Example #2
Source File: TestabilityCompilationParticipant.java    From testability-explorer with Apache License 2.0 6 votes vote down vote up
@Override
public void buildFinished(IJavaProject project) {
  super.buildFinished(project);
  ILaunchConfiguration launchConfiguration =
      configurationHelper.getLaunchConfiguration(project.getElementName());
  if (launchConfiguration != null) {
    try {
      ILaunchConfigurationWorkingCopy workingCopy = launchConfiguration.getWorkingCopy();
      workingCopy.setAttribute(
          TestabilityConstants.CONFIGURATION_ATTR_RUNNING_IN_COMPILATION_MODE, true);
      ILaunch launch = workingCopy.launch(TestabilityConstants.TESTABILITY_MODE, null);
    } catch (CoreException e) {
      logger.logException(e);
    }
  }
}
 
Example #3
Source File: GwtSuperDevModeCodeServerSettingsTab.java    From gwt-eclipse-plugin with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public void doPerformApply(ILaunchConfigurationWorkingCopy configuration) {
  if (urlSelectionBlock != null) {
    urlSelectionBlock.performApply(configuration);
  }

  if (sdmModeBlock != null) {
    sdmModeBlock.performApply(configuration);
  }

  // Save the entry point modules
  persistModules(configuration, entryPointModulesBlock.getModules());
  LaunchConfigurationProcessorUtilities.updateViaProcessor(new ModuleArgumentProcessor(), configuration);

  // TODO if codeServerModeBlock

  // // SDM CodeServer -src
  // LaunchConfigurationProcessorUtilities.updateViaProcessor(
  // new SuperDevModeSrcArgumentProcessor(), configuration);
  // // TODO change to text box
  // // SDM CodeServer -port
  // LaunchConfigurationProcessorUtilities.updateViaProcessor(
  // new SuperDevModeCodeServerPortArgumentProcessor(), configuration);

}
 
Example #4
Source File: BOSWebServerManager.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
protected void createLaunchConfiguration(final IServer server, final IProgressMonitor monitor)
        throws CoreException {
    ILaunchConfiguration conf = server.getLaunchConfiguration(false, Repository.NULL_PROGRESS_MONITOR);
    if (conf == null) {
        conf = server.getLaunchConfiguration(true,
                Repository.NULL_PROGRESS_MONITOR);
    }
    ILaunchConfigurationWorkingCopy workingCopy = conf.getWorkingCopy();
    final String args = workingCopy.getAttribute(IJavaLaunchConfigurationConstants.ATTR_VM_ARGUMENTS, "");
    if (!args.contains(tomcatInstanceLocation)) {
        conf = server.getLaunchConfiguration(true,
                Repository.NULL_PROGRESS_MONITOR);
        workingCopy = conf.getWorkingCopy();
    }
    configureLaunchConfiguration(workingCopy);
}
 
Example #5
Source File: GWTJUnitSettingsTab.java    From gwt-eclipse-plugin with Eclipse Public License 1.0 6 votes vote down vote up
public void performApply(ILaunchConfigurationWorkingCopy config) {
  StructuredSelection logLevelSelection = (StructuredSelection) logLevelComboViewer.getSelection();
  config.setAttribute(GWTLaunchConstants.ATTR_LOG_LEVEL,
      logLevelSelection.getFirstElement().toString());

  StructuredSelection outputStyleSelection = (StructuredSelection) outputStyleComboViewer.getSelection();
  config.setAttribute(GWTLaunchConstants.ATTR_OBFUSCATION,
      outputStyleSelection.getFirstElement().toString());

  config.setAttribute(GWTLaunchConstants.ATTR_NOT_HEADLESS,
      notHeadlessButton.getSelection());

  config.setAttribute(GWTLaunchConstants.ATTR_WEB_MODE,
      Boolean.toString(webModeButton.getSelection()));

  config.setAttribute(GWTLaunchConstants.ATTR_STANDARDS_MODE,
      standardsModeButton.getSelection());

  config.setAttribute(GWTLaunchConstants.ATTR_OUT_DIR,
      outputDirectoryField.getText());
}
 
Example #6
Source File: DataflowPipelineLaunchDelegate.java    From google-cloud-eclipse with Apache License 2.0 6 votes vote down vote up
private void setCredentialEnvironmentVariable(
    ILaunchConfigurationWorkingCopy workingCopy, String value) throws CoreException {
  // Dataflow SDK doesn't yet support reading credentials from an arbitrary JSON, so we use the
  // workaround of setting the "GOOGLE_APPLICATION_CREDENTIALS" environment variable.
  Map<String, String> variableMap = workingCopy.getAttribute(
      ILaunchManager.ATTR_ENVIRONMENT_VARIABLES, new HashMap<String, String>());
  if (variableMap.containsKey(GOOGLE_APPLICATION_CREDENTIALS_ENVIRONMENT_VARIABLE)) {
    String message = "You cannot define the environment variable GOOGLE_APPLICATION_CREDENTIALS"
        + " when launching Dataflow pipelines from Cloud Tools for Eclipse.";
    throw new CoreException(new Status(Status.ERROR, DataflowCorePlugin.PLUGIN_ID, message));
  }

  Map<String, String> variableMapCopy = new HashMap<>(variableMap);
  variableMapCopy.put(GOOGLE_APPLICATION_CREDENTIALS_ENVIRONMENT_VARIABLE, value);
  workingCopy.setAttribute(ILaunchManager.ATTR_ENVIRONMENT_VARIABLES, variableMapCopy);
}
 
Example #7
Source File: RunConfigurationConverter.java    From n4js with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Converts a {@link RunConfiguration} to an {@link ILaunchConfiguration}. Will throw a {@link WrappedException} in
 * case of error.
 *
 * @see RunConfiguration#readPersistentValues()
 */
public ILaunchConfiguration toLaunchConfiguration(ILaunchConfigurationType type, RunConfiguration runConfig) {
	try {
		final ILaunchConfiguration[] configs = DebugPlugin.getDefault().getLaunchManager()
				.getLaunchConfigurations(type);

		for (ILaunchConfiguration config : configs) {
			if (equals(runConfig, config))
				return config;
		}

		final IContainer container = null;
		final ILaunchConfigurationWorkingCopy workingCopy = type.newInstance(container, runConfig.getName());

		workingCopy.setAttributes(runConfig.readPersistentValues());

		return workingCopy.doSave();
	} catch (Exception e) {
		throw new WrappedException("could not convert N4JS RunConfiguration to Eclipse ILaunchConfiguration", e);
	}
}
 
Example #8
Source File: WebAppServerTab.java    From gwt-eclipse-plugin with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public void doPerformApply(ILaunchConfigurationWorkingCopy configuration) {
  if (runServerButton != null) {
    WebAppLaunchConfigurationWorkingCopy.setRunServer(configuration, runServerButton.getSelection());
  }

  LaunchConfigurationProcessorUtilities.updateViaProcessor(new NoServerArgumentProcessor(), configuration);

  // TODO remove and have folks use the CodeServerLauncher
  //LaunchConfigurationProcessorUtilities.updateViaProcessor(new ServerArgumentProcessor(), configuration);

  WebAppLaunchConfigurationWorkingCopy.setServerPort(configuration, serverPortText.getText().trim());

  if (autoPortSelectionButton != null) {
    WebAppLaunchConfigurationWorkingCopy.setAutoPortSelection(configuration, autoPortSelectionButton.getSelection());
  }

  LaunchConfigurationProcessorUtilities.updateViaProcessor(new PortArgumentProcessor(), configuration);
}
 
Example #9
Source File: GWTSettingsTab.java    From gwt-eclipse-plugin with Eclipse Public License 1.0 6 votes vote down vote up
public void performApply(ILaunchConfigurationWorkingCopy configuration) {
  // super dev mode args
  GWTLaunchConfigurationWorkingCopy.setSuperDevModeEnabled(configuration, selectionBlock.isSuperDevModeSelected());

  // Logic for determining Super Dev Mode is retrieved form working copy in
  // processors. So saving the Super Dev enabled here decouples processors.
  // TODO refer to updateArgumentProcessors todo about LaunchCOnfigurationUpdater.
  try {
    configuration.doSave();
  } catch (CoreException e) {
    MessageDialog.openError(Workbench.getInstance().getActiveWorkbenchWindow().getShell(), "Error saving project",
        "Please try hitting apply agian.");
  }

  // When changing between selections update all the launch config args
  updateArgumentProcessors(configuration);
}
 
Example #10
Source File: PipelineArgumentsTab.java    From google-cloud-eclipse with Apache License 2.0 6 votes vote down vote up
@Override
public void performApply(ILaunchConfigurationWorkingCopy configuration) {
  if (!uiUpToDate) {
    // uiUpToDate == false means initializeFrom() has not been called since
    // reload() was last called (on isValid() or initializeFrom()) and so
    // the UI elements are out of sync with this configuration.
    // Since isValid() must be true for performApply() to be called,
    // then we have no changes to apply.
    return;
  }
  PipelineRunner runner = getSelectedRunner();
  launchConfiguration.setRunner(runner);

  launchConfiguration.setUseDefaultLaunchOptions(defaultOptionsComponent.isUseDefaultOptions());

  Map<String, String> overallArgValues = new HashMap<>(launchConfiguration.getArgumentValues());
  if (!defaultOptionsComponent.isUseDefaultOptions()) {
    overallArgValues.putAll(defaultOptionsComponent.getValues());
  }
  overallArgValues.putAll(getNonDefaultOptions());
  launchConfiguration.setArgumentValues(overallArgValues);

  launchConfiguration.setUserOptionsName(userOptionsSelector.getText());

  launchConfiguration.toLaunchConfiguration(configuration);
}
 
Example #11
Source File: KubeUtil.java    From codewind-eclipse with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Starts a separate port forward launch
 */
public static PortForwardInfo launchPortForward(CodewindApplication app, int localPort, int port) throws Exception {
	// Check the app (throws an exception if there is a problem)
	checkApp(app);

	// Get the command
	List<String> commandList = getPortForwardCommand(app, localPort, port);
	String title = NLS.bind(Messages.PortForwardTitle, localPort + ":" + port);

	ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
	ILaunchConfigurationType launchConfigurationType = launchManager.getLaunchConfigurationType(UtilityLaunchConfigDelegate.LAUNCH_CONFIG_ID);
	ILaunchConfigurationWorkingCopy workingCopy = launchConfigurationType.newInstance((IContainer) null, app.name);
	workingCopy.setAttribute(CodewindLaunchConfigDelegate.CONNECTION_ID_ATTR, app.connection.getConid());
	workingCopy.setAttribute(CodewindLaunchConfigDelegate.PROJECT_ID_ATTR, app.projectID);
	workingCopy.setAttribute(UtilityLaunchConfigDelegate.TITLE_ATTR, title);
	workingCopy.setAttribute(UtilityLaunchConfigDelegate.COMMAND_ATTR, commandList);
	CodewindLaunchConfigDelegate.setConfigAttributes(workingCopy, app);
	ILaunchConfiguration launchConfig = workingCopy.doSave();
	ILaunch launch = launchConfig.launch(ILaunchManager.RUN_MODE, new NullProgressMonitor());
	return new PortForwardInfo(localPort, port, launch);
}
 
Example #12
Source File: AbstractCargoLaunchConfigurationTab.java    From corrosion with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public void setDefaults(ILaunchConfigurationWorkingCopy configuration) {
	configuration.setAttribute(RustLaunchDelegateTools.PROJECT_ATTRIBUTE, ""); //$NON-NLS-1$
	configuration.setAttribute(RustLaunchDelegateTools.ARGUMENTS_ATTRIBUTE, ""); //$NON-NLS-1$
	configuration.setAttribute(RustLaunchDelegateTools.OPTIONS_ATTRIBUTE, ""); //$NON-NLS-1$
	configuration.setAttribute(RustLaunchDelegateTools.WORKING_DIRECTORY_ATTRIBUTE, ""); //$NON-NLS-1$
}
 
Example #13
Source File: RustDebugDelegate.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,
			RustLaunchDelegateTools.CORROSION_DEBUG_LAUNCH_CONFIG_TYPE);
	if (launchConfiguration instanceof ILaunchConfigurationWorkingCopy) {
		ILaunchConfigurationWorkingCopy wc = (ILaunchConfigurationWorkingCopy) launchConfiguration;
		final IProject project = resource.getProject();
		wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME, project.getName());
		wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, getDefaultExecutablePath(project)); // $NON-NLS-1$
		wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN, false);
		wc.setAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUG_NAME, RustManager.getDefaultDebugger());
	}
	return launchConfiguration;
}
 
Example #14
Source File: WebAppArgumentsTab.java    From gwt-eclipse-plugin with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void activated(ILaunchConfigurationWorkingCopy workingCopy) {
  // JavaArgumentsTab does not call through to AbstractLCTab, which normally
  // does this. We need this to update the arguments text boxes from the
  // launch config.
  initializeFrom(workingCopy);

  super.activated(workingCopy);
}
 
Example #15
Source File: Model.java    From tlaplus with MIT License 5 votes vote down vote up
private void renameLaunch(final Spec newSpec, String newModelName) {
	try {
		// create the model with the new name
		final String fullyQualifiedName = fullyQualifiedNameFromSpecNameAndModelName(newSpec.getName(), newModelName);
		final ILaunchConfigurationWorkingCopy copy = this.launchConfig.copy(fullyQualifiedName);
		copy.setAttribute(SPEC_NAME, newSpec.getName());
		copy.setAttribute(ModelHelper.MODEL_NAME, newModelName);
		copy.setContainer(newSpec.getProject());
		final ILaunchConfiguration renamed = copy.doSave();

		final IFileStore ifs = ((LaunchConfiguration)launchConfig).getFileStore();
		
		// delete the copy of the old model in the new toolbox directory
		if (ifs != null) {
			final IPath newToolboxName = renamed.getFile().getFullPath().removeLastSegments(1);
			final URI u = ifs.toURI();
			final File oldLaunchConfigFile = new File(u);
			final File grandParentDirectory = oldLaunchConfigFile.getParentFile().getParentFile();
			final String newToolboxDirectoryName = newToolboxName.toString() + ResourceHelper.TOOLBOX_DIRECTORY_SUFFIX;
			final File fileToDelete = Paths.get(grandParentDirectory.getAbsolutePath(),
												newToolboxDirectoryName,
												oldLaunchConfigFile.getName()).toFile();
			
			if (!fileToDelete.delete()) {
				TLCActivator.logInfo("Could not delete old launch file [" + fileToDelete.getAbsolutePath()
										+ "] - will attempt on app exit, which is better than nothing.");
				fileToDelete.deleteOnExit();
			}
		} else {
			TLCActivator.logInfo("Could not get filestore for the original launch config; this is problematic.");
		}

		// delete the old model
		launchConfig.delete();
		launchConfig = renamed;
	} catch (CoreException e) {
		TLCActivator.logError("Error renaming model.", e);
	}
}
 
Example #16
Source File: GcpLocalRunTabTest.java    From google-cloud-eclipse with Apache License 2.0 5 votes vote down vote up
@Test
public void testPerformApply_updatesEnvironmentTab() throws CoreException {
  when(launchConfig.getAttribute(anyString(), anyString()))
    .thenAnswer(AdditionalAnswers.returnsSecondArg());
  tab.activated(launchConfig);
  tab.deactivated(launchConfig);
  verify(environmentTab).initializeFrom(any(ILaunchConfiguration.class));
  verify(environmentTab).performApply(any(ILaunchConfigurationWorkingCopy.class));
}
 
Example #17
Source File: GWTLaunchConfigurationWorkingCopy.java    From gwt-eclipse-plugin with Eclipse Public License 1.0 5 votes vote down vote up
private static void setBooleanAttribute(ILaunchConfigurationWorkingCopy workingCopy,
    GWTLaunchAttributes launchAttribute, boolean newValue) {
  String attributeQualifiedName = launchAttribute.getQualifiedName();
  if (shouldClearAttribute(launchAttribute.getDefaultValue(), newValue)) {
    clearAttribute(workingCopy, attributeQualifiedName);
  } else {
    workingCopy.setAttribute(attributeQualifiedName, newValue);
  }
}
 
Example #18
Source File: GenerateJSCodeConfigurationTab.java    From uml2solidity with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void performApply(ILaunchConfigurationWorkingCopy configuration) {
	configuration.setAttribute(GENERATE_JS_CONTROLLER, btnGenerateJsCode.getSelection());
	configuration.setAttribute(GENERATE_JS_CONTROLLER_TARGET, jsDirectoryText.getText());
	configuration.setAttribute(GENERATE_JS_TEST, btnGenerateJsTestcode.getSelection());
	configuration.setAttribute(GENERATE_JS_TEST_TARGET, testDirectoryText.getText());
	configuration.setAttribute(JS_FILE_HEADER, jsHeaderText.getText());
	configuration.setAttribute(GENERATE_WEB3, btnGenerateWeb3.getSelection());
}
 
Example #19
Source File: BuildTargetLaunchCreator.java    From goclipse with Eclipse Public License 1.0 5 votes vote down vote up
@Override
protected void saveToConfig_rest(ILaunchConfigurationWorkingCopy config) throws CommonException {
	String serializedBuildCommand = commandInvocationSerializer.writeToString(data.buildCommand);
	
	config.setAttribute(LaunchConstants.ATTR_BUILD_TARGET, getTargetName());
	LaunchUtils.setOptionalValue(config, 
		LaunchConstants.ATTR_BUILD_COMMAND_USE_DEFAULT, 
		LaunchConstants.ATTR_BUILD_COMMAND, serializedBuildCommand);
	LaunchUtils.setOptionalValue(config, 
		LaunchConstants.ATTR_PROGRAM_PATH_USE_DEFAULT, 
		LaunchConstants.ATTR_PROGRAM_PATH, data.executablePath);
}
 
Example #20
Source File: DotnetRunDelegate.java    From aCute with Eclipse Public License 2.0 5 votes vote down vote up
private ILaunchConfiguration getLaunchConfiguration(String mode, IResource resource) {
	ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
	ILaunchConfigurationType configType = launchManager
			.getLaunchConfigurationType("org.eclipse.acute.dotnetrun.DotnetRunDelegate"); //$NON-NLS-1$
	try {
		ILaunchConfiguration[] launchConfigurations = launchManager.getLaunchConfigurations(configType);

		String configName;
		if (resource.getLocation().toFile().isFile()) {
			configName = NLS.bind(Messages.DotnetRunDelegate_configuration, resource.getParent().getName() + "." + resource.getName()); //$NON-NLS-1$
		} else {
			configName = NLS.bind(Messages.DotnetRunDelegate_configuration, resource.getName());
		}

		for (ILaunchConfiguration iLaunchConfiguration : launchConfigurations) {
			if (iLaunchConfiguration.getName().equals(configName)
					&& iLaunchConfiguration.getModes().contains(mode)) {
				return iLaunchConfiguration;
			}
		}
		configName = launchManager.generateLaunchConfigurationName(configName);
		ILaunchConfigurationWorkingCopy wc = configType.newInstance(null, configName);
		if (resource.getLocation().toFile().isFile()) {
			resource = resource.getParent();
		}
		wc.setAttribute(PROJECT_FOLDER, resource.getLocation().toString());
		return wc;
	} catch (CoreException e) {
		AcutePlugin.logError(e);
	}
	return null;
}
 
Example #21
Source File: PipelineLaunchConfiguration.java    From google-cloud-eclipse with Apache License 2.0 5 votes vote down vote up
/**
 * Stores the Dataflow Pipeline-specific options of this LaunchConfiguration inside the provided
 * {@link ILaunchConfigurationWorkingCopy}.
 */
public void toLaunchConfiguration(ILaunchConfigurationWorkingCopy configuration) {
  if (runner != null) {
    configuration.setAttribute(PipelineConfigurationAttr.RUNNER_ARGUMENT.toString(),
        runner.getRunnerName());
  }
  configuration.setAttribute(
      PipelineConfigurationAttr.USE_DEFAULT_LAUNCH_OPTIONS.toString(), useDefaultLaunchOptions);
  configuration.setAttribute(
      PipelineConfigurationAttr.ALL_ARGUMENT_VALUES.toString(), argumentValues);
  configuration.setAttribute(
      PipelineConfigurationAttr.USER_OPTIONS_NAME.toString(), userOptionsName.orElse(null));
}
 
Example #22
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 #23
Source File: DotnetDebugLaunchShortcut.java    From aCute with Eclipse Public License 2.0 5 votes vote down vote up
private ILaunchConfiguration getLaunchConfiguration(IResource resource) {
	final String mode = "debug"; //$NON-NLS-1$
	ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
	ILaunchConfigurationType configType = launchManager
			.getLaunchConfigurationType(DotnetDebugLaunchDelegate.ID);
	try {
		ILaunchConfiguration[] launchConfigurations = launchManager.getLaunchConfigurations(configType);

		String configName;
		if (resource.getLocation().toFile().isFile()) {
			configName = NLS.bind(Messages.DotnetRunDelegate_configuration, resource.getParent().getName() + "." + resource.getName()); //$NON-NLS-1$
		} else {
			configName = NLS.bind(Messages.DotnetRunDelegate_configuration, resource.getName());
		}

		for (ILaunchConfiguration iLaunchConfiguration : launchConfigurations) {
			if (iLaunchConfiguration.getName().equals(configName)
					&& iLaunchConfiguration.getModes().contains(mode)) {
				return iLaunchConfiguration;
			}
		}
		configName = launchManager.generateLaunchConfigurationName(configName);
		ILaunchConfigurationWorkingCopy wc = configType.newInstance(null, configName);
		if (resource.getLocation().toFile().isFile()) {
			resource = resource.getParent();
		}
		wc.setAttribute(DotnetRunDelegate.PROJECT_FOLDER, resource.getFullPath().toString());
		DebuggerInfo info = DebuggersRegistry.getDefaultDebugger();
		wc.setAttribute(DSPPlugin.ATTR_DSP_CMD, info.debugger.getAbsolutePath());
		wc.setAttribute(DSPPlugin.ATTR_DSP_ARGS, info.args);
		return wc;
	} catch (CoreException e) {
		AcutePlugin.logError(e);
	}
	return null;
}
 
Example #24
Source File: WebAppLaunchDelegate.java    From gwt-eclipse-plugin with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * In the case of a project with an unmanaged WAR directory or when the project is not a web app but the main type
 * takes a WAR argument, we need to check at launch-time whether the launch config has a runtime WAR. If it does not,
 * then we ask the user for one and insert it into the launch config.
 *
 * @param configuration
 *          the launch configuration that may be written to
 * @return true to continue the launch, false to abort silently
 * @throws CoreException
 */
private boolean ensureWarArgumentExistenceInCertainCases(ILaunchConfiguration configuration) throws CoreException {
  IJavaProject javaProject = getJavaProject(configuration);
  if (javaProject != null) {
    IProject project = javaProject.getProject();
    boolean isWebApp = WebAppUtilities.isWebApp(project);
    if ((isWebApp && !WebAppUtilities.hasManagedWarOut(project))
        || (!isWebApp && WarArgumentProcessor.doesMainTypeTakeWarArgument(configuration))) {

      List<String> args = LaunchConfigurationProcessorUtilities.parseProgramArgs(configuration);
      WarParser parser = WarArgumentProcessor.WarParser.parse(args, javaProject);

      if (!(parser.isSpecifiedWithWarArg || parser.isWarDirValid)) {
        // The project's output WAR dir is unknown, so ask the user
        IPath warDir = WebAppUtilities.getWarOutLocationOrPrompt(project);
        if (warDir == null) {
          return false;
        }

        // The processor will update to the proper argument style
        // for the
        // current project nature(s)
        WarArgumentProcessor warArgProcessor = new WarArgumentProcessor();
        warArgProcessor.setWarDirFromLaunchConfigCreation(warDir.toOSString());

        ILaunchConfigurationWorkingCopy wc = configuration.getWorkingCopy();
        LaunchConfigurationProcessorUtilities.updateViaProcessor(warArgProcessor, wc);
        wc.doSave();
      }
    }
  }

  return true;
}
 
Example #25
Source File: DebugLaunchMainTab.java    From aCute with Eclipse Public License 2.0 5 votes vote down vote up
@Override public void performApply(ILaunchConfigurationWorkingCopy configuration) {
	if (getProject() != null) {
		configuration.setAttribute(DotnetRunDelegate.PROJECT_FOLDER, getProject().getName());
	}
	String programArgs = programArgsText.getText();
	configuration.setAttribute(DotnetRunDelegate.PROJECT_ARGUMENTS, programArgs);
}
 
Example #26
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 #27
Source File: DotnetTestTab.java    From aCute with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public void setDefaults(ILaunchConfigurationWorkingCopy configuration) {
	configuration.setAttribute(DebugPlugin.ATTR_WORKING_DIRECTORY, ""); //$NON-NLS-1$
	configuration.setAttribute(DotnetTestDelegate.TEST_SELECTION_TYPE, DotnetTestDelegate.ALL_TESTS);
	configuration.setAttribute(DotnetTestDelegate.TEST_FILTER, ""); //$NON-NLS-1$
	configuration.setAttribute(DotnetTestDelegate.TEST_CLASS, ""); //$NON-NLS-1$
	configuration.setAttribute(DotnetTestDelegate.TEST_METHOD, ""); //$NON-NLS-1$
	configuration.setAttribute(DotnetTestDelegate.CONFIGURATION, "Debug"); //$NON-NLS-1$
	configuration.setAttribute(DotnetTestDelegate.FRAMEWORK, ""); //$NON-NLS-1$
	configuration.setAttribute(DotnetTestDelegate.PROJECT_BUILD, true);
	configuration.setAttribute(DotnetTestDelegate.PROJECT_RESTORE, true);
}
 
Example #28
Source File: JVoiceXmlBrowserUI.java    From JVoiceXML with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * Convenience method to set an integer configuration value from a text.
 * 
 * @param configuration
 *            The configuration.
 * @param attribute
 *            Name of the attribute,
 * @param text
 *            The text containing the current value..
 */
private void setIntAttribute(
        final ILaunchConfigurationWorkingCopy configuration,
        final String attribute, final Text text) {
    if ((configuration == null) || (text == null)) {
        return;
    }

    final String value = text.getText();
    try {
        final Integer intValue = Integer.parseInt(value);
        configuration.setAttribute(attribute, intValue);
    } catch (NumberFormatException ignore) {
    }
}
 
Example #29
Source File: GWTLaunchConfigurationWorkingCopy.java    From gwt-eclipse-plugin with Eclipse Public License 1.0 5 votes vote down vote up
private static void setListAttribute(ILaunchConfigurationWorkingCopy workingCopy, String qualifiedAttributeName,
    List<String> newValue, List<String> defaultValue) {
  if (shouldClearAttribute(defaultValue, newValue)) {
    clearAttribute(workingCopy, qualifiedAttributeName);
  } else {
    workingCopy.setAttribute(qualifiedAttributeName, newValue);
  }
}
 
Example #30
Source File: CommonVoiceXMLBrowserTab.java    From JVoiceXML with GNU Lesser General Public License v2.1 5 votes vote down vote up
public void setDefaults(ILaunchConfigurationWorkingCopy configuration) {
    IExtensionPoint iep = Platform
            .getExtensionRegistry()
            .getExtensionPoint(
                    "org.jvoicexml.eclipse.debug.ui.launching.voiceXMLBrowser"); //$NON-NLS-1$
    if (iep != null) {
        IExtension[] extensions = iep.getExtensions();

        for (int i = 0; i < extensions.length; i++) {
            IConfigurationElement[] elements = extensions[i]
                    .getConfigurationElements();
            if (elements == null) {
                continue;
            }
            for (int j = 0; j < elements.length; j++) {
                if (new Boolean(elements[j].getAttributeAsIs("default")).equals(Boolean.TRUE)) { //$NON-NLS-1$
                    defaultBrowser = i;
                }
            }
        }
    }

    if (urlText != null) {
        urlText.setText("");//$NON-NLS-1$
    }
    if (browserCombo != null) {
        browserCombo.select(0);
        browserCombo.select(defaultBrowser);
        refreshActiveConfigurationPane();
        if (currentBrowserUI != null) {
            currentBrowserUI.setDefaults(configuration);
        }
    }
}