savePreferences(instanceScope); manager= new FormatterProfileManager(profiles, scope, access, profileVersioner); savePreferences(scope);
public static void checkCurrentOptionsVersion() { PreferencesAccess access= PreferencesAccess.getOriginalPreferences(); ProfileVersioner profileVersioner= new ProfileVersioner(); IScopeContext instanceScope= access.getInstanceScope(); IEclipsePreferences uiPreferences= instanceScope.getNode(JavaUI.ID_PLUGIN); int version= uiPreferences.getInt(PREF_FORMATTER_PROFILES + VERSION_KEY_SUFFIX, 0); if (version >= profileVersioner.getCurrentVersion()) { return; // is up to date } try { List<Profile> profiles= (new FormatterProfileStore(profileVersioner)).readProfiles(instanceScope); if (profiles == null) { profiles= new ArrayList<>(); } ProfileManager manager= new FormatterProfileManager(profiles, instanceScope, access, profileVersioner); if (manager.getSelected() instanceof CustomProfile) { manager.commitChanges(instanceScope); // updates JavaCore options } uiPreferences.putInt(PREF_FORMATTER_PROFILES + VERSION_KEY_SUFFIX, profileVersioner.getCurrentVersion()); savePreferences(instanceScope); } catch (CoreException e) { JavaPlugin.log(e); } catch (BackingStoreException e) { JavaPlugin.log(e); } }
public static void checkCurrentOptionsVersion() { PreferencesAccess access= PreferencesAccess.getOriginalPreferences(); ProfileVersioner profileVersioner= new ProfileVersioner(); IScopeContext instanceScope= access.getInstanceScope(); IEclipsePreferences uiPreferences= instanceScope.getNode(JavaUI.ID_PLUGIN); int version= uiPreferences.getInt(PREF_FORMATTER_PROFILES + VERSION_KEY_SUFFIX, 0); if (version >= profileVersioner.getCurrentVersion()) { return; // is up to date } try { List<Profile> profiles= (new FormatterProfileStore(profileVersioner)).readProfiles(instanceScope); if (profiles == null) { profiles= new ArrayList<>(); } ProfileManager manager= new FormatterProfileManager(profiles, instanceScope, access, profileVersioner); if (manager.getSelected() instanceof CustomProfile) { manager.commitChanges(instanceScope); // updates JavaCore options } uiPreferences.putInt(PREF_FORMATTER_PROFILES + VERSION_KEY_SUFFIX, profileVersioner.getCurrentVersion()); savePreferences(instanceScope); } catch (CoreException e) { JavaPlugin.log(e); } catch (BackingStoreException e) { JavaPlugin.log(e); } }