use of java.util.prefs.BackingStoreException in project jdk8u_jdk by JetBrains.
the class InputContext method getInputMethodSelectionKeyStroke.
private AWTKeyStroke getInputMethodSelectionKeyStroke(Preferences root) {
try {
if (root.nodeExists(inputMethodSelectionKeyPath)) {
Preferences node = root.node(inputMethodSelectionKeyPath);
int keyCode = node.getInt(inputMethodSelectionKeyCodeName, KeyEvent.VK_UNDEFINED);
if (keyCode != KeyEvent.VK_UNDEFINED) {
int modifiers = node.getInt(inputMethodSelectionKeyModifiersName, 0);
return AWTKeyStroke.getAWTKeyStroke(keyCode, modifiers);
}
}
} catch (BackingStoreException bse) {
}
return null;
}
use of java.util.prefs.BackingStoreException in project intellij-plugins by JetBrains.
the class OptionsButton method addResetPreferencesActionTo.
private void addResetPreferencesActionTo(DefaultActionGroup actionGroup) {
myResetSettingsAction = new AnAction("Reset to default settings") {
public void actionPerformed(AnActionEvent e) {
try {
Preferences preferences = Preferences.userRoot().node("jetbrains.communicator");
preferences.removeNode();
preferences.flush();
} catch (BackingStoreException e1) {
LOG.error(e1.getMessage(), e1);
}
}
};
actionGroup.add(myResetSettingsAction);
}
use of java.util.prefs.BackingStoreException in project processdash by dtuma.
the class TranslationSharer method promptForAuthorInfo.
private void promptForAuthorInfo() {
JLabel authorLabel = new JLabel(resources.getString("Translation.Sharing.Author.Name_Prompt"));
JTextField author = new JTextField(20);
JLabel emailLabel = new JLabel(resources.getString("Translation.Sharing.Author.Email_Prompt"));
JTextField email = new JTextField(30);
JRadioButton yesOption = new JRadioButton(resources.getString("Translation.Sharing.Author.Yes_Option"), true);
JRadioButton noOption = new JRadioButton(resources.getString("Translation.Sharing.Author.No_Option"));
ButtonGroup group = new ButtonGroup();
group.add(yesOption);
group.add(noOption);
ContactOptionListener l = new ContactOptionListener(yesOption, new JComponent[] { authorLabel, author, emailLabel, email });
yesOption.addActionListener(l);
noOption.addActionListener(l);
Box buttonBox = Box.createHorizontalBox();
buttonBox.add(yesOption);
buttonBox.add(Box.createHorizontalStrut(10));
buttonBox.add(noOption);
buttonBox.add(Box.createHorizontalGlue());
Object[] message = new Object[] { resources.getString("Translation.Sharing.Author.Prompt"), buttonBox, inputBox(authorLabel, author), inputBox(emailLabel, email) };
JOptionPane.showMessageDialog(null, message, resources.getString("Translation.Sharing.Author.Title"), JOptionPane.OK_OPTION);
if (yesOption.isSelected()) {
prefs.put(AUTHOR_SETTING, author.getText());
prefs.put(EMAIL_SETTING, email.getText());
try {
prefs.flush();
} catch (BackingStoreException e) {
System.out.println(resources.getString("Translation.Errors.Cant_Save_Preferences"));
e.printStackTrace();
}
}
}
use of java.util.prefs.BackingStoreException in project sling by apache.
the class Util method getPreference.
static int[] getPreference(final String name, final int[] defaultValues) {
Preferences prefs = getPreferences();
try {
prefs.sync();
String value = prefs.get(name, null);
if (value != null) {
String[] values = value.split(",");
int[] result = new int[values.length];
for (int i = 0; i < values.length; i++) {
result[i] = Integer.parseInt(values[i]);
}
return result;
}
} catch (BackingStoreException ioe) {
// ignore
} catch (NumberFormatException nfe) {
// ignore
}
return defaultValues;
}
use of java.util.prefs.BackingStoreException in project jabref by JabRef.
the class JabRefPreferences method getKeyPattern.
/**
* Fetches key patterns from preferences.
* The implementation doesn't cache the results
*
* @return LabelPattern containing all keys. Returned LabelPattern has no parent
*/
public GlobalBibtexKeyPattern getKeyPattern() {
keyPattern = GlobalBibtexKeyPattern.fromPattern(get(DEFAULT_BIBTEX_KEY_PATTERN));
Preferences pre = Preferences.userNodeForPackage(PREFS_BASE_CLASS).node(BIBTEX_KEY_PATTERNS_NODE);
try {
String[] keys = pre.keys();
if (keys.length > 0) {
for (String key : keys) {
keyPattern.addBibtexKeyPattern(key, pre.get(key, null));
}
}
} catch (BackingStoreException ex) {
LOGGER.info("BackingStoreException in JabRefPreferences.getKeyPattern", ex);
}
return keyPattern;
}
Aggregations