Java Code Examples for org.eclipse.debug.core.ILaunchConfiguration#getName()

The following examples show how to use org.eclipse.debug.core.ILaunchConfiguration#getName() . 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: CodewindLaunchConfigDelegate.java    From codewind-eclipse with Eclipse Public License 2.0 6 votes vote down vote up
protected CodewindEclipseApplication getApp(ILaunchConfiguration config) throws Exception {
	String connId = config.getAttribute(CONNECTION_ID_ATTR, (String) null);
	String projectId = config.getAttribute(PROJECT_ID_ATTR, (String) null);
	if (connId == null || projectId == null) {
		Logger.logError("Expected attributes were not found for launch configuration: " + config.getName());
		return null;
	}
	CodewindConnection conn = CodewindConnectionManager.getConnectionById(connId);
	CodewindApplication app = conn == null ? null : conn.getAppByID(projectId);
	if (!(app instanceof CodewindEclipseApplication)) {
		String msg = "Could not find the application associated with launch configuration: " + config.getName(); // $NON-NLS-1$
		Logger.logError(msg);
		abort(msg, null, IStatus.ERROR);
	}
	return (CodewindEclipseApplication) app;
}
 
Example 2
Source File: TestResultsView.java    From n4js with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Invoked when user performs {@link #actionStop}.
 */
protected void performStop() {
	IProcess process = DebugUITools.getCurrentProcess();
	if (process == null) {
		return;
	}
	final TestSession session = from(registeredSessions).firstMatch(s -> s.root == currentRoot).orNull();
	if (null != session) {
		ILaunch launch = process.getLaunch();
		ILaunchConfiguration runningConfig = launch.getLaunchConfiguration();
		ILaunchConfiguration sessionConfig = getLaunchConfigForSession(session, null);
		if (runningConfig.getName() == sessionConfig.getName()) { // we use "==" since the name is the same instance
			List<ITerminate> targets = collectTargets(process);
			targets.add(process);
			DebugCommandService service = DebugCommandService
					.getService(PlatformUI.getWorkbench().getActiveWorkbenchWindow());
			service.executeCommand(ITerminateHandler.class, targets.toArray(), null);
			session.root.stopRunning();
			refreshActions();
		}
	}
}
 
Example 3
Source File: TestabilityLaunchConfigurationHelper.java    From testability-explorer with Apache License 2.0 6 votes vote down vote up
public boolean isExistingLaunchConfigWithRunOnBuildOtherThanCurrent(
    String projectName, String launchConfigName) {
  try {
    ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
    ILaunchConfigurationType type = launchManager
        .getLaunchConfigurationType(TestabilityConstants.TESTABILITY_LAUNCH_CONFIGURATION_TYPE);
    ILaunchConfiguration[] launchConfigurations = launchManager.getLaunchConfigurations(type);
    for (ILaunchConfiguration launchConfiguration : launchConfigurations) {
      String configProjectName =
          launchConfiguration.getAttribute(TestabilityConstants.CONFIGURATION_ATTR_PROJECT_NAME,
              "");
      boolean runOnEveryBuild =
          launchConfiguration.getAttribute(TestabilityConstants.CONFIGURATION_ATTR_RUN_ON_BUILD,
              false);
      String configName = launchConfiguration.getName();
      boolean isProjectNameEqual = configProjectName.equals(projectName);
      boolean isLaunchConfigNameEqual = launchConfigName.equals(configName); 
      if (isProjectNameEqual && runOnEveryBuild && !isLaunchConfigNameEqual) {
        return true;
      }
    }
  } catch (CoreException e) {
    logger.logException(e);
  }
  return false;
}
 
Example 4
Source File: LaunchConfigRule.java    From eclipse-extras with Eclipse Public License 1.0 5 votes vote down vote up
public String renameLaunchConfig( ILaunchConfiguration launchConfig ) throws CoreException {
  String newName = launchConfig.getName() + "-renamed";
  if( launchManager.isExistingLaunchConfigurationName( newName ) ) {
    newName = launchManager.generateLaunchConfigurationName( newName );
  }
  ILaunchConfigurationWorkingCopy workingCopy = launchConfig.getWorkingCopy();
  workingCopy.rename( newName );
  workingCopy.doSave();
  return newName;
}
 
Example 5
Source File: LaunchSelectionDialog.java    From eclipse-extras with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public String getElementName( Object item ) {
  ILaunchConfiguration configuration = ( ILaunchConfiguration )item;
  return configuration.getName();
}