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 87853 Details for
Bug 128709
Need an openRule to support concurrent project checkout
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Proposal 03 with tests
128709_20080125.txt (text/plain), 13.26 KB, created by
Szymon Brandys
on 2008-01-25 07:11:24 EST
(
hide
)
Description:
Proposal 03 with tests
Filename:
MIME Type:
Creator:
Szymon Brandys
Created:
2008-01-25 07:11:24 EST
Size:
13.26 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.core.tests.resources >Index: src/org/eclipse/core/tests/resources/NatureTest.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/NatureTest.java,v >retrieving revision 1.11 >diff -u -r1.11 NatureTest.java >--- src/org/eclipse/core/tests/resources/NatureTest.java 17 Jul 2006 15:00:15 -0000 1.11 >+++ src/org/eclipse/core/tests/resources/NatureTest.java 25 Jan 2008 12:10:30 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2005 IBM Corporation and others. >+ * Copyright (c) 2000, 2008 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 >@@ -13,7 +13,9 @@ > import junit.framework.Test; > import junit.framework.TestSuite; > import org.eclipse.core.resources.*; >-import org.eclipse.core.runtime.CoreException; >+import org.eclipse.core.runtime.*; >+import org.eclipse.core.runtime.jobs.IJobManager; >+import org.eclipse.core.runtime.jobs.Job; > import org.eclipse.core.tests.internal.resources.SimpleNature; > > /** >@@ -214,4 +216,47 @@ > } > } > } >+ >+ /** >+ * Test addition of nature that requires the workspace root. >+ * See bugs 127562 and 128709. >+ */ >+ public void testBug127562Nature() { >+ IWorkspace ws = ResourcesPlugin.getWorkspace(); >+ IProject project = ws.getRoot().getProject("Project"); >+ ensureExistsInWorkspace(project, true); >+ >+ String[][] valid = getValidNatureSets(); >+ for (int i = 0; i < valid.length; i++) { >+ setNatures("valid: " + i, project, valid[i], false); >+ } >+ >+ // add with AVOID_NATURE_CONFIG >+ String[] currentSet = new String[] {NATURE_127562}; >+ setNatures("1.0", project, currentSet, false, true); >+ >+ // configure the nature using a conflicting scheduling rule >+ IJobManager manager = Job.getJobManager(); >+ try { >+ manager.beginRule(ws.getRuleFactory().modifyRule(project), null); >+ project.getNature(NATURE_127562).configure(); >+ fail("2.0"); >+ } catch (CoreException ex) { >+ fail("2.1"); >+ } catch (IllegalArgumentException ex) { >+ // should throw this kind of exception >+ } finally { >+ manager.endRule(ws.getRuleFactory().modifyRule(project)); >+ } >+ >+ // configure the nature using a non-conflicting scheduling rule >+ try { >+ manager.beginRule(ws.getRoot(), null); >+ project.getNature(NATURE_127562).configure(); >+ } catch (CoreException ex) { >+ fail("3.0"); >+ } finally { >+ manager.endRule(ws.getRoot()); >+ } >+ } > } >Index: src/org/eclipse/core/tests/resources/ResourceTest.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/ResourceTest.java,v >retrieving revision 1.23 >diff -u -r1.23 ResourceTest.java >--- src/org/eclipse/core/tests/resources/ResourceTest.java 12 Sep 2007 14:46:34 -0000 1.23 >+++ src/org/eclipse/core/tests/resources/ResourceTest.java 25 Jan 2008 12:10:30 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2007 IBM Corporation and others. >+ * Copyright (c) 2000, 2008 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 >@@ -54,6 +54,8 @@ > protected static final String NATURE_MUD = "org.eclipse.core.tests.resources.mudNature"; > //simpleNature > protected static final String NATURE_SIMPLE = "org.eclipse.core.tests.resources.simpleNature"; >+ //nature for regression tests of bug 127562 >+ protected static final String NATURE_127562 = "org.eclipse.core.tests.resources.bug127562Nature"; > //snowNature, requires: waterNature, one-of: otherSet > protected static final String NATURE_SNOW = "org.eclipse.core.tests.resources.snowNature"; > //waterNature, one-of: stateSet >Index: plugin.xml >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.core.tests.resources/plugin.xml,v >retrieving revision 1.74 >diff -u -r1.74 plugin.xml >--- plugin.xml 17 Apr 2007 15:51:29 -0000 1.74 >+++ plugin.xml 25 Jan 2008 12:10:30 -0000 >@@ -254,5 +254,14 @@ > <enablement> > <instanceof value="org.eclipse.core.resources.IResource"/> > </enablement> >+</extension> >+<extension >+ id="bug127562Nature" >+ point="org.eclipse.core.resources.natures"> >+ <runtime> >+ <run >+ class="org.eclipse.core.tests.internal.resources.Bug127562Nature"> >+ </run> >+ </runtime> > </extension> > </plugin> >Index: src/org/eclipse/core/tests/resources/regression/Bug_127562.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/regression/Bug_127562.java,v >retrieving revision 1.3 >diff -u -r1.3 Bug_127562.java >--- src/org/eclipse/core/tests/resources/regression/Bug_127562.java 17 Jul 2006 15:00:15 -0000 1.3 >+++ src/org/eclipse/core/tests/resources/regression/Bug_127562.java 25 Jan 2008 12:10:30 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2006 IBM Corporation and others. >+ * Copyright (c) 2000, 2008 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 >@@ -47,7 +47,7 @@ > public void run(IProgressMonitor monitor) throws CoreException { > project.setDescription(finalDescription, getMonitor()); > } >- }, getWorkspace().getRuleFactory().modifyRule(project), IResource.NONE, getMonitor()); >+ }, getWorkspace().getRoot(), IResource.NONE, getMonitor()); > } catch (CoreException e) { > fail("4.99", e); > } >Index: src/org/eclipse/core/tests/internal/resources/Bug127562Nature.java >=================================================================== >RCS file: src/org/eclipse/core/tests/internal/resources/Bug127562Nature.java >diff -N src/org/eclipse/core/tests/internal/resources/Bug127562Nature.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/core/tests/internal/resources/Bug127562Nature.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,45 @@ >+/******************************************************************************* >+ * Copyright (c) 2008 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.internal.resources; >+ >+import org.eclipse.core.resources.IProject; >+import org.eclipse.core.resources.ResourcesPlugin; >+import org.eclipse.core.runtime.CoreException; >+ >+/** >+ * This nature will try to modify resources outside the project scope. >+ */ >+public class Bug127562Nature extends TestNature { >+ /** >+ * Constructor for SimpleNature. >+ */ >+ public Bug127562Nature() { >+ super(); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.core.resources.IProjectNature#configure() >+ */ >+ public void configure() throws CoreException { >+ super.configure(); >+ IProject p = ResourcesPlugin.getWorkspace().getRoot().getProject("Project" + System.currentTimeMillis()); >+ p.create(null); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.core.resources.IProjectNature#deconfigure() >+ */ >+ public void deconfigure() throws CoreException { >+ super.deconfigure(); >+ IProject p = ResourcesPlugin.getWorkspace().getRoot().getProject("Project" + System.currentTimeMillis()); >+ p.create(null); >+ } >+} >#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.146 >diff -u -r1.146 Project.java >--- src/org/eclipse/core/internal/resources/Project.java 6 Dec 2007 20:38:15 -0000 1.146 >+++ src/org/eclipse/core/internal/resources/Project.java 25 Jan 2008 12:10:33 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2007 IBM Corporation and others. >+ * Copyright (c) 2000, 2008 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 >@@ -980,7 +980,11 @@ > monitor = Policy.monitorFor(monitor); > try { > monitor.beginTask(Messages.resources_setDesc, Policy.totalWork); >- final ISchedulingRule rule = workspace.getRoot(); >+ ISchedulingRule rule = null; >+ if ((updateFlags & IResource.AVOID_NATURE_CONFIG) != 0) >+ rule = workspace.getRuleFactory().modifyRule(this); >+ else >+ rule = workspace.getRoot(); > try { > //need to use root rule because nature configuration calls third party code > workspace.prepareOperation(rule, monitor); >Index: src/org/eclipse/core/resources/team/ResourceRuleFactory.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.core.resources/src/org/eclipse/core/resources/team/ResourceRuleFactory.java,v >retrieving revision 1.11 >diff -u -r1.11 ResourceRuleFactory.java >--- src/org/eclipse/core/resources/team/ResourceRuleFactory.java 1 Mar 2007 19:47:55 -0000 1.11 >+++ src/org/eclipse/core/resources/team/ResourceRuleFactory.java 25 Jan 2008 12:10:33 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2004, 2007 IBM Corporation and others. >+ * Copyright (c) 2004, 2008 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 >@@ -145,9 +145,6 @@ > * @see IProjectDescription#DESCRIPTION_FILE_NAME > */ > public ISchedulingRule modifyRule(IResource resource) { >- //modifying the project description requires the root >- if (resource.getType() == IResource.PROJECT) >- return workspace.getRoot(); > IPath path = resource.getFullPath(); > //modifying the project description may cause linked resources to be created or deleted > if (path.segmentCount() == 2 && path.segment(1).equals(IProjectDescription.DESCRIPTION_FILE_NAME)) >Index: src/org/eclipse/core/resources/IProject.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.core.resources/src/org/eclipse/core/resources/IProject.java,v >retrieving revision 1.42 >diff -u -r1.42 IProject.java >--- src/org/eclipse/core/resources/IProject.java 30 Nov 2007 16:13:28 -0000 1.42 >+++ src/org/eclipse/core/resources/IProject.java 25 Jan 2008 12:10:33 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2007 IBM Corporation and others. >+ * Copyright (c) 2000, 2008 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 >@@ -699,6 +699,10 @@ > * </pre> > * </p> > * <p> >+ * The scheduling rule for the operation is the root rule >+ * required when added and removed natures are configured and de-configured. >+ * </p> >+ * <p> > * This method changes resources; these changes will be reported > * in a subsequent resource change event, including an indication > * that the project's content has changed. >@@ -730,7 +734,6 @@ > * @see IProjectNature#configure() > * @see IProjectNature#deconfigure() > * @see #setDescription(IProjectDescription,int,IProgressMonitor) >- * @see IResourceRuleFactory#modifyRule(IResource) > */ > public void setDescription(IProjectDescription description, IProgressMonitor monitor) throws CoreException; > >@@ -784,6 +787,13 @@ > * removed, but they will not be configured or de-configured. > * </p> > * <p> >+ * The scheduling rule required for this operation depends on the >+ * <code>AVOID_NATURE_CONFIG</code> flag. If the flag is specified the >+ * {@link IResourceRuleFactory#modifyRule} is used since added and removed natures >+ * won't be configured and de-configured. If the flag is not specified, the root rule is used >+ * what is required when natures are configured and de-configured. >+ * </p> >+ * <p> > * Update flags other than <code>FORCE</code>, <code>KEEP_HISTORY</code>, > * and <code>AVOID_NATURE_CONFIG</code> are ignored. > * </p>
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 128709
:
87634
|
87648
|
87650
|
87653
| 87853