本文整理汇总了Java中org.eclipse.debug.core.ILaunchConfiguration类的典型用法代码示例。如果您正苦于以下问题:Java ILaunchConfiguration类的具体用法?Java ILaunchConfiguration怎么用?Java ILaunchConfiguration使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ILaunchConfiguration类属于org.eclipse.debug.core包,在下文中一共展示了ILaunchConfiguration类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isValid
import org.eclipse.debug.core.ILaunchConfiguration; //导入依赖的package包/类
/**
* (non-Javadoc)
*
* @see org.eclipse.debug.ui.ILaunchConfigurationTab#isValid(org.eclipse.debug.core.ILaunchConfiguration)
**/
@Override
public boolean isValid(ILaunchConfiguration launchConfig) {
setErrorMessage(null);
setMessage(null);
// TODO fix LaunchConfigurationMainTab validation
// String text = fileText.getText();
// if (text.length() > 0) {
// IPath path = new Path(text);
// if (ResourcesPlugin.getWorkspace().getRoot().findMember(path) ==
// null) {
// setErrorMessage("Specified file does not exist");
// return false;
// }
// } else {
// setMessage("Specify an file");
// }
return true;
}
示例2: toLaunchConfiguration
import org.eclipse.debug.core.ILaunchConfiguration; //导入依赖的package包/类
/**
* Creates an {@link ILaunchConfiguration} containing the information of this instance, only available when run
* within the Eclipse IDE. If an {@link ILaunchConfiguration} with the same name has been run before, the instance
* from the launch manager is used. This is usually done in the {@code ILaunchShortcut}.
*
* @see #fromLaunchConfiguration(ILaunchConfiguration)
*/
public ILaunchConfiguration toLaunchConfiguration() throws CoreException {
ILaunchConfiguration[] configs = DebugPlugin.getDefault().getLaunchManager()
.getLaunchConfigurations(configurationType);
boolean configurationHasChanged = false;
for (ILaunchConfiguration config : configs) {
if (configName.equals(config.getName())) {
configurationHasChanged = hasConfigurationChanged(config);
if (!configurationHasChanged) {
return config;
}
}
}
IContainer container = null;
ILaunchConfigurationWorkingCopy workingCopy = configurationType.newInstance(container, configName);
workingCopy.setAttribute(XT_FILE_TO_RUN, xtFileToRun);
workingCopy.setAttribute(WORKING_DIRECTORY, workingDirectory.getAbsolutePath());
return workingCopy.doSave();
}
示例3: toLaunchConfiguration
import org.eclipse.debug.core.ILaunchConfiguration; //导入依赖的package包/类
/**
* Converts a {@link TestConfiguration} to an {@link ILaunchConfiguration}. Will throw a {@link WrappedException} in
* case of error.
*
* @see TestConfiguration#readPersistentValues()
*/
public ILaunchConfiguration toLaunchConfiguration(ILaunchConfigurationType type, TestConfiguration testConfig) {
try {
final ILaunchConfiguration[] configs = DebugPlugin.getDefault().getLaunchManager()
.getLaunchConfigurations(type);
for (ILaunchConfiguration config : configs) {
if (equals(testConfig, config))
return config;
}
final IContainer container = null;
final ILaunchConfigurationWorkingCopy workingCopy = type.newInstance(container, testConfig.getName());
workingCopy.setAttributes(testConfig.readPersistentValues());
return workingCopy.doSave();
} catch (Exception e) {
throw new WrappedException("could not convert N4JS TestConfiguration to Eclipse ILaunchConfiguration", e);
}
}
示例4: toRunConfiguration
import org.eclipse.debug.core.ILaunchConfiguration; //导入依赖的package包/类
/**
* Converts an {@link ILaunchConfiguration} to a {@link RunConfiguration}. Will throw a {@link WrappedException} in
* case of error.
*
* @see RunConfiguration#writePersistentValues(Map)
*/
public RunConfiguration toRunConfiguration(ILaunchConfiguration launchConfig) throws CoreException {
try {
final Map<String, Object> properties = launchConfig.getAttributes();
// special treatment of name required:
// name is already included in 'properties', but we have to make sure that the name is up-to-date
// in case the name of the launch configuration has been changed after the launch configuration
// was created via method #toLaunchConfiguration()
properties.put(RunConfiguration.NAME, launchConfig.getName());
return runnerFrontEnd.createConfiguration(properties);
} catch (Exception e) {
String msg = "Error occurred while trying to launch module.";
if (null != e.getMessage()) {
msg += "\nReason: " + e.getMessage();
}
throw new CoreException(new Status(ERROR, PLUGIN_ID, msg, e));
}
}
示例5: toLaunchConfiguration
import org.eclipse.debug.core.ILaunchConfiguration; //导入依赖的package包/类
/**
* 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);
}
}
示例6: checkFileToRunSupportedByRunner
import org.eclipse.debug.core.ILaunchConfiguration; //导入依赖的package包/类
private boolean checkFileToRunSupportedByRunner(ILaunchConfiguration launchConfig, IResource resource,
@SuppressWarnings("unused") URI resourceUri) {
// note: we know the resource is an IFile because FILE is the only type returned by #getAcceptedResourceTypes()
final IFile fileToRun = (IFile) resource;
final String runnerId = RunnerUiUtils.getRunnerId(launchConfig, false);
if (runnerId == null) {
setErrorMessage("cannot read runner ID from launch configuration");
return false;
}
final Object[] args = new Object[] { runnerId };
// FIXME IDE-1393 once RunnerFrontEnd#canRun() has property tester logic, call it here
boolean isSupported = supportTester.test(
fileToRun, SupportingRunnerPropertyTester.PROPERTY_IS_SUPPORTING_RUNNER, args, "");
if (!isSupported) {
setErrorMessage("runner cannot handle provided file to run");
return false;
}
return true;
}
示例7: getRunnerId
import org.eclipse.debug.core.ILaunchConfiguration; //导入依赖的package包/类
/**
* Read the N4JS runner ID from the given Eclipse launch configuration. Will throw exceptions if 'failFast' is
* <code>true</code>, otherwise will return <code>null</code> in case of error.
*/
public static String getRunnerId(ILaunchConfiguration launchConfig, boolean failFast) {
try {
// 1) simple case: runnerId already defined in launchConfig
final String id = launchConfig.getAttribute(RunConfiguration.RUNNER_ID, (String) null);
if (id != null)
return id;
// 2) tricky case: not set yet, so have to go via the ILaunchConfigurationType or the launchConfig
final ILaunchConfigurationType launchConfigType = launchConfig.getType();
return getRunnerId(launchConfigType, failFast);
} catch (CoreException e) {
if (failFast)
throw new WrappedException(e);
return null;
}
}
示例8: getFirstInstruction
import org.eclipse.debug.core.ILaunchConfiguration; //导入依赖的package包/类
/**
* Gets the first {@link EObject instruction}.
*
* @param configuration
* the {@link ILaunchConfiguration}
* @return the first {@link EObject instruction}
*/
protected EObject getFirstInstruction(ILaunchConfiguration configuration) {
EObject res = null;
final ResourceSet rs = getResourceSet();
try {
rs.getResource(URI.createPlatformResourceURI(configuration.getAttribute(RESOURCE_URI, ""),
true), true);
res = rs.getEObject(URI.createURI(configuration.getAttribute(FIRST_INSTRUCTION_URI, ""),
true), true);
} catch (CoreException e) {
Activator.getDefault().error(e);
}
return res;
}
开发者ID:eclipse,项目名称:gemoc-studio-modeldebugging,代码行数:23,代码来源:AbstractDSLLaunchConfigurationDelegate.java
示例9: initializeFrom
import org.eclipse.debug.core.ILaunchConfiguration; //导入依赖的package包/类
/**
* {@inheritDoc}
*
* @see org.eclipse.debug.ui.ILaunchConfigurationTab#initializeFrom(org.eclipse.debug.core.ILaunchConfiguration)
*/
public void initializeFrom(final ILaunchConfiguration configuration) {
super.initializeFrom(configuration);
disableUpdate = true;
siriusResourceURIText.setText("");
try {
siriusResourceURIText.setText(configuration.getAttribute(
AbstractDSLLaunchConfigurationDelegate.RESOURCE_URI, ""));
} catch (CoreException e) {
Activator.getDefault().error(e);
}
disableUpdate = false;
}
示例10: initializeFrom
import org.eclipse.debug.core.ILaunchConfiguration; //导入依赖的package包/类
/**
* {@inheritDoc}
*
* @see org.eclipse.debug.ui.ILaunchConfigurationTab#initializeFrom(org.eclipse.debug.core.ILaunchConfiguration)
*/
public void initializeFrom(final ILaunchConfiguration configuration) {
disableUpdate = true;
resourceURIText.setText("");
firstInstructionURIText.setText("");
try {
resourceURIText.setText(configuration.getAttribute(
AbstractDSLLaunchConfigurationDelegate.RESOURCE_URI, ""));
firstInstructionURIText.setText(configuration.getAttribute(
AbstractDSLLaunchConfigurationDelegate.FIRST_INSTRUCTION_URI, ""));
} catch (CoreException e) {
Activator.getDefault().error(e);
}
disableUpdate = false;
}
示例11: initializeFrom
import org.eclipse.debug.core.ILaunchConfiguration; //导入依赖的package包/类
@Override
public void initializeFrom(ILaunchConfiguration config) {
try {
mpg.initialize(getModels(config));
fProjText.setText(config.getAttribute(CONFIG_PROJECT, ""));
fModelText.setText(getMainModel(config));
fOmitEmptyEdgeElementsButton.setSelection(Boolean.parseBoolean(config.getAttribute(GW4E_LAUNCH_CONFIGURATION_BUTTON_ID_OMIT_EMPTY_EDGE_DESCRIPTION, "false")));
fStartNodeText.setText(config.getAttribute(CONFIG_LAUNCH_STARTNODE, ""));
fRemoveBlockedElementsButton.setSelection(
new Boolean(config.getAttribute(CONFIG_LAUNCH_REMOVE_BLOCKED_ELEMENT_CONFIGURATION, "true")));
BuildPolicy bp = getMainPathGenerators(config);
if (bp!=null) {
comboViewer.setSelection(new StructuredSelection (bp), true);
}
} catch (CoreException e) {
ResourceManager.logException(e);
}
}
示例12: getModels
import org.eclipse.debug.core.ILaunchConfiguration; //导入依赖的package包/类
private ModelData[] getModels(ILaunchConfiguration config) throws CoreException {
List<ModelData> temp = new ArrayList<ModelData>();
String paths = config.getAttribute(CONFIG_GRAPH_MODEL_PATHS, "");
if (paths == null || paths.trim().length() == 0)
return new ModelData[0];
StringTokenizer st = new StringTokenizer(paths, ";");
st.nextToken(); // the main model path
st.nextToken(); // main model : Always "1"
st.nextToken(); // the main path generator
while (st.hasMoreTokens()) {
String path = st.nextToken();
IFile file = (IFile) ResourceManager
.getResource(new Path(path).toString());
if (file==null) continue;
ModelData data = new ModelData(file);
boolean selected = st.nextToken().equalsIgnoreCase("1");
String pathGenerator = st.nextToken();
data.setSelected(selected);
data.setSelectedPolicy(pathGenerator);
temp.add(data);
}
ModelData[] ret = new ModelData[temp.size()];
temp.toArray(ret);
return ret;
}
示例13: getModels
import org.eclipse.debug.core.ILaunchConfiguration; //导入依赖的package包/类
private ModelData[] getModels(ILaunchConfiguration config) throws CoreException {
List<ModelData> temp = new ArrayList<ModelData>();
String paths = config.getAttribute(CONFIG_GRAPH_MODEL_PATHS, "");
if (paths == null || paths.trim().length() == 0)
return new ModelData[0];
StringTokenizer st = new StringTokenizer(paths, ";");
st.nextToken(); // the main model path
st.nextToken(); // main model : Always "1"
st.nextToken(); // the main path generator
while (st.hasMoreTokens()) {
String path = st.nextToken();
IFile file = (IFile) ResourceManager
.getResource(new Path(path).toString());
if (file==null) continue;
ModelData data = new ModelData(file);
boolean selected = st.nextToken().equalsIgnoreCase("1");
String pathGenerator = st.nextToken();
data.setSelected(selected);
data.setSelectedPolicy(pathGenerator);
if (selected) temp.add(data);
}
ModelData[] ret = new ModelData[temp.size()];
temp.toArray(ret);
return ret;
}
示例14: initializeFrom
import org.eclipse.debug.core.ILaunchConfiguration; //导入依赖的package包/类
@Override
public void initializeFrom(ILaunchConfiguration config) {
try {
mpg.initialize(getModels(config));
fProjText.setText(config.getAttribute(CONFIG_PROJECT, ""));
fModelText.setText(getMainModel(config));
fPrintUnvisitedButton
.setSelection(Boolean.parseBoolean(config.getAttribute(CONFIG_UNVISITED_ELEMENT, "false")));
fVerbosedButton.setSelection(Boolean.parseBoolean(config.getAttribute(CONFIG_VERBOSE, "false")));
fStartNodeText.setText(config.getAttribute(CONFIG_LAUNCH_STARTNODE, ""));
fRemoveBlockedElementsButton.setSelection(
new Boolean(config.getAttribute(CONFIG_LAUNCH_REMOVE_BLOCKED_ELEMENT_CONFIGURATION, "true")));
BuildPolicy bp = getMainPathGenerators(config);
if (bp!=null) {
comboViewer.setSelection(new StructuredSelection (bp), true);
}
} catch (CoreException e) {
ResourceManager.logException(e);
}
}
示例15: updateClassPath
import org.eclipse.debug.core.ILaunchConfiguration; //导入依赖的package包/类
private String [] updateClassPath (ILaunchConfiguration configuration) throws CoreException {
URL resource = this.getClass().getResource(GW4ELaunchConfigurationDelegate.class.getSimpleName() + ".class");
String jarpath = GW4ELaunchConfigurationDelegate.class.getProtectionDomain().getCodeSource().getLocation().getPath ();
try {
resource = FileLocator.toFileURL(resource);
} catch (IOException e) {
ResourceManager.logException(e);
}
String root = resource.toString();
if (root.startsWith("jar:")) {
String vals[] = root.split("/");
for (String val: vals) {
if (val.contains("!")) {
root = val.substring(0, val.length() - 1);
}
}
} else {
int pos = root.indexOf((GW4ELaunchConfigurationDelegate.class.getName() ).replaceAll("\\.", "/"));
root = root.substring(0,pos);
}
String[] defaultCp = getClasspath(configuration);
String[] extendedCp = new String[defaultCp.length+2];
System.arraycopy(defaultCp, 0, extendedCp, 0, defaultCp.length);
extendedCp[extendedCp.length-1] = normalizePath(root);
extendedCp[extendedCp.length-2] = normalizePath(jarpath);
return extendedCp;
}