Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 34026 Details for
Bug 125965
[prefs] "Export/Import preferences" should let user to choose wich preference to export/import
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Patch to fix this issue
v00.txt (text/plain), 6.42 KB, created by
Frederic Fusier
on 2006-02-02 12:08:25 EST
(
hide
)
Description:
Patch to fix this issue
Filename:
MIME Type:
Creator:
Frederic Fusier
Created:
2006-02-02 12:08:25 EST
Size:
6.42 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core.tests.model >Index: src/org/eclipse/jdt/core/tests/model/ClasspathInitializerTests.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ClasspathInitializerTests.java,v >retrieving revision 1.33 >diff -u -r1.33 ClasspathInitializerTests.java >--- src/org/eclipse/jdt/core/tests/model/ClasspathInitializerTests.java 19 Oct 2005 21:11:45 -0000 1.33 >+++ src/org/eclipse/jdt/core/tests/model/ClasspathInitializerTests.java 2 Feb 2006 17:03:59 -0000 >@@ -15,6 +15,7 @@ > > import org.eclipse.core.resources.*; > import org.eclipse.core.runtime.*; >+import org.eclipse.core.runtime.preferences.IEclipsePreferences; > import org.eclipse.jdt.core.*; > import org.eclipse.jdt.core.compiler.CharOperation; > import org.eclipse.jdt.internal.core.JavaModelManager; >@@ -136,7 +137,7 @@ > // All specified tests which do not belong to the class are skipped... > static { > // Names of tests to run: can be "testBugXXXX" or "BugXXXX") >-// TESTS_NAMES = new String[] { "testVariableInitializer10" }; >+// TESTS_NAMES = new String[] { "testVariableInitializer11" }; > // Numbers of tests to run: "test<number>" will be run for each number of this array > // TESTS_NUMBERS = new int[] { 2, 12 }; > // Range numbers of tests to run: all tests between "test<first>" and "test<last>" will be run for { first, last } >@@ -883,9 +884,34 @@ > VariablesInitializer.reset(); > } > } >+/** >+ * Bug 125965: [prefs] "Export/Import preferences" should let user to choose wich preference to export/import >+ * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=125965" >+ */ >+public void testVariableInitializer11() throws CoreException { >+ try { >+ // Create initializer >+ String varName = "TEST_LIB"; >+ String initialValue = "/P1/lib.jar"; >+ String newValue = "/tmp/file.jar"; >+ VariablesInitializer.setInitializer(new DefaultVariableInitializer(new String[] {varName, initialValue})); >+ assertEquals("JavaCore classpath value should have been initialized", JavaCore.getClasspathVariable(varName).toString(), initialValue); >+ >+ // Modify preference >+ JavaModelManager manager = JavaModelManager.getJavaModelManager(); >+ IEclipsePreferences preferences = manager.getInstancePreferences(); >+ preferences.put(JavaModelManager.CP_VARIABLE_PREFERENCES_PREFIX+varName, newValue); >+ >+ // verify that JavaCore preferences have been reset >+ assertEquals("JavaCore classpath value should be unchanged", JavaCore.getClasspathVariable(varName).toString(), initialValue); >+ assertEquals("JavaCore preferences value should be unchanged", preferences.get(varName, "X"), initialValue); >+ } finally { >+ VariablesInitializer.reset(); >+ } >+} > >-/* >- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=61872 >+/** >+ * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=61872" > */ > public void testUserLibraryInitializer1() throws CoreException { > try { >#P org.eclipse.jdt.core >Index: model/org/eclipse/jdt/core/JavaCore.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/core/JavaCore.java,v >retrieving revision 1.526 >diff -u -r1.526 JavaCore.java >--- model/org/eclipse/jdt/core/JavaCore.java 30 Jan 2006 15:13:48 -0000 1.526 >+++ model/org/eclipse/jdt/core/JavaCore.java 2 Feb 2006 17:04:04 -0000 >@@ -1577,6 +1577,7 @@ > " variable: " + variableName +'\n' + //$NON-NLS-1$ > " variable path: " + variablePath); //$NON-NLS-1$ > } >+ JavaModelManager.getJavaModelManager().initializedVariables.add(variableName); > ok = true; > } catch (RuntimeException e) { > if (JavaModelManager.CP_RESOLVE_VERBOSE) { >Index: model/org/eclipse/jdt/internal/core/JavaModelManager.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaModelManager.java,v >retrieving revision 1.321 >diff -u -r1.321 JavaModelManager.java >--- model/org/eclipse/jdt/internal/core/JavaModelManager.java 2 Feb 2006 14:00:46 -0000 1.321 >+++ model/org/eclipse/jdt/internal/core/JavaModelManager.java 2 Feb 2006 17:04:07 -0000 >@@ -83,6 +83,7 @@ > * Classpath variables pool > */ > public HashMap variables = new HashMap(5); >+ public HashSet initializedVariables = new HashSet(5); > public HashMap previousSessionVariables = new HashMap(5); > private ThreadLocal variableInitializationInProgress = new ThreadLocal(); > >@@ -999,11 +1000,17 @@ > String propertyName = event.getKey(); > if (propertyName.startsWith(CP_VARIABLE_PREFERENCES_PREFIX)) { > String varName = propertyName.substring(CP_VARIABLE_PREFERENCES_PREFIX.length()); >- String newValue = (String)event.getNewValue(); >- if (newValue != null && !(newValue = newValue.trim()).equals(CP_ENTRY_IGNORE)) { >- getJavaModelManager().variables.put(varName, new Path(newValue)); >+ JavaModelManager manager = getJavaModelManager(); >+ if (manager.initializedVariables.contains(varName)) { >+ // revert preference value as we will not apply it to JavaCore classpath variable >+ manager.getInstancePreferences().put(varName, (String)event.getOldValue()); > } else { >- getJavaModelManager().variables.remove(varName); >+ String newValue = (String)event.getNewValue(); >+ if (newValue != null && !(newValue = newValue.trim()).equals(CP_ENTRY_IGNORE)) { >+ manager.variables.put(varName, new Path(newValue)); >+ } else { >+ manager.variables.remove(varName); >+ } > } > } > if (propertyName.startsWith(CP_CONTAINER_PREFERENCES_PREFIX)) { >@@ -3865,8 +3872,8 @@ > } > return result; > } >- >- public synchronized void variablePut(String variableName, IPath variablePath){ >+ >+ public synchronized void variablePut(String variableName, IPath variablePath) { > > // set/unset the initialization in progress > HashSet initializations = variableInitializationInProgress(); >@@ -3891,10 +3898,12 @@ > } > > String variableKey = CP_VARIABLE_PREFERENCES_PREFIX+variableName; >- if (variablePath == null) >+ if (variablePath == null) { > getInstancePreferences().remove(variableKey); >- else >+ this.initializedVariables.remove(variableName); >+ } else { > getInstancePreferences().put(variableKey, variablePath.toString()); >+ } > try { > getInstancePreferences().flush(); > } catch (BackingStoreException e) {
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 125965
:
33990
| 34026