View | Details | Raw Unified | Return to bug 128709 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/core/internal/resources/Project.java (-1 / +5 lines)
Lines 980-986 Link Here
980
		monitor = Policy.monitorFor(monitor);
980
		monitor = Policy.monitorFor(monitor);
981
		try {
981
		try {
982
			monitor.beginTask(Messages.resources_setDesc, Policy.totalWork);
982
			monitor.beginTask(Messages.resources_setDesc, Policy.totalWork);
983
			final ISchedulingRule rule = workspace.getRoot();
983
			ISchedulingRule rule = null;
984
			if ((updateFlags & IResource.AVOID_NATURE_CONFIG) != 0 || (updateFlags & IResource.NARROW_NATURE_CONFIG) != 0)
985
				rule = workspace.getRuleFactory().modifyRule(this);
986
			else
987
				rule = workspace.getRoot();		
984
			try {
988
			try {
985
				//need to use root rule because nature configuration calls third party code
989
				//need to use root rule because nature configuration calls third party code
986
				workspace.prepareOperation(rule, monitor);
990
				workspace.prepareOperation(rule, monitor);
(-)src/org/eclipse/core/resources/IResource.java (+10 lines)
Lines 278-283 Link Here
278
	 * @since 3.4
278
	 * @since 3.4
279
	 */
279
	 */
280
	public static final int HIDDEN = 0x1000;
280
	public static final int HIDDEN = 0x1000;
281
	
282
	/**
283
	 * Update flag constant (bit mask value 0x2000) indicating that 
284
	 * the attempt to configure and de-configure natures
285
	 * during setting description should use {@link IResourceRuleFactory#modifyRule(IResource)}.
286
	 *
287
	 * @see IProject#setDescription(IProjectDescription, int, IProgressMonitor)
288
	 * @since 3.4
289
	 */
290
	public static final int NARROW_NATURE_CONFIG = 0x2000;
281
291
282
	/*====================================================================
292
	/*====================================================================
283
	 * Other constants:
293
	 * Other constants:
(-)src/org/eclipse/core/resources/IProject.java (-4 / +11 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2007 IBM Corporation and others.
2
 * Copyright (c) 2000, 2008 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 784-791 Link Here
784
	 * removed, but they will not be configured or de-configured.
784
	 * removed, but they will not be configured or de-configured.
785
	 * </p>
785
	 * </p>
786
	 * <p>
786
	 * <p>
787
	 * The <code>NARROW_NATURE_CONFIG</code> update flag controls the scheduling rule
788
	* being used during the attempt to configure or de-configure natures. If this flag is specified, 
789
	* {@link IResourceRuleFactory#modifyRule(IResource)} will be used, otherwise whole workspace 
790
	* will be locked. This flag should be used with a special attention.
791
	 * </p>
792
	 * <p>
787
	 * Update flags other than <code>FORCE</code>, <code>KEEP_HISTORY</code>,
793
	 * Update flags other than <code>FORCE</code>, <code>KEEP_HISTORY</code>,
788
	 * and <code>AVOID_NATURE_CONFIG</code> are ignored.
794
	 * <code>AVOID_NATURE_CONFIG</code> and <code>NARROW_NATURE_CONFIG</code> are ignored.
789
	 * </p>
795
	 * </p>
790
	 * <p>
796
	 * <p>
791
	 * Prior to modifying the project description file, the file modification
797
	 * Prior to modifying the project description file, the file modification
Lines 806-813 Link Here
806
	 *
812
	 *
807
	 * @param description the project description
813
	 * @param description the project description
808
	 * @param updateFlags bit-wise or of update flag constants
814
	 * @param updateFlags bit-wise or of update flag constants
809
	 *   (<code>FORCE</code>, <code>KEEP_HISTORY</code> and
815
	 *   (<code>FORCE</code>, <code>KEEP_HISTORY</code>, 
810
	 * <code>AVOID_NATURE_CONFIG</code>)
816
	 * <code>AVOID_NATURE_CONFIG</code> and <code>NARROW_NATURE_CONFIG</code>)
811
	 * @param monitor a progress monitor, or <code>null</code> if progress
817
	 * @param monitor a progress monitor, or <code>null</code> if progress
812
	 *    reporting is not desired
818
	 *    reporting is not desired
813
	 * @exception CoreException if this method fails. Reasons include:
819
	 * @exception CoreException if this method fails. Reasons include:
Lines 832-837 Link Here
832
	 * @see IResource#FORCE
838
	 * @see IResource#FORCE
833
	 * @see IResource#KEEP_HISTORY
839
	 * @see IResource#KEEP_HISTORY
834
	 * @see IResource#AVOID_NATURE_CONFIG
840
	 * @see IResource#AVOID_NATURE_CONFIG
841
	 * @see IResource#NARROW_NATURE_CONFIG
835
	 * @see IResourceRuleFactory#modifyRule(IResource)
842
	 * @see IResourceRuleFactory#modifyRule(IResource)
836
	 * @since 2.0
843
	 * @since 2.0
837
	 */
844
	 */
(-)src/org/eclipse/core/resources/team/ResourceRuleFactory.java (-4 / +1 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2004, 2007 IBM Corporation and others.
2
 * Copyright (c) 2004, 2008 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 145-153 Link Here
145
	 * @see IProjectDescription#DESCRIPTION_FILE_NAME
145
	 * @see IProjectDescription#DESCRIPTION_FILE_NAME
146
	 */
146
	 */
147
	public ISchedulingRule modifyRule(IResource resource) {
147
	public ISchedulingRule modifyRule(IResource resource) {
148
		//modifying the project description requires the root
149
		if (resource.getType() == IResource.PROJECT)
150
			return workspace.getRoot();
151
		IPath path = resource.getFullPath();
148
		IPath path = resource.getFullPath();
152
		//modifying the project description may cause linked resources to be created or deleted
149
		//modifying the project description may cause linked resources to be created or deleted
153
		if (path.segmentCount() == 2 && path.segment(1).equals(IProjectDescription.DESCRIPTION_FILE_NAME))
150
		if (path.segmentCount() == 2 && path.segment(1).equals(IProjectDescription.DESCRIPTION_FILE_NAME))

Return to bug 128709