Search in sources :

Example 1 with CopyAction

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

the class AttributesTab method createViewer.

/**
     * Creates the viewer.
     * 
     * @param propertySheet The property sheet
     */
private void createViewer(PropertySheet propertySheet) {
    filteredTree = new PropertiesFilteredTree(this, propertySheet.getViewSite().getActionBars()) {

        private ShowInTimelineAction showInTimelineAction;

        @Override
        protected List<Action> createActions(IActionBars actionBars) {
            List<Action> actions = new ArrayList<Action>();
            CopyAction copyAction = CopyAction.createCopyAction(actionBars);
            actions.add(copyAction);
            showInTimelineAction = new MyShowInTimelineAction(section);
            actions.add(showInTimelineAction);
            return actions;
        }

        @Override
        public void menuAboutToshow() {
        // do nothing
        }
    };
    viewer = filteredTree.getViewer();
    filteredTree.setEditingSupport(new MyEditingSupport(viewer));
    contentProvider = new AttributeContentProvider();
    viewer.setContentProvider(contentProvider);
    viewer.setLabelProvider(new AttributeLabelProvider(viewer));
    viewer.setInput(new Object());
}
Also used : CopyAction(org.talend.designer.runtime.visualization.internal.actions.CopyAction) Action(org.eclipse.jface.action.Action) ShowInTimelineAction(org.talend.designer.runtime.visualization.internal.actions.ShowInTimelineAction) CopyAction(org.talend.designer.runtime.visualization.internal.actions.CopyAction) PropertiesFilteredTree(org.talend.designer.runtime.visualization.internal.ui.properties.PropertiesFilteredTree) ShowInTimelineAction(org.talend.designer.runtime.visualization.internal.actions.ShowInTimelineAction) ArrayList(java.util.ArrayList) List(java.util.List) IActionBars(org.eclipse.ui.IActionBars)

Example 2 with CopyAction

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

the class SWTResourceFilteredTree method createContextMenu.

/**
     * Creates the context menu.
     */
private void createContextMenu() {
    final CopyAction copyAction = CopyAction.createCopyAction(actionBars);
    getViewer().getControl().addFocusListener(new FocusListener() {

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

        @Override
        public void focusGained(FocusEvent e) {
            getViewer().addSelectionChangedListener(copyAction);
        }
    });
    //$NON-NLS-1$
    MenuManager menuMgr = new MenuManager("#PopupMenu");
    menuMgr.setRemoveAllWhenShown(true);
    menuMgr.addMenuListener(new IMenuListener() {

        @Override
        public void menuAboutToShow(IMenuManager manager) {
            manager.add(copyAction);
        }
    });
    Menu menu = menuMgr.createContextMenu(getViewer().getControl());
    getViewer().getControl().setMenu(menu);
}
Also used : CopyAction(org.talend.designer.runtime.visualization.internal.actions.CopyAction) MenuManager(org.eclipse.jface.action.MenuManager) IMenuManager(org.eclipse.jface.action.IMenuManager) IMenuManager(org.eclipse.jface.action.IMenuManager) Menu(org.eclipse.swt.widgets.Menu) FocusListener(org.eclipse.swt.events.FocusListener) FocusEvent(org.eclipse.swt.events.FocusEvent) IMenuListener(org.eclipse.jface.action.IMenuListener)

Example 3 with CopyAction

use of org.talend.designer.runtime.visualization.internal.actions.CopyAction 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 4 with CopyAction

use of org.talend.designer.runtime.visualization.internal.actions.CopyAction 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)

Example 5 with CopyAction

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

the class NotificationFilteredTree method createContextMenu.

/**
     * Creates the context menu.
     * 
     * @param actionBars The action bars
     */
private void createContextMenu(IActionBars actionBars) {
    final CopyAction copyAction = CopyAction.createCopyAction(actionBars);
    clearAction = new Action(Messages.clearLabel) {

        @Override
        public void run() {
            notificationsTab.clear();
        }
    };
    detailsAction = new NotificationDetailsDialogAction(this);
    configureColumnsAction = new ConfigureColumnsAction(this);
    getViewer().addSelectionChangedListener(copyAction);
    getViewer().addSelectionChangedListener(detailsAction);
    //$NON-NLS-1$
    MenuManager menuMgr = new MenuManager("#PopupMenu");
    menuMgr.setRemoveAllWhenShown(true);
    menuMgr.addMenuListener(new IMenuListener() {

        @Override
        public void menuAboutToShow(IMenuManager manager) {
            manager.add(copyAction);
            manager.add(new Separator());
            manager.add(clearAction);
            manager.add(new Separator());
            manager.add(configureColumnsAction);
            manager.add(new Separator());
            manager.add(detailsAction);
        }
    });
    Menu menu = menuMgr.createContextMenu(getViewer().getControl());
    getViewer().getControl().setMenu(menu);
}
Also used : ConfigureColumnsAction(org.talend.designer.runtime.visualization.internal.actions.ConfigureColumnsAction) CopyAction(org.talend.designer.runtime.visualization.internal.actions.CopyAction) Action(org.eclipse.jface.action.Action) CopyAction(org.talend.designer.runtime.visualization.internal.actions.CopyAction) 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) IMenuListener(org.eclipse.jface.action.IMenuListener) Separator(org.eclipse.jface.action.Separator)

Aggregations

CopyAction (org.talend.designer.runtime.visualization.internal.actions.CopyAction)9 IMenuListener (org.eclipse.jface.action.IMenuListener)4 IMenuManager (org.eclipse.jface.action.IMenuManager)4 MenuManager (org.eclipse.jface.action.MenuManager)4 Menu (org.eclipse.swt.widgets.Menu)4 Action (org.eclipse.jface.action.Action)3 Separator (org.eclipse.jface.action.Separator)3 FocusEvent (org.eclipse.swt.events.FocusEvent)3 IActionBars (org.eclipse.ui.IActionBars)3 ConfigureColumnsAction (org.talend.designer.runtime.visualization.internal.actions.ConfigureColumnsAction)3 ArrayList (java.util.ArrayList)2 TreeViewer (org.eclipse.jface.viewers.TreeViewer)2 FocusListener (org.eclipse.swt.events.FocusListener)2 FillLayout (org.eclipse.swt.layout.FillLayout)2 Composite (org.eclipse.swt.widgets.Composite)2 OpenDeclarationAction (org.talend.designer.runtime.visualization.internal.actions.OpenDeclarationAction)2 ShowInTimelineAction (org.talend.designer.runtime.visualization.internal.actions.ShowInTimelineAction)2 PropertiesFilteredTree (org.talend.designer.runtime.visualization.internal.ui.properties.PropertiesFilteredTree)2 List (java.util.List)1 IOpenListener (org.eclipse.jface.viewers.IOpenListener)1