use of org.eclipse.debug.ui.ILaunchGroup in project linuxtools by eclipse.
the class BuildDockerImageLaunchConfigurationDelegate method launch.
@Override
public void launch(final ILaunchConfiguration configuration, final String mode, final ILaunch launch, final IProgressMonitor monitor) throws CoreException {
final String sourcePathLocation = configuration.getAttribute(SOURCE_PATH_LOCATION, (String) null);
final boolean sourcePathWorkspaceRelativeLocation = configuration.getAttribute(SOURCE_PATH_WORKSPACE_RELATIVE_LOCATION, false);
final IPath sourcePath = BuildDockerImageUtils.getPath(sourcePathLocation, sourcePathWorkspaceRelativeLocation);
final String connectionName = configuration.getAttribute(DOCKER_CONNECTION, (String) null);
final String repoName = configuration.getAttribute(REPO_NAME, (String) null);
final IDockerConnection connection = DockerConnectionManager.getInstance().getConnectionByName(connectionName);
final Map<String, Object> buildOptions = new HashMap<>();
buildOptions.put(QUIET_BUILD, configuration.getAttribute(QUIET_BUILD, false));
buildOptions.put(NO_CACHE, configuration.getAttribute(NO_CACHE, false));
buildOptions.put(RM_INTERMEDIATE_CONTAINERS, configuration.getAttribute(RM_INTERMEDIATE_CONTAINERS, true));
buildOptions.put(FORCE_RM_INTERMEDIATE_CONTAINERS, configuration.getAttribute(FORCE_RM_INTERMEDIATE_CONTAINERS, false));
if (connection != null && sourcePath != null) {
final Job buildImageJob = new BuildDockerImageJob(connection, sourcePath, repoName, buildOptions);
buildImageJob.schedule();
} else {
final ILaunchGroup launchGroup = DebugUITools.getLaunchGroup(configuration, // $NON-NLS-1$
"run");
// prompt the user with the launch configuration editor
Display.getDefault().syncExec(() -> DebugUITools.openLaunchConfigurationDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), configuration, launchGroup.getIdentifier(), null));
}
}
use of org.eclipse.debug.ui.ILaunchGroup in project linuxtools by eclipse.
the class DockerComposeUpLaunchConfigurationDelegate method launch.
@Override
public void launch(final ILaunchConfiguration configuration, final String mode, final ILaunch launch, final IProgressMonitor monitor) throws CoreException {
final String sourcePathLocation = configuration.getAttribute(WORKING_DIR, (String) null);
final boolean sourcePathWorkspaceRelativeLocation = configuration.getAttribute(WORKING_DIR_WORKSPACE_RELATIVE_LOCATION, false);
final IPath sourcePath = BuildDockerImageUtils.getPath(sourcePathLocation, sourcePathWorkspaceRelativeLocation);
final String connectionName = configuration.getAttribute(DOCKER_CONNECTION, (String) null);
final IDockerConnection connection = DockerConnectionManager.getInstance().getConnectionByName(connectionName);
if (connection != null && sourcePath != null) {
final Job dockerComposeUpJob = new DockerComposeUpJob(connection, sourcePath.toOSString(), configuration);
dockerComposeUpJob.schedule();
} else {
final ILaunchGroup launchGroup = DebugUITools.getLaunchGroup(configuration, // $NON-NLS-1$
"run");
// prompt the user with the launch configuration editor
Display.getDefault().syncExec(() -> DebugUITools.openLaunchConfigurationDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), configuration, launchGroup.getIdentifier(), null));
}
}
use of org.eclipse.debug.ui.ILaunchGroup in project dbeaver by dbeaver.
the class DatabaseLaunchContributionItem method fill.
@Override
public void fill(Menu menu, int index) {
Object[] selected = extractSelectedObjects();
int accelerator = 1;
List<ILaunchConfiguration> configurations = extractSharedConfigurations(selected);
for (ILaunchConfiguration configuration : configurations) {
IAction action = DebugUIInternals.createConfigurationAction(configuration, mode, accelerator);
if (action != null) {
accelerator++;
ActionContributionItem item = new ActionContributionItem(action);
item.fill(menu, -1);
}
}
Map<IAction, String> shortcutActions = DebugUIInternals.createShortcutActions(selected, mode, accelerator);
// and there are following shortcuts
if (menu.getItemCount() > 0 && shortcutActions.size() > 0) {
new MenuItem(menu, SWT.SEPARATOR);
}
List<String> categories = new ArrayList<String>();
Set<IAction> actions = shortcutActions.keySet();
for (IAction action : actions) {
String category = shortcutActions.get(action);
// NOTE: category can be null
if (category != null && !categories.contains(category)) {
categories.add(category);
}
ActionContributionItem item = new ActionContributionItem(action);
item.fill(menu, -1);
}
// add in the open ... dialog shortcut(s)
if (categories.isEmpty()) {
if (defaultGroup != null) {
if (accelerator > 1) {
new MenuItem(menu, SWT.SEPARATOR);
}
IAction action = new OpenLaunchDialogAction(defaultGroup.getIdentifier());
ActionContributionItem item = new ActionContributionItem(action);
item.fill(menu, -1);
}
} else {
boolean addedSep = false;
for (String category : categories) {
ILaunchGroup group = defaultGroup;
if (category != null) {
group = groupsByCategory.get(category);
}
if (group != null) {
if (accelerator > 1 && !addedSep) {
new MenuItem(menu, SWT.SEPARATOR);
addedSep = true;
}
IAction action = new OpenLaunchDialogAction(group.getIdentifier());
ActionContributionItem item = new ActionContributionItem(action);
item.fill(menu, -1);
}
}
}
}
use of org.eclipse.debug.ui.ILaunchGroup in project dbeaver by serge-rider.
the class DatabaseLaunchContributionItem method fill.
@Override
public void fill(Menu menu, int index) {
Object[] selected = extractSelectedObjects();
int accelerator = 1;
List<ILaunchConfiguration> configurations = extractSharedConfigurations(selected);
for (ILaunchConfiguration configuration : configurations) {
IAction action = DebugUIInternals.createConfigurationAction(configuration, mode, accelerator);
if (action != null) {
accelerator++;
ActionContributionItem item = new ActionContributionItem(action);
item.fill(menu, -1);
}
}
Map<IAction, String> shortcutActions = DebugUIInternals.createShortcutActions(selected, mode, accelerator);
// and there are following shortcuts
if (menu.getItemCount() > 0 && shortcutActions.size() > 0) {
new MenuItem(menu, SWT.SEPARATOR);
}
List<String> categories = new ArrayList<String>();
Set<IAction> actions = shortcutActions.keySet();
for (IAction action : actions) {
String category = shortcutActions.get(action);
// NOTE: category can be null
if (category != null && !categories.contains(category)) {
categories.add(category);
}
ActionContributionItem item = new ActionContributionItem(action);
item.fill(menu, -1);
}
// add in the open ... dialog shortcut(s)
if (categories.isEmpty()) {
if (defaultGroup != null) {
if (accelerator > 1) {
new MenuItem(menu, SWT.SEPARATOR);
}
IAction action = new OpenLaunchDialogAction(defaultGroup.getIdentifier());
ActionContributionItem item = new ActionContributionItem(action);
item.fill(menu, -1);
}
} else {
boolean addedSep = false;
for (String category : categories) {
ILaunchGroup group = defaultGroup;
if (category != null) {
group = groupsByCategory.get(category);
}
if (group != null) {
if (accelerator > 1 && !addedSep) {
new MenuItem(menu, SWT.SEPARATOR);
addedSep = true;
}
IAction action = new OpenLaunchDialogAction(group.getIdentifier());
ActionContributionItem item = new ActionContributionItem(action);
item.fill(menu, -1);
}
}
}
}
Aggregations