org.eclipse.debug.core.ILaunchConfiguration Java Examples

The following examples show how to use org.eclipse.debug.core.ILaunchConfiguration. 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: ReportLaunchHelper.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
void init( ILaunchConfiguration configuration ) throws CoreException
	{
		fileName = covertVariables( configuration.getAttribute( ATTR_REPORT_FILE_NAME,
				"" ) ); //$NON-NLS-1$
		engineHome = covertVariables( configuration.getAttribute( ATTR_ENGINE_HOME,
				"" ) ); //$NON-NLS-1$
		tempFolder = covertVariables( configuration.getAttribute( ATTR_TEMP_FOLDER,
				"" ) ); //$NON-NLS-1$

//		useDefaultEngineHome = configuration.getAttribute( ATTR_USE_DEFULT_ENGINE_HOME,
//				true );

		targetFormat = configuration.getAttribute( ATTR_TARGET_FORMAT,
				DEFAULT_TARGET_FORMAT );
		isOpenTargetFile = configuration.getAttribute( ATTR_OPEN_TARGET, false );
		debugType = configuration.getAttribute( ATTR_DEBUG_TYPE,
				DEFAULT_DEBUG_TYPE );
		taskType = configuration.getAttribute( ATTR_TASK_TYPE,
				DEFAULT_TASK_TYPE );
	}
 
Example #2
Source File: FlexMavenPackagedProjectStagingDelegate.java    From google-cloud-eclipse with Apache License 2.0 6 votes vote down vote up
@Override
protected IPath getDeployArtifact(IPath safeWorkingDirectory, IProgressMonitor monitor)
    throws CoreException {
  SubMonitor subMonitor = SubMonitor.convert(monitor, 100);

  try {
    ILaunchConfiguration config = createMavenPackagingLaunchConfiguration(project);
    ILaunch launch = config.launch("run", subMonitor.newChild(10));
    if (!waitUntilLaunchTerminates(launch, subMonitor.newChild(90))) {
      throw new OperationCanceledException();
    }
    return getFinalArtifactPath(project);
  } catch (InterruptedException ex) {
    throw new OperationCanceledException();
  }
}
 
Example #3
Source File: SARLRuntimeEnvironmentTab.java    From sarl with Apache License 2.0 6 votes vote down vote up
/** Replies if the selected configuration has a valid version for
 * a SARL application.
 *
 * @param config the configuration.
 * @return <code>true</code> if the JRE is compatible with SARL.
 */
protected boolean isValidJREVersion(ILaunchConfiguration config) {
	final IVMInstall install = this.fJREBlock.getJRE();
	if (install instanceof IVMInstall2) {
		final String version = ((IVMInstall2) install).getJavaVersion();
		if (version == null) {
			setErrorMessage(MessageFormat.format(
					Messages.RuntimeEnvironmentTab_3, install.getName()));
			return false;
		}
		if (!Utils.isCompatibleJDKVersionWhenInSARLProjectClasspath(version)) {
			setErrorMessage(MessageFormat.format(
					Messages.RuntimeEnvironmentTab_4,
					install.getName(),
					version,
					SARLVersion.MINIMAL_JDK_VERSION_IN_SARL_PROJECT_CLASSPATH,
					SARLVersion.INCOMPATIBLE_JDK_VERSION_IN_SARL_PROJECT_CLASSPATH));
			return false;
		}
	}
	return true;
}
 
Example #4
Source File: LogLevelArgumentProcessor.java    From gwt-eclipse-plugin with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public String validate(ILaunchConfiguration launchConfig, IJavaProject javaProject, List<String> programArgs,
    List<String> vmArgs) throws CoreException {

  if (!isApplicable(launchConfig)) {
    return null;
  }

  int logLevelArgIndex = getArgIndex(programArgs);
  if (logLevelArgIndex == -1) {
    return null;
  }

  if (!GWTNature.isGWTProject(javaProject.getProject())) {
    return "Log level argument is only valid for GWT projects";
  }

  String logLevel = LaunchConfigurationProcessorUtilities.getArgValue(programArgs, logLevelArgIndex + 1);
  if (StringUtilities.isEmpty(logLevel)) {
    return "Argument for specifying a log level is missing or invalid";
  }

  return null;
}
 
Example #5
Source File: WebAppLaunchShortcut.java    From gwt-eclipse-plugin with Eclipse Public License 1.0 6 votes vote down vote up
private ILaunchConfiguration searchMatchingUrlAndProject(String startupUrl, IProject project, boolean isExternal,
    ILaunchConfiguration[] configs) throws CoreException {
  List<ILaunchConfiguration> candidates = new ArrayList<ILaunchConfiguration>();

  for (ILaunchConfiguration config : configs) {
    String configUrl = GWTLaunchConfiguration.getStartupUrl(config);

    if (configUrl.equals(startupUrl) && LaunchConfigurationUtilities.getProjectName(config).equals(project.getName())
        && WebAppLaunchConfiguration.getRunServer(config) == !isExternal) {
      candidates.add(config);
    }
  }

  if (candidates.isEmpty()) {
    return null;
  } else if (candidates.size() == 1) {
    return candidates.get(0);
  } else {
    return LaunchConfigurationUtilities.chooseConfiguration(candidates, getShell());
  }
}
 
Example #6
Source File: JVoiceXmlBrowserUI.java    From JVoiceXML with GNU Lesser General Public License v2.1 6 votes vote down vote up
/**
 * Convenience method to set a combo box value from a configuration.
 * 
 * @param configuration
 *            The configuration.
 * @param attribute
 *            Name of the attribute.
 * @param def
 *            Default value.
 * @param combo
 *            The combo box to use for display.
 */
private void getAttribute(final ILaunchConfiguration configuration,
        final String attribute, final String def, final Combo combo) {
    if ((configuration == null) || (combo == null)) {
        return;
    }

    try {
        final Object value = configuration.getAttribute(attribute, def);
        if (value == null) {
            return;
        }

        String str = value.toString();
        if (str.length() == 0) {
            str = def;
        }

        combo.setText(str);
    } catch (CoreException e) {
        e.printStackTrace();
    }
}
 
Example #7
Source File: AbstractDebugAdapterLaunchShortcut.java    From wildwebdeveloper with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * See {@link ILaunchShortcut2#getLaunchConfigurations(ISelection)} for contract.
 * @param file
 * @return
 */
private ILaunchConfiguration[] getLaunchConfigurations(File file) {
	if (file == null || !canLaunch(file)) {
		return null;
	}
	try {
		ILaunchConfiguration[] existing = Arrays.stream(launchManager.getLaunchConfigurations(configType))
				.filter(launchConfig -> match(launchConfig, file)).toArray(ILaunchConfiguration[]::new);
		if (existing.length != 0) {
			return existing;
		}
		return new ILaunchConfiguration[0];
	} catch (CoreException e) {
		ErrorDialog.openError(Display.getDefault().getActiveShell(), "error", e.getMessage(), e.getStatus()); //$NON-NLS-1$
		Activator.getDefault().getLog().log(e.getStatus());
	}
	return new ILaunchConfiguration[0];
}
 
Example #8
Source File: ChromeExecutableTab.java    From wildwebdeveloper with Eclipse Public License 2.0 6 votes vote down vote up
@Override
public void initializeFrom(ILaunchConfiguration configuration) {
	try {
		String browserLocation = configuration.getAttribute(ChromeRunDAPDebugDelegate.RUNTIME_EXECUTABLE, "");
		if (browserLocation.isEmpty()) {
			browserToUse.setSelection(new StructuredSelection(browserLocation));
		} else {
			Optional<IBrowserDescriptor> desc = proposals.stream() //
					.filter(IBrowserDescriptor.class::isInstance) //
					.map(IBrowserDescriptor.class::cast) //
					.filter(it -> browserLocation.equals(it.getLocation())) //
					.findFirst();
			if (desc.isPresent()) {
				desc.ifPresent(it -> browserToUse.setSelection(new StructuredSelection(it)));
			} else {
				if (!proposals.contains(browserLocation)) {
					proposals.add(browserLocation);
				}
				browserToUse.refresh();
				browserToUse.setSelection(new StructuredSelection(browserLocation));
			}
		}
	} catch (CoreException ex) {
		Activator.getDefault().getLog().log(ex.getStatus());
	}
}
 
Example #9
Source File: TypeScriptCompilerLaunchHelper.java    From typescript.java with MIT License 6 votes vote down vote up
private static ILaunchConfiguration chooseLaunchConfiguration(ILaunchConfiguration[] configurations,
		IFile tsconfigFile) {
	String buildFilePath = getBuildPath(tsconfigFile);
	try {
		for (ILaunchConfiguration conf : configurations) {
			String buildFileAttribute = conf.getAttribute(TypeScriptCompilerLaunchConstants.BUILD_PATH,
					(String) null);
			if (buildFilePath.equals(buildFileAttribute)) {
				return conf;
			}
		}
	} catch (CoreException e) {
		TypeScriptCorePlugin.logError(e, e.getMessage());
	}
	return null;
}
 
Example #10
Source File: PrimefacesLaunchConfigurationTab.java    From uml2solidity with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public void initializeFrom(ILaunchConfiguration configuration) {
	try {
		btnGenerateTagLibs.setSelection(configuration.getAttribute(GENERATE_TAG_LIBS, false));
		generateTagLibTargetText
				.setText(configuration.getAttribute(GENERATE_TAG_LIBS_TARGET, DEFAULT_TABLIB_TARGET));
		btnGenerateContractBeans.setSelection(configuration.getAttribute(GENERATE_CONTRACT_BEANS, false));
		generateContractBeansTargetText
				.setText(configuration.getAttribute(GENERATE_CONTRACT_BEANS_TARGET, DEFAULT_CONTRACT_BEANS_TARGET));
		basePackageText.setText(configuration.getAttribute(BASE_PACKAGE, ""));
		btnGenerateApplicationFiles.setSelection(configuration.getAttribute(GENERATE_APPLICATION_FILES, false));
		generateApplicationTargetText.setText(configuration.getAttribute(GENERATE_APPLICATION_FILES_TARGET,
				DEFAULT_GENERATE_APPLICATION_FILES_TARGET));
	} catch (CoreException e) {
		Activator.logError("Error while initialize launch config.", e);
	}
}
 
Example #11
Source File: JVoiceXmlBrowserUI.java    From JVoiceXML with GNU Lesser General Public License v2.1 6 votes vote down vote up
/**
 * Convenience method to set a text value from a configuration
 * 
 * @param configuration
 *            The configuration.
 * @param attribute
 *            Name of the attribute.
 * @param def
 *            Default value.
 * @param text
 *            The text to use for display.
 */
private void getAttribute(final ILaunchConfiguration configuration,
        final String attribute, final String def, final Text text) {
    if ((configuration == null) || (text == null)) {
        return;
    }

    try {
        final Object value = configuration.getAttribute(attribute, def);
        if (value == null) {
            return;
        }

        String str = value.toString();
        if (str.length() == 0) {
            str = def;
        }

        text.setText(str);
    } catch (CoreException e) {
        e.printStackTrace();
    }
}
 
Example #12
Source File: FatJarPackageWizardPage.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
private LaunchConfigurationElement[] getLaunchConfigurations() {
	ArrayList<ExistingLaunchConfigurationElement> result= new ArrayList<ExistingLaunchConfigurationElement>();

	try {
		ILaunchManager manager= DebugPlugin.getDefault().getLaunchManager();
		ILaunchConfigurationType type= manager.getLaunchConfigurationType(IJavaLaunchConfigurationConstants.ID_JAVA_APPLICATION);
		ILaunchConfiguration[] launchconfigs= manager.getLaunchConfigurations(type);

		for (int i= 0; i < launchconfigs.length; i++) {
			ILaunchConfiguration launchconfig= launchconfigs[i];
			if (!launchconfig.getAttribute(IDebugUIConstants.ATTR_PRIVATE, false)) {
				String projectName= launchconfig.getAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, ""); //$NON-NLS-1$
				result.add(new ExistingLaunchConfigurationElement(launchconfig, projectName));
			}
		}
	} catch (CoreException e) {
		JavaPlugin.log(e);
	}

	return result.toArray(new LaunchConfigurationElement[result.size()]);
}
 
Example #13
Source File: DevModeCodeServerPortArgumentProcessor.java    From gwt-eclipse-plugin with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public String validate(ILaunchConfiguration launchConfig, IJavaProject javaProject,
    List<String> programArgs, List<String> vmArgs) throws CoreException {
  int index = getArgIndex(programArgs);
  if (index < 0) {
    return null;
  }

  // last thing on the list, and hence can't have a value
  if (index == programArgs.size() - 1) {
    return CODE_SERVER_PORT_ERROR;
  }

  String value = programArgs.get(index + 1);
  if (value.equals("auto")) {
    return null;
  }

  if (!validatePort(value)) {
    return CODE_SERVER_PORT_ERROR;
  }

  return null;
}
 
Example #14
Source File: HybridProjectLaunchShortcut.java    From thym with Eclipse Public License 1.0 6 votes vote down vote up
private void launch(IProject project) {
	try {
		HybridProject hp = HybridProject.getHybridProject(project);
		if(!validateBuildToolsReady() 
				|| !shouldProceedWithLaunch(hp)
				|| !RequirementsUtility.checkCordovaRequirements() ){
			return;
		}
		ILaunchConfiguration launchConfig = findOrCreateLaunchConfiguration(project);
		ILaunchConfigurationWorkingCopy wc = launchConfig.getWorkingCopy();
		updateLaunchConfiguration(wc);
		launchConfig = wc.doSave();
		DebugUITools.launch(launchConfig, "run");
		
	} catch (CoreException e) {
		if (e.getCause() instanceof IOException) {
			Status status = new Status(IStatus.ERROR, HybridUI.PLUGIN_ID,
					"Unable to complete the build for target plarform",
					e.getCause());
			StatusManager.handle(status);
		}else{
			StatusManager.handle(e);
		}
	}
}
 
Example #15
Source File: AbstractSarlLaunchShortcut.java    From sarl with Apache License 2.0 6 votes vote down vote up
/** Collect the listing of {@link ILaunchConfiguration}s that apply to the given element.
 *
 * @param projectName the name of the project.
 * @param fullyQualifiedName the element.
 * @return the list of {@link ILaunchConfiguration}s or an empty list, never {@code null}
 * @throws CoreException if something is going wrong.
 */
protected List<ILaunchConfiguration> getCandidates(String projectName,
		String fullyQualifiedName) throws CoreException {
	final ILaunchConfigurationType ctype = getLaunchManager().getLaunchConfigurationType(getConfigurationType());
	List<ILaunchConfiguration> candidateConfigs = Collections.emptyList();
	final ILaunchConfiguration[] configs = getLaunchManager().getLaunchConfigurations(ctype);
	candidateConfigs = new ArrayList<>(configs.length);
	for (int i = 0; i < configs.length; i++) {
		final ILaunchConfiguration config = configs[i];
		if (Objects.equals(
				getElementQualifiedName(config),
				fullyQualifiedName)
				&& Objects.equals(
						config.getAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, ""), //$NON-NLS-1$
						projectName)) {
			candidateConfigs.add(config);
		}
	}
	return candidateConfigs;
}
 
Example #16
Source File: LaunchModeComputerPDETest.java    From eclipse-extras with Eclipse Public License 1.0 5 votes vote down vote up
@Test
public void testComputeLaunchGroupWithDeletedLaunchConfig() throws CoreException {
  ILaunchMode supportedMode = getSupportedMode();
  ILaunchConfiguration deletedLaunchConfig = launchConfig.doSave();
  deletedLaunchConfig.delete();

  ILaunchGroup launchGroup = new LaunchModeComputer( deletedLaunchConfig, supportedMode ).computeLaunchGroup();

  assertThat( launchGroup ).isNull();
}
 
Example #17
Source File: WebAppMainTab.java    From gwt-eclipse-plugin with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Get the LaunchConfigurator.
 *
 * @param configuration
 * @return the launch configurator.
 * @throws CoreException
 */
private LaunchConfigurationUpdater getLaunchConfigurator(ILaunchConfiguration configuration) throws CoreException {
  IJavaProject javaProject = getJavaProject();
  if (javaProject == null || !javaProject.exists()) {
    return null;
  }

  if (launchConfigurator == null) {
    launchConfigurator = new LaunchConfigurationUpdater(configuration, javaProject);
  }
  return launchConfigurator;
}
 
Example #18
Source File: AbstractMainTab.java    From typescript.java with MIT License 5 votes vote down vote up
/**
 * Updates the working directory widgets to match the state of the given
 * launch configuration.
 */
protected void updateWorkingDirectory(ILaunchConfiguration configuration) {
	String workingDir = IExternalToolConstants.EMPTY_STRING;
	try {
		workingDir = configuration.getAttribute(IExternalToolConstants.ATTR_WORKING_DIRECTORY,
				IExternalToolConstants.EMPTY_STRING);
	} catch (CoreException ce) {
		TypeScriptUIPlugin.log("Error while reading ng configuration", ce);
	}
	workDirectoryField.setText(workingDir);
}
 
Example #19
Source File: SuperDevModeCodeServerMainTypeProcessor.java    From gwt-eclipse-plugin with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * @return whether the main type is one of the SDK-provided main types
 * @throws CoreException
 */
public static boolean isMainTypeFromSdk(ILaunchConfiguration config) throws CoreException {
  String mainTypeName = LaunchConfigurationProcessorUtilities.getMainTypeName(config);
  for (MainType sdkMainType : MainType.values()) {
    if (sdkMainType.mainTypeName.equals(mainTypeName)) {
      return true;
    }
  }

  return false;
}
 
Example #20
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 #21
Source File: CargoTestDelegate.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_TEST_LAUNCH_CONFIG_TYPE_ID);
	if (launchConfiguration instanceof ILaunchConfigurationWorkingCopy) {
		ILaunchConfigurationWorkingCopy wc = (ILaunchConfigurationWorkingCopy) launchConfiguration;
		wc.setAttribute(RustLaunchDelegateTools.PROJECT_ATTRIBUTE, resource.getProject().getName());
	}
	return launchConfiguration;
}
 
Example #22
Source File: LaunchConfigProviderPDETest.java    From eclipse-extras with Eclipse Public License 1.0 5 votes vote down vote up
@Test
public void testKeepWhenMappedProjectWasDeletedAndFilterClosedOptionOn() throws CoreException {
  setFilterLaunchConfigsInClosedProjects( true );
  IResource resource = createLaunchConfigForResource();
  ProjectHelper.delete( resource.getProject() );

  ILaunchConfiguration[] launchConfigs = launchConfigProvider.getLaunchConfigurations();

  assertThat( launchConfigs ).hasSize( 1 );
}
 
Example #23
Source File: AbstractLaunchShortcut.java    From xds-ide with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Show Select Configuration dialog if there are several possible launch configurations
 * @param configs
 * @return null if user canceled dialog
 */
protected ILaunchConfiguration selectConfiguration(List<ILaunchConfiguration> configs) {
	ILaunchConfiguration c = null;
	if (configs.size() == 1) {
           c = configs.get(0);
   	} else if (configs.size() > 1) {
   		// Ask configuration to launch:
   		int selIdx = SimpleListSelectionDialog.Selection(getShell(), 
   				Messages.LaunchShortcut_SelectLaunchCongiguration,
                               Messages.LaunchShortcut_SelectLaunchCongigurationToLaunch+':',
   				ImageUtils.getImage(ImageUtils.XDS_GREEN_IMAGE_16X16),
   				new SimpleListSelectionDialog.ITextProvider() {
   					@Override
   					public String getText(Object o) {
   						if (o instanceof ILaunchConfiguration) {
							ILaunchConfiguration lc = (ILaunchConfiguration) o;
							return lc.getName();
						}
   						else {
   							return StringUtils.EMPTY;
   						}
   					}
   				},
   				configs.toArray(), 
   				null);
           if (selIdx >= 0) {
               c = configs.get(selIdx);
           }
       }
	return c;
}
 
Example #24
Source File: AbstractSARLLaunchConfigurationDelegate.java    From sarl with Apache License 2.0 5 votes vote down vote up
/** Replies the project SRE from the given configuration.
 *
 * @param configuration the configuration to read.
 * @param verify  if true verify the SRE validity, do nothing otherwise
 * @param projectAccessor the accessor to the Java project.
 * @return the project SRE or {@code null}.
 * @throws CoreException Some error occurs when accessing to the ecore elements.
 */
private static ISREInstall getProjectSpecificSRE(ILaunchConfiguration configuration, boolean verify,
		IJavaProjectAccessor projectAccessor) throws CoreException {
	assert projectAccessor != null;
	final IJavaProject jprj = projectAccessor.get(configuration);
	if (jprj != null) {
		final IProject prj = jprj.getProject();
		assert prj != null;

		// Get the SRE from the extension point
		ISREInstall sre = getSREFromExtension(prj, verify);
		if (sre != null) {
			return sre;
		}

		// Get the SRE from the default project configuration
		final ProjectSREProvider provider = new EclipseIDEProjectSREProvider(prj);
		sre = provider.getProjectSREInstall();
		if (sre != null) {
			if (verify) {
				verifySREValidity(sre, sre.getId());
			}
			return sre;
		}
	}
	final ISREInstall sre = SARLRuntime.getDefaultSREInstall();
	if (verify) {
		verifySREValidity(sre, (sre == null) ? Messages.SARLLaunchConfigurationDelegate_8 : sre.getId());
	}
	return sre;
}
 
Example #25
Source File: LaunchShortcutTest.java    From dartboard with Eclipse Public License 2.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
@Test
public void launchShortcut__DartProjectNoLaunchConfig__NewLaunchConfigIsCreated() throws Exception {
	String projectName = RandomString.make(8);
	String mainClass = RandomString.make(4) + ".dart";
	ProjectUtil.createDartProject(projectName);

	ProjectExplorer projectExplorer = new ProjectExplorer();
	projectExplorer.open();
	projectExplorer.getProject(projectName).select();

	new ContextMenuItem(new WithMnemonicTextMatcher("Run As"), new RegexMatcher("\\d Run as Dart Program"))
			.select();

	new WaitUntil(new ShellIsActive("Edit Configuration"));
	new LabeledCombo("Project:").setSelection(projectName);
	new LabeledText("Main class:").setText(mainClass);
	new PushButton("Run").click();
	ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager();

	// Find last launch configuration for selected project.
	ILaunchConfiguration launchConfiguration = null;
	for (ILaunchConfiguration conf : manager.getLaunchConfigurations()) {
		if (conf.getAttribute(Constants.LAUNCH_SELECTED_PROJECT, "").equalsIgnoreCase(projectName)) { //$NON-NLS-1$
			launchConfiguration = conf;
		}
	}

	assertNotNull(launchConfiguration);
	assertEquals(launchConfiguration.getAttribute("main_class", ""), mainClass);

	// Cleanup
	launchConfiguration.delete();
}
 
Example #26
Source File: LaunchConfigurationConfigurator.java    From sarl with Apache License 2.0 5 votes vote down vote up
@Override
public String getJRELaunchingArguments(ILaunchConfiguration configuration) {
	try {
		return Strings.nullToEmpty(configuration.getAttribute(IJavaLaunchConfigurationConstants.ATTR_VM_ARGUMENTS, (String) null));
	} catch (CoreException e) {
		return null;
	}
}
 
Example #27
Source File: WebAppLaunchDelegate.java    From gwt-eclipse-plugin with Eclipse Public License 1.0 5 votes vote down vote up
@Override
protected File getDefaultWorkingDirectory(ILaunchConfiguration configuration) throws CoreException {

  IJavaProject javaProject = getJavaProject(configuration);
  if (javaProject != null && WarArgumentProcessor.doesMainTypeTakeWarArgument(configuration)) {
    WarParser warParser = WarArgumentProcessor.WarParser
        .parse(LaunchConfigurationProcessorUtilities.parseProgramArgs(configuration), javaProject);
    if (warParser.isWarDirValid || warParser.isSpecifiedWithWarArg) {
      return new File(warParser.resolvedUnverifiedWarDir);
    }
  }

  // Fallback on super's implementation
  return super.getDefaultWorkingDirectory(configuration);
}
 
Example #28
Source File: LangLaunchConfigurationDelegate.java    From goclipse with Eclipse Public License 1.0 5 votes vote down vote up
protected CompositeBuildTargetSettings getBuildTargetSettings(ILaunchConfiguration configuration)
		throws CoreException, CommonException {
	BuildTargetLaunchCreator launchSettings = new BuildTargetLaunchCreator(configuration);
	
	BuildTargetSource buildTargetSource = new BuildTargetSource() {
		@Override
		public ProjectValidator getProjectValidator() {
			return new ProjectValidator();
		};
		
		@Override
		public String getProjectName() {
			return launchSettings.projectName;
		}
		
		@Override
		public String getBuildTargetName() {
			return launchSettings.getTargetName();
		}
	};
	
	return new CompositeBuildTargetSettings(buildTargetSource) {
		@Override
		public String getExecutablePath() {
			return launchSettings.getExecutablePath();
		}
		
		@Override
		public CommandInvocation getBuildCommand() {
			return launchSettings.getBuildCommand();
		}
	};
}
 
Example #29
Source File: SuperDevModeCodeServerMainTypeProcessor.java    From gwt-eclipse-plugin with Eclipse Public License 1.0 5 votes vote down vote up
private static String getPreviouslySetMainTypeName(ILaunchConfiguration config) {
  try {
    return config.getAttribute(ATTR_PREVIOUSLY_SET_MAIN_TYPE_NAME, (String) null);
  } catch (CoreException e) {
    CorePluginLog.logError(e, "Could not restore previously set main type, forcing overwrite.");
    return null;
  }
}
 
Example #30
Source File: TerminateLaunchesActionPDETest.java    From eclipse-extras with Eclipse Public License 1.0 5 votes vote down vote up
@Test
public void testSetSelectionToRunningLaunchConfig() throws CoreException {
  ILaunchConfiguration launchConfig = createRunningLaunchConfig();

  action.setSelection( new StructuredSelection( launchConfig ) );

  assertThat( action.isEnabled() ).isTrue();
}