use of org.eclipse.debug.core.ILaunchConfiguration in project jbosstools-hibernate by jbosstools.
the class AddConfigurationAction method doAddConfiguration.
protected void doAddConfiguration() {
try {
ILaunchConfiguration wc = createTemporaryLaunchConfiguration();
// $NON-NLS-1$
int res = DebugUITools.openLaunchConfigurationPropertiesDialog(part.getSite().getShell(), wc, "org.eclipse.debug.ui.launchGroup.run");
if (res != Window.OK) {
deleteTemporaryLaunchConfigurations();
} else {
makeTemporaryLaunchConfigurationsPermanent();
}
} catch (CoreException ce) {
HibernateConsolePlugin.getDefault().showError(part.getSite().getShell(), HibernateConsoleMessages.AddConfigurationAction_problem_add_console_config, ce);
}
}
use of org.eclipse.debug.core.ILaunchConfiguration in project n4js by eclipse.
the class XpectRunConfiguration method toLaunchConfiguration.
/**
* 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();
}
use of org.eclipse.debug.core.ILaunchConfiguration in project n4js by eclipse.
the class TestConfigurationConverter method toLaunchConfiguration.
/**
* 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);
}
}
use of org.eclipse.debug.core.ILaunchConfiguration in project usbdm-eclipse-plugins by podonoghue.
the class UsbdmLaunchShortcut method findLaunchConfiguration.
/**
* Locate a configuration to launch the given binary.<br>
* If one cannot be found, create one.
*
* @param bin The binary to launched
*
* @return A re-usable config or <code>null</code> if none.
* @throws Exception
*/
protected ILaunchConfiguration findLaunchConfiguration(IBinary bin) throws Exception {
ILaunchConfigurationType configType = getLaunchConfigType();
List<ILaunchConfiguration> candidateConfigs = Collections.emptyList();
IPath binPath = bin.getResource().getProjectRelativePath();
try {
ILaunchConfiguration[] configs = DebugPlugin.getDefault().getLaunchManager().getLaunchConfigurations(configType);
candidateConfigs = new ArrayList<ILaunchConfiguration>(configs.length);
for (ILaunchConfiguration config : configs) {
IPath programPath = CDebugUtils.getProgramPath(config);
String projectName = CDebugUtils.getProjectName(config);
if (programPath != null && programPath.equals(binPath)) {
if ((projectName != null) && projectName.equals(bin.getCProject().getProject().getName())) {
candidateConfigs.add(config);
}
}
}
} catch (CoreException e) {
System.err.println(e);
}
IProject project = bin.getCProject().getProject();
// If there are no existing configurations associated with the IBinary,
// create one. If there is exactly one configuration associated with the
// IBinary, return it. Otherwise, if there is more than one
// configuration associated with the IBinary, prompt the user to choose
// one.
ILaunchConfiguration configuration = null;
int candidateCount = candidateConfigs.size();
if (candidateCount < 1) {
// Create default launch
configuration = LaunchParameterUtilities.createLaunchConfig(getActiveWorkbenchShell(), project, bin);
} else if (candidateCount == 1) {
configuration = candidateConfigs.get(0);
} else {
// Prompt the user to choose a configuration. A null result means
// the user
// cancelled the dialog, in which case this method returns null,
// since canceling the dialog should also cancel launching
// anything.
configuration = chooseConfiguration(candidateConfigs);
}
return configuration;
}
use of org.eclipse.debug.core.ILaunchConfiguration in project egit by eclipse.
the class CommandConfirmation method confirmHardReset.
/**
* Ask the user to confirm hard reset. Warns the user if a running launch
* could be affected by the reset.
*
* @param shell
* @param repo
* @return {@code true} if the user confirmed hard reset
*/
public static boolean confirmHardReset(Shell shell, final Repository repo) {
String question = UIText.ResetTargetSelectionDialog_ResetConfirmQuestion;
ILaunchConfiguration launch = LaunchFinder.getRunningLaunchConfiguration(Collections.singleton(repo), null);
if (launch != null) {
question = MessageFormat.format(question, "\n\n" + // $NON-NLS-1$
MessageFormat.format(UIText.LaunchFinder_RunningLaunchMessage, launch.getName()));
} else {
// $NON-NLS-1$
question = MessageFormat.format(question, "");
}
MessageDialog messageDialog = new MessageDialog(shell, UIText.ResetTargetSelectionDialog_ResetQuestion, null, question, MessageDialog.QUESTION, new String[] { UIText.CommandConfirmationHardResetDialog_resetButtonLabel, IDialogConstants.CANCEL_LABEL }, 0);
return messageDialog.open() == Window.OK;
}
Aggregations