Search in sources :

Example 31 with CommandContributionItem

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);
}
Also used : HashMap(java.util.HashMap) CommandContributionItemParameter(org.eclipse.ui.menus.CommandContributionItemParameter) CommandContributionItem(org.eclipse.ui.menus.CommandContributionItem)

Aggregations

CommandContributionItem (org.eclipse.ui.menus.CommandContributionItem)31 CommandContributionItemParameter (org.eclipse.ui.menus.CommandContributionItemParameter)25 IContributionItem (org.eclipse.jface.action.IContributionItem)10 HashMap (java.util.HashMap)7 ArrayList (java.util.ArrayList)4 Separator (org.eclipse.jface.action.Separator)3 ParameterizedCommand (org.eclipse.core.commands.ParameterizedCommand)2 MenuManager (org.eclipse.jface.action.MenuManager)2 IMenuService (org.eclipse.ui.menus.IMenuService)2 UserRefactoringInfo (org.erlide.wrangler.refactoring.backend.UserRefactoringInfo)2 DBException (org.jkiss.dbeaver.DBException)2 DatabaseLoadService (org.jkiss.dbeaver.model.runtime.load.DatabaseLoadService)2 DataTransferNodeDescriptor (org.jkiss.dbeaver.tools.transfer.registry.DataTransferNodeDescriptor)2 DataTransferProcessorDescriptor (org.jkiss.dbeaver.tools.transfer.registry.DataTransferProcessorDescriptor)2 IOException (java.io.IOException)1 StringWriter (java.io.StringWriter)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 DecimalFormat (java.text.DecimalFormat)1 java.util (java.util)1 List (java.util.List)1