/** * Creates the tab folder for displaying the composite fragments * * @param parent */ public static CTabFolder createTabFolder(Composite parent) { Display display = getStandardDisplay(); Color c1 = display.getSystemColor(SWT.COLOR_TITLE_BACKGROUND), c2 = display .getSystemColor(SWT.COLOR_TITLE_BACKGROUND_GRADIENT); CTabFolder tabs = new CTabFolder(parent, SWT.NO_REDRAW_RESIZE | SWT.NO_TRIM | SWT.FLAT); GridData gd = new GridData(GridData.FILL_BOTH); gd.horizontalSpan = 2; tabs.setSelectionBackground(new Color[] { c1, c2 }, new int[] { 100 }, true); tabs.setSelectionForeground(getStandardDisplay().getSystemColor(SWT.COLOR_TITLE_FOREGROUND)); tabs.setSimple(PlatformUI.getPreferenceStore().getBoolean( IWorkbenchPreferenceConstants.SHOW_TRADITIONAL_STYLE_TABS)); tabs.setLayoutData(gd); tabs.setBorderVisible(true); tabs.setFont(parent.getFont()); return tabs; }
@Override public void preStartup() { // log system startup and record feature names/versions if (logUsage) { EnsembleUsageLogger.logUsage("RcpPlugin.start()"); } LogUtil.warn("Starting a new " + Platform.getProduct().getName() + " session"); PlatformUI.getPreferenceStore().setDefault(IWorkbenchPreferenceConstants.SHOW_PROGRESS_ON_STARTUP, true); IDE.registerAdapters(); // Set up exception listeners so that they can be properly logged // rather than falling off the stack silently Thread.setDefaultUncaughtExceptionHandler(EnsembleUnhandledExceptionHandler.getInstance()); Platform.addLogListener(EnsembleUnhandledExceptionHandler.getInstance()); if (shouldLogCommandExecutions()) { ICommandService service = (ICommandService)PlatformUI.getWorkbench().getService(ICommandService.class); service.addExecutionListener(new CommandExecutionMonitor()); } super.preStartup(); }
public void propertyChange(PropertyChangeEvent event) { String property= event.getProperty(); if (property.equals(JFacePreferences.QUALIFIER_COLOR) || property.equals(JFacePreferences.COUNTER_COLOR) || property.equals(JFacePreferences.DECORATIONS_COLOR) || property.equals(HIGHLIGHT_BG_COLOR_NAME) || property.equals(HIGHLIGHT_WRITE_BG_COLOR_NAME) || property.equals(INHERITED_COLOR_NAME) || property.equals(IWorkbenchPreferenceConstants.USE_COLORED_LABELS) ) { Display.getDefault().asyncExec(new Runnable() { public void run() { updateAllViewers(); } }); } }
/** * Restores the working set filter from the persistence store. */ protected void initWorkingSetFilter(String workingSetName) { IWorkingSet workingSet = null; if (workingSetName != null && workingSetName.length() > 0) { IWorkingSetManager workingSetManager = PlatformUI.getWorkbench().getWorkingSetManager(); workingSet = workingSetManager.getWorkingSet(workingSetName); } else if (PlatformUI.getPreferenceStore().getBoolean( IWorkbenchPreferenceConstants.USE_WINDOW_WORKING_SET_BY_DEFAULT)) { // use the window set by default if the global preference is set workingSet = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getAggregateWorkingSet(); } if (workingSet != null) { setWorkingSet(workingSet); } }
@Override public void initialize(IWorkbenchConfigurer configurer) { super.initialize(configurer); configurer.setSaveAndRestore(true); PlatformUI.getPreferenceStore().setValue( IWorkbenchPreferenceConstants.SHOW_TRADITIONAL_STYLE_TABS, false); // inserted: register workbench adapters IDE.registerAdapters(); // inserted: register images for rendering explorer view final String ICONS_PATH = "icons/full/"; final String PATH_OBJECT = ICONS_PATH + "obj16/"; Bundle ideBundle = Platform.getBundle(IDEWorkbenchPlugin.IDE_WORKBENCH); declareWorkbenchImage(configurer, ideBundle, IDE.SharedImages.IMG_OBJ_PROJECT, PATH_OBJECT + "prj_obj.gif", true); declareWorkbenchImage(configurer, ideBundle, IDE.SharedImages.IMG_OBJ_PROJECT_CLOSED, PATH_OBJECT + "cprj_obj.gif", true); }
/** * Diese Methode wird jeweils unmittelbar vor dem öffnen des Anwendungsfensters ausgeführt. */ public void preWindowOpen(){ IWorkbenchWindowConfigurer configurer = getWindowConfigurer(); // configurer.setInitialSize(new Point(900, 700)); configurer.setShowCoolBar(true); configurer.setShowStatusLine(true); configurer.setShowProgressIndicator(true); configurer.setTitle(Hub.APPLICATION_NAME + " " + CoreHub.readElexisBuildVersion()); configurer.setShowFastViewBars(true); if (CoreHub.localCfg.get(Preferences.SHOWPERSPECTIVESELECTOR, Boolean.toString(false)) .equals(Boolean.toString(true))) { configurer.setShowPerspectiveBar(true); } else { configurer.setShowPerspectiveBar(false); } // Wir wollen die schicken runden Tabs von Eclipse 3.x PlatformUI.getPreferenceStore().setValue( IWorkbenchPreferenceConstants.SHOW_TRADITIONAL_STYLE_TABS, false); // Aber die Animationen sind eher nervend, nicht? PlatformUI.getPreferenceStore().setValue(IWorkbenchPreferenceConstants.ENABLE_ANIMATIONS, false); }
public WorkbenchWindowAdvisor createWorkbenchWindowAdvisor(IWorkbenchWindowConfigurer configurer) { IDE.registerAdapters(); PlatformUI.getPreferenceStore().setValue(IWorkbenchPreferenceConstants.ENABLE_DETACHED_VIEWS, false); configurer.setShowProgressIndicator(true); configurer.setShowFastViewBars(true); configurer.setShowStatusLine(true); configurer.getWindow().getPartService().addPartListener(new TitleBarPartListener()); return new ApplicationWorkbenchWindowAdvisor(configurer); }
/** * Prompts the user for whether to switch perspectives. * * @param window * The workbench window in which to switch perspectives; must not * be <code>null</code> * @param finalPersp * The perspective to switch to; must not be <code>null</code>. * * @return <code>true</code> if it's OK to switch, <code>false</code> * otherwise */ private static boolean confirmPerspectiveSwitch(IWorkbenchWindow window, IPerspectiveDescriptor finalPersp) { IPreferenceStore store = IDEWorkbenchPlugin.getDefault().getPreferenceStore(); String pspm = store.getString(IDEInternalPreferences.PROJECT_SWITCH_PERSP_MODE); if (!IDEInternalPreferences.PSPM_PROMPT.equals(pspm)) { // Return whether or not we should always switch return IDEInternalPreferences.PSPM_ALWAYS.equals(pspm); } String desc = finalPersp.getDescription(); String message; if (desc == null || desc.length() == 0) message = NLS.bind(ResourceMessages.NewProject_perspSwitchMessage, finalPersp.getLabel()); else message = NLS.bind(ResourceMessages.NewProject_perspSwitchMessageWithDesc, new String[] { finalPersp.getLabel(), desc }); MessageDialogWithToggle dialog = MessageDialogWithToggle.openYesNoQuestion(window.getShell(), ResourceMessages.NewProject_perspSwitchTitle, message, null /* use the default message for the toggle */, false /* toggle is initially unchecked */, store, IDEInternalPreferences.PROJECT_SWITCH_PERSP_MODE); int result = dialog.getReturnCode(); // If we are not going to prompt anymore propogate the choice. if (dialog.getToggleState()) { String preferenceValue; if (result == IDialogConstants.YES_ID) { // Doesn't matter if it is replace or new window // as we are going to use the open perspective setting preferenceValue = IWorkbenchPreferenceConstants.OPEN_PERSPECTIVE_REPLACE; } else { preferenceValue = IWorkbenchPreferenceConstants.NO_NEW_PERSPECTIVE; } // update PROJECT_OPEN_NEW_PERSPECTIVE to correspond PrefUtil.getAPIPreferenceStore().setValue(IDE.Preferences.PROJECT_OPEN_NEW_PERSPECTIVE, preferenceValue); } return result == IDialogConstants.YES_ID; }
public void propertyChange(PropertyChangeEvent event) { String property= event.getProperty(); if (property.equals(JFacePreferences.QUALIFIER_COLOR) || property.equals(JFacePreferences.COUNTER_COLOR) || property.equals(JFacePreferences.DECORATIONS_COLOR) || property.equals(HIGHLIGHT_BG_COLOR_NAME) || property.equals(IWorkbenchPreferenceConstants.USE_COLORED_LABELS)) { Display.getDefault().asyncExec(new Runnable() { public void run() { refresh(); } }); } }
@Override public Object execute(ExecutionEvent event) throws ExecutionException { IResource resource = getFromActiveEditor(event); if(resource == null){ resource = getFromSelection(event); } if(resource == null){ resource = ResourcesPlugin.getWorkspace().getRoot(); } String hint = "To unlock, create empty stopLockJob file in " + System.getProperty("user.home") + " directory or cancel the lock job!"; boolean confirm = MessageDialog.openConfirm( HandlerUtil.getActiveShell(event), "Confirm lock", "Lock " + resource + "?" + "\n " + hint); if (confirm) { System.out.println(hint); IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindow(event); if(window != null){ try { PrefUtil.getAPIPreferenceStore().setValue(IWorkbenchPreferenceConstants.SHOW_SYSTEM_JOBS, true); window.getActivePage().showView(IPageLayout.ID_PROGRESS_VIEW); } catch (PartInitException e) { // ignore } } LockJob job = new LockJob("Locking " + resource, resource); job.schedule(); } return null; }
@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(); }
/** * Create the filtered tree. * * @param treeStyle * the style bits for the <code>Tree</code> * @param filter * the filter to be used * * @since 3.3 */ protected void init(int treeStyle, EnsemblePatternFilter filter) { patternFilter = filter; showFilterControls = PlatformUI.getPreferenceStore().getBoolean( IWorkbenchPreferenceConstants.SHOW_FILTERED_TEXTS); createControl(parent, treeStyle); createRefreshJob(); setInitialText(WorkbenchMessages.FilteredTree_FilterMessage); setFont(parent.getFont()); }
/** * Creates an EnsembleActionBarAdvisor, this calls the parent ActionBarAdvisor constructor. * This is the only public constructor. * * @param configurer The */ public EnsembleActionBarAdvisor(IActionBarConfigurer configurer) { super(configurer); PlatformUI.getPreferenceStore().setValue( IWorkbenchPreferenceConstants.DYNAMIC_HELP_ACTION_TEXT, "Related Help"); PlatformUI.getPreferenceStore().setValue( IWorkbenchPreferenceConstants.HELP_CONTENTS_ACTION_TEXT, "User Guide"); }
@Override public void preWindowOpen() { // We want curvy tabs and the perspective bar on the top right PlatformUI.getPreferenceStore().setDefault(IWorkbenchPreferenceConstants.SHOW_TRADITIONAL_STYLE_TABS, false); PlatformUI.getPreferenceStore().setDefault(IWorkbenchPreferenceConstants.DOCK_PERSPECTIVE_BAR, IWorkbenchPreferenceConstants.TOP_RIGHT); PlatformUI.getPreferenceStore().setDefault(IWorkbenchPreferenceConstants.SHOW_TEXT_ON_PERSPECTIVE_BAR, false); moveAdvancedPreferencesPages(); cleanupPreferencePages(); }
public PropertiesCorrectionAssistant(ITextEditor editor) { super(); Assert.isNotNull(editor); fEditor= editor; setQuickAssistProcessor(new PropertiesCorrectionProcessor(this)); enableColoredLabels(PlatformUI.getPreferenceStore().getBoolean(IWorkbenchPreferenceConstants.USE_COLORED_LABELS)); setInformationControlCreator(getInformationControlCreator()); }
@Override public void propertyChange(PropertyChangeEvent event) { String property = event.getProperty(); if (property.equals(JFacePreferences.QUALIFIER_COLOR) || property.equals(JFacePreferences.COUNTER_COLOR) || property.equals(JFacePreferences.DECORATIONS_COLOR) || property.equals(HIGHLIGHT_BG_COLOR_NAME) || property.equals(IWorkbenchPreferenceConstants.USE_COLORED_LABELS)) { Display.getDefault().asyncExec(new Runnable() { @Override public void run() { refresh(); } }); } }
@Override @SuppressWarnings("restriction") protected void before() throws Throwable { apiPreferences = org.eclipse.ui.internal.util.PrefUtil.getAPIPreferenceStore(); workbenchPreferences = org.eclipse.ui.internal.ide.IDEWorkbenchPlugin.getDefault().getPreferenceStore(); openNewPerspective = apiPreferences.getString(PREFERENCE_OPEN_NEW_PERSPECTIVE); switchPerspectiveMode = workbenchPreferences.getString(PREFERENCE_SWITCH_PERSPECTIVE_MODE); setPerspectiveSwitching(IWorkbenchPreferenceConstants.NO_NEW_PERSPECTIVE, MessageDialogWithToggle.NEVER); }
@Test public void should_switch_to_the_niem_uml_perspective() throws CoreException { preferencesRule.setPerspectiveSwitching(IWorkbenchPreferenceConstants.OPEN_PERSPECTIVE_REPLACE, MessageDialogWithToggle.ALWAYS); final IWorkbench theWorkbench = PlatformUI.getWorkbench(); assertThat(theWorkbench, is_not_open_to_the_niem_uml_perspective()); theModelProvider.create_a_niem_model(THE_MODEL_NAME + 2); assertThat(theWorkbench, is_open_to_the_niem_uml_perspective()); }
public void preWindowOpen() { IWorkbenchWindowConfigurer configurer = getWindowConfigurer(); configurer.setInitialSize(new Point(400, 300)); configurer.setShowCoolBar(true); configurer.setShowStatusLine(true); configurer.setShowPerspectiveBar(true); configurer.setTitle("VisualCenter"); //$NON-NLS-1$ PlatformUI.getPreferenceStore().setValue(IWorkbenchPreferenceConstants.DOCK_PERSPECTIVE_BAR, IWorkbenchPreferenceConstants.TOP_RIGHT); }
private void dockPrespectiveBarToRightTop(){ PlatformUI.getPreferenceStore().setValue(IWorkbenchPreferenceConstants.DOCK_PERSPECTIVE_BAR, IWorkbenchPreferenceConstants.TOP_RIGHT); }
private static boolean showColoredLabels() { return PlatformUI.getPreferenceStore().getBoolean(IWorkbenchPreferenceConstants.USE_COLORED_LABELS); }
public static boolean showColoredLabels() { return PlatformUI.getPreferenceStore().getBoolean(IWorkbenchPreferenceConstants.USE_COLORED_LABELS); }
/** * Prompts the user for whether to switch perspectives. * * @param window * The workbench window in which to switch perspectives; must not * be <code>null</code> * @param finalPersp * The perspective to switch to; must not be <code>null</code>. * * @return <code>true</code> if it's OK to switch, <code>false</code> * otherwise */ private static boolean confirmPerspectiveSwitch(IWorkbenchWindow window, IPerspectiveDescriptor finalPersp) { IPreferenceStore store = IDEWorkbenchPlugin.getDefault() .getPreferenceStore(); String pspm = store .getString(IDEInternalPreferences.PROJECT_SWITCH_PERSP_MODE); if (!IDEInternalPreferences.PSPM_PROMPT.equals(pspm)) { // Return whether or not we should always switch return IDEInternalPreferences.PSPM_ALWAYS.equals(pspm); } String desc = finalPersp.getDescription(); String message; if (desc == null || desc.length() == 0) message = NLS.bind(ResourceMessages.NewProject_perspSwitchMessage, finalPersp.getLabel()); else message = NLS.bind( ResourceMessages.NewProject_perspSwitchMessageWithDesc, new String[] { finalPersp.getLabel(), desc }); MessageDialogWithToggle dialog = MessageDialogWithToggle .openYesNoQuestion(window.getShell(), ResourceMessages.NewProject_perspSwitchTitle, message, null /* use the default message for the toggle */, false /* toggle is initially unchecked */, store, IDEInternalPreferences.PROJECT_SWITCH_PERSP_MODE); int result = dialog.getReturnCode(); // If we are not going to prompt anymore propogate the choice. if (dialog.getToggleState()) { String preferenceValue; if (result == IDialogConstants.YES_ID) { // Doesn't matter if it is replace or new window // as we are going to use the open perspective setting preferenceValue = IWorkbenchPreferenceConstants.OPEN_PERSPECTIVE_REPLACE; } else { preferenceValue = IWorkbenchPreferenceConstants.NO_NEW_PERSPECTIVE; } // update PROJECT_OPEN_NEW_PERSPECTIVE to correspond PrefUtil.getAPIPreferenceStore().setValue( IDE.Preferences.PROJECT_OPEN_NEW_PERSPECTIVE, preferenceValue); } return result == IDialogConstants.YES_ID; }
private boolean useWindowWorkingSetByDefault() { return fAllowWindowWorkingSetByDefault && PlatformUI.getPreferenceStore().getBoolean(IWorkbenchPreferenceConstants.USE_WINDOW_WORKING_SET_BY_DEFAULT); }
public StackPresentation createEditorPresentation(Composite parent, IStackPresentationSite site) { DefaultTabFolder folder = new DefaultTabFolder(parent, editorTabPosition | SWT.BORDER, site .supportsState(IStackPresentationSite.STATE_MINIMIZED), site.supportsState(IStackPresentationSite.STATE_MAXIMIZED)); /* * Set the minimum characters to display, if the preference is something * other than the default. This is mainly intended for RCP applications * or for expert users (i.e., via the plug-in customization file). * * Bug 32789. */ final IPreferenceStore store = PlatformUI.getPreferenceStore(); if (store .contains(IWorkbenchPreferenceConstants.EDITOR_MINIMUM_CHARACTERS)) { final int minimumCharacters = store .getInt(IWorkbenchPreferenceConstants.EDITOR_MINIMUM_CHARACTERS); if (minimumCharacters >= 0) { folder.setMinimumCharacters(minimumCharacters); } } PresentablePartFolder partFolder = new PresentablePartFolder(folder); TabbedStackPresentation result = new TabbedStackPresentation(site, partFolder, new StandardEditorSystemMenu(site)); DefaultThemeListener themeListener = new DefaultThemeListener(folder, result.getTheme()); result.getTheme().addListener(themeListener); new DefaultMultiTabListener(result.getApiPreferences(), IWorkbenchPreferenceConstants.SHOW_MULTIPLE_EDITOR_TABS, folder); new DefaultSimpleTabListener(result.getApiPreferences(), IWorkbenchPreferenceConstants.SHOW_TRADITIONAL_STYLE_TABS, folder); return result; }
/** * 构建界面显示控件 * @param parent * 顶层容器 ; */ private Composite initContents(Composite parent) { final Composite page = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(1, false); layout.marginWidth = 0; page.setLayout(layout); // 不显示过滤文本框 PlatformUI.getPreferenceStore().setDefault(IWorkbenchPreferenceConstants.SHOW_FILTERED_TEXTS, false); Group groupParent = new Group(page, SWT.None); groupParent.setLayout(new GridLayout()); groupParent.setLayoutData(new GridData(GridData.FILL_BOTH)); groupParent.setText(Messages.getString("languagecode.LanguageCodesPreferencePage.groupParent")); HsImageLabel imageLabel = new HsImageLabel( Messages.getString("languagecode.LanguageCodesPreferencePage.imageLabel"), Activator.getImageDescriptor(ImageConstant.PREFERENCE_SYS_LANG_CODE)); Composite cmp = imageLabel.createControl(groupParent); cmp.setLayout(new GridLayout()); Composite cmpTemp = (Composite) imageLabel.getControl(); cmpTemp.setLayoutData(new GridData(GridData.FILL_BOTH)); Composite cmpContent = new Composite(cmpTemp, SWT.None); cmpContent.setLayout(layout); GridData data = new GridData(GridData.FILL_BOTH); data.horizontalSpan = 2; cmpContent.setLayoutData(data); // 放置过滤文本框的容器 createFilterControls(cmpContent); // 创建添加、删除按钮 createLanguageControls(page); // 暂注释掉 创建与当前语言区域相关的数字、货币、时间、短日期、长日期的格式显示控件 // createLocaleFormatControls(page); imageLabel.computeSize(); // cmpContent.computeSize(SWT.DEFAULT, SWT.DEFAULT); return page; }
@Override protected Control createContents(Composite parent) { PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, IWorkbenchHelpContextIds.KEYS_PREFERENCE_PAGE); final Composite page = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(1, false); layout.marginWidth = 0; page.setLayout(layout); Group groupParent = new Group(page, SWT.None); groupParent.setLayout(new GridLayout()); groupParent.setLayoutData(new GridData(GridData.FILL_BOTH)); groupParent.setText(Messages.getString("preferencepage.KeysPreferencePage.groupParent")); HsImageLabel imageLabel = new HsImageLabel(Messages.getString("preferencepage.KeysPreferencePage.imageLabel"), Activator.getImageDescriptor(ImageConstant.PREFERENCE_SYS_KEY)); Composite cmp = imageLabel.createControl(groupParent); cmp.setLayout(new GridLayout()); Composite cmpTemp = (Composite) imageLabel.getControl(); cmpTemp.setLayoutData(new GridData(GridData.FILL_BOTH)); Composite cmpContent = new Composite(cmpTemp, SWT.None); cmpContent.setLayout(new GridLayout()); GridData data = new GridData(GridData.FILL_BOTH); data.horizontalSpan = 2; cmpContent.setLayoutData(data); // 不显示过滤文本框 PlatformUI.getPreferenceStore().setDefault(IWorkbenchPreferenceConstants.SHOW_FILTERED_TEXTS, false); IDialogSettings settings = getDialogSettings(); fPatternFilter = new CategoryPatternFilter(true, commandService.getCategory(null)); if (settings.get(TAG_FILTER_UNCAT) != null) { fPatternFilter.filterCategories(settings.getBoolean(TAG_FILTER_UNCAT)); } createTree(cmpContent); fill(); applyDialogFont(cmpContent); imageLabel.computeSize(); return page; }
public String getInitialWindowPerspectiveId() { return IWorkbenchPreferenceConstants.DEFAULT_PERSPECTIVE_ID; //return INITIAL_PERSPECTIVE_ID; }
@Override protected Control createContents(Composite parent) { PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, IWorkbenchHelpContextIds.KEYS_PREFERENCE_PAGE); final Composite page = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(1, false); layout.marginWidth = 0; page.setLayout(layout); Group groupParent = new Group(page, SWT.None); groupParent.setLayout(new GridLayout()); groupParent.setLayoutData(new GridData(GridData.FILL_BOTH)); groupParent.setText(Messages.getString("preferencepage.KeysPreferencePage.groupParent")); HsImageLabel imageLabel = new HsImageLabel(Messages.getString("preferencepage.KeysPreferencePage.imageLabel"), Activator.getImageDescriptor(ImageConstants.PREFERENCE_SYS_KEY)); Composite cmp = imageLabel.createControl(groupParent); cmp.setLayout(new GridLayout()); Composite cmpTemp = (Composite) imageLabel.getControl(); cmpTemp.setLayoutData(new GridData(GridData.FILL_BOTH)); Composite cmpContent = new Composite(cmpTemp, SWT.None); cmpContent.setLayout(new GridLayout()); GridData data = new GridData(GridData.FILL_BOTH); data.horizontalSpan = 2; cmpContent.setLayoutData(data); // 不显示过滤文本框 PlatformUI.getPreferenceStore().setDefault(IWorkbenchPreferenceConstants.SHOW_FILTERED_TEXTS, false); IDialogSettings settings = getDialogSettings(); fPatternFilter = new CategoryPatternFilter(true, commandService.getCategory(null)); if (settings.get(TAG_FILTER_UNCAT) != null) { fPatternFilter.filterCategories(settings.getBoolean(TAG_FILTER_UNCAT)); } createTree(cmpContent); fill(); applyDialogFont(cmpContent); imageLabel.computeSize(); return page; }
/** * 构建界面显示控件 * @param parent * 顶层容器 ; */ private Composite initContents(Composite parent) { final Composite page = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(1, false); layout.marginWidth = 0; page.setLayout(layout); // 不显示过滤文本框 PlatformUI.getPreferenceStore().setDefault(IWorkbenchPreferenceConstants.SHOW_FILTERED_TEXTS, false); Group groupParent = new Group(page, SWT.None); groupParent.setLayout(new GridLayout()); groupParent.setLayoutData(new GridData(GridData.FILL_BOTH)); groupParent.setText(Messages.getString("languagecode.LanguageCodesPreferencePage.groupParent")); HsImageLabel imageLabel = new HsImageLabel( Messages.getString("languagecode.LanguageCodesPreferencePage.imageLabel"), Activator.getImageDescriptor("images/preference/system/sys_language_code_32.png")); Composite cmp = imageLabel.createControl(groupParent); cmp.setLayout(new GridLayout()); Composite cmpTemp = (Composite) imageLabel.getControl(); cmpTemp.setLayoutData(new GridData(GridData.FILL_BOTH)); Composite cmpContent = new Composite(cmpTemp, SWT.None); cmpContent.setLayout(layout); GridData data = new GridData(GridData.FILL_BOTH); data.horizontalSpan = 2; cmpContent.setLayoutData(data); // 放置过滤文本框的容器 createFilterControls(cmpContent); // 创建添加、删除按钮 createLanguageControls(page); // 暂注释掉 创建与当前语言区域相关的数字、货币、时间、短日期、长日期的格式显示控件 // createLocaleFormatControls(page); imageLabel.computeSize(); // cmpContent.computeSize(SWT.DEFAULT, SWT.DEFAULT); return page; }