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 185543 Details for
Bug 202384
can not reload text file encoding prefs
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Patch v.0.5
patch202384_201012201500.txt (text/plain), 8.19 KB, created by
Szymon Ptaszkiewicz
on 2010-12-20 09:36:58 EST
(
hide
)
Description:
Patch v.0.5
Filename:
MIME Type:
Creator:
Szymon Ptaszkiewicz
Created:
2010-12-20 09:36:58 EST
Size:
8.19 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.core.resources >Index: src/org/eclipse/core/internal/resources/Project.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/Project.java,v >retrieving revision 1.177 >diff -u -r1.177 Project.java >--- src/org/eclipse/core/internal/resources/Project.java 29 Nov 2010 12:10:40 -0000 1.177 >+++ src/org/eclipse/core/internal/resources/Project.java 20 Dec 2010 14:10:14 -0000 >@@ -15,8 +15,6 @@ > *******************************************************************************/ > package org.eclipse.core.internal.resources; > >-import java.util.LinkedHashSet; >- > import java.net.URI; > import java.util.*; > import org.eclipse.core.filesystem.*; >@@ -1158,6 +1156,8 @@ > } > } > } >+ //initialize this project preferences >+ ((ProjectPreferences) Platform.getPreferencesService().getRootNode().node(ProjectScope.SCOPE).node(getName())).initialize(); > //creation of this project may affect overlapping resources > workspace.getAliasManager().updateAliases(this, getStore(), IResource.DEPTH_INFINITE, monitor); > } catch (OperationCanceledException e) { >Index: src/org/eclipse/core/internal/resources/ProjectPreferences.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/ProjectPreferences.java,v >retrieving revision 1.60 >diff -u -r1.60 ProjectPreferences.java >--- src/org/eclipse/core/internal/resources/ProjectPreferences.java 16 Dec 2010 12:24:11 -0000 1.60 >+++ src/org/eclipse/core/internal/resources/ProjectPreferences.java 20 Dec 2010 14:10:14 -0000 >@@ -305,7 +305,7 @@ > // Bug 108066: In case the node had existed before it was updated from > // file, the read() operation marks it dirty. Override the dirty flag > // since we know that the node is expected to be in sync with the file. >- projectPrefs.dirty= false; >+ projectPrefs.dirty = false; > > // make sure that we generate the appropriate resource change events > // if encoding settings have changed >@@ -348,21 +348,7 @@ > addPreferenceChangeListener(workspace.getCharsetManager().getPreferenceChangeListener()); > } > >- if (segmentCount != 2) >- return; >- >- // else segmentCount == 2 so we initialize the children >- if (initialized) >- return; >- try { >- synchronized (this) { >- String[] names = computeChildren(); >- for (int i = 0; i < names.length; i++) >- addChild(names[i], null); >- } >- } finally { >- initialized = true; >- } >+ initialize(); > } > > /* >@@ -471,6 +457,28 @@ > return new ProjectPreferences(nodeParent, nodeName); > } > >+ protected void initialize() { >+ if (segmentCount != 2) >+ return; >+ >+ // if already initialized, then skip this initialization >+ if (initialized) >+ return; >+ // initialize the children only if project is opened >+ if (project.isOpen()) { >+ try { >+ synchronized (this) { >+ String[] names = computeChildren(); >+ for (int i = 0; i < names.length; i++) >+ addChild(names[i], null); >+ } >+ } finally { >+ // mark as initialized so that subsequent project opening will not initialize preferences again >+ initialized = true; >+ } >+ } >+ } >+ > protected boolean isAlreadyLoaded(IEclipsePreferences node) { > return loadedNodes.contains(node.absolutePath()); > } >#P org.eclipse.core.tests.resources >Index: src/org/eclipse/core/tests/resources/session/AllTests.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/session/AllTests.java,v >retrieving revision 1.11 >diff -u -r1.11 AllTests.java >--- src/org/eclipse/core/tests/resources/session/AllTests.java 12 Nov 2010 18:01:26 -0000 1.11 >+++ src/org/eclipse/core/tests/resources/session/AllTests.java 20 Dec 2010 14:10:15 -0000 >@@ -51,6 +51,7 @@ > suite.addTest(org.eclipse.core.tests.resources.regression.TestMultipleBuildersOfSameType.suite()); > suite.addTest(org.eclipse.core.tests.resources.usecase.SnapshotTest.suite()); > suite.addTest(ProjectDescriptionDynamicTest.suite()); >+ suite.addTest(TestBug202384.suite()); > return suite; > } > } >Index: src/org/eclipse/core/tests/resources/session/TestBug202384.java >=================================================================== >RCS file: src/org/eclipse/core/tests/resources/session/TestBug202384.java >diff -N src/org/eclipse/core/tests/resources/session/TestBug202384.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/core/tests/resources/session/TestBug202384.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,111 @@ >+/******************************************************************************* >+ * Copyright (c) 2010 IBM Corporation and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.core.tests.resources.session; >+ >+import junit.framework.Test; >+import org.eclipse.core.resources.*; >+import org.eclipse.core.runtime.CoreException; >+import org.eclipse.core.tests.resources.AutomatedTests; >+import org.eclipse.core.tests.resources.WorkspaceSessionTest; >+import org.eclipse.core.tests.session.WorkspaceSessionTestSuite; >+ >+/** >+ * Test for bug 202384 >+ */ >+public class TestBug202384 extends WorkspaceSessionTest { >+ public TestBug202384() { >+ super(); >+ } >+ >+ public TestBug202384(String name) { >+ super(name); >+ } >+ >+ public void testInitializeWorkspace() { >+ IWorkspace workspace = ResourcesPlugin.getWorkspace(); >+ IProject project = workspace.getRoot().getProject("project"); >+ ensureExistsInWorkspace(project, true); >+ try { >+ project.setDefaultCharset("UTF-8", getMonitor()); >+ } catch (CoreException e1) { >+ fail("1.0", e1); >+ } >+ try { >+ assertEquals("UTF-8", project.getDefaultCharset()); >+ } catch (CoreException e) { >+ fail("2.0", e); >+ } >+ try { >+ project.close(getMonitor()); >+ } catch (CoreException e) { >+ fail("3.0", e); >+ } >+ assertFalse(project.isOpen()); >+ try { >+ workspace.save(true, getMonitor()); >+ } catch (CoreException e) { >+ fail("4.0", e); >+ } >+ } >+ >+ public void testStartWithClosedProject() { >+ IWorkspace workspace = ResourcesPlugin.getWorkspace(); >+ IProject project = workspace.getRoot().getProject("project"); >+ assertFalse(project.isOpen()); >+ try { >+ //ProjectPreferences should get created on getDefaultCharset but not >+ //initialized hence it is not possible to read correct encoding >+ assertNull(project.getDefaultCharset(false)); >+ } catch (CoreException e) { >+ fail("1.0", e); >+ } >+ try { >+ //opening project should re-initialize already loaded ProjectPreferences >+ //because project resources are now available >+ project.open(getMonitor()); >+ } catch (CoreException e) { >+ fail("2.0", e); >+ } >+ try { >+ //correct values should be available after re-initialization >+ assertEquals("UTF-8", project.getDefaultCharset()); >+ } catch (CoreException e) { >+ fail("3.0", e); >+ } >+ try { >+ workspace.save(true, getMonitor()); >+ } catch (CoreException e) { >+ fail("4.0", e); >+ } >+ } >+ >+ public void testStartWithOpenProject() { >+ IWorkspace workspace = ResourcesPlugin.getWorkspace(); >+ IProject project = workspace.getRoot().getProject("project"); >+ assertTrue(project.isOpen()); >+ try { >+ //correct values should be available if ProjectPreferences got >+ //initialized upon creation >+ assertEquals("UTF-8", project.getDefaultCharset(false)); >+ } catch (CoreException e) { >+ fail("1.0", e); >+ } >+ try { >+ workspace.save(true, getMonitor()); >+ } catch (CoreException e) { >+ fail("2.0", e); >+ } >+ } >+ >+ public static Test suite() { >+ return new WorkspaceSessionTestSuite(AutomatedTests.PI_RESOURCES_TESTS, TestBug202384.class); >+ } >+}
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 202384
:
185125
|
185134
|
185139
|
185424
|
185543
|
185703
|
185720
|
186377