private EclipsePreferences getPluginPreferences(boolean create) { try { if (!create && !pluginRoot.nodeExists(pluginID)) return null; } catch (BackingStoreException e) { return null; } try { return (EclipsePreferences) pluginRoot.node(pluginID); } catch (ClassCastException e) { throw new RuntimeException("Plug-in preferences must be instances of EclipsePreferences: " + e.getMessage()); //$NON-NLS-1$ } }
@Override public boolean nodeExists(String pathName) throws BackingStoreException { // short circuit for this node if (pathName.length() == 0) { return removed ? false : getOriginal().nodeExists(pathName); } return getOriginal().nodeExists(pathName); }
private EclipsePreferences getPluginPreferences(boolean create) { try { if (!create && !pluginRoot.nodeExists(pluginID)) return null; } catch (BackingStoreException e) { return null; } try { return (EclipsePreferences) pluginRoot.node(pluginID); } catch (ClassCastException e) { throw new RuntimeException("Plug-in preferences must be instances of EclipsePreferences: " + e.getMessage()); //$NON-NLS-1$ } }
@Override public boolean nodeExists(String path) throws BackingStoreException { // short circuit for checking this node if (path.length() == 0) return !removed; // illegal state if this node has been removed. // do this AFTER checking for the empty string. checkRemoved(); // use the root relative to this node instead of the global root // in case we have a different hierarchy. (e.g. export) if (path.charAt(0) == IPath.SEPARATOR) return calculateRoot().nodeExists(path.substring(1)); int index = path.indexOf(IPath.SEPARATOR); boolean noSlash = index == -1; // if we are looking for a simple child then just look in the table and return if (noSlash) return childExists(path); // otherwise load the parent of the child and then recursively ask String childName = path.substring(0, index); if (!childExists(childName)) return false; IEclipsePreferences child = getChild(childName, null, true); if (child == null) return false; return child.nodeExists(path.substring(index + 1)); }
public boolean nodeExists(String path) throws BackingStoreException { // short circuit for checking this node if (path.length() == 0) return !removed; // illegal state if this node has been removed. // do this AFTER checking for the empty string. checkRemoved(); // use the root relative to this node instead of the global root // in case we have a different hierarchy. (e.g. export) if (path.charAt(0) == IPath.SEPARATOR) return calculateRoot().nodeExists(path.substring(1)); int index = path.indexOf(IPath.SEPARATOR); boolean noSlash = index == -1; // if we are looking for a simple child then just look in the table and return if (noSlash) return childExists(path); // otherwise load the parent of the child and then recursively ask String childName = path.substring(0, index); if (!childExists(childName)) return false; IEclipsePreferences child = getChild(childName, null, true); if (child == null) return false; return child.nodeExists(path.substring(index + 1)); }
public IEclipsePreferences preApply(IEclipsePreferences node) { try { if (node.nodeExists("instance")) { //$NON-NLS-1$ ((ProxyManager)ProxyManager.getProxyManager()).migrateUpdateHttpProxy(node.node("instance"), false); //$NON-NLS-1$ } } catch (BackingStoreException e) { Activator.logError("Could not access instance preferences", e); //$NON-NLS-1$ } return super.preApply(node); }
public void updateServer(IServer server, String username, String password) { if (!serversById.containsKey(server.getId())) { throw new IllegalStateException("There is no server with id '" + server.getId() + "'"); } IEclipsePreferences rootNode = getSonarLintPreferenceNode(); try { if (!rootNode.nodeExists(PREF_SERVERS)) { // User is probably editing a default server. So we have to make them persistent. Collection<IServer> defaultServers = new ArrayList<>(serversById.values()); serversById.clear(); for (IServer iServer : defaultServers) { addServer(iServer, "", ""); } } } catch (BackingStoreException e) { throw new IllegalStateException("Unable to save server", e); } addOrUpdateProperties(server); if (server.hasAuth()) { storeCredentials(server, username, password); } Server serverToUpdate = (Server) serversById.get(server.getId()); update(serverToUpdate, server.getHost(), server.getOrganization(), server.hasAuth(), server.areNotificationsEnabled()); fireServerEvent(serverToUpdate, EVENT_CHANGED); }
if (tree.parent() == null && tree.nodeExists(scope)) copyFromTo(tree.node(scope), result.node(scope), null, -1); if (tree.nodeExists(childPath)) { PreferenceFilterEntry[] entries;
if (tree.parent() == null && tree.nodeExists(scope)) { if (containsKeys((IEclipsePreferences) tree.node(scope))) return true; if (tree.nodeExists(childPath)) { PreferenceFilterEntry[] entries;
if (tree.parent() == null && tree.nodeExists(scope)) copyFromTo(tree.node(scope), result.node(scope), null, -1); if (tree.nodeExists(childPath)) { Preferences child = tree.node(childPath); PreferenceFilterEntry[] entries;
public void stop() { IEclipsePreferences rootNode = getSonarLintPreferenceNode(); rootNode.removeNodeChangeListener(rootNodeChangeListener); try { if (rootNode.nodeExists(PREF_SERVERS)) { Preferences serversNode = rootNode.node(PREF_SERVERS); ((IEclipsePreferences) serversNode).removeNodeChangeListener(serversNodeChangeListener); for (String serverNodeName : serversNode.childrenNames()) { IEclipsePreferences serverNode = ((IEclipsePreferences) serversNode.node(serverNodeName)); serverNode.removePreferenceChangeListener(serverChangeListener); } } } catch (BackingStoreException e) { throw unableToLoadServerList(e); } serverListeners.clear(); }
/** * Dispose the receiver. */ private void disposePreferenceStoreListener() { IEclipsePreferences root = (IEclipsePreferences) Platform .getPreferencesService().getRootNode().node( Plugin.PLUGIN_PREFERENCE_SCOPE); try { if (!(root.nodeExists(nodeQualifier))) { return; } } catch (BackingStoreException e) { return;// No need to report here as the node won't have the // listener } IEclipsePreferences preferences = getStorePreferences(); if (preferences == null) { return; } if (preferencesListener != null) { preferences.removePreferenceChangeListener(preferencesListener); preferencesListener = null; } }
if (tree.parent() == null && tree.nodeExists(scope)) { if (containsKeys((IEclipsePreferences) tree.node(scope))) return true; if (tree.nodeExists(childPath)) { PreferenceFilterEntry[] entries;
/** * Dispose the preference store listener. */ private void disposePreferenceStoreListener() { IEclipsePreferences root = (IEclipsePreferences) Platform .getPreferencesService().getRootNode().node( Plugin.PLUGIN_PREFERENCE_SCOPE); try { if (!(root.nodeExists(nodeQualifier))) { return; } } catch (BackingStoreException e) { return;// No need to report here as the node won't have the // listener } IEclipsePreferences preferences = getStorePreferences(); if (preferences == null) { return; } if (preferencesListener != null) { preferences.removePreferenceChangeListener(preferencesListener); preferencesListener = null; } }
public void init() { IEclipsePreferences rootNode = getSonarLintPreferenceNode(); rootNode.addNodeChangeListener(rootNodeChangeListener); try { if (rootNode.nodeExists(PREF_SERVERS)) { Preferences serversNode = rootNode.node(PREF_SERVERS); ((IEclipsePreferences) serversNode).addNodeChangeListener(serversNodeChangeListener); serversById.putAll(loadServersList(serversNode)); for (String serverNodeName : serversNode.childrenNames()) { IEclipsePreferences serverNode = ((IEclipsePreferences) serversNode.node(serverNodeName)); serverNode.addPreferenceChangeListener(serverChangeListener); } } else { serversById.putAll(loadServersList(DefaultScope.INSTANCE.getNode(SonarLintCorePlugin.PLUGIN_ID).node(PREF_SERVERS))); } } catch (BackingStoreException e) { throw unableToLoadServerList(e); } }
.getSymbolicName(); try { if (rootNode.nodeExists(uiName)) { ((IEclipsePreferences) rootNode.node(uiName)) .addPreferenceChangeListener(PlatformUIPreferenceListener
.getSymbolicName(); try { if (rootNode.nodeExists(uiName)) { ((IEclipsePreferences) rootNode.node(uiName)) .addPreferenceChangeListener(PlatformUIPreferenceListener
.getSymbolicName(); try { if (rootNode.nodeExists(workbenchName)) { ((IEclipsePreferences) rootNode.node(workbenchName)) .addPreferenceChangeListener(PlatformUIPreferenceListener