本文整理匯總了Java中org.eclipse.ui.IViewSite.getActionBars方法的典型用法代碼示例。如果您正苦於以下問題:Java IViewSite.getActionBars方法的具體用法?Java IViewSite.getActionBars怎麽用?Java IViewSite.getActionBars使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.ui.IViewSite
的用法示例。
在下文中一共展示了IViewSite.getActionBars方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: init
import org.eclipse.ui.IViewSite; //導入方法依賴的package包/類
@Override
public void init(IPageBookViewPage page, IConsole console) {
IPageSite pageSite = page.getSite();
IWorkbenchPage workbenchPage = pageSite.getPage();
IViewPart viewPart = workbenchPage.findView(IConsoleConstants.ID_CONSOLE_VIEW);
IViewSite viewSite = viewPart.getViewSite();
IActionBars actionBars = viewSite.getActionBars();
IToolBarManager toolBarManager = actionBars.getToolBarManager();
IContributionItem[] items = toolBarManager.getItems();
for(int i = 0; i < items.length; ++i) {
IContributionItem item = items[i];
if(item instanceof ActionContributionItem) {
IAction action = ((ActionContributionItem) item).getAction();
String text = action.getText();
if(text.equals("Pi&n Console") || text.equals("Open Console"))
toolBarManager.remove(item);
}
}
}
示例2: createActions
import org.eclipse.ui.IViewSite; //導入方法依賴的package包/類
/**
* Actions in addition to the standard plotting actions which
* should be shown on the plot.
*
* @param site
*/
private void createActions(IViewSite site) {
IActionBars bars = site.getActionBars();
final List<IContributionManager> mans = Arrays.asList(bars.getToolBarManager(), bars.getMenuManager());
final IAction configureAxes = new Action("Configure...", Activator.getImageDescriptor("icons/home-for-sale-sign-blue.png")) {
@Override
public void run() {
try {
IModelDialog<AxisConfiguration> dialog = ServiceHolder.getInterfaceService().createModelDialog(site.getShell());
dialog.setPreamble("Please define the axes and their ranges we will map within.");
dialog.create();
dialog.setSize(550,450); // As needed
dialog.setText("Scan Area");
dialog.setModel(getAxisConfiguration());
int ok = dialog.open();
if (ok==IModelDialog.OK) {
AxisConfiguration conf = dialog.getModel();
setAxisConfiguration(conf);
}
} catch (Exception ne) {
ErrorDialog.openError(site.getShell(), "Error Showing Plot Configuration", "Please contact your support representative.", new Status(IStatus.ERROR, "org.eclipse.scanning.device.ui", ne.getMessage(), ne));
logger.error("Cannot configure plot!", ne);
}
}
};
ViewUtil.addGroups("configure", mans, configureAxes);
}
示例3: contributeToActionBars
import org.eclipse.ui.IViewSite; //導入方法依賴的package包/類
private void contributeToActionBars ( final IViewSite viewSite )
{
final IActionBars bars = viewSite.getActionBars ();
fillLocalPullDown ( bars.getMenuManager () );
fillLocalToolBar ( bars.getToolBarManager () );
}