Package org.eclipse.core.runtime.preferences

Examples of org.eclipse.core.runtime.preferences.IEclipsePreferences


    private Map/* <IProject, IEclipsePreferences> */projectPrefs = new HashMap();

    public List/* <StandaloneRetrieveSetup> */getSetup(IProject project) throws IOException {

        IEclipsePreferences pref;
        synchronized (projectPrefs) {
            pref = (IEclipsePreferences) projectPrefs.get(project);
        }
        if (pref == null) {
            IScopeContext projectScope = new ProjectScope(project);
            pref = projectScope.getNode(IvyPlugin.ID);
        }
        String retrieveSetup = pref.get(PREF_ID, null);
        if (retrieveSetup == null) {
            return new ArrayList();
        }
        List/* <StandaloneRetrieveSetup> */retrieveSetups;

 
View Full Code Here


        }

        final String retrieveSetup = new String(out.toByteArray());

        synchronized (projectPrefs) {
            IEclipsePreferences pref = (IEclipsePreferences) projectPrefs.get(project);
            if (pref == null) {
                IScopeContext projectScope = new ProjectScope(project);
                pref = projectScope.getNode(IvyPlugin.ID);
                projectPrefs.put(project, pref);
            }
            pref.put(PREF_ID, retrieveSetup);
        }
    }
View Full Code Here

  
  public void initializeDefaultPreferences() {

   
    IScopeContext context = new DefaultScope();
    IEclipsePreferences node = context.getNode(UIPlugin.getDefault()
        .getBundle().getSymbolicName());
    node.put(IWorkbenchPreferenceConstants.OPEN_NEW_PERSPECTIVE,
        IWorkbenchPreferenceConstants.OPEN_PERSPECTIVE_REPLACE);

    // Deprecated but kept for backwards compatibility
    node.put(IWorkbenchPreferenceConstants.PROJECT_OPEN_NEW_PERSPECTIVE,
        IWorkbenchPreferenceConstants.OPEN_PERSPECTIVE_REPLACE);
    node.put(IWorkbenchPreferenceConstants.SHIFT_OPEN_NEW_PERSPECTIVE,
        IWorkbenchPreferenceConstants.OPEN_PERSPECTIVE_REPLACE);
    node.put(IWorkbenchPreferenceConstants.ALTERNATE_OPEN_NEW_PERSPECTIVE,
        IWorkbenchPreferenceConstants.OPEN_PERSPECTIVE_REPLACE);

    // Although there is no longer any item on the preference pages
    // for setting the linking preference, since it is now a per-part
    // setting, it remains as a preference to allow product overrides of the
    // initial state of linking in the Navigator. By default, linking is
    // off.
    node.putBoolean(IWorkbenchPreferenceConstants.LINK_NAVIGATOR_TO_EDITOR,
        false);

    // Appearance / Presentation preferences
    node.put(IWorkbenchPreferenceConstants.PRESENTATION_FACTORY_ID,
        IWorkbenchConstants.DEFAULT_PRESENTATION_ID);
    node
        .putBoolean(
            IWorkbenchPreferenceConstants.SHOW_TRADITIONAL_STYLE_TABS,
            true);
    node.putBoolean(IWorkbenchPreferenceConstants.ENABLE_ANIMATIONS, true);
    node.put(IWorkbenchPreferenceConstants.DOCK_PERSPECTIVE_BAR,
        IWorkbenchPreferenceConstants.TOP_LEFT);
    node.putBoolean(
        IWorkbenchPreferenceConstants.SHOW_TEXT_ON_PERSPECTIVE_BAR,
        true);

    // the fast view bar should be on the bottom of a fresh workspace
    node.put(IWorkbenchPreferenceConstants.INITIAL_FAST_VIEW_BAR_LOCATION,
        IWorkbenchPreferenceConstants.BOTTOM);

    // default to showing intro on startup
    node.putBoolean(IWorkbenchPreferenceConstants.SHOW_INTRO, true);

    // Default to the standard key configuration.
    node.put(IWorkbenchPreferenceConstants.KEY_CONFIGURATION_ID,
        IBindingService.DEFAULT_DEFAULT_ACTIVE_SCHEME_ID);

    // Preference for showing system jobs in the jobs view
    node.putBoolean(IWorkbenchPreferenceConstants.SHOW_SYSTEM_JOBS, false);

    // The default minimum character width for editor tabs is undefined
    // (i.e., -1)
    node
        .putInt(
            IWorkbenchPreferenceConstants.EDITOR_MINIMUM_CHARACTERS,
            -1);

    // The default minimum character width for view tabs is 1
    node.putInt(IWorkbenchPreferenceConstants.VIEW_MINIMUM_CHARACTERS, 1);

    // Default for closing editors on exit.
    node.putBoolean(IWorkbenchPreferenceConstants.CLOSE_EDITORS_ON_EXIT,
        false);

    // Default for using window working sets
    node
        .putBoolean(
            IWorkbenchPreferenceConstants.USE_WINDOW_WORKING_SET_BY_DEFAULT,
            false);

    // Default for showing filter text widget that determines what is shown
    // in a FilteredTree
    node
        .putBoolean(IWorkbenchPreferenceConstants.SHOW_FILTERED_TEXTS,
            true);

    // Default for enabling detached views
    node.putBoolean(IWorkbenchPreferenceConstants.ENABLE_DETACHED_VIEWS,
        true);

    // Default for prompting for save when saveables are still held on to by other parts
    node.putBoolean(IWorkbenchPreferenceConstants.PROMPT_WHEN_SAVEABLE_STILL_OPEN,
        true);

    // Default the min/max behaviour to the old (3.2) style
    node.putBoolean(IWorkbenchPreferenceConstants.ENABLE_NEW_MIN_MAX, true);
   
    // By default the Fast View Bar allows to select a new fast view from the view list
    node.putBoolean(IWorkbenchPreferenceConstants.DISABLE_NEW_FAST_VIEW, false);
   
    // Default the sticky view close behaviour to the new style
    node.putBoolean(IWorkbenchPreferenceConstants.ENABLE_32_STICKY_CLOSE_BEHAVIOR, false);

    IEclipsePreferences rootNode = (IEclipsePreferences) Platform
        .getPreferencesService().getRootNode()
        .node(InstanceScope.SCOPE);

    final String uiName = UIPlugin.getDefault().getBundle()
        .getSymbolicName();
    try {
      if (rootNode.nodeExists(uiName)) {
        ((IEclipsePreferences) rootNode.node(uiName))
            .addPreferenceChangeListener(PlatformUIPreferenceListener
                .getSingleton());
      }
    } catch (BackingStoreException e) {
      IStatus status = new Status(IStatus.ERROR, UIPlugin.getDefault()
          .getBundle().getSymbolicName(), IStatus.ERROR, e
          .getLocalizedMessage(), e);
      UIPlugin.getDefault().getLog().log(status);
    }

    rootNode
        .addNodeChangeListener(new IEclipsePreferences.INodeChangeListener() {
          /*
           * (non-Javadoc)
           *
           * @see org.eclipse.core.runtime.preferences.IEclipsePreferences.INodeChangeListener#added(org.eclipse.core.runtime.preferences.IEclipsePreferences.NodeChangeEvent)
View Full Code Here

   * given object's type and then looks in the list of defaults to see if a value
   * exists. If not or if there is a problem converting the value, the default default
   * value for that type is returned.
   */
  private Object getDefault(String key, Object obj) {
    IEclipsePreferences defaults = getDefaultPreferences();
    if (obj instanceof String)
      return defaults.get(key, STRING_DEFAULT_DEFAULT);
    else if (obj instanceof Integer)
      return new Integer(defaults.getInt(key, INT_DEFAULT_DEFAULT));
    else if (obj instanceof Double)
      return new Double(defaults.getDouble(key, DOUBLE_DEFAULT_DEFAULT));
    else if (obj instanceof Float)
      return new Float(defaults.getFloat(key, FLOAT_DEFAULT_DEFAULT));
    else if (obj instanceof Long)
      return new Long(defaults.getLong(key, LONG_DEFAULT_DEFAULT));
    else if (obj instanceof byte[])
      return defaults.getByteArray(key, BYTE_ARRAY_DEFAULT_DEFAULT);
    else if (obj instanceof Boolean)
      return defaults.getBoolean(key, BOOLEAN_DEFAULT_DEFAULT) ? Boolean.TRUE : Boolean.FALSE;
    else
      return null;
  }
View Full Code Here

   * </p>
   *
   * @param name the name of the property
   */
  public void setToDefault(String name) {
    IEclipsePreferences preferences = getPluginPreferences(true);
    Object oldValue = preferences.get(name, null);
    if (oldValue != null)
      preferences.remove(name);
  }
View Full Code Here

   * Flush the values of these plug-in preferences to disk.
   *
   * @throws BackingStoreException
   */
  public void flush() throws BackingStoreException {
    IEclipsePreferences node = getPluginPreferences(false);
    if (node != null)
      node.flush();
  }
View Full Code Here

      throw new IOException(e.getMessage());
    }
  }

  private void convertFromProperties(Properties props) {
    IEclipsePreferences preferences = getPluginPreferences(true);
    for (Iterator i = props.keySet().iterator(); i.hasNext();) {
      String key = (String) i.next();
      String value = props.getProperty(key);
      if (value != null)
        preferences.put(key, value);
    }
  }
View Full Code Here

 
 

  public void initializeDefaultPreferences() {
    IScopeContext context = new DefaultScope();
    IEclipsePreferences node = context.getNode(WorkbenchPlugin
        .getDefault().getBundle().getSymbolicName());

    node
        .putBoolean(IPreferenceConstants.SHOULD_PROMPT_FOR_ENABLEMENT,
            true);

    node.putBoolean(IPreferenceConstants.EDITORLIST_PULLDOWN_ACTIVE, false);
    node.putBoolean(IPreferenceConstants.EDITORLIST_DISPLAY_FULL_NAME,
        false);
    node.putBoolean(IPreferenceConstants.STICKY_CYCLE, false);
    node.putBoolean(IPreferenceConstants.REUSE_EDITORS_BOOLEAN, false);
    node.putBoolean(IPreferenceConstants.REUSE_DIRTY_EDITORS, true);
    node.putInt(IPreferenceConstants.REUSE_EDITORS, 8);
    node.putBoolean(IPreferenceConstants.OPEN_ON_SINGLE_CLICK, false);
    node.putBoolean(IPreferenceConstants.SELECT_ON_HOVER, false);
    node.putBoolean(IPreferenceConstants.OPEN_AFTER_DELAY, false);
    node.putInt(IPreferenceConstants.RECENT_FILES, 4);

    node.putInt(IPreferenceConstants.VIEW_TAB_POSITION, SWT.TOP);
    node.putInt(IPreferenceConstants.EDITOR_TAB_POSITION, SWT.TOP);

    node.putBoolean(IPreferenceConstants.SHOW_MULTIPLE_EDITOR_TABS, true);
    node.putBoolean(IPreferenceConstants.USE_IPERSISTABLE_EDITORS, true);

    node.putInt(IPreferenceConstants.EDITOR_TAB_WIDTH, 3); // high
    node.putInt(IPreferenceConstants.OPEN_VIEW_MODE,
        IPreferenceConstants.OVM_EMBED);
    node.putInt(IPreferenceConstants.OPEN_PERSP_MODE,
        IPreferenceConstants.OPM_ACTIVE_PAGE);
    node.put(IPreferenceConstants.ENABLED_DECORATORS, ""); //$NON-NLS-1$
    node.putInt(IPreferenceConstants.EDITORLIST_SELECTION_SCOPE,
        IPreferenceConstants.EDITORLIST_SET_PAGE_SCOPE); // Current
                                 // Window
    node.putInt(IPreferenceConstants.EDITORLIST_SORT_CRITERIA,
        IPreferenceConstants.EDITORLIST_NAME_SORT); // Name Sort
    node.putBoolean(IPreferenceConstants.COLOR_ICONS, true);
    node.putInt(IPreferenceConstants.KEYS_PREFERENCE_SELECTED_TAB, 0);
    node.putBoolean(IPreferenceConstants.MULTI_KEY_ASSIST, true);
    node.putInt(IPreferenceConstants.MULTI_KEY_ASSIST_TIME, 1000);

    // Temporary option to enable wizard for project capability
    node.putBoolean("ENABLE_CONFIGURABLE_PROJECT_WIZARD", false); //$NON-NLS-1$
    // Temporary option to enable single click
    node.putInt("SINGLE_CLICK_METHOD", OpenStrategy.DOUBLE_CLICK); //$NON-NLS-1$
    // Temporary option to enable cool bars
    node.putBoolean("ENABLE_COOL_BARS", true); //$NON-NLS-1$
    // Temporary option to enable new menu organization
    node.putBoolean("ENABLE_NEW_MENUS", true); //$NON-NLS-1$  
    //Temporary option to turn off the dialog font
    node.putBoolean("DISABLE_DIALOG_FONT", false); //$NON-NLS-1$

    // Heap status preferences
    node.putBoolean(IWorkbenchPreferenceConstants.SHOW_MEMORY_MONITOR, false);
    node.putInt(IHeapStatusConstants.PREF_UPDATE_INTERVAL, 500);
    node.putBoolean(IHeapStatusConstants.PREF_SHOW_MAX, false);
    node.putBoolean(IPreferenceConstants.OVERRIDE_PRESENTATION, false);
   
    IEclipsePreferences rootNode = (IEclipsePreferences) Platform
        .getPreferencesService().getRootNode()
        .node(InstanceScope.SCOPE);

    final String workbenchName = WorkbenchPlugin.getDefault().getBundle()
        .getSymbolicName();
    try {
      if (rootNode.nodeExists(workbenchName)) {
        ((IEclipsePreferences) rootNode.node(workbenchName))
            .addPreferenceChangeListener(PlatformUIPreferenceListener
                .getSingleton());
      }
    } catch (BackingStoreException e) {
      IStatus status = new Status(IStatus.ERROR, WorkbenchPlugin
View Full Code Here

  public IEclipsePreferences getWorkingCopy(IEclipsePreferences original) {
    if (original instanceof WorkingCopyPreferences) {
      throw new IllegalArgumentException("Trying to get a working copy of a working copy"); //$NON-NLS-1$
    }
    String absolutePath = original.absolutePath();
    IEclipsePreferences preferences = (IEclipsePreferences) workingCopies.get(absolutePath);
    if (preferences == null) {
      preferences = new WorkingCopyPreferences(original, this);
      workingCopies.put(absolutePath, preferences);
    }
    return preferences;
View Full Code Here

   * @param obj
   *            the object who default we are looking for
   * @return Object or <code>null</code>
   */
  Object getDefault(String key, Object obj) {
    IEclipsePreferences defaults = getDefaultPreferences();
    if (obj instanceof String) {
      return defaults.get(key, STRING_DEFAULT_DEFAULT);
    } else if (obj instanceof Integer) {
      return new Integer(defaults.getInt(key, INT_DEFAULT_DEFAULT));
    } else if (obj instanceof Double) {
      return new Double(defaults.getDouble(key, DOUBLE_DEFAULT_DEFAULT));
    } else if (obj instanceof Float) {
      return new Float(defaults.getFloat(key, FLOAT_DEFAULT_DEFAULT));
    } else if (obj instanceof Long) {
      return new Long(defaults.getLong(key, LONG_DEFAULT_DEFAULT));
    } else if (obj instanceof Boolean) {
      return defaults.getBoolean(key, BOOLEAN_DEFAULT_DEFAULT) ? Boolean.TRUE : Boolean.FALSE;
    } else {
      return null;
    }
  }
View Full Code Here

TOP

Related Classes of org.eclipse.core.runtime.preferences.IEclipsePreferences

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.