Search in sources :

Example 36 with MenuManager

use of org.eclipse.jface.action.MenuManager in project translationstudio8 by heartsome.

the class SimpleModelExample method createControls.

/**
     * Create the controls that compose the console test.
     * 
     */
protected void createControls() {
    GridLayout gl = new GridLayout();
    gl.numColumns = 1;
    _shell.setLayout(gl);
    GridData gd = new GridData(GridData.FILL_BOTH);
    _jt = new JaretTable(_shell, SWT.V_SCROLL | SWT.H_SCROLL);
    _jt.setLayoutData(gd);
    if (_tableModel == null) {
        SimpleJaretTableModel model = new SimpleJaretTableModel();
        for (int x = 0; x <= NUMCOLS; x++) {
            model.setHeaderLabel(x, "" + x);
            for (int y = 0; y <= NUMROWS; y++) {
                model.setValueAt(x, y, x + "/" + y);
            }
        }
        _tableModel = model;
    }
    _jt.setTableModel(_tableModel);
    // set rowheight mode to variable .. optimal would be quite expensive on each col resize
    _jt.getTableViewState().setRowHeightMode(ITableViewState.RowHeightMode.VARIABLE);
    for (int i = 0; i < NUMCOLS; i++) {
        IColumn col = _tableModel.getColumn(i);
        _jt.getTableViewState().setColumnWidth(col, 40);
    }
    JaretTableActionFactory af = new JaretTableActionFactory();
    MenuManager mm = new MenuManager();
    mm.add(af.createStdAction(_jt, JaretTableActionFactory.ACTION_CONFIGURECOLUMNS));
    _jt.setHeaderContextMenu(mm.createContextMenu(_jt));
    MenuManager rm = new MenuManager();
    rm.add(af.createStdAction(_jt, JaretTableActionFactory.ACTION_OPTROWHEIGHT));
    rm.add(af.createStdAction(_jt, JaretTableActionFactory.ACTION_OPTALLROWHEIGHTS));
    _jt.setRowContextMenu(rm.createContextMenu(_jt));
    TableControlPanel ctrlPanel = new TableControlPanel(_shell, SWT.NULL, _jt);
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) IColumn(de.jaret.util.ui.table.model.IColumn) JaretTable(de.jaret.util.ui.table.JaretTable) GridData(org.eclipse.swt.layout.GridData) MenuManager(org.eclipse.jface.action.MenuManager) SimpleJaretTableModel(de.jaret.util.ui.table.model.simple.SimpleJaretTableModel) JaretTableActionFactory(de.jaret.util.ui.table.util.action.JaretTableActionFactory)

Example 37 with MenuManager

use of org.eclipse.jface.action.MenuManager in project translationstudio8 by heartsome.

the class ApplicationActionBarAdvisor method createHelpMenu.

/**
	 * 创建帮助菜单
	 * @return 返回帮助菜单的 menu manager;
	 */
private MenuManager createHelpMenu() {
    MenuManager menu = new MenuManager(Messages.getString("ts.ApplicationActionBarAdvisor.menu.help"), IWorkbenchActionConstants.M_HELP);
    // menu.add(new GroupMarker(IWorkbenchActionConstants.HELP_START));
    menu.add(helpAction);
    // menu.add(helpSearchAction);
    // menu.add(dynamicHelpAction);
    // menu.add(new GroupMarker(IWorkbenchActionConstants.HELP_END));
    menu.add(new GroupMarker("help.keyAssist"));
    menu.add(new Separator());
    menu.add(new GroupMarker("help.updatePlugin"));
    menu.add(new Separator());
    menu.add(new GroupMarker("help.license"));
    // 关于菜单需要始终显示在最底端
    menu.add(new GroupMarker("group.about"));
    // menu.add(aboutItem);
    return menu;
}
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 38 with MenuManager

use of org.eclipse.jface.action.MenuManager in project translationstudio8 by heartsome.

the class ApplicationActionBarAdvisor method createFileMenu.

/**
	 * 创建文件菜单
	 * @return 返回文件菜单的 menu manager;
	 */
private MenuManager createFileMenu() {
    MenuManager menu = new MenuManager(Messages.getString("ts.ApplicationActionBarAdvisor.menu.file"), // &File
    IWorkbenchActionConstants.M_FILE);
    menu.add(new GroupMarker(IWorkbenchActionConstants.FILE_START));
    // 添加 new.ext group,这样 IDE 中定义的 Open File... 可以显示在最顶端
    // menu.add(newAction);
    menu.add(new GroupMarker(IWorkbenchActionConstants.NEW_EXT));
    menu.add(new Separator());
    menu.add(closeAction);
    menu.add(closeAllAction);
    menu.add(refreshAction);
    // menu.add(new Separator("net.heartsome.cat.ts.ui.menu.file.separator"));
    menu.add(new GroupMarker("xliff.switch"));
    menu.add(new GroupMarker("rtf.switch"));
    menu.add(new GroupMarker("xliff.split"));
    menu.add(new Separator());
    // 设置保存文件记录条数为 5 条
    WorkbenchPlugin.getDefault().getPreferenceStore().setValue(IPreferenceConstants.RECENT_FILES, 5);
    // 添加文件访问列表
    ContributionItemFactory REOPEN_EDITORS = new //$NON-NLS-1$
    ContributionItemFactory(//$NON-NLS-1$
    "reopenEditors") {

        /* (non-javadoc) method declared on ContributionItemFactory */
        public IContributionItem create(IWorkbenchWindow window) {
            if (window == null) {
                throw new IllegalArgumentException();
            }
            return new ReopenEditorMenu(window, getId(), false);
        }
    };
    menu.add(REOPEN_EDITORS.create(window));
    menu.add(exitAction);
    menu.add(new GroupMarker(IWorkbenchActionConstants.FILE_END));
    return menu;
}
Also used : ContributionItemFactory(org.eclipse.ui.actions.ContributionItemFactory) IWorkbenchWindow(org.eclipse.ui.IWorkbenchWindow) ReopenEditorMenu(org.eclipse.ui.internal.ReopenEditorMenu) 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 39 with MenuManager

use of org.eclipse.jface.action.MenuManager in project translationstudio8 by heartsome.

the class PortingActionProvider method addImportMenu.

private void addImportMenu(IMenuManager aMenu) {
    importWizardActionGroup.setContext(getContext());
    if (importWizardActionGroup.getWizardActionIds().length == 0) {
        aMenu.appendToGroup(ICommonMenuConstants.GROUP_PORT, importAction);
        return;
    }
    IMenuManager submenu = new MenuManager(WorkbenchNavigatorMessages.PortingActionProvider_ImportResourcesMenu_label, COMMON_NAVIGATOR_IMPORT_MENU);
    importWizardActionGroup.fillContextMenu(submenu);
    submenu.add(new Separator(ICommonMenuConstants.GROUP_ADDITIONS));
    submenu.add(new Separator());
    submenu.add(importAction);
    aMenu.appendToGroup(ICommonMenuConstants.GROUP_PORT, submenu);
}
Also used : MenuManager(org.eclipse.jface.action.MenuManager) IMenuManager(org.eclipse.jface.action.IMenuManager) IMenuManager(org.eclipse.jface.action.IMenuManager) Separator(org.eclipse.jface.action.Separator)

Example 40 with MenuManager

use of org.eclipse.jface.action.MenuManager in project translationstudio8 by heartsome.

the class ApplicationActionBarAdvisor method fillMenuBar.

protected void fillMenuBar(IMenuManager menuBar) {
    MenuManager fileMenu = new MenuManager("&File", IWorkbenchActionConstants.M_FILE);
    menuBar.add(fileMenu);
    fileMenu.add(exitAction);
    MenuManager editMenu = new MenuManager("&Edit", IWorkbenchActionConstants.M_EDIT);
    menuBar.add(editMenu);
    editMenu.add(preferenceAction);
}
Also used : IMenuManager(org.eclipse.jface.action.IMenuManager) MenuManager(org.eclipse.jface.action.MenuManager)

Aggregations

MenuManager (org.eclipse.jface.action.MenuManager)657 IMenuManager (org.eclipse.jface.action.IMenuManager)498 Menu (org.eclipse.swt.widgets.Menu)303 IMenuListener (org.eclipse.jface.action.IMenuListener)246 Separator (org.eclipse.jface.action.Separator)220 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)65 Point (org.eclipse.swt.graphics.Point)63 Action (org.eclipse.jface.action.Action)55 Composite (org.eclipse.swt.widgets.Composite)49 IAction (org.eclipse.jface.action.IAction)48 SelectionEvent (org.eclipse.swt.events.SelectionEvent)44 GridData (org.eclipse.swt.layout.GridData)44 GroupMarker (org.eclipse.jface.action.GroupMarker)43 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)43 Transfer (org.eclipse.swt.dnd.Transfer)35 GridLayout (org.eclipse.swt.layout.GridLayout)32 List (java.util.List)30 EditingDomainViewerDropAdapter (org.eclipse.emf.edit.ui.dnd.EditingDomainViewerDropAdapter)30 LocalTransfer (org.eclipse.emf.edit.ui.dnd.LocalTransfer)30 ViewerDragAdapter (org.eclipse.emf.edit.ui.dnd.ViewerDragAdapter)30