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 186377 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.7
patch202384_201101101230.txt (text/plain), 8.32 KB, created by
Szymon Ptaszkiewicz
on 2011-01-10 06:42:36 EST
(
hide
)
Description:
Patch v.0.7
Filename:
MIME Type:
Creator:
Szymon Ptaszkiewicz
Created:
2011-01-10 06:42:36 EST
Size:
8.32 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 10 Jan 2011 11:37:02 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2010 IBM Corporation and others. >+ * Copyright (c) 2000, 2011 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 >@@ -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.63 >diff -u -r1.63 ProjectPreferences.java >--- src/org/eclipse/core/internal/resources/ProjectPreferences.java 5 Jan 2011 11:19:33 -0000 1.63 >+++ src/org/eclipse/core/internal/resources/ProjectPreferences.java 10 Jan 2011 11:37:02 -0000 >@@ -343,21 +343,7 @@ > if (segmentCount > 2) > qualifier = getSegment(path, 2); > >- 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(); > } > > /* >@@ -479,6 +465,28 @@ > return super.internalPut(key, newValue); > } > >+ 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()); > } >@@ -513,9 +521,6 @@ > FileUtil.safeClose(input); > } > convertFromProperties(this, fromDisk, true); >- } >- >- protected void loaded() { > loadedNodes.add(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.12 >diff -u -r1.12 AllTests.java >--- src/org/eclipse/core/tests/resources/session/AllTests.java 5 Jan 2011 15:08:27 -0000 1.12 >+++ src/org/eclipse/core/tests/resources/session/AllTests.java 10 Jan 2011 11:37:03 -0000 >@@ -52,6 +52,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) 2011 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 created 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
Flags:
Szymon.Brandys
:
iplog+
Actions:
View
|
Diff
Attachments on
bug 202384
:
185125
|
185134
|
185139
|
185424
|
185543
|
185703
|
185720
| 186377