List of usage examples for org.eclipse.jdt.internal.core JavaModelManager DEPRECATED_OPTION
int DEPRECATED_OPTION
To view the source code for org.eclipse.jdt.internal.core JavaModelManager DEPRECATED_OPTION.
Click Source Link
From source file:org.eclipse.jdt.internal.core.JavaModelManager.java
License:Open Source License
/** * Store the preferences value for the given option name. * * @param optionName The name of the option * @param optionValue The value of the option. If <code>null</code>, then * the option will be removed from the preferences instead. * @param eclipsePreferences The eclipse preferences to be updated * @return <code>true</code> if the preferences have been changed, * <code>false</code> otherwise. */// w w w .ja v a2s . c o m public boolean storePreference(String optionName, String optionValue, IEclipsePreferences eclipsePreferences) { int optionLevel = this.getOptionLevel(optionName); if (optionLevel == UNKNOWN_OPTION) return false; // unrecognized option // Store option value switch (optionLevel) { case JavaModelManager.VALID_OPTION: if (optionValue == null) { eclipsePreferences.remove(optionName); } else { eclipsePreferences.put(optionName, optionValue); } break; case JavaModelManager.DEPRECATED_OPTION: // Try to migrate deprecated option eclipsePreferences.remove(optionName); // get rid off old preference String[] compatibleOptions = (String[]) this.deprecatedOptions.get(optionName); for (int co = 0, length = compatibleOptions.length; co < length; co++) { if (optionValue == null) { eclipsePreferences.remove(compatibleOptions[co]); } else { eclipsePreferences.put(compatibleOptions[co], optionValue); } } break; default: return false; } return true; }