Examples of IPreferencesService


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

    /**
     * Appends the preferences
     */
    private void appendUserPreferences(PrintWriter writer) {
        // write the prefs to a byte array
        IPreferencesService service = Platform.getPreferencesService();
        IEclipsePreferences node = service.getRootNode();
        ByteArrayOutputStream stm = new ByteArrayOutputStream();
        try {
            service.exportPreferences(node, stm, null);
        } catch (CoreException e) {
            writer.println("Error reading preferences " + e.toString());//$NON-NLS-1$   
        }

        // copy the prefs from the byte array to the writer
View Full Code Here

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

            decoded = string;
        }

        ByteArrayInputStream input = new ByteArrayInputStream(decoded.getBytes());
        try {
            IPreferencesService preferencesService = Platform.getPreferencesService();
            IExportedPreferences paramsNode = preferencesService.readPreferences(input);

            ServiceParameterPersister persister = new LayerCatalogRefPersister(connectionParams,
                    null);

            persister.restore(findParameterNode(paramsNode));
View Full Code Here

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

    }

    public void loadFromFile( File catalogLocation, IServiceFactory factory ) {
        try {
            FileInputStream input = new FileInputStream(catalogLocation);
            IPreferencesService preferencesService = Platform.getPreferencesService();
            IExportedPreferences paramsNode = preferencesService.readPreferences(input);

            ServiceParameterPersister persister = new ServiceParameterPersister(this, factory, catalogLocation);
            Preferences parameterNode = findParameterNode(paramsNode);
           
            persister.restore(parameterNode);
View Full Code Here

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

     *
     * @param factory
     * @param e
     */
    public void loadFromFileOld(IServiceFactory factory, Throwable e) {
        IPreferencesService prefs = Platform.getPreferencesService();
        IEclipsePreferences root = prefs.getRootNode();
        Preferences node = root.node(InstanceScope.SCOPE).node(
                CatalogPlugin.ID + ".services"); //$NON-NLS-1$
        ServiceParameterPersister persister = new ServiceParameterPersister(this, factory);
        persister.restore(node);
    }
View Full Code Here

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

     * Restore the bookmarks from the plugin's preference store
     *
     * @throws BackingStoreException
     */
    public void restoreFromPreferences() throws BackingStoreException {
        IPreferencesService prefs = Platform.getPreferencesService();
        IEclipsePreferences root = prefs.getRootNode();
        Preferences node = root.node(InstanceScope.SCOPE).node(
                getBundle().getSymbolicName() + ".bookmarks"); //$NON-NLS-1$

        for( String projectId : node.childrenNames() ) {
            URI projectURI = URI.createURI(URI.decode(projectId));
View Full Code Here

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

    public void storeToPreferences() throws BackingStoreException {
        IBookmarkService mgr = getBookmarkService();
        if (mgr == null) {
            return; // nothing to save!
        }
        IPreferencesService prefs = Platform.getPreferencesService();
        IEclipsePreferences root = prefs.getRootNode();
        Preferences node = root.node(InstanceScope.SCOPE).node(
                getBundle().getSymbolicName() + ".bookmarks"); //$NON-NLS-1$
        clearPreferences(node);
        for( URI project : mgr.getProjects() ) {
            String projectString = project.toString();
View Full Code Here

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

    if (isDeprecatedOption(optionName)) {
      return JavaCore.ERROR;
    }
    int optionLevel = getOptionLevel(optionName);
    if (optionLevel != UNKNOWN_OPTION){
      IPreferencesService service = Platform.getPreferencesService();
      String value = service.get(optionName, null, this.preferencesLookup);
      if (value == null && optionLevel == DEPRECATED_OPTION) {
        // May be a deprecated option, retrieve the new value in compatible options
        String[] compatibleOptions = (String[]) this.deprecatedOptions.get(optionName);
        value = service.get(compatibleOptions[0], null, this.preferencesLookup);
      }
      return value==null ? null : value.trim();
    }
    return null;
  }
View Full Code Here

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

      if (DEBUG_302850) checkTaskTags("Platform is not running", this.optionsCache); //$NON-NLS-1$
      return new Hashtable(this.optionsCache);
    }
    // init
    Hashtable options = new Hashtable(10);
    IPreferencesService service = Platform.getPreferencesService();

    // set options using preferences service lookup
    Iterator iterator = this.optionNames.iterator();
    while (iterator.hasNext()) {
      String propertyName = (String) iterator.next();
      String propertyValue = service.get(propertyName, null, this.preferencesLookup);
      if (propertyValue != null) {
        options.put(propertyName, propertyValue);
      }
    }
    if (DEBUG_302850) checkTaskTags("Options initialized from preferences", options); //$NON-NLS-1$

    // set deprecated options using preferences service lookup
    Iterator deprecatedEntries = this.deprecatedOptions.entrySet().iterator();
    while (deprecatedEntries.hasNext()) {
      Entry entry = (Entry) deprecatedEntries.next();
      String propertyName = (String) entry.getKey();
      String propertyValue = service.get(propertyName, null, this.preferencesLookup);
      if (propertyValue != null) {
        options.put(propertyName, propertyValue);
        String[] compatibleOptions = (String[]) entry.getValue();
        for (int co=0, length=compatibleOptions.length; co < length; co++) {
          String compatibleOption = compatibleOptions[co];
View Full Code Here

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

         * If the host has no project specific line delimiter set, we do this
         * here, so it will be transfered to the clients.
         */
        IScopeContext[] scopeContexts = new IScopeContext[] {
            new ProjectScope(project), new InstanceScope() };
        IPreferencesService preferencesService = Platform
            .getPreferencesService();
        String platformLineDelimiter = System.getProperty("line.separator");
        String lineDelimiter = preferencesService.getString(
            Platform.PI_RUNTIME, Platform.PREF_LINE_SEPARATOR,
            platformLineDelimiter, scopeContexts);
        putLineDelimiterPreference(project, lineDelimiter);

        return new IRestorePoint() {
View Full Code Here

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

    XMLValidationConfiguration configuration = new XMLValidationConfiguration();
    try
    {
      //Preferences pluginPreferences = XMLCorePlugin.getDefault().getPluginPreferences();
      configuration.setFeature(XMLValidationConfiguration.INDICATE_NO_GRAMMAR, indicateNoGrammar);
      final IPreferencesService preferencesService = Platform.getPreferencesService();
      configuration.setFeature(XMLValidationConfiguration.INDICATE_NO_DOCUMENT_ELEMENT, preferencesService.getInt(XMLCorePlugin.getDefault().getBundle().getSymbolicName(), XMLCorePreferenceNames.INDICATE_NO_DOCUMENT_ELEMENT, -1, fPreferenceScopes));
      configuration.setFeature(XMLValidationConfiguration.USE_XINCLUDE, preferencesService.getBoolean(XMLCorePlugin.getDefault().getBundle().getSymbolicName(), XMLCorePreferenceNames.USE_XINCLUDE, false, fPreferenceScopes));
      configuration.setFeature(XMLValidationConfiguration.HONOUR_ALL_SCHEMA_LOCATIONS, preferencesService.getBoolean(XMLCorePlugin.getDefault().getBundle().getSymbolicName(), XMLCorePreferenceNames.HONOUR_ALL_SCHEMA_LOCATIONS, true, fPreferenceScopes));
    }
    catch(Exception e)
    {
      // TODO: Unable to set the preference. Log this problem.
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.