1 11 package org.eclipse.ui.internal; 12 13 import org.eclipse.core.runtime.IStatus; 14 import org.eclipse.core.runtime.Platform; 15 import org.eclipse.core.runtime.Status; 16 import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer; 17 import org.eclipse.core.runtime.preferences.DefaultScope; 18 import org.eclipse.core.runtime.preferences.IEclipsePreferences; 19 import org.eclipse.core.runtime.preferences.IScopeContext; 20 import org.eclipse.core.runtime.preferences.InstanceScope; 21 import org.eclipse.jface.util.OpenStrategy; 22 import org.eclipse.swt.SWT; 23 import org.eclipse.ui.IWorkbenchPreferenceConstants; 24 import org.osgi.service.prefs.BackingStoreException; 25 26 35 public class WorkbenchPreferenceInitializer extends 36 AbstractPreferenceInitializer { 37 38 39 40 public void initializeDefaultPreferences() { 41 IScopeContext context = new DefaultScope(); 42 IEclipsePreferences node = context.getNode(WorkbenchPlugin 43 .getDefault().getBundle().getSymbolicName()); 44 45 node 46 .putBoolean(IPreferenceConstants.SHOULD_PROMPT_FOR_ENABLEMENT, 47 true); 48 49 node.putBoolean(IPreferenceConstants.EDITORLIST_PULLDOWN_ACTIVE, false); 50 node.putBoolean(IPreferenceConstants.EDITORLIST_DISPLAY_FULL_NAME, 51 false); 52 node.putBoolean(IPreferenceConstants.STICKY_CYCLE, false); 53 node.putBoolean(IPreferenceConstants.REUSE_EDITORS_BOOLEAN, false); 54 node.putBoolean(IPreferenceConstants.REUSE_DIRTY_EDITORS, true); 55 node.putInt(IPreferenceConstants.REUSE_EDITORS, 8); 56 node.putBoolean(IPreferenceConstants.OPEN_ON_SINGLE_CLICK, false); 57 node.putBoolean(IPreferenceConstants.SELECT_ON_HOVER, false); 58 node.putBoolean(IPreferenceConstants.OPEN_AFTER_DELAY, false); 59 node.putInt(IPreferenceConstants.RECENT_FILES, 4); 60 61 node.putInt(IPreferenceConstants.VIEW_TAB_POSITION, SWT.TOP); 62 node.putInt(IPreferenceConstants.EDITOR_TAB_POSITION, SWT.TOP); 63 64 node.putBoolean(IPreferenceConstants.SHOW_MULTIPLE_EDITOR_TABS, true); 65 node.putBoolean(IPreferenceConstants.USE_IPERSISTABLE_EDITORS, true); 66 67 node.putInt(IPreferenceConstants.EDITOR_TAB_WIDTH, 3); node.putInt(IPreferenceConstants.OPEN_VIEW_MODE, 69 IPreferenceConstants.OVM_EMBED); 70 node.putInt(IPreferenceConstants.OPEN_PERSP_MODE, 71 IPreferenceConstants.OPM_ACTIVE_PAGE); 72 node.put(IPreferenceConstants.ENABLED_DECORATORS, ""); node.putInt(IPreferenceConstants.EDITORLIST_SELECTION_SCOPE, 74 IPreferenceConstants.EDITORLIST_SET_PAGE_SCOPE); node.putInt(IPreferenceConstants.EDITORLIST_SORT_CRITERIA, 77 IPreferenceConstants.EDITORLIST_NAME_SORT); node.putBoolean(IPreferenceConstants.COLOR_ICONS, true); 79 node.putInt(IPreferenceConstants.KEYS_PREFERENCE_SELECTED_TAB, 0); 80 node.putBoolean(IPreferenceConstants.MULTI_KEY_ASSIST, true); 81 node.putInt(IPreferenceConstants.MULTI_KEY_ASSIST_TIME, 1000); 82 83 node.putBoolean("ENABLE_CONFIGURABLE_PROJECT_WIZARD", false); node.putInt("SINGLE_CLICK_METHOD", OpenStrategy.DOUBLE_CLICK); node.putBoolean("ENABLE_COOL_BARS", true); node.putBoolean("ENABLE_NEW_MENUS", true); node.putBoolean("DISABLE_DIALOG_FONT", false); 94 node.putBoolean(IWorkbenchPreferenceConstants.SHOW_MEMORY_MONITOR, false); 96 node.putInt(IHeapStatusConstants.PREF_UPDATE_INTERVAL, 500); 97 node.putBoolean(IHeapStatusConstants.PREF_SHOW_MAX, false); 98 node.putBoolean(IPreferenceConstants.OVERRIDE_PRESENTATION, false); 99 100 IEclipsePreferences rootNode = (IEclipsePreferences) Platform 101 .getPreferencesService().getRootNode() 102 .node(InstanceScope.SCOPE); 103 104 final String workbenchName = WorkbenchPlugin.getDefault().getBundle() 105 .getSymbolicName(); 106 try { 107 if (rootNode.nodeExists(workbenchName)) { 108 ((IEclipsePreferences) rootNode.node(workbenchName)) 109 .addPreferenceChangeListener(PlatformUIPreferenceListener 110 .getSingleton()); 111 } 112 } catch (BackingStoreException e) { 113 IStatus status = new Status(IStatus.ERROR, WorkbenchPlugin 114 .getDefault().getBundle().getSymbolicName(), IStatus.ERROR, 115 e.getLocalizedMessage(), e); 116 WorkbenchPlugin.getDefault().getLog().log(status); 117 } 118 119 } 120 121 } 122 | Popular Tags |