Search in sources :

Example 71 with IMenuManager

use of org.eclipse.jface.action.IMenuManager in project tdi-studio-se by Talend.

the class ApplicationActionBarAdvisor method fillMenuBar.

protected void fillMenuBar(IMenuManager menuBar) {
    MenuManager fileMenu = new MenuManager(Messages.getString("ApplicationActionBarAdvisor.fileMenu"), //$NON-NLS-1$
    IWorkbenchActionConstants.M_FILE);
    MenuManager windowMenu = new MenuManager(Messages.getString("ApplicationActionBarAdvisor.windowMenu"), //$NON-NLS-1$
    IWorkbenchActionConstants.M_WINDOW);
    MenuManager helpMenu = new MenuManager(Messages.getString("ApplicationActionBarAdvisor.helpMenu"), //$NON-NLS-1$
    IWorkbenchActionConstants.M_HELP);
    menuBar.add(fileMenu);
    menuBar.add(windowMenu);
    // Add a group marker indicating where action set menus will appear.
    menuBar.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
    menuBar.add(helpMenu);
    // File
    fileMenu.add(new Separator());
    fileMenu.add(ActionFactory.SAVE.create(window));
    fileMenu.add(exitAction);
    // Window
    windowMenu.add(preferenceAction);
    windowMenu.add(new ShowViewAction());
    // Help
    helpMenu.add(aboutAction);
}
Also used : MenuManager(org.eclipse.jface.action.MenuManager) IMenuManager(org.eclipse.jface.action.IMenuManager) GroupMarker(org.eclipse.jface.action.GroupMarker) Separator(org.eclipse.jface.action.Separator)

Example 72 with IMenuManager

use of org.eclipse.jface.action.IMenuManager in project tdi-studio-se by Talend.

the class FOXUI method addXMLViewer.

/**
     * create xml viewer.
     * 
     * @param mainComposite
     * @param form
     * @param width
     * @param height
     */
private void addXMLViewer(final Composite mainComposite, final int width, final int height) {
    // Group Schema Viewer
    //$NON-NLS-1$
    Group group = Form.createGroup(mainComposite, 1, Messages.getString("FOXUI.0"), height);
    // group.setBackgroundMode(SWT.INHERIT_FORCE);
    xmlViewer = new TreeViewer(group, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI | SWT.VIRTUAL);
    GridData gridData = new GridData(GridData.FILL_BOTH);
    xmlViewer.getControl().setLayoutData(gridData);
    xmlViewer.setUseHashlookup(true);
    Tree tree = xmlViewer.getTree();
    // see bug 7087
    if (canModify || isRepository) {
        tree.setEnabled(false);
    }
    tree.setLinesVisible(true);
    tree.setBackground(tree.getDisplay().getSystemColor(SWT.COLOR_WHITE));
    TreeColumn column1 = new TreeColumn(tree, SWT.LEFT);
    //$NON-NLS-1$
    column1.setText(Messages.getString("FOXUI.1"));
    column1.setWidth(170);
    // Related Column
    TreeColumn column2 = new TreeColumn(tree, SWT.CENTER);
    //$NON-NLS-1$ 
    column2.setText(Messages.getString("FOXUI.2"));
    column2.setWidth(100);
    TreeColumn column3 = new TreeColumn(tree, SWT.CENTER);
    //$NON-NLS-1$
    column3.setText(Messages.getString("FOXUI.3"));
    column3.setWidth(90);
    TreeColumn column4 = new TreeColumn(tree, SWT.CENTER);
    //$NON-NLS-1$
    column4.setText(Messages.getString("FOXUI.4"));
    column4.setWidth(90);
    tree.setHeaderVisible(true);
    // tree.setBackgroundMode(SWT.INHERIT_NONE);
    FOXTargetTreeViewerProvider provider = new FOXTargetTreeViewerProvider();
    xmlViewer.setLabelProvider(provider);
    xmlViewer.setCellModifier(new ICellModifier() {

        @Override
        public boolean canModify(Object element, String property) {
            FOXTreeNode node = (FOXTreeNode) element;
            if (property.equals("C1")) {
                //$NON-NLS-1$
                if (node.getLabel() != null && node.getLabel().length() > 0) {
                    return true;
                }
            }
            if (property.equals("C4")) {
                //$NON-NLS-1$
                if (node.getDefaultValue() != null && node.getDefaultValue().length() > 0) {
                    return true;
                }
            }
            return false;
        }

        @Override
        public Object getValue(Object element, String property) {
            FOXTreeNode node = (FOXTreeNode) element;
            if (property.equals("C1")) {
                //$NON-NLS-1$
                return node.getLabel();
            }
            if (property.equals("C4")) {
                //$NON-NLS-1$
                return node.getDefaultValue();
            }
            return null;
        }

        @Override
        public void modify(Object element, String property, Object value) {
            TreeItem treeItem = (TreeItem) element;
            FOXTreeNode node = (FOXTreeNode) treeItem.getData();
            if (property.equals("C1")) {
                //$NON-NLS-1$
                node.setLabel((String) value);
            }
            if (property.equals("C4")) {
                //$NON-NLS-1$
                node.setDefaultValue((String) value);
            }
            xmlViewer.refresh(node);
        }
    });
    //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
    xmlViewer.setColumnProperties(new String[] { "C1", "C2", "C3", "C4" });
    CellEditor editor = new TextCellEditor(xmlViewer.getTree());
    //$NON-NLS-1$
    editor.addListener(new DialogErrorXMLLabelCellEditor(editor, "C1"));
    // add by wzhang for bug 8572. set Default value column to be edit.
    CellEditor editorDefault = new TextCellEditor(xmlViewer.getTree());
    //$NON-NLS-1$
    editorDefault.addListener(new DialogErrorXMLLabelCellEditor(editorDefault, "C4"));
    xmlViewer.setCellEditors(new CellEditor[] { editor, null, null, editorDefault });
    xmlViewer.setContentProvider(provider);
    xmlViewer.setInput(this.foxManager.getTreeData());
    createAction();
    //$NON-NLS-1$
    MenuManager menuMgr = new MenuManager("#PopupMenu");
    menuMgr.setRemoveAllWhenShown(true);
    menuMgr.addMenuListener(new IMenuListener() {

        @Override
        public void menuAboutToShow(IMenuManager manager) {
            FOXUI.this.fillContextMenu(manager);
        }
    });
    Menu menu = menuMgr.createContextMenu(xmlViewer.getControl());
    xmlViewer.getControl().setMenu(menu);
    xmlViewer.addSelectionChangedListener(new ISelectionChangedListener() {

        @Override
        public void selectionChanged(SelectionChangedEvent event) {
        // TODO Auto-generated method stub
        }
    });
    refreshXMLViewer(null);
}
Also used : FOXTreeNode(org.talend.metadata.managment.ui.wizard.metadata.xml.node.FOXTreeNode) Group(org.eclipse.swt.widgets.Group) FOXTargetTreeViewerProvider(org.talend.designer.fileoutputxml.ui.edit.FOXTargetTreeViewerProvider) TreeItem(org.eclipse.swt.widgets.TreeItem) TreeViewer(org.eclipse.jface.viewers.TreeViewer) CellEditor(org.eclipse.jface.viewers.CellEditor) TextCellEditor(org.eclipse.jface.viewers.TextCellEditor) ISelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) SelectionChangedEvent(org.eclipse.jface.viewers.SelectionChangedEvent) IMenuListener(org.eclipse.jface.action.IMenuListener) TreeColumn(org.eclipse.swt.widgets.TreeColumn) GridData(org.eclipse.swt.layout.GridData) ICellModifier(org.eclipse.jface.viewers.ICellModifier) MenuManager(org.eclipse.jface.action.MenuManager) IMenuManager(org.eclipse.jface.action.IMenuManager) Tree(org.eclipse.swt.widgets.Tree) TextCellEditor(org.eclipse.jface.viewers.TextCellEditor) IMenuManager(org.eclipse.jface.action.IMenuManager) Menu(org.eclipse.swt.widgets.Menu)

Example 73 with IMenuManager

use of org.eclipse.jface.action.IMenuManager 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)

Example 74 with IMenuManager

use of org.eclipse.jface.action.IMenuManager in project tdi-studio-se by Talend.

the class NotificationDetailsDialog method configureTree.

/**
     * Configures the tree.
     * 
     * @param detailsTree The tree
     */
private void configureTree(Tree detailsTree) {
    detailsTree.setLinesVisible(true);
    detailsTree.setHeaderVisible(true);
    for (PropertiesColumn column : PropertiesColumn.values()) {
        TreeColumn treeColumn = new TreeColumn(detailsTree, SWT.NONE);
        treeColumn.setText(column.label);
        treeColumn.setWidth(column.defalutWidth);
        treeColumn.setAlignment(column.alignment);
        treeColumn.setToolTipText(column.toolTip);
    }
    //$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(detailsTree);
    detailsTree.setMenu(menu);
}
Also used : TreeColumn(org.eclipse.swt.widgets.TreeColumn) MenuManager(org.eclipse.jface.action.MenuManager) IMenuManager(org.eclipse.jface.action.IMenuManager) IMenuManager(org.eclipse.jface.action.IMenuManager) Menu(org.eclipse.swt.widgets.Menu) PropertiesColumn(org.talend.designer.runtime.visualization.internal.ui.properties.PropertiesColumn) IMenuListener(org.eclipse.jface.action.IMenuListener)

Example 75 with IMenuManager

use of org.eclipse.jface.action.IMenuManager in project tdi-studio-se by Talend.

the class CallTreeTabPage method createCallTreeViewer.

/**
     * Creates the call tree viewer.
     * 
     * @param composite The parent composite
     * @param propertySheet The property sheet
     */
private void createCallTreeViewer(Composite composite, PropertySheet propertySheet) {
    filteredTree = new CallTreeFilteredTree(composite, propertySheet.getViewSite().getActionBars()) {

        @Override
        protected void addMenus(IMenuManager manager) {
            super.addMenus(manager);
            manager.add(new Separator());
            manager.add(new ConfigureCpuProfilerAction(cpuSection));
        }
    };
    TreeViewer callTreeViewer = filteredTree.getViewer();
    callTreeViewer.setContentProvider(new CallTreeContentProvider());
    callTreeViewer.setLabelProvider(new CallTreeLabelProvider(callTreeViewer));
    callTreeViewer.addSelectionChangedListener(new ISelectionChangedListener() {

        @Override
        public void selectionChanged(SelectionChangedEvent event) {
            filteredTree.updateStatusLine((IStructuredSelection) event.getSelection());
        }
    });
}
Also used : ConfigureCpuProfilerAction(org.talend.designer.runtime.visualization.internal.ui.properties.cpu.actions.ConfigureCpuProfilerAction) TreeViewer(org.eclipse.jface.viewers.TreeViewer) ISelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) SelectionChangedEvent(org.eclipse.jface.viewers.SelectionChangedEvent) IMenuManager(org.eclipse.jface.action.IMenuManager) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) Separator(org.eclipse.jface.action.Separator)

Aggregations

IMenuManager (org.eclipse.jface.action.IMenuManager)88 MenuManager (org.eclipse.jface.action.MenuManager)72 IMenuListener (org.eclipse.jface.action.IMenuListener)48 Menu (org.eclipse.swt.widgets.Menu)43 Separator (org.eclipse.jface.action.Separator)31 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)16 IAction (org.eclipse.jface.action.IAction)9 TreeViewer (org.eclipse.jface.viewers.TreeViewer)9 ISelectionChangedListener (org.eclipse.jface.viewers.ISelectionChangedListener)8 GridData (org.eclipse.swt.layout.GridData)8 Action (org.eclipse.jface.action.Action)7 SelectionChangedEvent (org.eclipse.jface.viewers.SelectionChangedEvent)7 Composite (org.eclipse.swt.widgets.Composite)7 GridLayout (org.eclipse.swt.layout.GridLayout)6 List (java.util.List)5 ICoolBarManager (org.eclipse.jface.action.ICoolBarManager)5 FocusEvent (org.eclipse.swt.events.FocusEvent)5 ActionManager (com.cubrid.common.ui.spi.action.ActionManager)4 IContributionItem (org.eclipse.jface.action.IContributionItem)4 Point (org.eclipse.swt.graphics.Point)4