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

The following examples show how to use org.eclipse.debug.core.ILaunchConfiguration#getAttribute() . 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: ReportApplicationLaunchDelegate.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
private synchronized void ensureDelegate( ILaunchConfiguration configuration )
		throws CoreException
{
	boolean useDefaultEngineHome = configuration.getAttribute( ATTR_USE_DEFULT_ENGINE_HOME,
			true );

	if ( delegate == null || !match( useDefaultEngineHome ) )
	{
		if ( useDefaultEngineHome )
		{
			delegate = new ReportOSGiLaunchDelegate( );
		}
		else
		{
			delegate = new ReportStandardAppLaunchDelegate( );
		}
	}
}
 
Example 3
Source File: DistributedTLCJob.java    From tlaplus with MIT License 6 votes vote down vote up
protected List<String> getAdditionalVMArgs() throws CoreException {
	final List<String> additionalVMArgs = super.getAdditionalVMArgs();
	
	// distributed FPSet count
	final ILaunchConfiguration launchConfig = launch.getLaunchConfiguration();
	final int distributedFPSetCount = launchConfig.getAttribute(LAUNCH_DISTRIBUTED_FPSET_COUNT, 0);
	if (distributedFPSetCount > 0) {
		additionalVMArgs.add("-Dtlc2.tool.distributed.TLCServer.expectedFPSetCount=" + distributedFPSetCount);
	}
	
	// Inet Address to listen on
	final String iface = launchConfig.getAttribute(LAUNCH_DISTRIBUTED_INTERFACE, "");
	if (!"".equals(iface)) {
		additionalVMArgs.add("-Djava.rmi.server.hostname=" + iface);
	}
	
	return additionalVMArgs;
}
 
Example 4
Source File: PipelineLaunchConfiguration.java    From google-cloud-eclipse with Apache License 2.0 6 votes vote down vote up
private void setValuesFromLaunchConfiguration(ILaunchConfiguration configuration)
    throws CoreException {
  // never set a default runner unless actually specified
  String runnerArgument = configuration
      .getAttribute(PipelineConfigurationAttr.RUNNER_ARGUMENT.toString(), (String) null);
  if (runnerArgument != null) {
    setRunner(PipelineRunner.fromRunnerName(runnerArgument));
  }

  setUseDefaultLaunchOptions(configuration.getAttribute(
      PipelineConfigurationAttr.USE_DEFAULT_LAUNCH_OPTIONS.toString(),
      isUseDefaultLaunchOptions()));

  setArgumentValues(configuration.getAttribute(
      PipelineConfigurationAttr.ALL_ARGUMENT_VALUES.toString(), getArgumentValues()));

  setUserOptionsName(configuration.getAttribute(
      PipelineConfigurationAttr.USER_OPTIONS_NAME.toString(), getUserOptionsName()));
}
 
Example 5
Source File: FatJarPackageWizardPage.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
public static Object[] getSelectedElementsWithoutContainedChildren(ILaunchConfiguration launchconfig, JarPackageData data, IRunnableContext context, MultiStatus status) throws CoreException {
	if (launchconfig == null)
		return new Object[0];

	String projectName= launchconfig.getAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, ""); //$NON-NLS-1$

	IPath[] classpath= getClasspath(launchconfig);
	IPackageFragmentRoot[] classpathResources= getRequiredPackageFragmentRoots(classpath, projectName, status);

	String mainClass= getMainClass(launchconfig, status);
	IType mainType= findMainMethodByName(mainClass, classpathResources, context);
	if (mainType == null) {
		status.add(new Status(IStatus.ERROR, JavaUI.ID_PLUGIN, FatJarPackagerMessages.FatJarPackageWizardPage_error_noMainMethod));
	}
	data.setManifestMainClass(mainType);

	return classpathResources;
}
 
Example 6
Source File: FlexMavenPackagedProjectStagingDelegateTest.java    From google-cloud-eclipse with Apache License 2.0 6 votes vote down vote up
@Test
public void testCreateMavenPackagingLaunchConfiguration() throws CoreException {
  IProject project = projectCreator.getProject();

  ILaunchConfiguration launchConfig =
      FlexMavenPackagedProjectStagingDelegate.createMavenPackagingLaunchConfiguration(project);

  boolean privateConfig = launchConfig.getAttribute(ILaunchManager.ATTR_PRIVATE, false);
  assertTrue(privateConfig);

  boolean launchInBackground = launchConfig.getAttribute(
      "org.eclipse.debug.ui.ATTR_LAUNCH_IN_BACKGROUND", false);
  assertTrue(launchInBackground);

  String jreContainerPath = launchConfig.getAttribute(
      IJavaLaunchConfigurationConstants.ATTR_JRE_CONTAINER_PATH, "");
  assertEquals("org.eclipse.jdt.launching.JRE_CONTAINER/"
      + "org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7", jreContainerPath);

  String pomDirectory = launchConfig.getAttribute(MavenLaunchConstants.ATTR_POM_DIR, "");
  assertEquals(project.getLocation().toString(), pomDirectory);

  String mavenGoals = launchConfig.getAttribute(MavenLaunchConstants.ATTR_GOALS, "");
  assertEquals("package", mavenGoals);
}
 
Example 7
Source File: AbstractUml2SolidityLaunchConfigurationTab.java    From uml2solidity with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * @param configuration
 * @param resourceName
 * @return
 * @throws CoreException
 */
protected IResource findResource(ILaunchConfiguration configuration, String resourceName) throws CoreException {
	String model = configuration.getAttribute(GenerateUml2Solidity.MODEL_URI, "");
	Path path = new Path(model);
	IResource findMember = ResourcesPlugin.getWorkspace().getRoot().findMember(path);
	if (findMember instanceof IFile) {
		IFile f = (IFile) findMember;
		IProject project = f.getProject();
		IResource member = project.findMember(resourceName);
		return member;
	}
	return null;
}
 
Example 8
Source File: RustDebugDelegate.java    From corrosion with Eclipse Public License 2.0 5 votes vote down vote up
@Override
protected ISourceLocator getSourceLocator(ILaunchConfiguration configuration, DsfSession session)
		throws CoreException {
	SourceLookupDirector locator = new SourceLookupDirector();
	String memento = configuration.getAttribute(ILaunchConfiguration.ATTR_SOURCE_LOCATOR_MEMENTO, (String) null);
	if (memento == null) {
		locator.initializeDefaults(configuration);
	} else {
		locator.initializeFromMemento(memento, configuration);
	}
	return locator;
}
 
Example 9
Source File: LocalAppEngineServerLaunchConfigurationDelegate.java    From google-cloud-eclipse with Apache License 2.0 5 votes vote down vote up
/**
 * Pull out a port from the specified attribute on the given {@link ILaunchConfiguration} or
 * {@link IServer} instance.
 *
 * @param defaultPort the port if no port attributes are found
 * @return the port, or {@code defaultPort} if no port was found
 */
@VisibleForTesting
static int getPortAttribute(String attributeName, int defaultPort,
    ILaunchConfiguration configuration, IServer server) {
  int port = -1;
  try {
    port = configuration.getAttribute(attributeName, -1);
  } catch (CoreException ex) {
    logger.log(Level.WARNING, "Unable to retrieve " + attributeName, ex); //$NON-NLS-1$
  }
  if (port < 0) {
    port = server.getAttribute(attributeName, defaultPort);
  }
  return port;
}
 
Example 10
Source File: AndroidEmulatorLaunchShortcut.java    From thym with Eclipse Public License 1.0 5 votes vote down vote up
@Override
protected boolean isCorrectLaunchConfiguration(IProject project,
		ILaunchConfiguration config) throws CoreException {
	if(config.getAttribute(AndroidLaunchConstants.ATTR_IS_DEVICE_LAUNCH, false)){
		return false;
	}
	return super.isCorrectLaunchConfiguration(project, config);
}
 
Example 11
Source File: TestabilityLaunchConfigurationHelper.java    From testability-explorer with Apache License 2.0 5 votes vote down vote up
private boolean isValidToRun(String projectName, ILaunchConfiguration launchConfiguration) throws CoreException {
  boolean runOnEveryBuild =
      launchConfiguration.getAttribute(TestabilityConstants.CONFIGURATION_ATTR_RUN_ON_BUILD,
          false);
  if (runOnEveryBuild
      && !isExistingLaunchConfigWithRunOnBuildOtherThanCurrent(projectName,
          launchConfiguration.getName())) {
    return true;
  }
  return false;
}
 
Example 12
Source File: AbstractSCTLaunchConfigurationDelegate.java    From statecharts with Eclipse Public License 1.0 5 votes vote down vote up
@Override
protected IProject[] getProjectsForProblemSearch(ILaunchConfiguration configuration, String mode)
		throws CoreException {
	String filename = configuration.getAttribute(FILE_NAME, "");
	IResource resource = ResourcesPlugin.getWorkspace().getRoot().findMember(filename);
	return new IProject[] { resource.getProject() };

}
 
Example 13
Source File: GWTJUnitSettingsTab.java    From gwt-eclipse-plugin with Eclipse Public License 1.0 5 votes vote down vote up
private void initializeNotHeadless(ILaunchConfiguration config) {
  boolean notHeadless = GWTLaunchConstants.Defaults.NOT_HEADLESS;
  try {
    notHeadless = config.getAttribute(GWTLaunchConstants.ATTR_NOT_HEADLESS,
        notHeadless);
  } catch (CoreException ce) {
    GWTPluginLog.logError(ce);
  }
  notHeadlessButton.setSelection(notHeadless);
}
 
Example 14
Source File: FatJarPackageWizardPage.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private static String getMainClass(ILaunchConfiguration launchConfig, MultiStatus status) {
	String result= null;
	if (launchConfig != null) {
		try {
			result= launchConfig.getAttribute(IJavaLaunchConfigurationConstants.ATTR_MAIN_TYPE_NAME, (String) null);
		} catch (CoreException e) {
			JavaPlugin.log(e);
		}
	}
	if (result == null) {
		status.add(new Status(IStatus.WARNING, JavaUI.ID_PLUGIN, FatJarPackagerMessages.FatJarPackageWizardPage_LaunchConfigurationWithoutMainType_warning));
		result= ""; //$NON-NLS-1$
	}
	return result;
}
 
Example 15
Source File: FixedFatJarExportPage.java    From sarl with Apache License 2.0 5 votes vote down vote up
private static String getMainClass(ILaunchConfiguration launchConfig, MultiStatus status) {
	String result= null;
	if (launchConfig != null) {
		try {
			result= launchConfig.getAttribute(IJavaLaunchConfigurationConstants.ATTR_MAIN_TYPE_NAME, (String) null);
		} catch (CoreException e) {
			JavaPlugin.log(e);
		}
	}
	if (result == null) {
		status.add(new Status(IStatus.WARNING, JavaUI.ID_PLUGIN, FatJarPackagerMessages.FatJarPackageWizardPage_LaunchConfigurationWithoutMainType_warning));
		result= ""; //$NON-NLS-1$
	}
	return result;
}
 
Example 16
Source File: ProjectBlock.java    From Pydev with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void initializeFrom(ILaunchConfiguration configuration) {
    String projectName = "";
    try {
        projectName = configuration.getAttribute(Constants.ATTR_PROJECT, "");
    } catch (CoreException e) {
    }
    fProjectText.setText(projectName);
}
 
Example 17
Source File: ReportLaunchConfigurationDelegate.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
private String[] getOthersVMArguments( ILaunchConfiguration configuration )
		throws CoreException
{
	// String temp[] = ( new ExecutionArguments( configuration.getAttribute(
	// "vmargs", "" ), "" ) ).getVMArgumentsArray( ); //$NON-NLS-1$
	// //$NON-NLS-2$ //$NON-NLS-3$
	String path = configuration.getAttribute( IMPORTPROJECT, "" ); //$NON-NLS-1$

	String append = "-D" + PROJECT_NAMES_KEY + "=" + path; //$NON-NLS-1$ //$NON-NLS-2$

	String projectClassPaths = finder.getClassPath( );

	String classPath = ""; //$NON-NLS-1$
	// String sourcePath = "";
	if ( projectClassPaths != null && projectClassPaths.length( ) != 0 )
	{
		classPath = "-D" + PROJECT_CLASSPATH_KEY + "=" + projectClassPaths; //$NON-NLS-1$ //$NON-NLS-2$
	}

	String openFiles = "-D" //$NON-NLS-1$
			+ PROJECT_OPENFILES_KEY
			+ "=" //$NON-NLS-1$
			+ configuration.getAttribute( OPENFILENAMES, "" ); //$NON-NLS-1$

	String mode = "-D" + WebViewer.REPORT_DEBUT_MODE + "=" + "TRUE"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
	return new String[]{
			append, classPath, openFiles, mode
	};
}
 
Example 18
Source File: GWTLaunchConfiguration.java    From gwt-eclipse-plugin with Eclipse Public License 1.0 4 votes vote down vote up
private static boolean getBooleanAttribute(ILaunchConfiguration launchConfiguration,
    GWTLaunchAttributes launchAttribute) throws CoreException {
  return launchConfiguration.getAttribute(launchAttribute.getQualifiedName(),
      ((Boolean) launchAttribute.getDefaultValue()).booleanValue());
}
 
Example 19
Source File: AndroidLaunchDelegate.java    From thym with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public boolean preLaunchCheck(ILaunchConfiguration configuration,
		String mode, IProgressMonitor monitor) throws CoreException {
	// Start ADB Server
	boolean runOnDevice = configuration.getAttribute(AndroidLaunchConstants.ATTR_IS_DEVICE_LAUNCH, false);
	AndroidSDKManager sdk = AndroidSDKManager.getManager();
	if(!runOnDevice){
		sdk.killADBServer();
	}
	sdk.startADBServer();

	if(runOnDevice){
		String  serial = configuration.getAttribute(AndroidLaunchConstants.ATTR_DEVICE_SERIAL, (String)null);
		Assert.isNotNull(serial);
		List<AndroidDevice> devices = sdk.listDevices();
		for (AndroidDevice androidDevice : devices) {
			if( !androidDevice.isEmulator()){ // We want a device (not emulator)
				this.device = androidDevice;
			}
			//Prefer the device with given serial if available.
			//This is probably important if there are multiple devices that are
			//connected.
			if(serial.equals(androidDevice.getSerialNumber()))
			{
				this.device = androidDevice;
				break;
			}
		}
		if(this.device != null )
		{
			monitor.done();
			return true;
		}else{
			throw new CoreException(new Status(IStatus.ERROR, AndroidCore.PLUGIN_ID, "Could not establish connection with the device. Please try again."));
		}
	}

	//Run emulator
	AndroidDevice emulator = getEmulator();
	// Do we have any emulators to run on?
	if ( emulator == null ){
		// No emulators lets start an emulator.
		// Check if we have an AVD
		String avdName = selectAVD(configuration, sdk);
		if(monitor.isCanceled()){
			return false;
		}
		//start the emulator.
		IProcess emulatorProcess = sdk.startEmulator(avdName);
		// wait for it to come online
		sdk.waitForEmulator(emulatorProcess, monitor);
	}
	this.device = getEmulator();
	if(this.device == null ){// This is non-sense so is adb
		sdk.killADBServer();
		sdk.startADBServer();
		this.device = getEmulator();
	}
	monitor.done();
	return true;
}
 
Example 20
Source File: LaunchConfigurationUtils.java    From xds-ide with Eclipse Public License 1.0 2 votes vote down vote up
/**
 * Gets the name of the corresponding (XDS IDE) {@link IProject} from the {@link ILaunchConfiguration}
 * @param config
 * @return
 * @throws CoreException
 */
public static String getProjectName(ILaunchConfiguration config)
		throws CoreException {
	return config.getAttribute(ILaunchConfigConst.ATTR_PROJECT_NAME, (String)null);
}