Package org.eclipse.core.runtime.preferences

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


   * @return
   * @throws CoreException
   */
  public String getDevelopmentLanguage() throws CoreException {
    IScopeContext projectScope = new ProjectScope(getDesignRoot().getProject());
    IEclipsePreferences projectNode = projectScope.getNode(Activator.PLUGIN_ID);
    String langCode = projectNode.get("WGA_DESIGN_DEV_LANGUAGE/" + getDesignRoot().getLocation(), null);
    if (langCode != null && getAvailableLableLanguages().contains(langCode.toLowerCase())) {
      return langCode.toLowerCase();
    } else {
      List<String> languages = getAvailableLableLanguages();
      if (languages.isEmpty()) {
View Full Code Here


    }
  }

  public boolean isSortLabelFiles() {
    IScopeContext projectScope = new ProjectScope(getDesignRoot().getProject());
    IEclipsePreferences projectNode = projectScope.getNode(Activator.PLUGIN_ID);
    return projectNode.getBoolean("WGA_DESIGN_SORT_LABEL_FILES/" + getDesignRoot().getLocation(), false);
  }
View Full Code Here

    return projectNode.getBoolean("WGA_DESIGN_SORT_LABEL_FILES/" + getDesignRoot().getLocation(), false);
  }

  public void setSortLabelFiles(boolean sort) throws BackingStoreException {
    IScopeContext projectScope = new ProjectScope(getDesignRoot().getProject());
    IEclipsePreferences projectNode = projectScope.getNode(Activator.PLUGIN_ID);
    projectNode.putBoolean("WGA_DESIGN_SORT_LABEL_FILES/" + getDesignRoot().getLocation(), sort);
    projectNode.flush();
  }
View Full Code Here

  public void setDevelopmentLanguage(String langCode) throws CoreException, BackingStoreException {
    if (langCode != null) {
      langCode = langCode.toLowerCase();
    }
    IScopeContext projectScope = new ProjectScope(getDesignRoot().getProject());
    IEclipsePreferences projectNode = projectScope.getNode(Activator.PLUGIN_ID);
    projectNode.put("WGA_DESIGN_DEV_LANGUAGE/" + getDesignRoot().getLocation(), langCode);
    projectNode.flush();
  }
View Full Code Here

        String projectName = project.getName();
        _specificHeaders.put(projectName, header);
   
   
    public void writeSpecificHeader(IProject project) {
        IEclipsePreferences prefs = Plugin.getDefault().getProjectPreferences(project);
        prefs.put(getName(), getSpecificHeader(project));
        try {
            prefs.flush();
        }
        catch (BackingStoreException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
View Full Code Here

            e.printStackTrace();
        }
    }
   
    public void readSpecificHeader(IProject project){
        IEclipsePreferences prefs = Plugin.getDefault().getProjectPreferences(project);
        _specificHeaders.put(project.getName(),prefs.get(getName(), ""));
    }   
View Full Code Here

        // Get cached preferences if exist
        JavaModelManager.PerProjectInfo perProjectInfo = JavaModelManager.getJavaModelManager().getPerProjectInfo(this.project, true);
        if (perProjectInfo.preferences != null) return perProjectInfo.preferences;
        // Init project preferences
        IScopeContext context = new ProjectScope(getProject());
        final IEclipsePreferences eclipsePreferences = context.getNode(JavaCore.PLUGIN_ID);
        updatePreferences(eclipsePreferences);
        perProjectInfo.preferences = eclipsePreferences;
   
        // Listen to node removal from parent in order to reset cache (see bug 68993)
        IEclipsePreferences.INodeChangeListener nodeListener = new IEclipsePreferences.INodeChangeListener() {
          public void added(IEclipsePreferences.NodeChangeEvent event) {
            // do nothing
          }
          public void removed(IEclipsePreferences.NodeChangeEvent event) {
            if (event.getChild() == eclipsePreferences) {
              JavaModelManager.getJavaModelManager().resetProjectPreferences(JavaProject.this);
            }
          }
        };
        ((IEclipsePreferences) eclipsePreferences.parent()).addNodeChangeListener(nodeListener);
   
        // Listen to preference changes
        IEclipsePreferences.IPreferenceChangeListener preferenceListener = new IEclipsePreferences.IPreferenceChangeListener() {
          public void preferenceChange(IEclipsePreferences.PreferenceChangeEvent event) {
            String propertyName = event.getKey();
          JavaModelManager manager = JavaModelManager.getJavaModelManager();
          if (propertyName.startsWith(JavaCore.PLUGIN_ID)) {
            if (propertyName.equals(JavaCore.CORE_JAVA_BUILD_CLEAN_OUTPUT_FOLDER) ||
              propertyName.equals(JavaCore.CORE_JAVA_BUILD_RESOURCE_COPY_FILTER) ||
              propertyName.equals(JavaCore.CORE_JAVA_BUILD_DUPLICATE_RESOURCE) ||
              propertyName.equals(JavaCore.CORE_JAVA_BUILD_RECREATE_MODIFIED_CLASS_FILES_IN_OUTPUT_FOLDER) ||
              propertyName.equals(JavaCore.CORE_JAVA_BUILD_INVALID_CLASSPATH) ||
              propertyName.equals(JavaCore.CORE_ENABLE_CLASSPATH_EXCLUSION_PATTERNS) ||
              propertyName.equals(JavaCore.CORE_ENABLE_CLASSPATH_MULTIPLE_OUTPUT_LOCATIONS) ||
              propertyName.equals(JavaCore.CORE_INCOMPLETE_CLASSPATH) ||
              propertyName.equals(JavaCore.CORE_CIRCULAR_CLASSPATH) ||
              propertyName.equals(JavaCore.CORE_INCOMPATIBLE_JDK_LEVEL))
            {
              manager.deltaState.addClasspathValidation(JavaProject.this);
            }
            manager.resetProjectOptions(JavaProject.this);
            }
          }
        };
        eclipsePreferences.addPreferenceChangeListener(preferenceListener);
        return eclipsePreferences;
      }
View Full Code Here

   */ 
  public String getOption(String optionName, boolean inheritJavaCoreOptions) {
   
    String propertyName = optionName;
    if (JavaModelManager.getJavaModelManager().optionNames.contains(propertyName)){
      IEclipsePreferences projectPreferences = getEclipsePreferences();
      String javaCoreDefault = inheritJavaCoreOptions ? JavaCore.getOption(propertyName) : null;
      if (projectPreferences == null) return javaCoreDefault;
      String value = projectPreferences.get(propertyName, javaCoreDefault);
      return value == null ? null : value.trim();
    }
    return null;
  }
View Full Code Here

    try {
      perProjectInfo = getPerProjectInfo();
      projectOptions = perProjectInfo.options;
      if (projectOptions == null) {
        // get eclipse preferences
        IEclipsePreferences projectPreferences= getEclipsePreferences();
        if (projectPreferences == null) return options; // cannot do better (non-Java project)
        // create project options
        String[] propertyNames = projectPreferences.keys();
        projectOptions = new Hashtable(propertyNames.length);
        for (int i = 0; i < propertyNames.length; i++){
          String propertyName = propertyNames[i];
          String value = projectPreferences.get(propertyName, null);
          if (value != null && optionNames.contains(propertyName)){
            projectOptions.put(propertyName, value.trim());
          }
        }   
        // cache project options
View Full Code Here

   * @see org.aspectj.org.eclipse.jdt.core.IJavaProject#setOption(java.lang.String, java.lang.String)
   */
  public void setOption(String optionName, String optionValue) {
    if (!JavaModelManager.getJavaModelManager().optionNames.contains(optionName)) return; // unrecognized option
    if (optionValue == null) return; // invalid value
    IEclipsePreferences projectPreferences = getEclipsePreferences();
    String defaultValue = JavaCore.getOption(optionName);
    if (optionValue.equals(defaultValue)) {
      // set default value => remove preference
      projectPreferences.remove(optionName);
    } else {
      projectPreferences.put(optionName, optionValue);
    }
   
    // Dump changes
    try {
      projectPreferences.flush();
    } catch (BackingStoreException e) {
      // problem with pref store - quietly ignore
    }
  }
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.