Package org.eclipse.core.runtime.preferences

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


   * Initialize preferences lookups for JavaCore plugin.
   */
  public void initializePreferences() {
   
    // Create lookups
    preferencesLookup[PREF_INSTANCE] = ((IScopeContext) new InstanceScope()).getNode(JavaCore.PLUGIN_ID);
    preferencesLookup[PREF_DEFAULT] = ((IScopeContext) new DefaultScope()).getNode(JavaCore.PLUGIN_ID);

    // Listen to instance preferences node removal from parent in order to refresh stored one
    IEclipsePreferences.INodeChangeListener listener = new IEclipsePreferences.INodeChangeListener() {
      public void added(IEclipsePreferences.NodeChangeEvent event) {
        // do nothing
      }
      public void removed(IEclipsePreferences.NodeChangeEvent event) {
        if (event.getChild() == preferencesLookup[PREF_INSTANCE]) {
          preferencesLookup[PREF_INSTANCE] = ((IScopeContext) new InstanceScope()).getNode(JavaCore.PLUGIN_ID);
          preferencesLookup[PREF_INSTANCE].addPreferenceChangeListener(new EclipsePreferencesListener());
        }
      }
    };
    ((IEclipsePreferences) preferencesLookup[PREF_INSTANCE].parent()).addNodeChangeListener(listener);
View Full Code Here


      if (lineSeparator != null)
        return lineSeparator;
    }
   
    // line delimiter in workspace preference
    scopeContext= new IScopeContext[] { new InstanceScope() };
    lineSeparator = Platform.getPreferencesService().getString(Platform.PI_RUNTIME, Platform.PREF_LINE_SEPARATOR, null, scopeContext);
    if (lineSeparator != null)
      return lineSeparator;
   
    // system line delimiter
View Full Code Here

   * Set a bunch of preferences so that m2eclipse hopefully isn't doing a lot
   * of time consuming stuff in the background.
   */
  public static void mavenOffline() throws Error {
    System.out.println("Pacifying m2eclipse...");
    IEclipsePreferences m2EclipsePrefs = new InstanceScope().getNode("org.eclipse.m2e.core");
    m2EclipsePrefs.putBoolean("eclipse.m2.offline", true);
    m2EclipsePrefs.putBoolean("eclipse.m2.globalUpdatePolicy", false);
    m2EclipsePrefs.putBoolean("eclipse.m2.updateIndexes", false);
    try {
      m2EclipsePrefs.flush();
View Full Code Here

     * type + local module name) to the deployed application name.
     * @return map containing local module ID (key) to deployed cloud
     * application name (value)
     */
    private Map<String, String> getLocalModuleToCloudModuleMapping() {
      IEclipsePreferences node = new InstanceScope().getNode(CloudFoundryPlugin.PLUGIN_ID);
      String string = node.get(KEY_MODULE_MAPPING_LIST + ":" + getServerId(), ""); //$NON-NLS-1$ //$NON-NLS-2$
      return convertStringToMap(string);
    }
View Full Code Here

      return server.getAttribute(CloudFoundryServer.PROP_SERVER_ID, (String) null);
    }

    private void setLocalModuleToCloudModuleMapping(Map<String, String> list) {
      String string = convertMapToString(list);
      IEclipsePreferences node = new InstanceScope().getNode(CloudFoundryPlugin.PLUGIN_ID);
      CloudFoundryPlugin.trace("Updated mapping: " + string); //$NON-NLS-1$
      node.put(KEY_MODULE_MAPPING_LIST + ":" + getServerId(), string); //$NON-NLS-1$
      try {
        node.flush();
      }
View Full Code Here

      add(appModule);
      return appModule;
    }

    void updateServerId(String oldServerId, String newServerId) {
      IEclipsePreferences node = new InstanceScope().getNode(CloudFoundryPlugin.PLUGIN_ID);
      String string = node.get(KEY_MODULE_MAPPING_LIST + ":" + oldServerId, ""); //$NON-NLS-1$ //$NON-NLS-2$
      node.remove(KEY_MODULE_MAPPING_LIST + ":" + oldServerId); //$NON-NLS-1$
      node.put(KEY_MODULE_MAPPING_LIST + ":" + newServerId, string); //$NON-NLS-1$
    }
View Full Code Here

  protected synchronized void remove(IServer server) {
    dataByServer.remove(server);

    String serverId = server.getAttribute(CloudFoundryServer.PROP_SERVER_ID, (String) null);
    if (serverId != null) {
      IEclipsePreferences node = new InstanceScope().getNode(CloudFoundryPlugin.PLUGIN_ID);
      node.remove(KEY_MODULE_MAPPING_LIST + ":" + serverId); //$NON-NLS-1$
      try {
        node.flush();
      }
      catch (BackingStoreException e) {
View Full Code Here

  public IScopeContext getDefaultScope() {
    return new DefaultScope();
  }

  public IScopeContext getInstanceScope() {
    return new InstanceScope();
  }
View Full Code Here

   * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
   */
  public void start(BundleContext context) throws Exception {
    super.start(context);
    plugin = this;
    store = new ScopedPreferenceStore(new InstanceScope(), Activator.PLUGIN_ID);
  }
View Full Code Here

  protected void initialize() {
    super.initialize();
   
    // We want to store M2_REPO property into java classpath vars
    ScopedPreferenceStore store = new ScopedPreferenceStore(
        new InstanceScope(), "org.eclipse.jdt.core");
    m2Repo.setPreferenceStore(store);
    store.addPropertyChangeListener(new IPropertyChangeListener(){
      @Override
      public void propertyChange(PropertyChangeEvent event) {
        // We want to erase the value if the M2_REPO was deleted from the classpath variables ui...
View Full Code Here

TOP

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

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.