Java Code Examples for org.eclipse.ui.IViewSite#getActionBars()

The following examples show how to use org.eclipse.ui.IViewSite#getActionBars() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: EnhancedTextField.java    From elexis-3-core with Eclipse Public License 1.0 6 votes vote down vote up
public void connectGlobalActions(IViewSite site){
	makeActions();
	IActionBars actionBars = site.getActionBars();
	actionBars.setGlobalActionHandler(ActionFactory.COPY.getId(), copyAction);
	actionBars.setGlobalActionHandler(ActionFactory.CUT.getId(), cutAction);
	actionBars.setGlobalActionHandler(ActionFactory.PASTE.getId(), pasteAction);
	globalMenuListener = new IMenuListener() {
		@Override
		public void menuAboutToShow(IMenuManager manager){
			if (text.getSelectionCount() == 0) {
				copyAction.setEnabled(false);
				cutAction.setEnabled(false);
			} else {
				copyAction.setEnabled(true);
				cutAction.setEnabled(true);
			}
			
		}
	};
	// TODO
	// ApplicationActionBarAdvisor.editMenu.addMenuListener(globalMenuListener);
	ElexisEventDispatcher.getInstance().addListeners(eeli_user);
}
 
Example 2
Source File: AbstractFXView.java    From gef with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Create actions for this view and registers at the action bars of the
 * view's site.
 */
protected void createActions() {
	IViewSite site = getViewSite();
	IActionBars actionBars = site.getActionBars();
	undoRedoActionGroup = new UndoRedoActionGroup(getSite(),
			(IUndoContext) getAdapter(IUndoContext.class), true);
	undoRedoActionGroup.fillActionBars(actionBars);

	deleteAction = new DeleteAction();
	getContentViewer().setAdapter(deleteAction);
	actionBars.setGlobalActionHandler(ActionFactory.DELETE.getId(),
			deleteAction);

	selectAllAction = new SelectAllAction();
	getContentViewer().setAdapter(selectAllAction);
	actionBars.setGlobalActionHandler(ActionFactory.SELECT_ALL.getId(),
			selectAllAction);

	zoomActionGroup = new ZoomActionGroup(new FitToViewportAction());
	getContentViewer().setAdapter(zoomActionGroup);
	fitToViewportActionGroup = new FitToViewportActionGroup();
	getContentViewer().setAdapter(fitToViewportActionGroup);
	scrollActionGroup = new ScrollActionGroup();
	getContentViewer().setAdapter(scrollActionGroup);

	IToolBarManager mgr = actionBars.getToolBarManager();
	zoomActionGroup.fillActionBars(actionBars);
	mgr.add(new Separator());
	fitToViewportActionGroup.fillActionBars(actionBars);
	mgr.add(new Separator());
	scrollActionGroup.fillActionBars(actionBars);
}
 
Example 3
Source File: ReferrersView.java    From Pydev with Eclipse Public License 1.0 5 votes vote down vote up
@Override
protected void configureToolBar(IViewSite viewSite) {
    IActionBars actionBars = viewSite.getActionBars();
    IToolBarManager toolBar = actionBars.getToolBarManager();
    //IMenuManager menuManager = actionBars.getMenuManager(); -- not adding anything to the menu for now.

    toolBar.add(new ClearCurrentReferrers(this));

}
 
Example 4
Source File: CurrentExceptionView.java    From Pydev with Eclipse Public License 1.0 5 votes vote down vote up
@Override
protected void configureToolBar(IViewSite viewSite) {
    IActionBars actionBars = viewSite.getActionBars();
    IToolBarManager toolBar = actionBars.getToolBarManager();
    //IMenuManager menuManager = actionBars.getMenuManager(); -- not adding anything to the menu for now.

    toolBar.add(new EditIgnoredCaughtExceptions(this));
}
 
Example 5
Source File: EnhancedTextField.java    From elexis-3-core with Eclipse Public License 1.0 5 votes vote down vote up
public void disconnectGlobalActions(IViewSite site){
	IActionBars actionBars = site.getActionBars();
	actionBars.setGlobalActionHandler(ActionFactory.COPY.getId(), null);
	actionBars.setGlobalActionHandler(ActionFactory.CUT.getId(), null);
	actionBars.setGlobalActionHandler(ActionFactory.PASTE.getId(), null);
	// TODO
	// ApplicationActionBarAdvisor.editMenu.removeMenuListener(globalMenuListener);
	ElexisEventDispatcher.getInstance().removeListeners(eeli_user);
	
}
 
Example 6
Source File: RealTimeListViewer.java    From neoscada with Eclipse Public License 1.0 4 votes vote down vote up
private void contributeToActionBars ( final IViewSite viewSite )
{
    final IActionBars bars = viewSite.getActionBars ();
    fillLocalPullDown ( bars.getMenuManager () );
    fillLocalToolBar ( bars.getToolBarManager () );
}