use of org.eclipse.ui.menus.CommandContributionItem in project dbeaver by serge-rider.
the class NavigatorHandlerObjectCreateNew method makeCreateContributionItem.
private static IContributionItem makeCreateContributionItem(@Nullable IWorkbenchPartSite site, String objectType, String objectTypeName, DBPImage objectIcon, boolean isFolder) {
if (site == null) {
return DUMMY_CONTRIBUTION_ITEM;
}
CommandContributionItemParameter params = new CommandContributionItemParameter(site, NavigatorCommands.CMD_OBJECT_CREATE, NavigatorCommands.CMD_OBJECT_CREATE, CommandContributionItem.STYLE_PUSH);
Map<String, String> parameters = new HashMap<>();
parameters.put(NavigatorCommands.PARAM_OBJECT_TYPE, objectType);
parameters.put(NavigatorCommands.PARAM_OBJECT_TYPE_NAME, objectTypeName);
if (objectIcon != null) {
parameters.put(NavigatorCommands.PARAM_OBJECT_TYPE_ICON, objectIcon.getLocation());
}
if (isFolder) {
parameters.put(NavigatorCommands.PARAM_OBJECT_TYPE_FOLDER, String.valueOf(true));
}
params.parameters = parameters;
return new CommandContributionItem(params);
}
Aggregations