Package org.eclipse.core.runtime.preferences

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


   *
   * @param id the runtime type id
   * @param value the location
   */
  public static void setPreference(String id, String value) {
    final IEclipsePreferences prefs = InstanceScope.INSTANCE.getNode(PLUGIN_ID);
    prefs.put(id, value);
    try {
      prefs.flush();
    } catch (BackingStoreException e) {
      logError(e);
    }
  }
View Full Code Here


 
  public void reload() throws BackingStoreException {
    if (!this.prefsChanging) {
      this.folders.clear();
      final ProjectScope scope = new ProjectScope(project);
      final IEclipsePreferences prefs = scope.getNode(PREFS_QUALIFIER);
     
      if (prefs.nodeExists(PREFS_DEFAULT_WEB_ROOT)) {
        final String def = prefs.get(PREFS_DEFAULT_WEB_ROOT, null);
        if (def.length() == 0) {
          this.defaultWebFolder = this.project;
        } else {
          this.defaultWebFolder = this.project.getFolder(def);
        }
      } else {
        this.defaultWebFolder = this.project;
      }
     
      if (prefs.nodeExists(PREFS_FOLDER_COUNT)) {
        for (int i = 0; i < prefs.getInt(PREFS_FOLDER_COUNT, 0); i++) {
          final String container = prefs.get(PREFS_FOLDER_CONTAINER + i, null);
          final String pathName = prefs.get(PREFS_FOLDER_PATHNAME + i, null);
          this.folders.add(new WebFolder(project.getFolder(container), pathName));
        }
      }
    }
  }
View Full Code Here

      throw new CoreException(new Status(IStatus.ERROR, PEXServerPlugin.PLUGIN_ID, "Container not within target project")); //$NON-NLS-1$
    }
    this.prefsChanging = true;
    try {
      final ProjectScope scope = new ProjectScope(project);
      final IEclipsePreferences prefs = scope.getNode(PREFS_QUALIFIER);
      prefs.put(PREFS_DEFAULT_WEB_ROOT, folder.getProjectRelativePath().toString());
      try {
        prefs.flush();
      } catch (BackingStoreException e) {
        throw new CoreException(new Status(IStatus.ERROR, PEXServerPlugin.PLUGIN_ID, "Error while saving preferences", e)); //$NON-NLS-1$
      }
      this.defaultWebFolder = folder;
    }
View Full Code Here

  private void saveFolders() throws CoreException {
    this.prefsChanging = true;
    try {
      final ProjectScope scope = new ProjectScope(project);
      final IEclipsePreferences prefs = scope.getNode(PREFS_QUALIFIER);
      prefs.put(PREFS_FOLDER_COUNT, String.valueOf(folders.size()));
      for (int i = 0; i < folders.size(); i++) {
        final WebFolder folder = this.folders.get(i);
        prefs.put(PREFS_FOLDER_CONTAINER + i, folder.getFolder().getProjectRelativePath().toString());
        prefs.put(PREFS_FOLDER_PATHNAME + i, folder.getPathName());
      }
      try {
        prefs.flush();
      } catch (BackingStoreException e) {
        throw new CoreException(new Status(IStatus.ERROR, PEXServerPlugin.PLUGIN_ID, "Error while saving preferences", e)); //$NON-NLS-1$
      }
    }
    finally {
View Full Code Here

    if (!"org.eclipse.php.debug.coreinstalledPHPDefaults".equals(event.getProperty())) {
      return;
    }

    IEclipsePreferences preferences = InstanceScope.INSTANCE.getNode(bundleId);
    String executable = preferences.get(executableKey, null);

    if (executable != null && executable.length() > 0) {
      return;
    }

    try {
      PHPexeItem[] exes = PHPexes.getInstance().getAllItems();
      if (exes.length == 1) {
        Logger.debug("PHP executable changed, setting store value for " + bundleId + " to " + executableKey + " (" + exes[0].getExecutable().toString() + ")" );
        preferences.put(executableKey, exes[0].getExecutable().toString());
        preferences.flush();
       
        // we don't need it anymore now
        PHPDebugPlugin.getDefault().getPluginPreferences().removePropertyChangeListener(this);
      }
View Full Code Here

    project.delete(true, true, null);
  }

  @Test
  public void enablingValidators() throws BackingStoreException {
    IEclipsePreferences rootNode = Platform.getPreferencesService().getRootNode();
    assertTrue(manager.isEnabled(scriptProject));

    final Preferences globalNode = rootNode.node(InstanceScope.SCOPE).node(PEXAnalysisPlugin.VALIDATORS_PREFERENCES_NODE_ID);
    globalNode.putBoolean(PreferenceConstants.ENABLED, false);
    assertFalse(manager.isEnabled(scriptProject));

    Preferences projectNode = rootNode.node(ProjectScope.SCOPE).node(project.getName()).node(PEXAnalysisPlugin.VALIDATORS_PREFERENCES_NODE_ID);
    projectNode.putBoolean(PreferenceConstants.ENABLED, true);
    assertTrue(manager.isEnabled(scriptProject));

    projectNode.remove(PreferenceConstants.ENABLED);
   
View Full Code Here

            InstanceScope.INSTANCE, DefaultScope.INSTANCE };
   
    for (int i = 0; i < contents.length; i++) {
     
      IScopeContext scopeContext = contents[i];
      IEclipsePreferences inode = scopeContext.getNode(PHPCorePlugin.ID);
     
      if (inode != null) {
       
        if (!options.containsKey(PHPCoreConstants.FORMATTER_USE_TABS)) {
         
          String useTabs = inode.get(PHPCoreConstants.FORMATTER_USE_TABS,null);
          if (useTabs != null) {
            options.put(PHPCoreConstants.FORMATTER_USE_TABS, useTabs);
          }
        }
       
        if (!options.containsKey(PHPCoreConstants.FORMATTER_INDENTATION_SIZE)) {
         
          String size = inode.get(PHPCoreConstants.FORMATTER_INDENTATION_SIZE,null);
         
          if (size != null) {
            options.put(PHPCoreConstants.FORMATTER_INDENTATION_SIZE,size);
          }
        }
View Full Code Here

    }

    public static IEclipsePreferences getPrefsNode() {
        final String qualifier = ErlideUIPlugin.PLUGIN_ID;
        final IScopeContext context = InstanceScope.INSTANCE;
        final IEclipsePreferences eclipsePreferences = context.getNode(qualifier);
        return eclipsePreferences;
    }
View Full Code Here

        } catch (final CoreException e) {
        }
    }

    private void addFilters() {
        final IEclipsePreferences prefsNode = ErlangOutlinePage.getPrefsNode();
        final Collection<FilterDescriptor> filterDescriptors = FilterDescriptor
                .getFilterDescriptors();
        final List<FilterDescriptor> descs = Lists.newArrayList();
        for (final FilterDescriptor filterDescriptor : filterDescriptors) {
            final String filterId = filterDescriptor.getId();
            final boolean value = prefsNode.getBoolean(filterId, false);
            if (value) {
                descs.add(filterDescriptor);
            }
        }
        OutlineFilterUtils.setFilters(descs, this);
View Full Code Here

    }

    public static IEclipsePreferences getPrefsNode() {
        final String qualifier = ErlideUIPlugin.PLUGIN_ID;
        final IScopeContext context = InstanceScope.INSTANCE;
        final IEclipsePreferences eclipsePreferences = context.getNode(qualifier);
        return eclipsePreferences;
    }
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.