예제 #1
0
 /** Save an object to global plugin's preference store. */
 public static void toPreferenceStore(String globalPreferenceKey, Object object) {
   final IPreferenceStore prefStore = WorkbenchCorePlugin.getDefault().getPreferenceStore();
   try {
     prefStore.setValue(globalPreferenceKey, toString(object));
   } catch (IOException e) {
     Utils.logError(e, false);
   }
 }
예제 #2
0
 /**
  * Read an object from the global plugin's preference store. May return <code>null</code> if an
  * error occurred.
  */
 public static <T> T fromPreferenceStore(Class<T> clazz, String globalPreferenceKey) {
   final IPreferenceStore prefStore = WorkbenchCorePlugin.getDefault().getPreferenceStore();
   final String xml = prefStore.getString(globalPreferenceKey);
   if (!StringUtils.isEmpty(xml)) {
     try {
       return fromString(clazz, xml);
     } catch (IOException e) {
       Utils.logError(e, false);
     }
   }
   return null;
 }