Search in sources :

Example 1 with FilteringMenuManager

use of org.yakindu.base.xtext.utils.jface.viewers.FilteringMenuManager in project statecharts by Yakindu.

the class StatechartDefinitionSection method initContextMenu.

protected void initContextMenu(Control control) {
    MenuManager menuManager = new FilteringMenuManager();
    Menu contextMenu = menuManager.createContextMenu(control);
    control.setMenu(contextMenu);
    IWorkbenchPartSite site = editorPart.getSite();
    if (site != null)
        site.registerContextMenu("org.yakindu.base.xtext.utils.jface.viewers.StyledTextXtextAdapterContextMenu", menuManager, site.getSelectionProvider());
}
Also used : IWorkbenchPartSite(org.eclipse.ui.IWorkbenchPartSite) FilteringMenuManager(org.yakindu.base.xtext.utils.jface.viewers.FilteringMenuManager) MenuManager(org.eclipse.jface.action.MenuManager) FilteringMenuManager(org.yakindu.base.xtext.utils.jface.viewers.FilteringMenuManager) Menu(org.eclipse.swt.widgets.Menu)

Example 2 with FilteringMenuManager

use of org.yakindu.base.xtext.utils.jface.viewers.FilteringMenuManager in project statecharts by Yakindu.

the class AbstractEditorPropertySection method initContextMenu.

protected void initContextMenu(Control control) {
    MenuManager menuManager = new FilteringMenuManager();
    Menu contextMenu = menuManager.createContextMenu(control);
    control.setMenu(contextMenu);
    IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
    IWorkbenchPartSite site = window.getActivePage().getActiveEditor().getSite();
    site.registerContextMenu(CONTEXTMENUID, menuManager, site.getSelectionProvider());
}
Also used : IWorkbenchPartSite(org.eclipse.ui.IWorkbenchPartSite) IWorkbenchWindow(org.eclipse.ui.IWorkbenchWindow) FilteringMenuManager(org.yakindu.base.xtext.utils.jface.viewers.FilteringMenuManager) MenuManager(org.eclipse.jface.action.MenuManager) FilteringMenuManager(org.yakindu.base.xtext.utils.jface.viewers.FilteringMenuManager) Menu(org.eclipse.swt.widgets.Menu)

Aggregations

MenuManager (org.eclipse.jface.action.MenuManager)2 Menu (org.eclipse.swt.widgets.Menu)2 IWorkbenchPartSite (org.eclipse.ui.IWorkbenchPartSite)2 FilteringMenuManager (org.yakindu.base.xtext.utils.jface.viewers.FilteringMenuManager)2 IWorkbenchWindow (org.eclipse.ui.IWorkbenchWindow)1