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);
}
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;
}
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;
}
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);
}
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);
}
Aggregations