Using the following code we can hide or remove a Contribution item from a toolbar or menubar
private void hidePinbuttonFromPropertySheet() { IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
IViewPart view = page.findView(IPageLayout.ID_PROP_SHEET); String id = "";
if(view!=null)
{
for ( IContributionItem item : view.getViewSite().getActionBars().getToolBarManager().getItems()) {
if (item.getId().indexOf("PinPropertySheetAction")!=-1) { id = item.getId();
break;
}
}
view.getViewSite().getActionBars().getToolBarManager().remove(id);
view.getViewSite().getActionBars().getToolBarManager().update(false); } }
private void hidePinbuttonFromPropertySheet() { IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
IViewPart view = page.findView(IPageLayout.ID_PROP_SHEET); String id = "";
if(view!=null)
{
for ( IContributionItem item : view.getViewSite().getActionBars().getToolBarManager().getItems()) {
if (item.getId().indexOf("PinPropertySheetAction")!=-1) { id = item.getId();
break;
}
}
view.getViewSite().getActionBars().getToolBarManager().remove(id);
view.getViewSite().getActionBars().getToolBarManager().update(false); } }
No comments:
Post a Comment