Search in sources :

Example 1 with OpenDeclarationAction

use of org.talend.designer.runtime.visualization.internal.actions.OpenDeclarationAction in project tdi-studio-se by Talend.

the class HeapHistogramPage method createContextMenu.

/**
     * Creates the context menu.
     * 
     * @param actionBars The action bars
     */
private void createContextMenu(IActionBars actionBars) {
    final OpenDeclarationAction openAction = OpenDeclarationAction.createOpenDeclarationAction(actionBars);
    final CopyAction copyAction = CopyAction.createCopyAction(actionBars);
    configureColumnsAction = new ConfigureColumnsAction(this);
    heapViewer.addSelectionChangedListener(openAction);
    heapViewer.getControl().addFocusListener(new FocusListener() {

        @Override
        public void focusLost(FocusEvent e) {
            heapViewer.removeSelectionChangedListener(copyAction);
        }

        @Override
        public void focusGained(FocusEvent e) {
            heapViewer.addSelectionChangedListener(copyAction);
        }
    });
    heapViewer.addOpenListener(new IOpenListener() {

        @Override
        public void open(OpenEvent event) {
            openAction.run();
        }
    });
    //$NON-NLS-1$
    MenuManager menuMgr = new MenuManager("#PopupMenu");
    menuMgr.setRemoveAllWhenShown(true);
    menuMgr.addMenuListener(new IMenuListener() {

        @Override
        public void menuAboutToShow(IMenuManager manager) {
            manager.add(openAction);
            manager.add(copyAction);
            manager.add(new Separator());
            manager.add(configureColumnsAction);
        }
    });
    Menu menu = menuMgr.createContextMenu(heapViewer.getControl());
    heapViewer.getControl().setMenu(menu);
}
Also used : OpenDeclarationAction(org.talend.designer.runtime.visualization.internal.actions.OpenDeclarationAction) CopyAction(org.talend.designer.runtime.visualization.internal.actions.CopyAction) FocusEvent(org.eclipse.swt.events.FocusEvent) IMenuListener(org.eclipse.jface.action.IMenuListener) IOpenListener(org.eclipse.jface.viewers.IOpenListener) MenuManager(org.eclipse.jface.action.MenuManager) IMenuManager(org.eclipse.jface.action.IMenuManager) IMenuManager(org.eclipse.jface.action.IMenuManager) Menu(org.eclipse.swt.widgets.Menu) ConfigureColumnsAction(org.talend.designer.runtime.visualization.internal.actions.ConfigureColumnsAction) FocusListener(org.eclipse.swt.events.FocusListener) Separator(org.eclipse.jface.action.Separator) OpenEvent(org.eclipse.jface.viewers.OpenEvent)

Example 2 with OpenDeclarationAction

use of org.talend.designer.runtime.visualization.internal.actions.OpenDeclarationAction in project tdi-studio-se by Talend.

the class CpuDumpEditor method contributeToActionBars.

/**
     * Contributes to action bars.
     */
private void contributeToActionBars() {
    IActionBars actionBars = getEditorSite().getActionBars();
    actionBars.setGlobalActionHandler(JdtActionConstants.OPEN, new OpenDeclarationAction());
    actionBars.setGlobalActionHandler(ActionFactory.FIND.getId(), new FindAction());
    actionBars.setGlobalActionHandler(ActionFactory.COPY.getId(), new CopyAction());
}
Also used : OpenDeclarationAction(org.talend.designer.runtime.visualization.internal.actions.OpenDeclarationAction) FindAction(org.talend.designer.runtime.visualization.internal.ui.properties.cpu.actions.FindAction) CopyAction(org.talend.designer.runtime.visualization.internal.actions.CopyAction) IActionBars(org.eclipse.ui.IActionBars)

Aggregations

CopyAction (org.talend.designer.runtime.visualization.internal.actions.CopyAction)2 OpenDeclarationAction (org.talend.designer.runtime.visualization.internal.actions.OpenDeclarationAction)2 IMenuListener (org.eclipse.jface.action.IMenuListener)1 IMenuManager (org.eclipse.jface.action.IMenuManager)1 MenuManager (org.eclipse.jface.action.MenuManager)1 Separator (org.eclipse.jface.action.Separator)1 IOpenListener (org.eclipse.jface.viewers.IOpenListener)1 OpenEvent (org.eclipse.jface.viewers.OpenEvent)1 FocusEvent (org.eclipse.swt.events.FocusEvent)1 FocusListener (org.eclipse.swt.events.FocusListener)1 Menu (org.eclipse.swt.widgets.Menu)1 IActionBars (org.eclipse.ui.IActionBars)1 ConfigureColumnsAction (org.talend.designer.runtime.visualization.internal.actions.ConfigureColumnsAction)1 FindAction (org.talend.designer.runtime.visualization.internal.ui.properties.cpu.actions.FindAction)1