use of org.eclipse.debug.ui.actions.OpenLaunchDialogAction 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.actions.OpenLaunchDialogAction 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