1 11 12 package org.eclipse.jdt.internal.ui.preferences.cleanup; 13 14 import java.util.Map ; 15 16 import org.eclipse.jdt.internal.corext.fix.CleanUpConstants; 17 18 import org.eclipse.jdt.internal.ui.preferences.formatter.IProfileVersioner; 19 import org.eclipse.jdt.internal.ui.preferences.formatter.ProfileManager.CustomProfile; 20 21 22 public class CleanUpProfileVersioner implements IProfileVersioner { 23 24 public static final String PROFILE_KIND= "CleanUpProfile"; 26 private static final int VERSION_1= 1; private static final int VERSION_2= 2; 29 public static final int CURRENT_VERSION= VERSION_2; 30 31 34 public int getFirstVersion() { 35 return VERSION_1; 36 } 37 38 41 public int getCurrentVersion() { 42 return CURRENT_VERSION; 43 } 44 45 48 public void update(CustomProfile profile) { 49 if (profile.getVersion() == VERSION_1) 50 updateFrom1To2(profile); 51 52 profile.setVersion(CURRENT_VERSION); 53 } 54 55 58 public String getProfileKind() { 59 return PROFILE_KIND; 60 } 61 62 private static void updateFrom1To2(CustomProfile profile) { 63 Map defaultSettings= CleanUpConstants.getEclipseDefaultSettings(); 64 profile.getSettings().put(CleanUpConstants.ORGANIZE_IMPORTS, defaultSettings.get(CleanUpConstants.ORGANIZE_IMPORTS)); 65 } 66 67 } 68 | Popular Tags |