org.eclipse.ui.internal.util.PrefUtil Java Examples
The following examples show how to use
org.eclipse.ui.internal.util.PrefUtil.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: N4JSApplicationWorkbenchWindowAdvisor.java From n4js with Eclipse Public License 1.0 | 6 votes |
private void updateDefaultEditorMappingIfAbsent() { final EditorRegistry registry = (EditorRegistry) WorkbenchPlugin.getDefault().getEditorRegistry(); for (final IFileEditorMapping editorMapping : registry.getFileEditorMappings()) { final IEditorDescriptor defaultEditor = editorMapping.getDefaultEditor(); if (null == defaultEditor) { final String extension = editorMapping.getExtension(); LOGGER.info("No default editor is associated with files with extension: '." + extension + "'."); final IEditorDescriptor defaultTextEditor = registry.findEditor(DEFAULT_TEXT_EDITOR_ID); if (null != defaultTextEditor) { ((FileEditorMapping) editorMapping).setDefaultEditor(defaultTextEditor); String editorName = defaultTextEditor.getLabel(); if (null == editorName) { editorName = defaultTextEditor.getId(); } if (null != editorName) { LOGGER.info("Associated files with extension " + extension + " with '" + editorName + "'."); } } } } registry.saveAssociations(); PrefUtil.savePrefs(); }
Example #2
Source File: LifeCycleHook.java From MergeProcessor with Apache License 2.0 | 5 votes |
@ProcessRemovals public void removeElementsFromContext() { /* * WorkbenchWindow.populateStandardTrim(MTrimBar) automatically shows the heap * status in the status line. LifeCycleHook.removeElementsFromContext(...) is * called before the element is created. Therefore, we set the preference to not * show the heap status. * * This behaviour is only known in the 3.x legacy compatibility mode. */ PrefUtil.getAPIPreferenceStore().setValue(IWorkbenchPreferenceConstants.SHOW_MEMORY_MONITOR, false); }
Example #3
Source File: AbstractNewProjectWizard.java From typescript.java with MIT License | 5 votes |
/** * 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; }
Example #4
Source File: Application.java From gama with GNU General Public License v3.0 | 4 votes |
public static void ClearWorkspace(final boolean clear) { PrefUtil.getInternalPreferenceStore().setValue(CLEAR_WORKSPACE, Boolean.valueOf(clear).toString()); PrefUtil.saveInternalPrefs(); }
Example #5
Source File: Application.java From gama with GNU General Public License v3.0 | 4 votes |
public static boolean IsClearWorkspace() { final boolean result = PrefUtil.getInternalPreferenceStore().getBoolean(CLEAR_WORKSPACE); DEBUG.OUT("Value of clearWorkspace pref: " + result); return result; }
Example #6
Source File: PreferenceInitializer.java From bonita-studio with GNU General Public License v2.0 | 4 votes |
protected IPreferenceStore getAPIPreferenceStore() { return PrefUtil.getAPIPreferenceStore(); }
Example #7
Source File: BOSSplashHandler.java From bonita-studio with GNU General Public License v2.0 | 4 votes |
@Override public void init(final Shell splash) { super.init(splash); String progressRectString = null; String messageRectString = null; String foregroundColorString = null; final IProduct product = Platform.getProduct(); if (product != null) { progressRectString = product.getProperty(IProductConstants.STARTUP_PROGRESS_RECT); messageRectString = product.getProperty(IProductConstants.STARTUP_MESSAGE_RECT); foregroundColorString = product.getProperty(IProductConstants.STARTUP_FOREGROUND_COLOR); } final Rectangle progressRect = StringConverter.asRectangle(progressRectString); setProgressRect(progressRect); final Rectangle messageRect = StringConverter.asRectangle(messageRectString); setMessageRect(messageRect); int foregroundColorInteger; try { foregroundColorInteger = Integer.parseInt(foregroundColorString, 16); } catch (final Exception ex) { foregroundColorInteger = 0xD2D7FF; // off white } setForeground(new RGB((foregroundColorInteger & 0xFF0000) >> 16, (foregroundColorInteger & 0xFF00) >> 8, foregroundColorInteger & 0xFF)); setForeground(new RGB((foregroundColorInteger & 0xFF0000) >> 16, (foregroundColorInteger & 0xFF00) >> 8, foregroundColorInteger & 0xFF)); // the following code will be removed for release time if (PrefUtil.getInternalPreferenceStore().getBoolean( "SHOW_BUILDID_ON_STARTUP")) { //$NON-NLS-1$ final String buildId = System.getProperty( "eclipse.buildId", "Unknown Build"); //$NON-NLS-1$ //$NON-NLS-2$ // find the specified location. Not currently API // hardcoded to be sensible with our current splash Graphic final String buildIdLocString = product.getProperty("buildIdLocation"); //$NON-NLS-1$ final Point buildIdPoint = StringConverter.asPoint(buildIdLocString, new Point(322, 190)); getContent().addPaintListener(new PaintListener() { @Override public void paintControl(final PaintEvent e) { e.gc.setForeground(getForeground()); e.gc.setBackground(getForeground()) ; e.gc .drawText(buildId, buildIdPoint.x, buildIdPoint.y, true); } }); } else { getContent(); // ensure creation of the progress } }
Example #8
Source File: BonitaStudioWorkbenchWindowAdvisor.java From bonita-studio with GNU General Public License v2.0 | 4 votes |
@Override public void openIntro() { PrefUtil.getAPIPreferenceStore().setValue(IWorkbenchPreferenceConstants.SHOW_INTRO, true); PrefUtil.saveAPIPrefs(); }