本文整理汇总了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 () );
}