Lines 83-88
Link Here
|
83 |
* Classpath variables pool |
83 |
* Classpath variables pool |
84 |
*/ |
84 |
*/ |
85 |
public HashMap variables = new HashMap(5); |
85 |
public HashMap variables = new HashMap(5); |
|
|
86 |
public HashSet initializedVariables = new HashSet(5); |
86 |
public HashMap previousSessionVariables = new HashMap(5); |
87 |
public HashMap previousSessionVariables = new HashMap(5); |
87 |
private ThreadLocal variableInitializationInProgress = new ThreadLocal(); |
88 |
private ThreadLocal variableInitializationInProgress = new ThreadLocal(); |
88 |
|
89 |
|
Lines 999-1009
Link Here
|
999 |
String propertyName = event.getKey(); |
1000 |
String propertyName = event.getKey(); |
1000 |
if (propertyName.startsWith(CP_VARIABLE_PREFERENCES_PREFIX)) { |
1001 |
if (propertyName.startsWith(CP_VARIABLE_PREFERENCES_PREFIX)) { |
1001 |
String varName = propertyName.substring(CP_VARIABLE_PREFERENCES_PREFIX.length()); |
1002 |
String varName = propertyName.substring(CP_VARIABLE_PREFERENCES_PREFIX.length()); |
1002 |
String newValue = (String)event.getNewValue(); |
1003 |
JavaModelManager manager = getJavaModelManager(); |
1003 |
if (newValue != null && !(newValue = newValue.trim()).equals(CP_ENTRY_IGNORE)) { |
1004 |
if (manager.initializedVariables.contains(varName)) { |
1004 |
getJavaModelManager().variables.put(varName, new Path(newValue)); |
1005 |
// revert preference value as we will not apply it to JavaCore classpath variable |
|
|
1006 |
manager.getInstancePreferences().put(varName, (String)event.getOldValue()); |
1005 |
} else { |
1007 |
} else { |
1006 |
getJavaModelManager().variables.remove(varName); |
1008 |
String newValue = (String)event.getNewValue(); |
|
|
1009 |
if (newValue != null && !(newValue = newValue.trim()).equals(CP_ENTRY_IGNORE)) { |
1010 |
manager.variables.put(varName, new Path(newValue)); |
1011 |
} else { |
1012 |
manager.variables.remove(varName); |
1013 |
} |
1007 |
} |
1014 |
} |
1008 |
} |
1015 |
} |
1009 |
if (propertyName.startsWith(CP_CONTAINER_PREFERENCES_PREFIX)) { |
1016 |
if (propertyName.startsWith(CP_CONTAINER_PREFERENCES_PREFIX)) { |
Lines 3865-3872
Link Here
|
3865 |
} |
3872 |
} |
3866 |
return result; |
3873 |
return result; |
3867 |
} |
3874 |
} |
3868 |
|
3875 |
|
3869 |
public synchronized void variablePut(String variableName, IPath variablePath){ |
3876 |
public synchronized void variablePut(String variableName, IPath variablePath) { |
3870 |
|
3877 |
|
3871 |
// set/unset the initialization in progress |
3878 |
// set/unset the initialization in progress |
3872 |
HashSet initializations = variableInitializationInProgress(); |
3879 |
HashSet initializations = variableInitializationInProgress(); |
Lines 3891-3900
Link Here
|
3891 |
} |
3898 |
} |
3892 |
|
3899 |
|
3893 |
String variableKey = CP_VARIABLE_PREFERENCES_PREFIX+variableName; |
3900 |
String variableKey = CP_VARIABLE_PREFERENCES_PREFIX+variableName; |
3894 |
if (variablePath == null) |
3901 |
if (variablePath == null) { |
3895 |
getInstancePreferences().remove(variableKey); |
3902 |
getInstancePreferences().remove(variableKey); |
3896 |
else |
3903 |
this.initializedVariables.remove(variableName); |
|
|
3904 |
} else { |
3897 |
getInstancePreferences().put(variableKey, variablePath.toString()); |
3905 |
getInstancePreferences().put(variableKey, variablePath.toString()); |
|
|
3906 |
} |
3898 |
try { |
3907 |
try { |
3899 |
getInstancePreferences().flush(); |
3908 |
getInstancePreferences().flush(); |
3900 |
} catch (BackingStoreException e) { |
3909 |
} catch (BackingStoreException e) { |