org.openide.util.NbPreferences Java Examples

The following examples show how to use org.openide.util.NbPreferences. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: InstancePropertiesManager.java    From netbeans with Apache License 2.0 6 votes vote down vote up
/**
 * Returns all existing properties created in the given namespace.
 *
 * @param namespace string identifying the namespace
 * @return list of all existing properties created in the given namespace
 */
public List<InstanceProperties> getProperties(String namespace) {
    Preferences prefs = NbPreferences.forModule(InstancePropertiesManager.class);

    try {
        prefs = prefs.node(namespace);
        prefs.flush();

        List<InstanceProperties> allProperties = new ArrayList<InstanceProperties>();
        synchronized (this) {
            for (String id : prefs.childrenNames()) {
                Preferences child = prefs.node(id);
                InstanceProperties props = cache.get(child);
                if (props == null) {
                    props = new DefaultInstanceProperties(id, this, child);
                    cache.put(child, props);
                }
                allProperties.add(props);
            }
        }
        return allProperties;
    } catch (BackingStoreException ex) {
        LOGGER.log(Level.INFO, null, ex);
        throw new IllegalStateException(ex);
    }
}
 
Example #2
Source File: RefreshClientDialog.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private RefreshClientDialog(String url) {
    this.url=url;
    initComponents();
    final Preferences prefs = NbPreferences.forModule(RefreshClientDialog.class);
    if (prefs != null) {
        downloadWsdlCheckBox.setSelected(prefs.getBoolean(DOWNLOAD_WSDL_ON_REFRESH, false));
    }
    jTextField1.setText(url);
    downloadWsdlCheckBox.addItemListener(new ItemListener() {

        @Override
        public void itemStateChanged(ItemEvent e) {
            boolean isSelected = ((javax.swing.JCheckBox)e.getSource()).isSelected();
            if (isSelected) {
                jTextField1.setEditable(true);
            } else {
                jTextField1.setEditable(false);
            }
            if (prefs != null) {
                prefs.putBoolean(DOWNLOAD_WSDL_ON_REFRESH, isSelected);
            }
        }
        
    });
}
 
Example #3
Source File: BasicProjectWizardIterator.java    From nb-springboot with Apache License 2.0 6 votes vote down vote up
private void createNbActions(FileObject dir) throws IOException {
    // retrieve default options from prefs
    final Preferences prefs = NbPreferences.forModule(PrefConstants.class);
    final boolean bForceColor = prefs.getBoolean(PREF_FORCE_COLOR_OUTPUT, true);
    final boolean bManualRestart = prefs.getBoolean(PREF_MANUAL_RESTART, false);
    final String strVmOpts = Utils.vmOptsFromPrefs();
    // compute name of devtools restart trigger file
    String triggerFileEnv = BOOTVERSION.startsWith("2") ? SpringBootService.ENV_RESTART_20 : SpringBootService.ENV_RESTART_15;
    // create nbactions.xml from template
    FileObject foTmpl = Templates.getTemplate(wiz);
    new FileBuilder(foTmpl, dir)
            .name("nbactions")
            .param("forceColor", bForceColor)
            .param("manualRestart", bManualRestart)
            .param("restartTriggerFileEnv", triggerFileEnv)
            .param("vmOpts", strVmOpts)
            .build();
}
 
Example #4
Source File: ServerDetailsView.java    From syncope with Apache License 2.0 6 votes vote down vote up
protected void okButtonActionPerformed(final java.awt.event.ActionEvent evt) {
    // validation
    List<String> validation = validate(schemeTxt, hostTxt, portTxt, userNameTxt);
    if (validation.isEmpty()) {
        Preferences prefs = NbPreferences.forModule(ResourceExplorerTopComponent.class);
        prefs.put("scheme", schemeTxt.getText());
        prefs.put("host", hostTxt.getText());
        prefs.put("port", portTxt.getText());
        prefs.put("username", userNameTxt.getText());
        prefs.put("password", new String(passwordTxt.getPassword()));
        // dismiss panel
        this.dispose();
    } else {
        JOptionPane.showMessageDialog(
                null, "Please insert valid " + validation, "Validation  Error", JOptionPane.ERROR_MESSAGE);
    }
}
 
Example #5
Source File: BootPrefsPanel.java    From nb-springboot with Apache License 2.0 6 votes vote down vote up
void store() {
    // store modified settings
    final Preferences prefs = NbPreferences.forModule(PrefConstants.class);
    prefs.put(PrefConstants.PREF_INITIALIZR_URL, txInitializrUrl.getText());
    prefs.put(PrefConstants.PREF_VM_OPTS, txVmOpts.getText());
    prefs.putInt(PrefConstants.PREF_INITIALIZR_TIMEOUT, (int) spInitializrTimeout.getValue());
    prefs.putBoolean(PrefConstants.PREF_FORCE_COLOR_OUTPUT, chColorOutput.isSelected());
    prefs.putBoolean(PrefConstants.PREF_MANUAL_RESTART, chDevtoolsTrigger.isSelected());
    prefs.putBoolean(PrefConstants.PREF_VM_OPTS_LAUNCH, chVmOptsLaunch.isSelected());
    prefs.putBoolean(PrefConstants.PREF_DEPR_SORT_LAST, chDeprSortLast.isSelected());
    prefs.putBoolean(PrefConstants.PREF_DEPR_ERROR_SHOW, chDeprErrorShow.isSelected());
    prefs.putBoolean(PrefConstants.PREF_ARRAY_NOTATION, chArrayNotation.isSelected());
    prefs.putInt(PrefConstants.PREF_HLIGHT_LEV_DTMISMATCH, cbDtMismatch.getSelectedIndex());
    prefs.putInt(PrefConstants.PREF_HLIGHT_LEV_DUPLICATES, cbDupl.getSelectedIndex());
    prefs.putInt(PrefConstants.PREF_HLIGHT_LEV_SYNERR, cbSynErr.getSelectedIndex());
    prefs.putInt(PrefConstants.PREF_HLIGHT_LEV_UNKNOWN, cbUnknown.getSelectedIndex());
    prefs.putInt(PrefConstants.PREF_HLIGHT_LEV_DEPRECATED, cbDeprecated.getSelectedIndex());
    InitializrService.getInstance().clearCachedValues();
}
 
Example #6
Source File: FontUtilities.java    From constellation with Apache License 2.0 6 votes vote down vote up
/**
 * Return the user's default font size.
 * <p>
 * This retrieves the font size specified in Setup &rarr; Options &rarr;
 * Miscellaneous &rarr; Output &rarr; Font Size. The default if not
 * specified is 11.
 *
 * @return The user's default font size.
 */
public static int getOutputFontSize() {
    int fontSize;

    try {
        final Preferences p = NbPreferences.root();
        if (p.nodeExists(ApplicationPreferenceKeys.OUTPUT2_PREFERENCE)) {
            final String fontSizePreference = p.node(ApplicationPreferenceKeys.OUTPUT2_PREFERENCE).get(ApplicationPreferenceKeys.OUTPUT2_FONT_SIZE, ApplicationPreferenceKeys.OUTPUT2_FONT_SIZE_DEFAULT);
            fontSize = Integer.parseInt(fontSizePreference);
        } else {
            fontSize = UIManager.getFont(SWING_FONT).getSize();
        }
    } catch (final BackingStoreException | NumberFormatException ex) {
        fontSize = Integer.parseInt(ApplicationPreferenceKeys.OUTPUT2_FONT_SIZE_DEFAULT);
        LOGGER.severe(ex.getLocalizedMessage());
    }

    LOGGER.log(Level.FINE, "Font size is {0}", fontSize);
    return fontSize;
}
 
Example #7
Source File: OptionsDisplayerImpl.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private Point getUserLocation(GraphicsConfiguration gconf, OptionsPanel optionsPanel) {
      final Rectangle screenBounds = Utilities.getUsableScreenBounds(gconf);
      int x = NbPreferences.forModule(OptionsDisplayerImpl.class).getInt("OptionsX", Integer.MAX_VALUE);//NOI18N
      int y = NbPreferences.forModule(OptionsDisplayerImpl.class).getInt("OptionsY", Integer.MAX_VALUE);//NOI18N
      Dimension userSize = optionsPanel.getUserSize();
      if (x > screenBounds.x + screenBounds.getWidth() || y > screenBounds.y + screenBounds.getHeight()
              || x + userSize.width > screenBounds.x + screenBounds.getWidth() 
              || y + userSize.height > screenBounds.y + screenBounds.getHeight()
              || (x < screenBounds.x && screenBounds.x >= 0)
|| (x > screenBounds.x && screenBounds.x < 0)
|| (y < screenBounds.y && screenBounds.y >= 0)
|| (y > screenBounds.y && screenBounds.y < 0)){
          return null;
      } else {
          return new Point(x, y);
      }
  }
 
Example #8
Source File: AndroidPlatform.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/**
 * Sets the Android SDK location from ANDROID_HOME environment variable, if
 * available.
 *
 * @return Android SDK Location or <code>null</code> if Android SDK could
 * not be found.
 */
private String getSdkFromAndroidHome() {
    String androidHomeValue = System.getenv("ANDROID_HOME"); //NOI18N
    if (androidHomeValue != null && !androidHomeValue.isEmpty()) {
        File androidLoc = new File(androidHomeValue);
        File androidTools = new File(androidLoc, "platform-tools"); //NOI18N
        boolean validSdk = androidLoc.exists() && androidLoc.isDirectory()
                && androidTools.exists() && androidTools.isDirectory();
        if (validSdk) {
            NbPreferences.forModule(AndroidPlatform.class).put(ANDROID_SDK_ROOT_PREF, androidHomeValue);
            return androidHomeValue;
        }
    }
    return null;
}
 
Example #9
Source File: StatusProvider.java    From netbeans with Apache License 2.0 5 votes vote down vote up
StatusProviderImpl(Document doc) {
    this.document = doc;
    listener = new FileChangeAdapter() {
        @Override
        public void fileChanged(FileEvent fe) {
            // XXX fire PROP_UP_TO_DATE
            RP.post(new Runnable() {
                @Override
                public void run() {
                    checkHints();
                }
            });
        }
    };
    prefListener = new PreferenceChangeListener() {
        @Override
        public void preferenceChange(PreferenceChangeEvent evt) {
            if(EmbedderFactory.PROP_COMMANDLINE_PATH.equals(evt.getKey())) {
                // given by the registered mvn client, the pom validation result may change ...
                checkHints();
            }
        }
    };
    Preferences prefs = NbPreferences.root().node("org/netbeans/modules/maven");
    prefs.addPreferenceChangeListener(WeakListeners.create(PreferenceChangeListener.class, prefListener, prefs));
    
    RP.post(new Runnable() {
        @Override
        public void run() {
            initializeModel(); //#204067 moved to RP 
            checkHints();
        }
    });
}
 
Example #10
Source File: CollapsibleSplitPane.java    From netbeans with Apache License 2.0 5 votes vote down vote up
void setCollapsed(boolean collapsed) {
    getBottomComponent().setVisible(!collapsed);
    if (!collapsed) setDividerLocation(savedDividerLocation);
    
    NbPreferences.forModule(CollapsibleSplitPane.class).
            putBoolean(PREF_COLLAPSED, collapsed);
}
 
Example #11
Source File: CombinationRSSFeed.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
protected void clearCache() {
    try {
        NbPreferences.forModule( RSSFeed.class ).remove( url2path( new URL(url1))) ;
        NbPreferences.forModule( RSSFeed.class ).remove( url2path( new URL(url2))) ;
    } catch( MalformedURLException mE ) {
        //ignore
    }
}
 
Example #12
Source File: MRUFilesOptions.java    From opensim-gui with Apache License 2.0 5 votes vote down vote up
/** Return the backing store Preferences
 * @return Preferences
 */
protected final Preferences getPreferences() {
    String name = DEFAULT_NODE_NAME;
    if (nodeName != null) {
        name = nodeName;
    }
 
    Preferences prefs = NbPreferences.forModule(this.getClass()).node("options").node(name);
 
    return prefs;
}
 
Example #13
Source File: DataViewPageContext.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/**
 * Get stored or default page size.
 *
 * @return Page size, positive integer, not zero;
 * @since 1.20
 */
public static int getStoredPageSize() {
    if (defaultPageSize < 0) {
        defaultPageSize = NbPreferences.forModule(
                DataViewPageContext.class).getInt(
                PROP_STORED_PAGE_SIZE, DEFAULT_PAGE_SIZE);
        if (defaultPageSize < 0) {
            defaultPageSize = DEFAULT_PAGE_SIZE;
            setStoredPageSize(defaultPageSize);
        }
    }
    return defaultPageSize;
}
 
Example #14
Source File: NonProxyHostsTest.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
protected void setUp () throws Exception {
    super.setUp ();
    System.setProperty ("netbeans.system_http_proxy", SYSTEM_PROXY_HOST + ":" + SYSTEM_PROXY_PORT);
    System.setProperty ("netbeans.system_socks_proxy", SYSTEM_PROXY_HOST + ":" + SYSTEM_PROXY_PORT);
    System.setProperty ("netbeans.system_http_non_proxy_hosts", "*.other.org");
    System.setProperty ("http.nonProxyHosts", "*.netbeans.org");
    selector = ProxySelector.getDefault ();
    proxyPreferences  = NbPreferences.root ().node ("/org/netbeans/core");
    proxyPreferences.addPreferenceChangeListener (new PreferenceChangeListener () {
        public void preferenceChange (PreferenceChangeEvent arg0) {
            isWaiting = false;
        }
    });
    proxyPreferences.put ("proxyHttpHost", USER_PROXY_HOST);
    proxyPreferences.put ("proxyHttpPort", USER_PROXY_PORT);
    proxyPreferences.put ("proxySocksHost", USER_PROXY_HOST);
    proxyPreferences.put ("proxySocksPort", USER_PROXY_PORT);
    while (isWaiting);
    isWaiting = true;
    TO_LOCALHOST = new URI ("http://localhost");
    TO_LOCAL_DOMAIN_1 = new URI ("http://core.netbeans.org");
    TO_LOCAL_DOMAIN_2 = new URI ("http://core.other.org");
    TO_EXTERNAL = new URI ("http://worldwide.net");
    
    SOCKS_TO_LOCALHOST = new URI ("socket://localhost:8041");
    SOCKS_TO_LOCAL_DOMAIN_1 = new URI ("socket://core.netbeans.org");
    SOCKS_TO_LOCAL_DOMAIN_2 = new URI ("socket://core.other.org");
    SOCKS_TO_EXTERNAL = new URI ("socket://worldwide.net");
}
 
Example #15
Source File: PasswordManager.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/**
 * Remove password from memory and Keyring
 *
 * @param execEnv
 */
public void forceClearPassword(ExecutionEnvironment execEnv) {
    String key = ExecutionEnvironmentFactory.toUniqueID(execEnv);
    if (keepPasswordsInMemory) {
        cache.remove(key);
    }
    NbPreferences.forModule(PasswordManager.class).remove(STORE_PREFIX + key);
    Keyring.delete(KEY_PREFIX + key);
    Logger.getInstance().log(Level.FINEST, "PasswordManager.forceClearPassword({0})", execEnv); // NOI18N
}
 
Example #16
Source File: KeystoreOptionsSubPanel.java    From NBANDROID-V2 with Apache License 2.0 5 votes vote down vote up
@Override
public void load() {
    char[] keystorePasswd = Keyring.read(KEY_STORE_PASSWORD);
    char[] keyPasswd = Keyring.read(KEY_PASSWORD);
    if (keystorePasswd != null) {
        keystorePassword.setText(new String(keystorePasswd));
    }
    if (keyPasswd != null) {
        keyPassword.setText(new String(keyPasswd));
    }
    path.setText(NbPreferences.forModule(KeystoreOptionsSubPanel.class).get(KEY_STORE_PATH, ""));
    alias.setText(NbPreferences.forModule(KeystoreOptionsSubPanel.class).get(KEY_ALIAS, ""));
    rememberPasswd.setSelected(NbPreferences.forModule(KeystoreOptionsSubPanel.class).getBoolean(REMEMBER_PASSWORDS, true));

}
 
Example #17
Source File: SimpleGraphTopComponent.java    From constellation with Apache License 2.0 5 votes vote down vote up
@Override
public void componentOpened() {
    super.componentOpened();

    // Try to free up any unused memory
    final boolean forceGarbageCollectOnOpen = NbPreferences.forModule(ApplicationPreferenceKeys.class).getBoolean(DeveloperPreferenceKeys.FORCE_GC_ON_OPEN, DeveloperPreferenceKeys.FORCE_GC_ON_OPEN_DEFAULT);
    if (forceGarbageCollectOnOpen) {
        System.gc();
    }
}
 
Example #18
Source File: ConnectToLanguageServerParameters.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public ConnectToLanguageServerParameters() {
    initComponents();
    Preferences prefs = NbPreferences.forModule(ConnectToLanguageServerParameters.class);
    settings = prefs.node("connect");
    root.setText(settings.get(KEY_ROOT, ""));
    port.setText(settings.get(KEY_PORT, ""));
    extensions.setText(settings.get(KEY_EXTENSIONS, ""));
}
 
Example #19
Source File: MasterPasswordEncryption.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public @Override boolean enabled() {
    if (Boolean.getBoolean("netbeans.keyring.no.master")) {
        LOG.fine("master password encryption disabled");
        return false;
    }
    if (GraphicsEnvironment.isHeadless()) {
        LOG.fine("disabling master password encryption in headless mode");
        return false;
    }
    try {
        KEY_FACTORY = SecretKeyFactory.getInstance(ENCRYPTION_ALGORITHM);
        encrypt = Cipher.getInstance(ENCRYPTION_ALGORITHM);
        decrypt = Cipher.getInstance(ENCRYPTION_ALGORITHM);
        Preferences prefs = NbPreferences.forModule(Keyring.class);
        Utils.goMinusR(prefs);
        String saltKey = "salt"; // NOI18N
        byte[] salt = prefs.getByteArray(saltKey, null);
        if (salt == null) {
            salt = new byte[36];
            new SecureRandom().nextBytes(salt);
            prefs.putByteArray(saltKey, salt);
        }
        PARAM_SPEC = new PBEParameterSpec(salt, 20);
        LOG.warning("Falling back to master password encryption; " +
                "add -J-Dorg.netbeans.modules.keyring.level=0 to netbeans.conf to see why native keyrings could not be loaded");
        return true;
    } catch (Exception x) {
        LOG.log(Level.INFO, "Cannot initialize security using " + ENCRYPTION_ALGORITHM, x);
        return false;
    }
}
 
Example #20
Source File: HudsonScanner.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override public void setScope(TaskScanningScope scope, Callback callback) {
    try {
        // XXX make Installer.active into API
        if (!NbPreferences.root().nodeExists("org/netbeans/modules/hudson/instances")) {
            return; // avoid loading any more classes
        }
    } catch (BackingStoreException x) {
        LOG.log(Level.INFO, null, x);
    }
    doSetScope(scope, callback);
}
 
Example #21
Source File: ResultWindow.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public void updateOptionStatus(String property, boolean selected) {
NbPreferences.forModule(StatisticsPanel.class).putBoolean(property, selected);
for (int i = 0; i < tabPane.getTabCount(); i++) {
    StatisticsPanel sp = (StatisticsPanel)((JSplitPane)tabPane.getComponentAt(i)).getLeftComponent();
    sp.updateOptionStatus(property, selected);
}
   }
 
Example #22
Source File: GraphOptionsPanelController.java    From constellation with Apache License 2.0 5 votes vote down vote up
@Override
public boolean isChanged() {
    final Preferences prefs = NbPreferences.forModule(GraphPreferenceKeys.class);
    final GraphOptionsPanel graphOptionsPanel = getPanel();
    return !(graphOptionsPanel.getBlazeSize() == prefs.getInt(GraphPreferenceKeys.BLAZE_SIZE, GraphPreferenceKeys.BLAZE_SIZE_DEFAULT)
            && graphOptionsPanel.getBlazeOpacity() == prefs.getInt(GraphPreferenceKeys.BLAZE_OPACITY, GraphPreferenceKeys.BLAZE_OPACITY_DEFAULT));
}
 
Example #23
Source File: OpenProjectListSettings.java    From netbeans with Apache License 2.0 5 votes vote down vote up
protected final Preferences getPreferences(boolean allowGrouped) {
    if (allowGrouped) {
        Group act = Group.getActiveGroup();
        if (act != null) {
            //TODO replace with NbPreferences.forModule()
            return act.prefs().node(OpenProjectListSettings.class.getPackage().getName().replace(".", "/"));
        }   
    }
    return NbPreferences.forModule(OpenProjectListSettings.class);
}
 
Example #24
Source File: VisualGraphTopComponent.java    From constellation with Apache License 2.0 5 votes vote down vote up
@Override
public void componentClosed() {
    super.componentClosed();

    setActivatedNodes(new Node[]{});

    graph.removeGraphChangeListener(this);

    visualManager.stopProcessing();
    displayPanel.remove(visualManager.getVisualComponent());
    content.remove(saveAs);
    content.remove(graphNode.getDataObject());
    content.remove(graph);
    content.remove(graphNode);
    content.remove(getActionMap());

    // Get rid of any autosaved files on a user-requested close.
    // Note that canClose() will catch unsaved graphs, so at this point the graph has either been saved or discarded by the user.
    AutosaveUtilities.deleteAutosave(graph.getId());

    graphNode.destroy();

    visualManager.destroy();

    StatusDisplayer.getDefault().setStatusText("Closed " + graphNode.getDataObject().getName());

    // Try to free up any unused memory
    final boolean forceGarbageCollectOnClose = NbPreferences.forModule(ApplicationPreferenceKeys.class).getBoolean(DeveloperPreferenceKeys.FORCE_GC_ON_CLOSE, DeveloperPreferenceKeys.FORCE_GC_ON_CLOSE_DEFAULT);
    if (forceGarbageCollectOnClose) {
        System.gc();
    }

    graphUpdateManager.setManaged(false);
}
 
Example #25
Source File: WritablePreferences131128Test.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
protected void setUp() throws Exception {
    MockServices.setServices(Displayer.class, MockPreferencesProviderImpl.class);
    Lookup.getDefault().lookupAll(NbPreferences.Provider.class);
    // initialize the logging
    new TopLogging();
}
 
Example #26
Source File: Autosaver.java    From constellation with Apache License 2.0 5 votes vote down vote up
/**
 * Schedule a new autosave.
 * <p>
 * A new task is always scheduled, regardless of whether autosave is enabled
 * or not. It is up to the task to determine whether autosave is enabled or
 * not and do the required work.
 *
 * @param delayMinutes The delay (in minutes) until the next autosave.
 */
public static void schedule(final int delayMinutes) {
    int dm = delayMinutes;
    if (dm <= 0) {
        final Preferences prefs = NbPreferences.forModule(ApplicationPreferenceKeys.class);
        final int autosaveSchedule = prefs.getInt(ApplicationPreferenceKeys.AUTOSAVE_SCHEDULE, ApplicationPreferenceKeys.AUTOSAVE_SCHEDULE_DEFAULT);
        dm = autosaveSchedule;
    }

    REQUEST_PROCESSOR.schedule(new Autosaver(), dm, TimeUnit.MINUTES);
}
 
Example #27
Source File: Autosaver.java    From constellation with Apache License 2.0 5 votes vote down vote up
@Override
public void run() {
    StatusDisplayer.getDefault().setStatusText(String.format("Auto saving %s at %s...", "", new Date()));

    final Preferences prefs = NbPreferences.forModule(ApplicationPreferenceKeys.class);
    final boolean autosaveEnabled = prefs.getBoolean(ApplicationPreferenceKeys.AUTOSAVE_ENABLED, ApplicationPreferenceKeys.AUTOSAVE_ENABLED_DEFAULT);
    if (autosaveEnabled) {
        runAutosave();
    }

    final int autosaveSchedule = prefs.getInt(ApplicationPreferenceKeys.AUTOSAVE_SCHEDULE, ApplicationPreferenceKeys.AUTOSAVE_SCHEDULE_DEFAULT);
    final int delayMinutes = autosaveSchedule;
    schedule(delayMinutes);
}
 
Example #28
Source File: ProxyOptionsPanelController.java    From constellation with Apache License 2.0 5 votes vote down vote up
@Override
public boolean isChanged() {
    final Preferences prefs = NbPreferences.forModule(ProxyPreferenceKeys.class);
    final ProxyOptionsPanel proxyOptionsPanel = getPanel();
    return !(proxyOptionsPanel.getUseDefaultSettings() == prefs.getBoolean(ProxyPreferenceKeys.USE_DEFAULTS, ProxyPreferenceKeys.USE_DEFAULTS_DEFAULT)
            && proxyOptionsPanel.getDefaultProxy().equals(prefs.get(ProxyPreferenceKeys.DEFAULT, ProxyPreferenceKeys.DEFAULT_DEFAULT))
            && proxyOptionsPanel.getAdditionalProxies().equals(prefs.get(ProxyPreferenceKeys.ADDITIONAL, ProxyPreferenceKeys.ADDITIONAL_DEFAULT))
            && proxyOptionsPanel.getBypassProxyHosts().equals(prefs.get(ProxyPreferenceKeys.BYPASS, ProxyPreferenceKeys.BYPASS_DEFAULT)));
}
 
Example #29
Source File: UiOptions.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private static synchronized Preferences getNode() {
    if ( node == null ) {                
        Preferences p = NbPreferences.forModule(UiOptions.class);
        node = p.node(GO_TO_SYMBOL_DIALOG);
    }
    return node;
}
 
Example #30
Source File: MethodsFeatureModes.java    From netbeans with Apache License 2.0 4 votes vote down vote up
private int readColumns2() {
    return NbPreferences.forModule(MethodsFeatureModes.class).getInt("MethodsFeatureModes.columns2", DEFAULT_COLUMNS); // NOI18N
}