Search in sources :

Example 11 with IContributionItem

use of org.eclipse.jface.action.IContributionItem in project tdi-studio-se by Talend.

the class AbstractJvmPropertySection method clearStatusLine.

/**
     * Clears the status line.
     */
public void clearStatusLine() {
    IStatusLineManager manager = propertySheet.getViewSite().getActionBars().getStatusLineManager();
    IContributionItem[] items = manager.getItems();
    for (IContributionItem item : items) {
        if (item instanceof StatusLineContributionItem) {
            ((StatusLineContributionItem) item).setText(Util.ZERO_LENGTH_STRING);
        }
    }
}
Also used : StatusLineContributionItem(org.eclipse.jface.action.StatusLineContributionItem) IStatusLineManager(org.eclipse.jface.action.IStatusLineManager) IContributionItem(org.eclipse.jface.action.IContributionItem)

Example 12 with IContributionItem

use of org.eclipse.jface.action.IContributionItem in project tdi-studio-se by Talend.

the class NewActionProvider method fillContextMenu.

/**
     * Adds a submenu to the given menu with the name "New Component".
     */
public void fillContextMenu(IMenuManager menu) {
    for (IContributionItem item : menu.getItems()) {
        if (item == null || item.getId() == null) {
            continue;
        }
        if (item.getId().equals("export") || item.getId().equals("import")) {
            //$NON-NLS-1$ //$NON-NLS-2$
            menu.remove(item);
        }
    }
    // append the submenu after the GROUP_NEW group.
    if (ComponentDesigenerPlugin.getDefault().isUsed()) {
        //$NON-NLS-1$
        IMenuManager submenu = new MenuManager(Messages.getString("NewActionProvider.New"), NEW_MENU_NAME);
        submenu.add(newProjectAction);
        menu.insertAfter(ICommonMenuConstants.GROUP_NEW, submenu);
    }
}
Also used : IContributionItem(org.eclipse.jface.action.IContributionItem) MenuManager(org.eclipse.jface.action.MenuManager) IMenuManager(org.eclipse.jface.action.IMenuManager) IMenuManager(org.eclipse.jface.action.IMenuManager)

Example 13 with IContributionItem

use of org.eclipse.jface.action.IContributionItem in project tdi-studio-se by Talend.

the class TalendPaletteHelper method updatePaletteActions.

private static void updatePaletteActions(IActionBars actionBars, IAction action, boolean isTalendEditor) {
    IToolBarManager toolBarManager = actionBars.getToolBarManager();
    IContributionItem cItem = toolBarManager.find(action.getClass().getCanonicalName());
    if (cItem == null) {
        if (isTalendEditor) {
            toolBarManager.add(action);
        }
    } else {
        if (!isTalendEditor) {
            toolBarManager.remove(new ActionContributionItem(action));
        }
    }
}
Also used : ActionContributionItem(org.eclipse.jface.action.ActionContributionItem) IToolBarManager(org.eclipse.jface.action.IToolBarManager) IContributionItem(org.eclipse.jface.action.IContributionItem)

Example 14 with IContributionItem

use of org.eclipse.jface.action.IContributionItem in project tdi-studio-se by Talend.

the class SWTResourceFilteredTree method updateStatusLine.

/**
     * Updates the status line.
     * 
     * @param resourceElements The SWT resource elements
     */
public void updateStatusLine(ISWTResourceElement[] resourceElements) {
    IStatusLineManager manager = actionBars.getStatusLineManager();
    IContributionItem[] items = manager.getItems();
    StatusLineContributionItem resourceCountContributionItem = null;
    for (IContributionItem item : items) {
        if (item instanceof StatusLineContributionItem) {
            resourceCountContributionItem = (StatusLineContributionItem) item;
        }
    }
    // create the status line
    if (resourceCountContributionItem == null) {
        //$NON-NLS-1$
        resourceCountContributionItem = new StatusLineContributionItem("ResourceCountContributionItem");
        manager.add(resourceCountContributionItem);
    }
    if (resourceElements == null) {
        resourceCountContributionItem.setText(Util.ZERO_LENGTH_STRING);
        return;
    }
    Map<String, Integer> resources = new HashMap<String, Integer>();
    for (ISWTResourceElement resourceElement : resourceElements) {
        //$NON-NLS-1$
        String name = resourceElement.getName().split(" ")[0];
        Integer count = resources.get(name);
        resources.put(name, count == null ? 1 : ++count);
    }
    // set text on status line
    List<String> list = new ArrayList<String>(resources.keySet());
    Collections.sort(list);
    StringBuffer buffer = new StringBuffer();
    //$NON-NLS-1$
    buffer.append("Total: ").append(resourceElements.length);
    for (String name : list) {
        //$NON-NLS-1$
        buffer.append(", ").append(name);
        //$NON-NLS-1$
        buffer.append(": ").append(resources.get(name));
    }
    resourceCountContributionItem.setText(buffer.toString());
}
Also used : StatusLineContributionItem(org.eclipse.jface.action.StatusLineContributionItem) IStatusLineManager(org.eclipse.jface.action.IStatusLineManager) HashMap(java.util.HashMap) IContributionItem(org.eclipse.jface.action.IContributionItem) ArrayList(java.util.ArrayList) ISWTResourceElement(org.talend.designer.runtime.visualization.ISWTResourceElement)

Example 15 with IContributionItem

use of org.eclipse.jface.action.IContributionItem in project sling by apache.

the class ServersActionModeFiddlerActionDelegate method findWstPublishAction.

private void findWstPublishAction() {
    if (wstPublishAction != null) {
        return;
    }
    IContributionItem[] items = actionBars.getToolBarManager().getItems();
    for (IContributionItem item : items) {
        if (item instanceof ActionContributionItem) {
            ActionContributionItem actionItem = (ActionContributionItem) item;
            IAction a = actionItem.getAction();
            if ("org.eclipse.wst.server.publish".equals(a.getActionDefinitionId())) {
                wstPublishAction = actionItem;
            //                    item.setVisible(false);
            //                    actionBars.getToolBarManager().remove(item);
            }
        }
    }
}
Also used : ActionContributionItem(org.eclipse.jface.action.ActionContributionItem) IAction(org.eclipse.jface.action.IAction) IContributionItem(org.eclipse.jface.action.IContributionItem)

Aggregations

IContributionItem (org.eclipse.jface.action.IContributionItem)15 IMenuManager (org.eclipse.jface.action.IMenuManager)5 MenuManager (org.eclipse.jface.action.MenuManager)5 IAction (org.eclipse.jface.action.IAction)4 ActionContributionItem (org.eclipse.jface.action.ActionContributionItem)3 IStatusLineManager (org.eclipse.jface.action.IStatusLineManager)3 IToolBarManager (org.eclipse.jface.action.IToolBarManager)3 StatusLineContributionItem (org.eclipse.jface.action.StatusLineContributionItem)3 RestoreQueryEditorAction (com.cubrid.common.ui.common.action.RestoreQueryEditorAction)2 ActionManager (com.cubrid.common.ui.spi.action.ActionManager)2 ArrayList (java.util.ArrayList)2 ControlContribution (org.eclipse.jface.action.ControlContribution)2 ICoolBarManager (org.eclipse.jface.action.ICoolBarManager)2 IMenuListener (org.eclipse.jface.action.IMenuListener)2 StatusLineManager (org.eclipse.jface.action.StatusLineManager)2 ToolBarContributionItem (org.eclipse.jface.action.ToolBarContributionItem)2 IPreferenceNode (org.eclipse.jface.preference.IPreferenceNode)2 PreferenceManager (org.eclipse.jface.preference.PreferenceManager)2 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)2 SelectionEvent (org.eclipse.swt.events.SelectionEvent)2