Пример #1
0
 private static void setBoolean(IJavaProject jproject, String optionName, boolean value) {
   IScopeContext context =
       (null != jproject) ? new ProjectScope(jproject.getProject()) : InstanceScope.INSTANCE;
   IEclipsePreferences node = context.getNode(AptPlugin.PLUGIN_ID);
   // get old val as a String, so it can be null if setting doesn't exist yet
   String oldValue = node.get(optionName, null);
   node.putBoolean(optionName, value);
   if (jproject != null && oldValue == null || (value != Boolean.parseBoolean(oldValue))) {
     AptProject aproj = AptPlugin.getAptProject(jproject);
     aproj.preferenceChanged(optionName);
   }
   flushPreference(optionName, node);
 }
Пример #2
0
 private static void setString(IJavaProject jproject, String optionName, String value) {
   IScopeContext context =
       (null != jproject) ? new ProjectScope(jproject.getProject()) : InstanceScope.INSTANCE;
   IEclipsePreferences node;
   if (AptPreferenceConstants.APT_PROCESSANNOTATIONS.equals(optionName)) {
     node = context.getNode(JavaCore.PLUGIN_ID);
   } else {
     node = context.getNode(AptPlugin.PLUGIN_ID);
   }
   String oldValue = node.get(optionName, null);
   node.put(optionName, value);
   if (jproject != null && !value.equals(oldValue)) {
     AptProject aproj = AptPlugin.getAptProject(jproject);
     aproj.preferenceChanged(optionName);
   }
   flushPreference(optionName, node);
 }