当前位置: 首页>>代码示例>>Java>>正文


Java ILaunchManager类代码示例

本文整理汇总了Java中org.eclipse.debug.core.ILaunchManager的典型用法代码示例。如果您正苦于以下问题:Java ILaunchManager类的具体用法?Java ILaunchManager怎么用?Java ILaunchManager使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ILaunchManager类属于org.eclipse.debug.core包,在下文中一共展示了ILaunchManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: launchFile

import org.eclipse.debug.core.ILaunchManager; //导入依赖的package包/类
/**
 * Launch a file, using the file information, which means using default launch configurations.
 */
protected void launchFile(IFile originalFileToRun, String mode) {
	final String runnerId = getRunnerId();
	final String path = originalFileToRun.getFullPath().toOSString();
	final URI moduleToRun = URI.createPlatformResourceURI(path, true);

	final String implementationId = chooseImplHelper.chooseImplementationIfRequired(runnerId, moduleToRun);
	if (implementationId == ChooseImplementationHelper.CANCEL)
		return;

	RunConfiguration runConfig = runnerFrontEnd.createConfiguration(runnerId, implementationId, moduleToRun);

	ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
	ILaunchConfigurationType type = launchManager.getLaunchConfigurationType(getLaunchConfigTypeID());
	DebugUITools.launch(runConfigConverter.toLaunchConfiguration(type, runConfig), mode);
	// execution dispatched to proper delegate LaunchConfigurationDelegate
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:20,代码来源:AbstractRunnerLaunchShortcut.java

示例2: getLaunchConfiguration

import org.eclipse.debug.core.ILaunchManager; //导入依赖的package包/类
public ILaunchConfiguration getLaunchConfiguration(String projectName) {
  try {
    ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
    ILaunchConfigurationType type = launchManager
        .getLaunchConfigurationType(JSTD_LAUNCH_CONFIGURATION_TYPE);
    ILaunchConfiguration[] launchConfigurations = launchManager.getLaunchConfigurations(type);
    for (ILaunchConfiguration launchConfiguration : launchConfigurations) {
      String configProjectName =
          launchConfiguration.getAttribute(LaunchConfigurationConstants.PROJECT_NAME,
              "");
      if (configProjectName.equals(projectName)
          && isValidToRun(projectName, launchConfiguration)) {
        return launchConfiguration;
      }
    }
  } catch (CoreException e) {
    //logger.logException(e);
  }
  return null;
}
 
开发者ID:BladeRunnerJS,项目名称:brjs-JsTestDriver,代码行数:21,代码来源:JavascriptLaunchConfigurationHelper.java

示例3: addLaunchCfg

import org.eclipse.debug.core.ILaunchManager; //导入依赖的package包/类
private void addLaunchCfg() {
	try {
		ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager();
		ILaunchConfigurationType type = manager
				.getLaunchConfigurationType("org.eclipse.pde.ui.RuntimeWorkbench");
		ILaunchConfiguration[] lcs = manager.getLaunchConfigurations(type);
		List<ILaunchConfiguration> configList = Arrays.asList(lcs);
		List<String> configs = configList.stream().map(config -> config.getName()).collect(Collectors.toList());
		ComboDialog dialog = new ComboDialog(getShell(), true);
		dialog.setTitle("Choose launch config");
		dialog.setInfoText("Choose Eclipse launch conguration to edit it's configuration settings");
		dialog.setAllowedValues(configs);
		if (dialog.open() == OK) {
			String selectedName = dialog.getValue();
			ILaunchConfiguration selectedConfig = configList.stream().filter(config -> selectedName.equals(config.getName())).findFirst().get();
			String configLocation = getConfigLocation(selectedConfig);
			valueAdded(new File(configLocation, ".settings").getAbsolutePath());
			buttonPressed(IDialogConstants.OK_ID);
		}
	} catch (CoreException e) {
		PrefEditorPlugin.log(e);
	}
}
 
开发者ID:32kda,项目名称:com.onpositive.prefeditor,代码行数:24,代码来源:FolderSelectionDialog.java

示例4: findEnablementConfiguration

import org.eclipse.debug.core.ILaunchManager; //导入依赖的package包/类
private IConfigurationElement findEnablementConfiguration(
    String delegateShortcutID) {
  IConfigurationElement[] configs = Platform.getExtensionRegistry()
      .getConfigurationElementsFor("org.eclipse.debug.ui.launchShortcuts"); //$NON-NLS-1$
  for (final IConfigurationElement config : configs) {
    if (!delegateShortcutID.equals(config.getAttribute("id")))continue; //$NON-NLS-1$
    String modes = config.getAttribute("modes"); //$NON-NLS-1$
    if (modes == null)
      continue;
    if (!Arrays.asList(modes.split("\\W")).contains(ILaunchManager.RUN_MODE))continue; //$NON-NLS-1$
    IConfigurationElement[] launch = config.getChildren("contextualLaunch"); //$NON-NLS-1$
    if (launch.length != 1)
      continue;
    IConfigurationElement[] enablement = launch[0]
        .getChildren(ExpressionTagNames.ENABLEMENT);
    if (enablement.length == 1)
      return enablement[0];
  }
  return null;
}
 
开发者ID:eclipse,项目名称:eclemma,代码行数:21,代码来源:ContextualLaunchableTester.java

示例5: createMavenPackagingLaunchConfiguration

import org.eclipse.debug.core.ILaunchManager; //导入依赖的package包/类
@VisibleForTesting
static ILaunchConfiguration createMavenPackagingLaunchConfiguration(IProject project)
    throws CoreException {
  ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
  ILaunchConfigurationType launchConfigurationType = launchManager
      .getLaunchConfigurationType(MavenLaunchConstants.LAUNCH_CONFIGURATION_TYPE_ID);

  String launchConfigName = "CT4E App Engine flexible Maven deploy artifact packaging "
      + project.getLocation().toString().replaceAll("[^a-zA-Z0-9]", "_");

  ILaunchConfigurationWorkingCopy workingCopy = launchConfigurationType.newInstance(
      null /*container*/, launchConfigName);
  workingCopy.setAttribute(ILaunchManager.ATTR_PRIVATE, true);
  // IDebugUIConstants.ATTR_LAUNCH_IN_BACKGROUND;
  workingCopy.setAttribute("org.eclipse.debug.ui.ATTR_LAUNCH_IN_BACKGROUND", true);
  workingCopy.setAttribute(MavenLaunchConstants.ATTR_POM_DIR, project.getLocation().toString());
  workingCopy.setAttribute(MavenLaunchConstants.ATTR_GOALS, "package");
  workingCopy.setAttribute(RefreshUtil.ATTR_REFRESH_SCOPE, "${project}");
  workingCopy.setAttribute(RefreshUtil.ATTR_REFRESH_RECURSIVE, true);

  IPath jreContainerPath = getJreContainerPath(project);
  workingCopy.setAttribute(
      IJavaLaunchConfigurationConstants.ATTR_JRE_CONTAINER_PATH, jreContainerPath.toString());

  return workingCopy;
}
 
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-eclipse,代码行数:27,代码来源:FlexMavenPackagedProjectStagingDelegate.java

示例6: testGenerateRunConfiguration

import org.eclipse.debug.core.ILaunchManager; //导入依赖的package包/类
@Test
public void testGenerateRunConfiguration() throws CoreException {
  when(launchConfiguration.getAttribute(anyString(), anyString()))
      .thenAnswer(AdditionalAnswers.returnsSecondArg());
  when(launchConfiguration.getAttribute(anyString(), anyInt()))
      .thenAnswer(AdditionalAnswers.returnsSecondArg());
  when(server.getAttribute(anyString(), anyString()))
      .thenAnswer(AdditionalAnswers.returnsSecondArg());
  when(server.getAttribute(anyString(), anyInt()))
      .thenAnswer(AdditionalAnswers.returnsSecondArg());

  DefaultRunConfiguration config = new LocalAppEngineServerLaunchConfigurationDelegate()
      .generateServerRunConfiguration(launchConfiguration, server, ILaunchManager.RUN_MODE);
  assertNull(config.getHost());
  assertEquals((Integer) LocalAppEngineServerBehaviour.DEFAULT_SERVER_PORT, config.getPort());
  assertNull(config.getApiPort());
  assertNull(config.getJvmFlags());
  verify(server, atLeastOnce()).getHost();
  verify(launchConfiguration, atLeastOnce()).getAttribute(anyString(), anyInt());
  verify(server, atLeastOnce()).getAttribute(anyString(), anyInt());
}
 
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-eclipse,代码行数:22,代码来源:LocalAppEngineServerLaunchConfigurationDelegateTest.java

示例7: testGenerateRunConfiguration_withServerPort

import org.eclipse.debug.core.ILaunchManager; //导入依赖的package包/类
@Test
public void testGenerateRunConfiguration_withServerPort() throws CoreException {
  when(launchConfiguration.getAttribute(anyString(), anyString()))
      .thenAnswer(AdditionalAnswers.returnsSecondArg());
  when(launchConfiguration
      .getAttribute(eq(LocalAppEngineServerBehaviour.SERVER_PORT_ATTRIBUTE_NAME), anyInt()))
          .thenReturn(9999);

  DefaultRunConfiguration config = new LocalAppEngineServerLaunchConfigurationDelegate()
      .generateServerRunConfiguration(launchConfiguration, server, ILaunchManager.RUN_MODE);

  assertNotNull(config.getPort());
  assertEquals(9999, (int) config.getPort());
  verify(launchConfiguration)
      .getAttribute(eq(LocalAppEngineServerBehaviour.SERVER_PORT_ATTRIBUTE_NAME), anyInt());
  verify(server, never()).getAttribute(anyString(), anyInt());
}
 
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-eclipse,代码行数:18,代码来源:LocalAppEngineServerLaunchConfigurationDelegateTest.java

示例8: testGenerateRunConfiguration_withAdminPortWhenDevAppserver2

import org.eclipse.debug.core.ILaunchManager; //导入依赖的package包/类
@Test
public void testGenerateRunConfiguration_withAdminPortWhenDevAppserver2() throws CoreException {
  Assume.assumeTrue(LocalAppEngineServerLaunchConfigurationDelegate.DEV_APPSERVER2);

  when(launchConfiguration.getAttribute(anyString(), anyString()))
      .thenAnswer(AdditionalAnswers.returnsSecondArg());
  when(launchConfiguration
      .getAttribute(eq(LocalAppEngineServerBehaviour.ADMIN_PORT_ATTRIBUTE_NAME), anyInt()))
          .thenReturn(9999);

  DefaultRunConfiguration config = new LocalAppEngineServerLaunchConfigurationDelegate()
      .generateServerRunConfiguration(launchConfiguration, server, ILaunchManager.RUN_MODE);

  assertNull(config.getAdminPort());
  verify(launchConfiguration, never())
      .getAttribute(eq(LocalAppEngineServerBehaviour.ADMIN_PORT_ATTRIBUTE_NAME), anyInt());
  verify(server, never())
      .getAttribute(eq(LocalAppEngineServerBehaviour.ADMIN_PORT_ATTRIBUTE_NAME), anyInt());
}
 
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-eclipse,代码行数:20,代码来源:LocalAppEngineServerLaunchConfigurationDelegateTest.java

示例9: testGenerateRunConfiguration_withEnvironment

import org.eclipse.debug.core.ILaunchManager; //导入依赖的package包/类
@Test
public void testGenerateRunConfiguration_withEnvironment() throws CoreException {
  Map<String, String> definedMap = new HashMap<>();
  definedMap.put("foo", "bar");
  definedMap.put("baz", "${env_var:PATH}");
  when(launchConfiguration.getAttribute(eq(ILaunchManager.ATTR_ENVIRONMENT_VARIABLES),
      anyMapOf(String.class, String.class)))
      .thenReturn(definedMap);

  DefaultRunConfiguration config = new LocalAppEngineServerLaunchConfigurationDelegate()
      .generateServerRunConfiguration(launchConfiguration, server, ILaunchManager.RUN_MODE);

  Map<String, String> parsedEnvironment = config.getEnvironment();
  assertNotNull(parsedEnvironment);
  assertEquals("bar", parsedEnvironment.get("foo"));
  assertEquals(System.getenv("PATH"), parsedEnvironment.get("baz"));
  verify(launchConfiguration).getAttribute(eq(ILaunchManager.ATTR_ENVIRONMENT_VARIABLES),
      anyMapOf(String.class, String.class));
  verify(launchConfiguration, atLeastOnce())
      .getAttribute(eq(ILaunchManager.ATTR_APPEND_ENVIRONMENT_VARIABLES),
      anyBoolean());
}
 
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-eclipse,代码行数:23,代码来源:LocalAppEngineServerLaunchConfigurationDelegateTest.java

示例10: testPerformApply_activated

import org.eclipse.debug.core.ILaunchManager; //导入依赖的package包/类
@Test
public void testPerformApply_activated() throws CoreException {
  mockLaunchConfig("[email protected]", "project-A", "/usr/home/key.json");
  tab.activated(launchConfig);

  accountSelector.selectAccount("[email protected]");
  projectSelector.selectProjectId("project-C");
  serviceKeyText.setText("/tmp/keys/another.json");

  tab.deactivated(launchConfig);

  verify(launchConfig).setAttribute("com.google.cloud.tools.eclipse.gcpEmulation.accountEmail",
      "[email protected]");

  verify(launchConfig).setAttribute(eq(ILaunchManager.ATTR_ENVIRONMENT_VARIABLES),
      mapCaptor.capture());
  assertEquals("project-C", mapCaptor.getValue().get("GOOGLE_CLOUD_PROJECT"));
  assertEquals("/tmp/keys/another.json",
      mapCaptor.getValue().get("GOOGLE_APPLICATION_CREDENTIALS"));
}
 
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-eclipse,代码行数:21,代码来源:GcpLocalRunTabTest.java

示例11: testPerformApply_notActivated

import org.eclipse.debug.core.ILaunchManager; //导入依赖的package包/类
@Test
public void testPerformApply_notActivated() throws CoreException {
  mockLaunchConfig("[email protected]", "project-A", "/usr/home/key.json");
  tab.initializeFrom(launchConfig);

  accountSelector.selectAccount("[email protected]");
  projectSelector.selectProjectId("project-C");
  serviceKeyText.setText("/tmp/keys/another.json");

  tab.performApply(launchConfig);

  verify(launchConfig, never()).setAttribute(
      "com.google.cloud.tools.eclipse.gcpEmulation.accountEmail", "[email protected]");
  verify(launchConfig, never()).setAttribute(
      eq(ILaunchManager.ATTR_ENVIRONMENT_VARIABLES),
      Matchers.anyMapOf(String.class, String.class));
}
 
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-eclipse,代码行数:18,代码来源:GcpLocalRunTabTest.java

示例12: getParameterValues

import org.eclipse.debug.core.ILaunchManager; //导入依赖的package包/类
@Override
@SuppressWarnings("rawtypes")
public Map getParameterValues() {
  ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager();
  Map<String, String> modes = new HashMap<>();
  for (String modeId : LocalAppEngineServerLaunchConfigurationDelegate.SUPPORTED_LAUNCH_MODES) {
    ILaunchMode mode = manager.getLaunchMode(modeId);
    if (mode != null) {
      // label is intended to be shown in menus and buttons and often has
      // embedded '&' for mnemonics, which isn't useful here
      String label = mode.getLabel();
      label = label.replace("&", "");
      modes.put(label, mode.getIdentifier());
    }
  }
  return modes;
}
 
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-eclipse,代码行数:18,代码来源:LaunchModes.java

示例13: testCreateMavenPackagingLaunchConfiguration

import org.eclipse.debug.core.ILaunchManager; //导入依赖的package包/类
@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);
}
 
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-eclipse,代码行数:26,代码来源:FlexMavenPackagedProjectStagingDelegateTest.java

示例14: getConfigurations

import org.eclipse.debug.core.ILaunchManager; //导入依赖的package包/类
private ILaunchConfiguration[] getConfigurations(IFile file) {
	ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager();
	ILaunchConfigurationType type = manager.getLaunchConfigurationType(LAUNCH_CONFIG_TYPE_CODE_ANALYSIS);
	try {
		// configurations that match the given resource
		List<ILaunchConfiguration> configs = new ArrayList<ILaunchConfiguration>();

		// candidates
		ILaunchConfiguration[] candidates = manager.getLaunchConfigurations(type);
		String name = FileUtils.getRelativePath(file);
		for (ILaunchConfiguration config : candidates) {
			String fileName = config.getAttribute(CAL_XDF.longName(), "");
			if (fileName.equals(name)) {
				configs.add(config);
			}
		}

		return configs.toArray(new ILaunchConfiguration[] {});
	} catch (Exception e) {
		e.printStackTrace();
		return null;
	}
}
 
开发者ID:turnus,项目名称:turnus.orcc,代码行数:24,代码来源:OrccCodeAnalysisLaunchShortcut.java

示例15: getConfigurations

import org.eclipse.debug.core.ILaunchManager; //导入依赖的package包/类
private ILaunchConfiguration[] getConfigurations(IFile file) {
	ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager();
	ILaunchConfigurationType type = manager.getLaunchConfigurationType(LAUNCH_CONFIG_TYPE_NUMA_EXECUTION_ANALYSIS);
	try {
		// configurations that match the given resource
		List<ILaunchConfiguration> configs = new ArrayList<ILaunchConfiguration>();

		// candidates
		ILaunchConfiguration[] candidates = manager.getLaunchConfigurations(type);
		String name = FileUtils.getRelativePath(file);
		for (ILaunchConfiguration config : candidates) {
			String fileName = config.getAttribute(CAL_XDF.longName(), "");
			if (fileName.equals(name)) {
				configs.add(config);
			}
		}

		return configs.toArray(new ILaunchConfiguration[] {});
	} catch (Exception e) {
		e.printStackTrace();
		return null;
	}
}
 
开发者ID:turnus,项目名称:turnus.orcc,代码行数:24,代码来源:OrccNumaExecutionLaunchShortcut.java


注:本文中的org.eclipse.debug.core.ILaunchManager类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。