use of org.eclipse.debug.core.ILaunchConfigurationType in project bndtools by bndtools.
the class AbstractLaunchShortcut method getLaunchConfigsForProject.
protected ILaunchConfiguration[] getLaunchConfigsForProject(@SuppressWarnings("unused") IProject project) {
ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager();
ILaunchConfigurationType type = manager.getLaunchConfigurationType(launchId);
try {
ILaunchConfiguration[] all = manager.getLaunchConfigurations(type);
List<ILaunchConfiguration> result = new ArrayList<ILaunchConfiguration>(all.length);
return result.toArray(new ILaunchConfiguration[0]);
} catch (CoreException e) {
logger.logError("Error retrieving launch configurations.", e);
return null;
}
}
use of org.eclipse.debug.core.ILaunchConfigurationType in project bndtools by bndtools.
the class AbstractLaunchShortcut method createConfiguration.
protected ILaunchConfigurationWorkingCopy createConfiguration(IPath targetPath, IProject targetProject) throws CoreException {
ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager();
ILaunchConfigurationType configType = manager.getLaunchConfigurationType(launchId);
ILaunchConfigurationWorkingCopy wc;
wc = configType.newInstance(null, manager.generateLaunchConfigurationName(targetPath.lastSegment()));
wc.setAttribute(LaunchConstants.ATTR_LAUNCH_TARGET, targetPath.toString());
wc.setAttribute(LaunchConstants.ATTR_CLEAN, LaunchConstants.DEFAULT_CLEAN);
wc.setAttribute(LaunchConstants.ATTR_DYNAMIC_BUNDLES, LaunchConstants.DEFAULT_DYNAMIC_BUNDLES);
if (targetProject != null) {
IJavaProject javaProject = JavaCore.create(targetProject);
if (javaProject.exists()) {
wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, targetProject.getName());
}
}
return wc;
}
use of org.eclipse.debug.core.ILaunchConfigurationType in project titan.EclipsePlug-ins by eclipse.
the class LaunchShortcut method getWorkingCopy.
protected ILaunchConfigurationWorkingCopy getWorkingCopy(final IProject project, final IFile file, final String mode) {
try {
final ILaunchConfigurationType configurationType = DebugPlugin.getDefault().getLaunchManager().getLaunchConfigurationType(getConfigurationId());
final ILaunchConfiguration[] configurations = DebugPlugin.getDefault().getLaunchManager().getLaunchConfigurations(configurationType);
final List<ILaunchConfiguration> candidateConfigurations = new ArrayList<ILaunchConfiguration>();
for (ILaunchConfiguration configuration : configurations) {
IResource[] resources = configuration.getMappedResources();
if (null != resources) {
boolean found = false;
for (IResource resource : resources) {
if (file.equals(resource)) {
found = true;
}
}
if (found) {
candidateConfigurations.add(configuration);
}
}
}
if (1 == candidateConfigurations.size()) {
candidateConfigurations.get(0).launch(mode, null);
return null;
} else if (candidateConfigurations.size() > 1) {
ILabelProvider labelProvider = DebugUITools.newDebugModelPresentation();
ElementListSelectionDialog dialog = new ElementListSelectionDialog(null, labelProvider);
dialog.setTitle(getDialogTitle());
dialog.setMessage("Select existing configuration:");
dialog.setElements(candidateConfigurations.toArray(new ILaunchConfiguration[candidateConfigurations.size()]));
if (dialog.open() == Window.OK) {
ILaunchConfiguration result = (ILaunchConfiguration) dialog.getFirstResult();
result.launch(mode, null);
labelProvider.dispose();
return null;
}
labelProvider.dispose();
}
final String configurationName = "new configuration (" + file.getFullPath().toString().replace("/", "__") + ")";
ILaunchConfigurationWorkingCopy wc = configurationType.newInstance(null, configurationName);
wc.setMappedResources(new IResource[] { project });
wc.setAttribute(EXECUTECONFIGFILEONLAUNCH, true);
return wc;
} catch (CoreException e) {
ErrorReporter.logExceptionStackTrace(e);
return null;
}
}
use of org.eclipse.debug.core.ILaunchConfigurationType in project titan.EclipsePlug-ins by eclipse.
the class LaunchShortcutConfig method getWorkingCopy.
protected ILaunchConfigurationWorkingCopy getWorkingCopy(final IProject project, final IFile file, final String mode) {
try {
final ILaunchConfigurationType configurationType = DebugPlugin.getDefault().getLaunchManager().getLaunchConfigurationType(getConfigurationId());
final ILaunchConfiguration[] configurations = DebugPlugin.getDefault().getLaunchManager().getLaunchConfigurations(configurationType);
final List<ILaunchConfiguration> candidateConfigurations = new ArrayList<ILaunchConfiguration>();
for (ILaunchConfiguration configuration : configurations) {
IResource[] resources = configuration.getMappedResources();
if (null != resources) {
boolean found = false;
for (IResource resource : resources) {
if (file.equals(resource)) {
found = true;
}
}
if (found) {
candidateConfigurations.add(configuration);
}
}
}
if (1 == candidateConfigurations.size()) {
candidateConfigurations.get(0).launch(mode, null);
return null;
} else if (candidateConfigurations.size() > 1) {
final ILabelProvider labelProvider = DebugUITools.newDebugModelPresentation();
final ElementListSelectionDialog dialog = new ElementListSelectionDialog(null, labelProvider);
dialog.setTitle(getDialogTitle());
dialog.setMessage("Select existing configuration.");
dialog.setElements(candidateConfigurations.toArray(new ILaunchConfiguration[candidateConfigurations.size()]));
if (dialog.open() == Window.OK) {
final ILaunchConfiguration result = (ILaunchConfiguration) dialog.getFirstResult();
result.launch(mode, null);
labelProvider.dispose();
return null;
}
labelProvider.dispose();
}
// size() == 0 case: create new configuration
final String configurationName = "new configuration (" + file.getFullPath().toString().replace("/", "__") + ")";
final ILaunchConfigurationWorkingCopy wc = configurationType.newInstance(null, configurationName);
wc.setMappedResources(new IResource[] { project, file });
wc.setAttribute(EXECUTECONFIGFILEONLAUNCH, true);
return wc;
} catch (CoreException e) {
ErrorReporter.logExceptionStackTrace(e);
return null;
}
}
use of org.eclipse.debug.core.ILaunchConfigurationType in project jbosstools-hibernate by jbosstools.
the class HibernateJpaPlatformUi method createDefaultLaunchConfig.
public static ILaunchConfigurationWorkingCopy createDefaultLaunchConfig(String projectName) {
ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
ILaunchConfigurationType launchConfigurationType = launchManager.getLaunchConfigurationType(LaunchConfigurationType_ID);
ILaunchConfigurationWorkingCopy wc = null;
try {
// $NON-NLS-1$
wc = launchConfigurationType.newInstance(null, projectName + "-hibernate-generate");
// Create exporters
List<String> exporters = new ArrayList<String>();
exporters.add(exporter_id);
wc.setAttribute(HibernateLaunchConstants.ATTR_EXPORTERS, exporters);
wc.setAttribute(full_exporter_id, true);
} catch (CoreException e) {
HibernateJptUIPlugin.logException(e);
}
return wc;
}
Aggregations