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

Collapse All | Expand All

(-)src/org/eclipse/ltk/internal/core/refactoring/resource/DeleteResourcesProcessor.java (-3 / +18 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2007, 2008 IBM Corporation and others.
2
 * Copyright (c) 2007, 2011 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 10-15 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.ltk.internal.core.refactoring.resource;
11
package org.eclipse.ltk.internal.core.refactoring.resource;
12
12
13
import java.net.URI;
13
import java.util.ArrayList;
14
import java.util.ArrayList;
14
import java.util.Arrays;
15
import java.util.Arrays;
15
16
Lines 287-300 Link Here
287
288
288
	private static void addToList(ArrayList result, IResource curr) {
289
	private static void addToList(ArrayList result, IResource curr) {
289
		IPath currPath= curr.getFullPath();
290
		IPath currPath= curr.getFullPath();
290
		for (int k= result.size() - 1; k >= 0 ; k--) {
291
		URI currURI= curr.getLocationURI();
291
			IResource other= (IResource) result.get(k);
292
		String currURIString= currURI != null ? currURI.toString() : null;
293
		for (int k= result.size() - 1; k >= 0; k--) {
294
			IResource other= (IResource)result.get(k);
292
			IPath otherPath= other.getFullPath();
295
			IPath otherPath= other.getFullPath();
293
			if (otherPath.isPrefixOf(currPath)) {
296
			if (otherPath.isPrefixOf(currPath)) {
294
				return; // current entry is a descendant of an entry in the list
297
				return; // current entry is a descendant of an entry in the list
295
			}
298
			}
296
			if (currPath.isPrefixOf(otherPath)) {
299
			if (currPath.isPrefixOf(otherPath)) {
297
				result.remove(k); // entry in the list is a descendant of the current entry
300
				result.remove(k); // entry in the list is a descendant of the current entry
301
			} else if ((curr.getType() == IResource.PROJECT) && (other.getType() == IResource.PROJECT)) {
302
				// handle nested projects (bug 343584)
303
				URI otherURI= other.getLocationURI();
304
				String otherURIString= otherURI != null ? otherURI.toString() : null;
305
				if (currURIString != null && otherURIString != null) {
306
					if (currURIString.startsWith(otherURIString)) {
307
						return; // current entry is a descendant of an entry in the list
308
					}
309
					if (otherURIString.startsWith(currURIString)) {
310
						result.remove(k); // entry in the list is a descendant of the current entry
311
					}
312
				}
298
			}
313
			}
299
		}
314
		}
300
		result.add(curr);
315
		result.add(curr);

Return to bug 343584