/** * @param options the options to add to this options */ public void addAll(CleanUpOptions options) { if (options instanceof MapCleanUpOptions) { fOptions.putAll(((MapCleanUpOptions)options).getMap()); } else { Set<String> keys= options.getKeys(); for (Iterator<String> iterator= keys.iterator(); iterator.hasNext();) { String key= iterator.next(); fOptions.put(key, options.getValue(key)); } } }
/** * @param options the options to add to this options */ public void addAll(CleanUpOptions options) { if (options instanceof MapCleanUpOptions) { fOptions.putAll(((MapCleanUpOptions)options).getMap()); } else { Set<String> keys= options.getKeys(); for (Iterator<String> iterator= keys.iterator(); iterator.hasNext();) { String key= iterator.next(); fOptions.put(key, options.getValue(key)); } } }
private Map<String, String> updateAndComplete(Map<String, String> oldSettings, int version) { final Map<String, String> newSettings= JavaPlugin.getDefault().getCleanUpRegistry().getDefaultOptions(CleanUpConstants.DEFAULT_CLEAN_UP_OPTIONS).getMap(); switch (version) { case VERSION_1: updateFrom1To2(oldSettings); //$FALL-THROUGH$ default: for (final Iterator<String> iter= oldSettings.keySet().iterator(); iter.hasNext();) { final String key= iter.next(); if (!newSettings.containsKey(key)) continue; final String value= oldSettings.get(key); if (value != null) { newSettings.put(key, value); } } } return newSettings; }
private Map<String, String> updateAndComplete(Map<String, String> oldSettings, int version) { final Map<String, String> newSettings= JavaPlugin.getDefault().getCleanUpRegistry().getDefaultOptions(CleanUpConstants.DEFAULT_CLEAN_UP_OPTIONS).getMap(); switch (version) { case VERSION_1: updateFrom1To2(oldSettings); //$FALL-THROUGH$ default: for (final Iterator<String> iter= oldSettings.keySet().iterator(); iter.hasNext();) { final String key= iter.next(); if (!newSettings.containsKey(key)) continue; final String value= oldSettings.get(key); if (value != null) { newSettings.put(key, value); } } } return newSettings; }
/** * Returns a list of built in clean up profiles * @return the list of built in profiles, not null * @since 3.3 */ public static List<Profile> getBuiltInProfiles() { ArrayList<Profile> result= new ArrayList<>(); Map<String, String> settings= JavaPlugin.getDefault().getCleanUpRegistry().getDefaultOptions(CleanUpConstants.DEFAULT_CLEAN_UP_OPTIONS).getMap(); final Profile eclipseProfile= new BuiltInProfile(CleanUpConstants.ECLIPSE_PROFILE, CleanUpMessages.CleanUpProfileManager_ProfileName_EclipseBuildIn, settings, 2, CleanUpProfileVersioner.CURRENT_VERSION, CleanUpProfileVersioner.PROFILE_KIND); result.add(eclipseProfile); return result; }
/** * Returns a list of built in clean up profiles * @return the list of built in profiles, not null * @since 3.3 */ public static List<Profile> getBuiltInProfiles() { ArrayList<Profile> result= new ArrayList<>(); Map<String, String> settings= JavaPlugin.getDefault().getCleanUpRegistry().getDefaultOptions(CleanUpConstants.DEFAULT_CLEAN_UP_OPTIONS).getMap(); final Profile eclipseProfile= new BuiltInProfile(CleanUpConstants.ECLIPSE_PROFILE, CleanUpMessages.CleanUpProfileManager_ProfileName_EclipseBuildIn, settings, 2, CleanUpProfileVersioner.CURRENT_VERSION, CleanUpProfileVersioner.PROFILE_KIND); result.add(eclipseProfile); return result; }
public Map<String, String> decodeSettings(String settings) throws CoreException { byte[] bytes; try { bytes= settings.getBytes(ENCODING); } catch (UnsupportedEncodingException e) { bytes= settings.getBytes(); } InputStream is= new ByteArrayInputStream(bytes); try { List<Profile> res= ProfileStore.readProfilesFromStream(new InputSource(is)); if (res == null || res.size() == 0) return JavaPlugin.getDefault().getCleanUpRegistry().getDefaultOptions(CleanUpConstants.DEFAULT_CLEAN_UP_OPTIONS).getMap(); CustomProfile profile= (CustomProfile)res.get(0); new CleanUpProfileVersioner().update(profile); return profile.getSettings(); } finally { try { is.close(); } catch (IOException e) { /* ignore */ } } }
public Map<String, String> decodeSettings(String settings) throws CoreException { byte[] bytes; try { bytes= settings.getBytes(ENCODING); } catch (UnsupportedEncodingException e) { bytes= settings.getBytes(); } InputStream is= new ByteArrayInputStream(bytes); try { List<Profile> res= ProfileStore.readProfilesFromStream(new InputSource(is)); if (res == null || res.size() == 0) return JavaPlugin.getDefault().getCleanUpRegistry().getDefaultOptions(CleanUpConstants.DEFAULT_CLEAN_UP_OPTIONS).getMap(); CustomProfile profile= (CustomProfile)res.get(0); new CleanUpProfileVersioner().update(profile); return profile.getSettings(); } finally { try { is.close(); } catch (IOException e) { /* ignore */ } } }
public static Map<String, String> loadSaveParticipantOptions(IScopeContext context) { IEclipsePreferences node; if (hasSettingsInScope(context)) { node= context.getNode(JavaUI.ID_PLUGIN); } else { IScopeContext instanceScope= InstanceScope.INSTANCE; if (hasSettingsInScope(instanceScope)) { node= instanceScope.getNode(JavaUI.ID_PLUGIN); } else { return JavaPlugin.getDefault().getCleanUpRegistry().getDefaultOptions(CleanUpConstants.DEFAULT_SAVE_ACTION_OPTIONS).getMap(); } } Map<String, String> result= new HashMap<>(); Set<String> keys= JavaPlugin.getDefault().getCleanUpRegistry().getDefaultOptions(CleanUpConstants.DEFAULT_SAVE_ACTION_OPTIONS).getKeys(); for (Iterator<String> iterator= keys.iterator(); iterator.hasNext();) { String key= iterator.next(); result.put(key, node.get(SAVE_PARTICIPANT_KEY_PREFIX + key, CleanUpOptions.FALSE)); } return result; }
public static Map<String, String> loadSaveParticipantOptions(IScopeContext context) { IEclipsePreferences node; if (hasSettingsInScope(context)) { node= context.getNode(JavaUI.ID_PLUGIN); } else { IScopeContext instanceScope= InstanceScope.INSTANCE; if (hasSettingsInScope(instanceScope)) { node= instanceScope.getNode(JavaUI.ID_PLUGIN); } else { return JavaPlugin.getDefault().getCleanUpRegistry().getDefaultOptions(CleanUpConstants.DEFAULT_SAVE_ACTION_OPTIONS).getMap(); } } Map<String, String> result= new HashMap<>(); Set<String> keys= JavaPlugin.getDefault().getCleanUpRegistry().getDefaultOptions(CleanUpConstants.DEFAULT_SAVE_ACTION_OPTIONS).getKeys(); for (Iterator<String> iterator= keys.iterator(); iterator.hasNext();) { String key= iterator.next(); result.put(key, node.get(SAVE_PARTICIPANT_KEY_PREFIX + key, CleanUpOptions.FALSE)); } return result; }
@Override public void performDefaults() { if (ProjectScope.SCOPE.equals(fContext.getName()) && !hasSettingsInScope(fContext)) return; enabled(true); if (ProjectScope.SCOPE.equals(fContext.getName())) { fSettings= CleanUpPreferenceUtil.loadSaveParticipantOptions(InstanceScope.INSTANCE); } else { fSettings= JavaPlugin.getDefault().getCleanUpRegistry().getDefaultOptions(CleanUpConstants.DEFAULT_SAVE_ACTION_OPTIONS).getMap(); } settingsChanged(); super.performDefaults(); }
@Override public void performDefaults() { if (ProjectScope.SCOPE.equals(fContext.getName()) && !hasSettingsInScope(fContext)) return; enabled(true); if (ProjectScope.SCOPE.equals(fContext.getName())) { fSettings= CleanUpPreferenceUtil.loadSaveParticipantOptions(InstanceScope.INSTANCE); } else { fSettings= JavaPlugin.getDefault().getCleanUpRegistry().getDefaultOptions(CleanUpConstants.DEFAULT_SAVE_ACTION_OPTIONS).getMap(); } settingsChanged(); super.performDefaults(); }
return JavaPlugin.getDefault().getCleanUpRegistry().getDefaultOptions(CleanUpConstants.DEFAULT_SAVE_ACTION_OPTIONS).getMap();
return JavaPlugin.getDefault().getCleanUpRegistry().getDefaultOptions(CleanUpConstants.DEFAULT_SAVE_ACTION_OPTIONS).getMap();
fCustomSettings= JavaPlugin.getDefault().getCleanUpRegistry().getDefaultOptions(CleanUpConstants.DEFAULT_CLEAN_UP_OPTIONS).getMap(); } else { try { } catch (CoreException e) { JavaPlugin.log(e); fCustomSettings= JavaPlugin.getDefault().getCleanUpRegistry().getDefaultOptions(CleanUpConstants.DEFAULT_CLEAN_UP_OPTIONS).getMap();
fCustomSettings= JavaPlugin.getDefault().getCleanUpRegistry().getDefaultOptions(CleanUpConstants.DEFAULT_CLEAN_UP_OPTIONS).getMap(); } else { try { } catch (CoreException e) { JavaPlugin.log(e); fCustomSettings= JavaPlugin.getDefault().getCleanUpRegistry().getDefaultOptions(CleanUpConstants.DEFAULT_CLEAN_UP_OPTIONS).getMap();