/** * 创建文件菜单 * @return 返回文件菜单的 menu manager; */ private MenuManager createFileMenu() { MenuManager menu = new MenuManager(Messages.getString("ts.ApplicationActionBarAdvisor.menu.file"), IWorkbenchActionConstants.M_FILE); // &File menu.add(new GroupMarker(IWorkbenchActionConstants.FILE_START)); // 添加 new.ext group,这样 IDE 中定义的 Open File... 可以显示在最顶端 menu.add(new GroupMarker(IWorkbenchActionConstants.NEW_EXT)); menu.add(new Separator()); menu.add(new GroupMarker(IWorkbenchActionConstants.CLOSE_EXT)); 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); menu.add(new GroupMarker(IWorkbenchActionConstants.HISTORY_GROUP)); menu.add(exitAction); menu.add(new GroupMarker(IWorkbenchActionConstants.FILE_END)); return menu; }
/** * @see org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#initializeDefaultPreferences() */ public void initializeDefaultPreferences() { final IPreferenceStore uiPreferencesStore = TLCUIActivator.getDefault().getPreferenceStore(); final IPreferenceStore tlcPreferencesStore = TLCActivator.getDefault().getPreferenceStore(); tlcPreferencesStore.setDefault(TLCActivator.I_TLC_SNAPSHOT_KEEP_COUNT, 10); // This is so bad.. we store them in parallel because one is needed by plugin relied upon the PreferencePage // and the other by a plugin which is on the opposite side of the dependency. (TLCModelLaunchDelegate) uiPreferencesStore.setDefault(TLCActivator.I_TLC_SNAPSHOT_KEEP_COUNT, 10); uiPreferencesStore.setDefault(ITLCPreferenceConstants.I_TLC_TRACE_MAX_SHOW_ERRORS, 10000); uiPreferencesStore.setDefault(ITLCPreferenceConstants.I_TLC_POPUP_ERRORS, true); uiPreferencesStore.setDefault(ITLCPreferenceConstants.I_TLC_REVALIDATE_ON_MODIFY, true); uiPreferencesStore.setDefault(ITLCPreferenceConstants.I_TLC_MAXIMUM_HEAP_SIZE_DEFAULT, MAX_HEAP_SIZE_DEFAULT); uiPreferencesStore.setDefault(ITLCPreferenceConstants.I_TLC_MAXSETSIZE_DEFAULT, TLCGlobals.setBound); uiPreferencesStore.setDefault(ITLCPreferenceConstants.I_TLC_FPBITS_DEFAULT, 1); uiPreferencesStore.setDefault(ITLCPreferenceConstants.I_TLC_FPSETIMPL_DEFAULT, FPSetFactory.getImplementationDefault()); // store.setDefault(ITLCPreferenceConstants.I_TLC_DELETE_PREVIOUS_FILES, true); // By default we want the Toolbox to show a modal progress dialog upon TLC // startup. A user can opt to subsequently suppress the dialog. // This restores the behavior prior to https://bugs.eclipse.org/146205#c10. if (!uiPreferencesStore.contains(ITLCPreferenceConstants.I_TLC_SHOW_MODAL_PROGRESS)) { final IEclipsePreferences node = InstanceScope.INSTANCE .getNode(WorkbenchPlugin.getDefault().getBundle().getSymbolicName()); node.putBoolean(IPreferenceConstants.RUN_IN_BACKGROUND, false); try { node.flush(); } catch (final BackingStoreException e) { TLCUIActivator.getDefault().logError("Error trying to flush the workbench plugin preferences store.", e); } uiPreferencesStore.setValue(ITLCPreferenceConstants.I_TLC_SHOW_MODAL_PROGRESS, true); } }
@Override public void preWindowOpen() { final IWorkbenchWindowConfigurer configurer = getWindowConfigurer(); configurer.setInitialSize(new Point(950, 700)); configurer.setShowPerspectiveBar(true); configurer.setShowCoolBar(true); configurer.setShowProgressIndicator(true); // status line shows photo selection and loading state // configurer.setShowStatusLine(false); configurer.setTitle(_appTitle); final IPreferenceStore uiPrefStore = PlatformUI.getPreferenceStore(); uiPrefStore.setValue(IWorkbenchPreferenceConstants.SHOW_TRADITIONAL_STYLE_TABS, true); uiPrefStore.setValue(IWorkbenchPreferenceConstants.SHOW_PROGRESS_ON_STARTUP, true); // show memory monitor final boolean isMemoryMonitorVisible = _prefStore .getBoolean(ITourbookPreferences.APPEARANCE_SHOW_MEMORY_MONITOR); uiPrefStore.setValue(IWorkbenchPreferenceConstants.SHOW_MEMORY_MONITOR, isMemoryMonitorVisible); hookTitleUpdateListeners(configurer); /* * display the progress dialog for UI jobs, when pressing the hide button there is no other * way to display the dialog again */ WorkbenchPlugin.getDefault().getPreferenceStore().setValue(IPreferenceConstants.RUN_IN_BACKGROUND, false); // must be initialized early to set photoServiceProvider in the Photo TourPhotoManager.restoreState(); FormatManager.updateDisplayFormats(); }
/** * 创建文件菜单 * @return 返回文件菜单的 menu manager; */ private MenuManager createFileMenu() { MenuManager menu = new MenuManager(Messages.getString("ts.ApplicationActionBarAdvisor.menu.file"), IWorkbenchActionConstants.M_FILE); // &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 ContributionItemFactory("reopenEditors") { //$NON-NLS-1$ /* (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; }
/** * 创建文件菜单 * @return 返回文件菜单的 menu manager; */ private MenuManager createFileMenu() { MenuManager menu = new MenuManager(Messages.getString("ts.ApplicationActionBarAdvisor.menu.file"), IWorkbenchActionConstants.M_FILE); // &File menu.add(new GroupMarker(IWorkbenchActionConstants.FILE_START)); // 添加 new.ext group,这样 IDE 中定义的 Open File... 可以显示在最顶端 menu.add(new GroupMarker(IWorkbenchActionConstants.NEW_EXT)); menu.add(new Separator()); menu.add(new GroupMarker(IWorkbenchActionConstants.CLOSE_EXT)); 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 ContributionItemFactory("reopenEditors") { //$NON-NLS-1$ /* (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; }