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);
}
}
}
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);
}
}
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));
}
}
}
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());
}
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);
}
}
}
}
Aggregations