Search in sources :

Example 76 with BackingStoreException

use of java.util.prefs.BackingStoreException in project blue by kunstmusik.

the class OSCPanel method store.

void store() {
    final Preferences prefs = NbPreferences.forModule(OSCManager.class);
    prefs.putInt("serverPort", ((SpinnerNumberModel) serverPortSpinner.getModel()).getNumber().intValue());
    try {
        prefs.sync();
    } catch (BackingStoreException ex) {
        Exceptions.printStackTrace(ex);
    }
}
Also used : SpinnerNumberModel(javax.swing.SpinnerNumberModel) BackingStoreException(java.util.prefs.BackingStoreException) NbPreferences(org.openide.util.NbPreferences) Preferences(java.util.prefs.Preferences)

Example 77 with BackingStoreException

use of java.util.prefs.BackingStoreException in project blue by kunstmusik.

the class GeneralSettings method save.

public void save() {
    final Preferences prefs = NbPreferences.forModule(GeneralSettings.class);
    prefs.put(PREFIX + DEFAULT_WORK_DIRECTORY, defaultDirectory.getAbsolutePath());
    prefs.putBoolean(PREFIX + NEW_USER_DEFAULTS_ENABLED, newUserDefaultsEnabled);
    prefs.putBoolean(PREFIX + DRAW_ALPHA_BACKGROUND_ON_MARQUEE, alphaEnabled);
    prefs.putBoolean(PREFIX + MESSAGE_COLORS_ENABLED, messageColorsEnabled);
    prefs.putBoolean(PREFIX + CSOUND_ERROR_WARNING_ENABLED, csoundErrorWarningEnabled);
    try {
        prefs.sync();
    } catch (BackingStoreException ex) {
        Exceptions.printStackTrace(ex);
    }
}
Also used : BackingStoreException(java.util.prefs.BackingStoreException) NbPreferences(org.openide.util.NbPreferences) Preferences(java.util.prefs.Preferences)

Example 78 with BackingStoreException

use of java.util.prefs.BackingStoreException in project blue by kunstmusik.

the class UtilitySettings method save.

public void save() {
    final Preferences prefs = NbPreferences.forModule(UtilitySettings.class);
    prefs.put(PREFIX + CSOUND_EXECUTABLE, csoundExecutable);
    prefs.put(PREFIX + FREEZE_FLAGS, freezeFlags);
    try {
        prefs.sync();
    } catch (BackingStoreException ex) {
        Exceptions.printStackTrace(ex);
    }
}
Also used : BackingStoreException(java.util.prefs.BackingStoreException) NbPreferences(org.openide.util.NbPreferences) Preferences(java.util.prefs.Preferences)

Example 79 with BackingStoreException

use of java.util.prefs.BackingStoreException in project blue by kunstmusik.

the class InfoDialog method showInformationDialogTabs.

public static final void showInformationDialogTabs(String information, String title) {
    if (dialog == null) {
        dialog = new JDialog(WindowManager.getDefault().getMainWindow(), false);
        dialog.setTitle("Information");
        tabs = new JTabbedPane();
        dialog.getContentPane().add(tabs);
        final Preferences prefs = NbPreferences.forModule(InfoDialog.class);
        int w = prefs.getInt("infoDialogTabsWidth", 640);
        int h = prefs.getInt("infoDialogTabsHeight", 480);
        dialog.setSize(new Dimension(w, h));
        dialog.addWindowListener(new WindowAdapter() {

            @Override
            public void windowClosing(WindowEvent e) {
                final Preferences prefs = NbPreferences.forModule(InfoDialog.class);
                prefs.putInt("infoDialogTabsWidth", dialog.getWidth());
                prefs.putInt("infoDialogTabsHeight", dialog.getHeight());
                prefs.putInt("infoDialogTabsX", dialog.getX());
                prefs.putInt("infoDialogTabsY", dialog.getY());
                try {
                    prefs.sync();
                } catch (BackingStoreException ex) {
                    Exceptions.printStackTrace(ex);
                }
            }
        });
        int x = prefs.getInt("infoDialogTabsX", -1);
        int y = prefs.getInt("infoDialogTabsY", -1);
        if (x > 0 && y > 0) {
            dialog.setLocation(x, y);
        } else {
            GUI.centerOnScreen(dialog);
        }
        popup = new JPopupMenu();
        popup.add(new AbstractAction("Remove") {

            @Override
            public void actionPerformed(ActionEvent e) {
                int index = tabs.getSelectedIndex();
                if (index >= 0) {
                    tabs.remove(index);
                    if (tabs.getTabCount() == 0) {
                        dialog.setVisible(false);
                    }
                }
            }
        });
        tabs.addMouseListener(new MouseAdapter() {

            @Override
            public void mousePressed(MouseEvent e) {
                if (UiUtilities.isRightMouseButton(e)) {
                    popup.show(tabs, e.getX(), e.getY());
                }
            }
        });
        dialog.getRootPane().putClientProperty("SeparateWindow", Boolean.TRUE);
    }
    tabs.add(title, new JScrollPane(new JTextArea(information)));
    tabs.setSelectedIndex(tabs.getTabCount() - 1);
    dialog.setVisible(true);
}
Also used : JScrollPane(javax.swing.JScrollPane) MouseEvent(java.awt.event.MouseEvent) JTextArea(javax.swing.JTextArea) ActionEvent(java.awt.event.ActionEvent) JTabbedPane(javax.swing.JTabbedPane) BackingStoreException(java.util.prefs.BackingStoreException) MouseAdapter(java.awt.event.MouseAdapter) WindowAdapter(java.awt.event.WindowAdapter) Dimension(java.awt.Dimension) JPopupMenu(javax.swing.JPopupMenu) WindowEvent(java.awt.event.WindowEvent) Preferences(java.util.prefs.Preferences) NbPreferences(org.openide.util.NbPreferences) AbstractAction(javax.swing.AbstractAction) JDialog(javax.swing.JDialog)

Example 80 with BackingStoreException

use of java.util.prefs.BackingStoreException in project blue by kunstmusik.

the class RecentProjectsList method store.

protected void store() {
    Preferences prefs = getPreferences();
    // clear the backing store
    try {
        prefs.clear();
    } catch (BackingStoreException ex) {
    }
    for (int i = 0; i < mruFileList.size(); i++) {
        String str = mruFileList.get(i);
        prefs.put(MRU_FILE_LIST_PROPERTY + i, str);
    }
}
Also used : BackingStoreException(java.util.prefs.BackingStoreException) NbPreferences(org.openide.util.NbPreferences) Preferences(java.util.prefs.Preferences)

Aggregations

BackingStoreException (java.util.prefs.BackingStoreException)112 Preferences (java.util.prefs.Preferences)95 NbPreferences (org.openide.util.NbPreferences)14 File (java.io.File)11 IOException (java.io.IOException)10 ArrayList (java.util.ArrayList)9 HashMap (java.util.HashMap)4 AutoCompletePreferences (org.jabref.logic.autocompleter.AutoCompletePreferences)4 FieldContentParserPreferences (org.jabref.logic.bibtex.FieldContentParserPreferences)4 LatexFieldFormatterPreferences (org.jabref.logic.bibtex.LatexFieldFormatterPreferences)4 BibtexKeyPatternPreferences (org.jabref.logic.bibtexkeypattern.BibtexKeyPatternPreferences)4 CleanupPreferences (org.jabref.logic.cleanup.CleanupPreferences)4 ImportFormatPreferences (org.jabref.logic.importer.ImportFormatPreferences)4 JournalAbbreviationPreferences (org.jabref.logic.journals.JournalAbbreviationPreferences)4 LayoutFormatterPreferences (org.jabref.logic.layout.LayoutFormatterPreferences)4 FileLinkPreferences (org.jabref.logic.layout.format.FileLinkPreferences)4 NameFormatterPreferences (org.jabref.logic.layout.format.NameFormatterPreferences)4 ProxyPreferences (org.jabref.logic.net.ProxyPreferences)4 OpenOfficePreferences (org.jabref.logic.openoffice.OpenOfficePreferences)4 ProtectedTermsPreferences (org.jabref.logic.protectedterms.ProtectedTermsPreferences)4