Package org.eclipse.core.runtime.preferences

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


   */
  public void setPreference(
      String nodeName, IProject project, String name, String value)
    throws IllegalArgumentException, Exception
  {
    IScopeContext context = InstanceScope.INSTANCE;

    IEclipsePreferences globalPrefs = context.getNode(nodeName);
    initializeDefaultPreferences(globalPrefs);

    Option pref = preferences.get(name);
    if (pref == null){
      pref = options.get(name);
    }

    // set global
    if (project == null){
      validateValue(pref, name, value);
      globalPrefs.put(name, value);
      globalPrefs.flush();

    }else{
      context = new ProjectScope(project);
      IEclipsePreferences projectPrefs = context.getNode(nodeName);

      // if project value is the same as the global, then remove it.
      if(value.equals(globalPrefs.get(name, null))){
        projectPrefs.remove(name);
        projectPrefs.flush();
View Full Code Here


    return store;
  }

  private IEclipsePreferences getPreferences(IProject project)
  {
    IScopeContext context = new ProjectScope(project);
    IEclipsePreferences preferences = context.getNode("org.eclipse.php.core");
    return preferences;
  }
View Full Code Here

   *
   * @return all matching content types in the preferred order
   * @see IContentTypeManager#findContentTypesFor(String)
   */
  public IContentType[][] internalFindContentTypesFor(ContentTypeMatcher matcher, final String fileName, Comparator sortingPolicy) {
    IScopeContext context = matcher.getContext();
    IContentType[][] result = {NO_CONTENT_TYPES, NO_CONTENT_TYPES};

    final Set allByFileName;

    if (context.equals(manager.getContext()))
      allByFileName = getDirectlyAssociated(fileName, IContentTypeSettings.FILE_NAME_SPEC);
    else {
      allByFileName = new HashSet(getDirectlyAssociated(fileName, IContentTypeSettings.FILE_NAME_SPEC | IContentType.IGNORE_USER_DEFINED));
      allByFileName.addAll(matcher.getDirectlyAssociated(this, fileName, IContentTypeSettings.FILE_NAME_SPEC));
    }
    Set selectedByName = selectMatchingByName(context, allByFileName, Collections.EMPTY_SET, fileName, IContentType.FILE_NAME_SPEC);
    result[0] = (IContentType[]) selectedByName.toArray(new IContentType[selectedByName.size()]);
    final String fileExtension = ContentTypeManager.getFileExtension(fileName);
    if (fileExtension != null) {
      final Set allByFileExtension;
      if (context.equals(manager.getContext()))
        allByFileExtension = getDirectlyAssociated(fileExtension, IContentTypeSettings.FILE_EXTENSION_SPEC);
      else {
        allByFileExtension = new HashSet(getDirectlyAssociated(fileExtension, IContentTypeSettings.FILE_EXTENSION_SPEC | IContentType.IGNORE_USER_DEFINED));
        allByFileExtension.addAll(matcher.getDirectlyAssociated(this, fileExtension, IContentTypeSettings.FILE_EXTENSION_SPEC));
      }
View Full Code Here

        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();
        }
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 PreferenceInitializer() {
  }

  public void initializeDefaultPreferences() {
    IScopeContext context = DefaultScope.INSTANCE;
    IEclipsePreferences node = context.getNode(CoreActivator.getDefault().getBundle().getSymbolicName());
    String folderPath = ConfigConstants.MAIN_CONFIG_FOLDER;
    node.put(DesignerCoreConstants.CONFIG_FOLDER_PREFERENCE, folderPath);
  }
View Full Code Here

        this.element = element;
        // Now that we have a project, we can reset the scope to be project specific.  NB: We're
        // guaranteed that this is an IProject because we restrict to that in plugin.xml.
        IProject project = (IProject) element.getAdapter(IProject.class);
        if (project != null) {
            IScopeContext scope = new ProjectScope(project);
            setPreferenceStore(new ScopedPreferenceStore(scope, JSLintPlugin.PLUGIN_ID));
        }
    }
View Full Code Here

    // ensure that the -outxml preference is set on the project
    // so that aj builds will produce the aop-ajc.xml file.
    AspectJPreferences.setUsingProjectSettings(project, true);
   
    // this should really go in AJDT
    IScopeContext projectScope = new ProjectScope(project);
    IEclipsePreferences projectNode = projectScope
        .getNode(AspectJPlugin.PLUGIN_ID);
    projectNode.putBoolean(AspectJPreferences.OPTION_Outxml, true);
    try {
      projectNode.flush();
    } catch (BackingStoreException e) {
View Full Code Here

  public static SpringCorePreferences getProjectPreferences(IProject project, String qualifier) {
    return new SpringCorePreferences(project, qualifier);
  }
 
  private IEclipsePreferences getEclipsePreferences(IProject project, String qualifier) {
    IScopeContext context = new ProjectScope(project);
    IEclipsePreferences node = context.getNode(qualifier);
    return node;
  }
View Full Code Here

  /**
   * Checks if the default double click action is active
   * @since 2.0.2
   */
  public static boolean shouldOpenConfigFile() {
    IScopeContext context = new InstanceScope();
    IEclipsePreferences node = context.getNode(BeansUIPlugin.PLUGIN_ID);
    return node.getBoolean(
        BeansUIPlugin.DEFAULT_DOUBLE_CLICK_ACTION_PREFERENCE_ID, true);
  }
View Full Code Here

TOP

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

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.