use of org.eclipse.jface.commands.ActionHandler in project mylyn.docs by eclipse.
the class MarkupEditor method setAction.
@Override
public void setAction(String actionID, IAction action) {
if (action != null && action.getActionDefinitionId() != null && !isCommandAction(action)) {
// bug 336679: don't activate handlers for CommandAction.
// We do this by class name so that we don't rely on internals
IHandlerService handlerService = getSite().getService(IHandlerService.class);
handlerService.activateHandler(action.getActionDefinitionId(), new ActionHandler(action));
}
super.setAction(actionID, action);
}
use of org.eclipse.jface.commands.ActionHandler in project erlide_eclipse by erlang.
the class ErlangOutlinePage method createControl.
@Override
public void createControl(final Composite parent) {
final Tree tree = new Tree(parent, SWT.MULTI);
fOutlineViewer = new TreeViewer(tree);
fOutlineViewer.setAutoExpandLevel(0);
fOutlineViewer.setUseHashlookup(true);
fOutlineViewer.setContentProvider(fEditor.createOutlineContentProvider());
fOutlineViewer.setLabelProvider(fEditor.createOutlineLabelProvider());
fOutlineViewer.addPostSelectionChangedListener(this);
fOutlineViewer.setInput(fModule);
final IPageSite site = getSite();
fOpenAndLinkWithEditorHelper = new OpenAndLinkWithEditorHelper(fOutlineViewer, fEditor, site.getPage());
final IContextService service = site.getService(IContextService.class);
if (service != null) {
service.activateContext("org.erlide.ui.erlangOutlineAndNavigatorScope");
}
final MenuManager manager = new MenuManager();
manager.setRemoveAllWhenShown(true);
manager.addMenuListener(this::contextMenuAboutToShow);
final Menu menu = manager.createContextMenu(tree);
tree.setMenu(menu);
site.registerContextMenu(ErlangCore.PLUGIN_ID + ".outline", manager, fOutlineViewer);
fActionGroups = new CompositeActionGroup(new ActionGroup[] { new ErlangSearchActionGroup(this) });
// register global actions
final IActionBars actionBars = site.getActionBars();
actionBars.setGlobalActionHandler(ITextEditorActionConstants.UNDO, fEditor.getAction(ITextEditorActionConstants.UNDO));
actionBars.setGlobalActionHandler(ITextEditorActionConstants.REDO, fEditor.getAction(ITextEditorActionConstants.REDO));
fActionGroups.fillActionBars(actionBars);
registerToolbarActions(actionBars);
final IHandlerService handlerService = site.getService(IHandlerService.class);
if (handlerService != null) {
handlerService.activateHandler(IWorkbenchCommandConstants.NAVIGATE_TOGGLE_LINK_WITH_EDITOR, new ActionHandler(fToggleLinkingAction));
}
fPartListener = new IPartListener() {
@Override
public void partOpened(final IWorkbenchPart part) {
// JC borde filter-metoden ovan r�cka?
addFilters();
}
@Override
public void partDeactivated(final IWorkbenchPart part) {
}
@Override
public void partClosed(final IWorkbenchPart part) {
}
@Override
public void partBroughtToTop(final IWorkbenchPart part) {
}
@Override
public void partActivated(final IWorkbenchPart part) {
addFilters();
}
};
getSite().getPage().addPartListener(fPartListener);
}
Aggregations