Lines 1043-1052
Link Here
|
1043 |
} |
1043 |
} |
1044 |
} else { |
1044 |
} else { |
1045 |
String newValue = (String)event.getNewValue(); |
1045 |
String newValue = (String)event.getNewValue(); |
|
|
1046 |
IPath newPath; |
1046 |
if (newValue != null && !(newValue = newValue.trim()).equals(CP_ENTRY_IGNORE)) { |
1047 |
if (newValue != null && !(newValue = newValue.trim()).equals(CP_ENTRY_IGNORE)) { |
1047 |
manager.variables.put(varName, new Path(newValue)); |
1048 |
newPath = new Path(newValue); |
1048 |
} else { |
1049 |
} else { |
1049 |
manager.variables.remove(varName); |
1050 |
newPath = null; |
|
|
1051 |
} |
1052 |
try { |
1053 |
manager.updateVariableValues(new String[] {varName}, new IPath[] {newPath}, false/*don't update preferences*/, null/*no progress available*/); |
1054 |
} catch (JavaModelException e) { |
1055 |
Util.log(e, "Could not set classpath variable " + varName + " to " + newPath); //$NON-NLS-1$ //$NON-NLS-2$ |
1050 |
} |
1056 |
} |
1051 |
} |
1057 |
} |
1052 |
} |
1058 |
} |
Lines 2940-2952
Link Here
|
2940 |
void save() throws IOException, JavaModelException { |
2946 |
void save() throws IOException, JavaModelException { |
2941 |
saveProjects(JavaModelManager.this.getJavaModel().getJavaProjects()); |
2947 |
saveProjects(JavaModelManager.this.getJavaModel().getJavaProjects()); |
2942 |
|
2948 |
|
2943 |
// don't save classpath variables from the default preferences as there is no delta if they are removed |
2949 |
// remove variables that should not be saved |
2944 |
HashMap varsToSave = null; |
2950 |
HashMap varsToSave = null; |
2945 |
Iterator iterator = JavaModelManager.this.variables.keySet().iterator(); |
2951 |
Iterator iterator = JavaModelManager.this.variables.entrySet().iterator(); |
2946 |
IEclipsePreferences defaultPreferences = getDefaultPreferences(); |
2952 |
IEclipsePreferences defaultPreferences = getDefaultPreferences(); |
2947 |
while (iterator.hasNext()) { |
2953 |
while (iterator.hasNext()) { |
2948 |
String varName = (String) iterator.next(); |
2954 |
Map.Entry entry = (Map.Entry) iterator.next(); |
2949 |
if (defaultPreferences.get(CP_VARIABLE_PREFERENCES_PREFIX + varName, null) != null) { |
2955 |
String varName = (String) entry.getKey(); |
|
|
2956 |
if (defaultPreferences.get(CP_VARIABLE_PREFERENCES_PREFIX + varName, null) != null // don't save classpath variables from the default preferences as there is no delta if they are removed |
2957 |
|| CP_ENTRY_IGNORE_PATH.equals(entry.getValue())) { |
2958 |
|
2950 |
if (varsToSave == null) |
2959 |
if (varsToSave == null) |
2951 |
varsToSave = new HashMap(JavaModelManager.this.variables); |
2960 |
varsToSave = new HashMap(JavaModelManager.this.variables); |
2952 |
varsToSave.remove(varName); |
2961 |
varsToSave.remove(varName); |
Lines 3826-3831
Link Here
|
3826 |
public void updateVariableValues( |
3835 |
public void updateVariableValues( |
3827 |
String[] variableNames, |
3836 |
String[] variableNames, |
3828 |
IPath[] variablePaths, |
3837 |
IPath[] variablePaths, |
|
|
3838 |
boolean updatePreferences, |
3829 |
IProgressMonitor monitor) throws JavaModelException { |
3839 |
IProgressMonitor monitor) throws JavaModelException { |
3830 |
|
3840 |
|
3831 |
if (monitor != null && monitor.isCanceled()) return; |
3841 |
if (monitor != null && monitor.isCanceled()) return; |
Lines 3921-3927
Link Here
|
3921 |
} |
3931 |
} |
3922 |
// update variables |
3932 |
// update variables |
3923 |
for (int i = 0; i < varLength; i++){ |
3933 |
for (int i = 0; i < varLength; i++){ |
3924 |
this.variablePut(variableNames[i], variablePaths[i]); |
3934 |
variablePut(variableNames[i], variablePaths[i]); |
|
|
3935 |
if (updatePreferences) |
3936 |
variablePreferencesPut(variableNames[i], variablePaths[i]); |
3925 |
} |
3937 |
} |
3926 |
final String[] dbgVariableNames = variableNames; |
3938 |
final String[] dbgVariableNames = variableNames; |
3927 |
|
3939 |
|
Lines 4024-4030
Link Here
|
4024 |
// discard obsoleted information about previous session |
4036 |
// discard obsoleted information about previous session |
4025 |
this.previousSessionVariables.remove(variableName); |
4037 |
this.previousSessionVariables.remove(variableName); |
4026 |
} |
4038 |
} |
4027 |
|
4039 |
} |
|
|
4040 |
|
4041 |
private void variablePreferencesPut(String variableName, IPath variablePath) { |
4028 |
String variableKey = CP_VARIABLE_PREFERENCES_PREFIX+variableName; |
4042 |
String variableKey = CP_VARIABLE_PREFERENCES_PREFIX+variableName; |
4029 |
if (variablePath == null) { |
4043 |
if (variablePath == null) { |
4030 |
this.variablesWithInitializer.remove(variableName); |
4044 |
this.variablesWithInitializer.remove(variableName); |