View | Details | Raw Unified | Return to bug 298100
Collapse All | Expand All

(-)plugin.xml (+17 lines)
Lines 211-214 Link Here
211
         </run>
211
         </run>
212
      </filesystem>
212
      </filesystem>
213
   </extension>
213
   </extension>
214
   <extension
215
         id="filtermarker"
216
         name="Filter Marker"
217
         point="org.eclipse.core.resources.markers">
218
      <super
219
            type="org.eclipse.core.resources.marker">
220
      </super>
221
      <persistent
222
            value="false">
223
      </persistent>
224
      <attribute
225
            name="type">
226
      </attribute>
227
      <attribute
228
            name="matcherDescription">
229
      </attribute>
230
   </extension>
214
</plugin>
231
</plugin>
(-)src/org/eclipse/core/internal/localstore/CopyVisitor.java (-9 / +8 lines)
Lines 11-17 Link Here
11
*******************************************************************************/
11
*******************************************************************************/
12
package org.eclipse.core.internal.localstore;
12
package org.eclipse.core.internal.localstore;
13
13
14
import java.util.LinkedList;
15
import org.eclipse.core.filesystem.EFS;
14
import org.eclipse.core.filesystem.EFS;
16
import org.eclipse.core.filesystem.IFileStore;
15
import org.eclipse.core.filesystem.IFileStore;
17
import org.eclipse.core.internal.resources.*;
16
import org.eclipse.core.internal.resources.*;
Lines 81-94 Link Here
81
				return false;
80
				return false;
82
			}
81
			}
83
			// update filters in project descriptions
82
			// update filters in project descriptions
84
			if (source.hasFilters()) {
83
//			if (source.hasFilters()) {
85
				Project sourceProject = (Project) source.getProject();
84
//				Project sourceProject = (Project) source.getProject();
86
				LinkedList/*<FilterDescription>*/originalDescriptions = sourceProject.internalGetDescription().getFilter(source.getProjectRelativePath());
85
//				LinkedList/*<FilterDescription>*/originalDescriptions = sourceProject.internalGetDescription().getFilter(source.getProjectRelativePath());
87
				LinkedList/*<FilterDescription>*/filterDescriptions = FilterDescription.copy(originalDescriptions, destination);
86
//				LinkedList/*<FilterDescription>*/filterDescriptions = FilterDescription.copy(originalDescriptions, destination);
88
				Project project = (Project) destination.getProject();
87
//				Project project = (Project) destination.getProject();
89
				project.internalGetDescription().setFilters(destination.getProjectRelativePath(), filterDescriptions);
88
//				project.internalGetDescription().setFilters(destination.getProjectRelativePath(), filterDescriptions);
90
				project.writeDescription(updateFlags);
89
//				project.writeDescription(updateFlags);
91
			}
90
//			}
92
91
93
			IFileStore sourceStore = node.getStore();
92
			IFileStore sourceStore = node.getStore();
94
			IFileStore destinationStore = destination.getStore();
93
			IFileStore destinationStore = destination.getStore();
(-)src/org/eclipse/core/internal/resources/FilterTypeManager.java (-2 / +19 lines)
Lines 12-19 Link Here
12
package org.eclipse.core.internal.resources;
12
package org.eclipse.core.internal.resources;
13
13
14
import java.util.HashMap;
14
import java.util.HashMap;
15
import org.eclipse.core.resources.IFilterMatcherDescriptor;
15
import org.eclipse.core.resources.*;
16
import org.eclipse.core.resources.ResourcesPlugin;
17
import org.eclipse.core.resources.filtermatchers.AbstractFileInfoMatcher;
16
import org.eclipse.core.resources.filtermatchers.AbstractFileInfoMatcher;
18
import org.eclipse.core.runtime.*;
17
import org.eclipse.core.runtime.*;
19
18
Lines 102-106 Link Here
102
101
103
	public void startup(IProgressMonitor monitor) {
102
	public void startup(IProgressMonitor monitor) {
104
		//nothing to do
103
		//nothing to do
104
105
//		ResourcesPlugin.getWorkspace().addResourceChangeListener(new IResourceChangeListener() {
106
//			public void resourceChanged(IResourceChangeEvent event) {
107
//				IMarkerDelta[] mDelta = event.getDelta().getMarkerDeltas();
108
//				if (mDelta.length != 0) {
109
//					if (mDelta[0].getKind() == IResourceDelta.ADDED) {
110
//						try {
111
//							((ProjectDescription) mDelta[0].getResource().getProject().getDescription()).addFilterDescription(new FilterDescription(mDelta[0].getResource(), ((Integer) mDelta[0].getAttribute("type")).intValue(), //$NON-NLS-1$
112
//									(FileInfoMatcherDescription) mDelta[0].getAttribute("matcherDescription"))); //$NON-NLS-1$
113
//							((Project)mDelta[0].getResource().getProject()).writeDescription(IResource.NONE);
114
//						} catch (CoreException e) {
115
//							// TODO Auto-generated catch block
116
//							e.printStackTrace();
117
//						}
118
//					}
119
//				}
120
//			}
121
//		}, IResourceChangeEvent.POST_CHANGE);
105
	}
122
	}
106
}
123
}
(-)src/org/eclipse/core/internal/resources/ModelObjectWriter.java (-10 / +11 lines)
Lines 219-234 Link Here
219
				Collections.sort(sorted);
219
				Collections.sort(sorted);
220
				write(LINKED_RESOURCES, sorted, writer);
220
				write(LINKED_RESOURCES, sorted, writer);
221
			}
221
			}
222
			HashMap filters = description.getFilters();
222
			
223
			if (filters != null) {
223
//			HashMap filters = description.getFilters();
224
				List sorted = new ArrayList();
224
//			if (filters != null) {
225
				for (Iterator it = filters.values().iterator(); it.hasNext();) {
225
//				List sorted = new ArrayList();
226
					List list = (List) it.next();
226
//				for (Iterator it = filters.values().iterator(); it.hasNext();) {
227
					sorted.addAll(list);
227
//					List list = (List) it.next();
228
				}
228
//					sorted.addAll(list);
229
				Collections.sort(sorted);
229
//				}
230
				write(FILTERED_RESOURCES, sorted, writer);
230
//				Collections.sort(sorted);
231
			}
231
//				write(FILTERED_RESOURCES, sorted, writer);
232
//			}
232
			HashMap variables = description.getVariables();
233
			HashMap variables = description.getVariables();
233
			if (variables != null) {
234
			if (variables != null) {
234
				List sorted = new ArrayList(variables.values());
235
				List sorted = new ArrayList(variables.values());
(-)src/org/eclipse/core/internal/resources/ProjectDescription.java (-35 / +45 lines)
Lines 181-191 Link Here
181
	 * Returns the filter for the given resource name. Returns null if
181
	 * Returns the filter for the given resource name. Returns null if
182
	 * no such filter exists.
182
	 * no such filter exists.
183
	 */
183
	 */
184
	synchronized public LinkedList/*<FilterDescription>*/ getFilter(IPath aPath) {
184
//	synchronized public LinkedList/*<FilterDescription>*/ getFilter(IPath aPath) {
185
		if (filterDescriptions == null)
185
//		if (filterDescriptions == null)
186
			return null;
186
//			return null;
187
		return (LinkedList /*<FilterDescription> */) filterDescriptions.get(aPath);
187
//		return (LinkedList /*<FilterDescription> */) filterDescriptions.get(aPath);
188
	}
188
//	}
189
189
190
	/**
190
	/**
191
	 * Returns the map of link descriptions (IPath (project relative path) -> LinkDescription).
191
	 * Returns the map of link descriptions (IPath (project relative path) -> LinkDescription).
Lines 201-209 Link Here
201
	 * Since this method is only used internally, it never creates a copy.
201
	 * Since this method is only used internally, it never creates a copy.
202
	 * Returns null if the project does not have any filtered resources.
202
	 * Returns null if the project does not have any filtered resources.
203
	 */
203
	 */
204
	public HashMap getFilters() {
204
//	public HashMap getFilters() {
205
		return filterDescriptions;
205
//		return filterDescriptions;
206
	}
206
//	}
207
207
208
	/**
208
	/**
209
	 * Returns the map of variable descriptions (String (variable name) ->
209
	 * Returns the map of variable descriptions (String (variable name) ->
Lines 300-310 Link Here
300
		if (!Arrays.equals(natures, description.getNatureIds(false)))
300
		if (!Arrays.equals(natures, description.getNatureIds(false)))
301
			return true;
301
			return true;
302
		
302
		
303
		HashMap otherFilters = description.getFilters();
303
//		HashMap otherFilters = description.getFilters();
304
		if ((filterDescriptions == null) && (otherFilters != null))
304
//		if ((filterDescriptions == null) && (otherFilters != null))
305
			return otherFilters != null;
305
//			return otherFilters != null;
306
		if ((filterDescriptions != null) && !filterDescriptions.equals(otherFilters))
306
//		if ((filterDescriptions != null) && !filterDescriptions.equals(otherFilters))
307
			return true;
307
//			return true;
308
308
309
		HashMap otherVariables = description.getVariables();
309
		HashMap otherVariables = description.getVariables();
310
		if ((variableDescriptions == null) && (otherVariables != null))
310
		if ((variableDescriptions == null) && (otherVariables != null))
Lines 431-465 Link Here
431
	 * Add the description of a filter. Setting to a description of null will
431
	 * Add the description of a filter. Setting to a description of null will
432
	 * remove the filter from the project description.
432
	 * remove the filter from the project description.
433
	 */
433
	 */
434
	synchronized public void addFilter(IPath path, FilterDescription description) {
434
//	synchronized public void addFilter(IPath path, FilterDescription description) {
435
		Assert.isNotNull(description);
435
//		Assert.isNotNull(description);
436
		if (filterDescriptions == null)
436
//		if (filterDescriptions == null)
437
			filterDescriptions = new HashMap(10);
437
//			filterDescriptions = new HashMap(10);
438
		LinkedList/*<FilterDescription>*/ descList = (LinkedList /*<FilterDescription> */) filterDescriptions.get(path);
438
//		LinkedList/*<FilterDescription>*/ descList = (LinkedList /*<FilterDescription> */) filterDescriptions.get(path);
439
		if (descList == null) {
439
//		if (descList == null) {
440
			descList = new LinkedList/*<FilterDescription>*/();
440
//			descList = new LinkedList/*<FilterDescription>*/();
441
			filterDescriptions.put(path, descList);
441
//			filterDescriptions.put(path, descList);
442
		}
442
//		}
443
//		descList.add(description);
444
//	}
445
	
446
	LinkedList descList = new LinkedList();
447
	
448
	public void addFilterDescription(FilterDescription description) {
443
		descList.add(description);
449
		descList.add(description);
444
	}
450
	}
445
	
451
	
452
	public void removeFilterDescription(FilterDescription description) {
453
		descList.remove(description);
454
	}
455
	
446
	/**
456
	/**
447
	 * Add the description of a filter. Setting to a description of null will
457
	 * Add the description of a filter. Setting to a description of null will
448
	 * remove the filter from the project description.
458
	 * remove the filter from the project description.
449
	 */
459
	 */
450
	synchronized public void removeFilter(IPath path, FilterDescription description) {
460
//	synchronized public void removeFilter(IPath path, FilterDescription description) {
451
		if (filterDescriptions != null) {
461
//		if (filterDescriptions != null) {
452
			LinkedList/*<FilterDescription>*/ descList = (LinkedList /*<FilterDescription> */) filterDescriptions.get(path);
462
//			LinkedList/*<FilterDescription>*/ descList = (LinkedList /*<FilterDescription> */) filterDescriptions.get(path);
453
			if (descList != null) {
463
//			if (descList != null) {
454
				descList.remove(description);
464
//				descList.remove(description);
455
				if (descList.size() == 0) {
465
//				if (descList.size() == 0) {
456
					filterDescriptions.remove(path);
466
//					filterDescriptions.remove(path);
457
					if (filterDescriptions.size() == 0)
467
//					if (filterDescriptions.size() == 0)
458
						filterDescriptions = null;
468
//						filterDescriptions = null;
459
				}
469
//				}
460
			}
470
//			}
461
		}
471
//		}
462
	}
472
//	}
463
473
464
	/**
474
	/**
465
	 * Sets the description of a variable. Setting to a description of null will
475
	 * Sets the description of a variable. Setting to a description of null will
(-)src/org/eclipse/core/internal/resources/Resource.java (-146 / +183 lines)
Lines 17-28 Link Here
17
 *******************************************************************************/
17
 *******************************************************************************/
18
package org.eclipse.core.internal.resources;
18
package org.eclipse.core.internal.resources;
19
19
20
import org.eclipse.core.resources.IFile;
20
import org.eclipse.core.runtime.CoreException;
21
import org.eclipse.core.runtime.IProgressMonitor;
22
23
import org.eclipse.core.internal.utils.Messages;
24
import org.eclipse.core.internal.utils.Policy;
25
import org.eclipse.core.runtime.OperationCanceledException;
26
21
27
import java.net.URI;
22
import java.net.URI;
28
import java.net.URISyntaxException;
23
import java.net.URISyntaxException;
Lines 716-827 Link Here
716
	 * @see IContainer#createFilter(int, IFileInfoMatcherDescription, int, IProgressMonitor)
711
	 * @see IContainer#createFilter(int, IFileInfoMatcherDescription, int, IProgressMonitor)
717
	 */
712
	 */
718
	public IResourceFilterDescription createFilter(int type, IFileInfoMatcherDescription matcherDescription, int updateFlags, IProgressMonitor monitor) throws CoreException {
713
	public IResourceFilterDescription createFilter(int type, IFileInfoMatcherDescription matcherDescription, int updateFlags, IProgressMonitor monitor) throws CoreException {
719
		Assert.isNotNull(getProject());
714
		//		Assert.isNotNull(getProject());
720
		monitor = Policy.monitorFor(monitor);
715
		//		monitor = Policy.monitorFor(monitor);
721
		FilterDescription filter = null;
716
		FilterDescription filter = null;
722
		try {
717
		//		try {
723
			String message = NLS.bind(Messages.links_creating, getFullPath());
718
		//			String message = NLS.bind(Messages.links_creating, getFullPath());
724
			monitor.beginTask(message, Policy.totalWork);
719
		//			monitor.beginTask(message, Policy.totalWork);
725
			Policy.checkCanceled(monitor);
720
		//			Policy.checkCanceled(monitor);
726
			checkValidPath(path, FOLDER | PROJECT, true);
721
		//			checkValidPath(path, FOLDER | PROJECT, true);
727
			final ISchedulingRule rule = workspace.getRuleFactory().createRule(this);
722
		//			final ISchedulingRule rule = workspace.getRuleFactory().createRule(this);
728
			try {
723
		//			try {
729
				workspace.prepareOperation(rule, monitor);
724
		//				workspace.prepareOperation(rule, monitor);
730
				workspace.broadcastEvent(LifecycleEvent.newEvent(LifecycleEvent.PRE_FILTER_ADD, this));
725
		//				workspace.broadcastEvent(LifecycleEvent.newEvent(LifecycleEvent.PRE_FILTER_ADD, this));
731
				workspace.beginOperation(true);
726
		//				workspace.beginOperation(true);
732
				monitor.worked(Policy.opWork * 5 / 100);
727
		//				monitor.worked(Policy.opWork * 5 / 100);
733
				//save the filter in the project description
728
		//save the filter in the project description
734
				filter = new FilterDescription(this, type, matcherDescription);
729
		filter = new FilterDescription(this, type, matcherDescription);
735
				filter.setId(System.currentTimeMillis());
730
		//				filter.setId(System.currentTimeMillis());
736
				
731
737
				Project project = (Project) getProject();
732
		//				Project project = (Project) getProject();
738
				project.internalGetDescription().addFilter(getProjectRelativePath(), filter);
733
		//				project.internalGetDescription().addFilter(getProjectRelativePath(), filter);
739
				project.writeDescription(IResource.NONE);
734
		//				project.writeDescription(IResource.NONE);
740
				monitor.worked(Policy.opWork * 5 / 100);
735
		//				monitor.worked(Policy.opWork * 5 / 100);
741
736
742
				//refresh to discover any new resources below this folder
737
		IMarker filterMarker = createMarker("org.eclipse.core.resources.filtermarker"); //$NON-NLS-1$
743
				if (getType() != IResource.FILE) {
738
		filterMarker.setAttribute("type", new Integer(type)); //$NON-NLS-1$
744
					//refresh either in background or foreground
739
		filterMarker.setAttribute("matcherDescription", matcherDescription); //$NON-NLS-1$
745
					if ((updateFlags & IResource.BACKGROUND_REFRESH) != 0) {
740
		filter.setId(filterMarker.getId());
746
						workspace.refreshManager.refresh(this);
741
747
						monitor.worked(Policy.opWork * 90 / 100);
742
		//refresh to discover any new resources below this folder
748
					} else {
743
						if (getType() != IResource.FILE) {
749
						refreshLocal(DEPTH_INFINITE, Policy.subMonitorFor(monitor, Policy.opWork * 90 / 100));
744
							//refresh either in background or foreground
750
					}
745
							if ((updateFlags & IResource.BACKGROUND_REFRESH) != 0) {
751
				} else
746
								workspace.refreshManager.refresh(this);
752
					monitor.worked(Policy.opWork * 90 / 100);
747
//								monitor.worked(Policy.opWork * 90 / 100);
753
			} catch (OperationCanceledException e) {
748
							} else {
754
				workspace.getWorkManager().operationCanceled();
749
								refreshLocal(DEPTH_INFINITE, null/*Policy.subMonitorFor(monitor, Policy.opWork * 90 / 100)*/);
755
				throw e;
750
							}
756
			} finally {
751
						}
757
				workspace.endOperation(rule, true, Policy.subMonitorFor(monitor, Policy.endOpWork));
752
//						} else
758
			}
753
		//					monitor.worked(Policy.opWork * 90 / 100);
759
		} finally {
754
		//			} catch (OperationCanceledException e) {
760
			monitor.done();
755
							
761
		}
756
		//				workspace.getWorkManager().operationCanceled();
757
		//				throw e;
758
		//			} finally {
759
		//				workspace.endOperation(rule, true, Policy.subMonitorFor(monitor, Policy.endOpWork));
760
		//			}
761
		//		} finally {
762
		//			monitor.done();
763
		//		}
762
		return filter;
764
		return filter;
763
	}
765
	}
764
766
765
	public void removeFilter(IResourceFilterDescription filterDescription, int updateFlags, IProgressMonitor monitor) throws CoreException {
767
	public void removeFilter(IResourceFilterDescription filterDescription, int updateFlags, IProgressMonitor monitor) throws CoreException {
766
		monitor = Policy.monitorFor(monitor);
768
		//		monitor = Policy.monitorFor(monitor);
767
		try {
769
		//		try {
768
			String message = NLS.bind(Messages.links_creating, getFullPath());
770
		//			String message = NLS.bind(Messages.links_creating, getFullPath());
769
			monitor.beginTask(message, Policy.totalWork);
771
		//			monitor.beginTask(message, Policy.totalWork);
770
			Policy.checkCanceled(monitor);
772
		//			Policy.checkCanceled(monitor);
771
			checkValidPath(path, FOLDER | PROJECT, true);
773
		//			checkValidPath(path, FOLDER | PROJECT, true);
772
			final ISchedulingRule rule = workspace.getRuleFactory().createRule(this);
774
		//			final ISchedulingRule rule = workspace.getRuleFactory().createRule(this);
773
			try {
775
		//			try {
774
				workspace.prepareOperation(rule, monitor);
776
		//				workspace.prepareOperation(rule, monitor);
775
				workspace.broadcastEvent(LifecycleEvent.newEvent(LifecycleEvent.PRE_FILTER_REMOVE, this));
777
		//				workspace.broadcastEvent(LifecycleEvent.newEvent(LifecycleEvent.PRE_FILTER_REMOVE, this));
776
				workspace.beginOperation(true);
778
		//				workspace.beginOperation(true);
777
				monitor.worked(Policy.opWork * 5 / 100);
779
		//				monitor.worked(Policy.opWork * 5 / 100);
778
				//save the filter in the project description
780
		//				//save the filter in the project description
779
				Project project = (Project) getProject();
781
		//				Project project = (Project) getProject();
780
				project.internalGetDescription().removeFilter(getProjectRelativePath(), (FilterDescription)filterDescription);
782
		//				project.internalGetDescription().removeFilter(getProjectRelativePath(), (FilterDescription)filterDescription);
781
				project.writeDescription(IResource.NONE);
783
		//				project.writeDescription(IResource.NONE);
782
				monitor.worked(Policy.opWork * 5 / 100);
784
		//				monitor.worked(Policy.opWork * 5 / 100);
783
785
784
				//refresh to discover any new resources below this linked location
786
		IMarker filterMarker = findMarker(((FilterDescription) filterDescription).getId());
785
				if (getType() != IResource.FILE) {
787
		filterMarker.delete();
786
					//refresh either in background or foreground
788
787
					if ((updateFlags & IResource.BACKGROUND_REFRESH) != 0) {
789
		//				//refresh to discover any new resources below this linked location
788
						workspace.refreshManager.refresh(this);
790
						if (getType() != IResource.FILE) {
789
						monitor.worked(Policy.opWork * 90 / 100);
791
							//refresh either in background or foreground
790
					} else {
792
							if ((updateFlags & IResource.BACKGROUND_REFRESH) != 0) {
791
						refreshLocal(DEPTH_INFINITE, Policy.subMonitorFor(monitor, Policy.opWork * 90 / 100));
793
								workspace.refreshManager.refresh(this);
792
					}
794
//								monitor.worked(Policy.opWork * 90 / 100);
793
				} else
795
							} else {
794
					monitor.worked(Policy.opWork * 90 / 100);
796
								refreshLocal(DEPTH_INFINITE, null /*Policy.subMonitorFor(monitor, Policy.opWork * 90 / 100)*/);
795
			} catch (OperationCanceledException e) {
797
							}
796
				workspace.getWorkManager().operationCanceled();
798
						}
797
				throw e;
799
		//				} else
798
			} finally {
800
		//					monitor.worked(Policy.opWork * 90 / 100);
799
				workspace.endOperation(rule, true, Policy.subMonitorFor(monitor, Policy.endOpWork));
801
		//			} catch (OperationCanceledException e) {
800
			}
802
		//				workspace.getWorkManager().operationCanceled();
801
		} finally {
803
		//				throw e;
802
			monitor.done();
804
		//			} finally {
803
		}
805
		//				workspace.endOperation(rule, true, Policy.subMonitorFor(monitor, Policy.endOpWork));
806
		//			}
807
		//		} finally {
808
		//			monitor.done();
809
		//		}
804
	}
810
	}
805
811
806
	/* (non-Javadoc)
812
	/* (non-Javadoc)
807
	 * @see org.eclipse.core.resources.IContainer#getFilters()
813
	 * @see org.eclipse.core.resources.IContainer#getFilters()
808
	 */
814
	 */
809
	public IResourceFilterDescription[] getFilters() throws CoreException {
815
	public IResourceFilterDescription[] getFilters() throws CoreException {
810
		IResourceFilterDescription[] results = null;
816
		IMarker[] filterMarkers = findMarkers("org.eclipse.core.resources.filtermarker", false, IResource.DEPTH_ZERO); //$NON-NLS-1$
811
		checkValidPath(path, FOLDER | PROJECT, true);
817
		
812
		Project project = (Project) getProject();
818
		FilterDescription[] filterDescriptions = new FilterDescription[filterMarkers.length];
813
		ProjectDescription desc = project.internalGetDescription();
819
		
814
		if (desc != null) {
820
		for (int i = 0; i < filterMarkers.length; i++) {
815
			LinkedList/*<FilterDescription>*/ list = desc.getFilter(getProjectRelativePath());
821
			FilterDescription filterDescription = new FilterDescription(this, ((Integer) filterMarkers[i].getAttribute("type")).intValue(), //$NON-NLS-1$
816
			if (list != null) {
822
					(FileInfoMatcherDescription) filterMarkers[i].getAttribute("matcherDescription")); //$NON-NLS-1$
817
				results = new IResourceFilterDescription[list.size()];
823
			filterDescription.setId(filterMarkers[i].getId());
818
				for (int i = 0; i < list.size(); i++) {
824
			filterDescriptions[i] = filterDescription;
819
					results[i] = (FilterDescription) list.get(i);
820
				}
821
				return results;
822
			}
823
		}
825
		}
824
		return new IResourceFilterDescription[0];
826
		
827
		return filterDescriptions;
828
		
829
//		IResourceFilterDescription[] results = null;
830
//		checkValidPath(path, FOLDER | PROJECT, true);
831
//		Project project = (Project) getProject();
832
//		ProjectDescription desc = project.internalGetDescription();
833
//		if (desc != null) {
834
//			LinkedList/*<FilterDescription>*/ list = desc.getFilter(getProjectRelativePath());
835
//			if (list != null) {
836
//				results = new IResourceFilterDescription[list.size()];
837
//				for (int i = 0; i < list.size(); i++) {
838
//					results[i] = (FilterDescription) list.get(i);
839
//				}
840
//				return results;
841
//			}
842
//		}
843
//		return new IResourceFilterDescription[0];
825
	}
844
	}
826
845
827
	/* (non-Javadoc)
846
	/* (non-Javadoc)
Lines 991-1008 Link Here
991
			}
1010
			}
992
		}
1011
		}
993
1012
994
		List filters = findFilters();
1013
//		List filters = findFilters();
995
		if ((filters != null) && (filters.size() > 0)) {
1014
//		if ((filters != null) && (filters.size() > 0)) {
996
			// delete resource filters
1015
//			// delete resource filters
997
			Project project = (Project) getProject();
1016
//			Project project = (Project) getProject();
998
			ProjectDescription description = project.internalGetDescription();
1017
//			ProjectDescription description = project.internalGetDescription();
999
			if (description != null) {
1018
//			if (description != null) {
1000
				for (Iterator it = filters.iterator(); it.hasNext();)
1019
//				for (Iterator it = filters.iterator(); it.hasNext();)
1001
					description.setFilters(((IResource) it.next()).getProjectRelativePath(), null);
1020
//					description.setFilters(((IResource) it.next()).getProjectRelativePath(), null);
1002
				project.internalSetDescription(description, true);
1021
//				project.internalSetDescription(description, true);
1003
				project.writeDescription(IResource.FORCE);
1022
//				project.writeDescription(IResource.FORCE);
1004
			}
1023
//			}
1005
		}
1024
//		}
1006
		
1025
		
1007
		// Delete properties after the resource is deleted from the tree. See bug 84584.
1026
		// Delete properties after the resource is deleted from the tree. See bug 84584.
1008
		CoreException err = null;
1027
		CoreException err = null;
Lines 1046-1071 Link Here
1046
	 * Returns a list of all filtered resources at or below this resource, or null if there
1065
	 * Returns a list of all filtered resources at or below this resource, or null if there
1047
	 * are no links.
1066
	 * are no links.
1048
	 */
1067
	 */
1049
	private List findFilters() {
1068
//	private List findFilters() {
1050
		Project project = (Project) getProject();
1069
//		Project project = (Project) getProject();
1051
		ProjectDescription description = project.internalGetDescription();
1070
//		ProjectDescription description = project.internalGetDescription();
1052
		List filters = null;
1071
//		List filters = null;
1053
		if (description != null) {
1072
//		if (description != null) {
1054
			HashMap filterMap = description.getFilters();
1073
//			HashMap filterMap = description.getFilters();
1055
			if (filterMap != null) {
1074
//			if (filterMap != null) {
1056
				IPath myPath = getProjectRelativePath();
1075
//				IPath myPath = getProjectRelativePath();
1057
				for (Iterator it = filterMap.keySet().iterator(); it.hasNext();) {
1076
//				for (Iterator it = filterMap.keySet().iterator(); it.hasNext();) {
1058
					IPath filterPath = (IPath) it.next();
1077
//					IPath filterPath = (IPath) it.next();
1059
					if (myPath.isPrefixOf(filterPath)) {
1078
//					if (myPath.isPrefixOf(filterPath)) {
1060
						if (filters == null)
1079
//						if (filters == null)
1061
							filters = new ArrayList();
1080
//							filters = new ArrayList();
1062
						filters.add(workspace.newResource(project.getFullPath().append(filterPath), IResource.FOLDER));
1081
//						filters.add(workspace.newResource(project.getFullPath().append(filterPath), IResource.FOLDER));
1063
					}
1082
//					}
1064
				}
1083
//				}
1065
			}
1084
//			}
1066
		}
1085
//		}
1067
		return filters;
1086
//		return filters;
1068
	}
1087
//	}
1069
1088
1070
	/* (non-Javadoc)
1089
	/* (non-Javadoc)
1071
	 * @see IResource#equals(Object)
1090
	 * @see IResource#equals(Object)
Lines 1169-1183 Link Here
1169
				project.writeDescription(IResource.NONE);
1188
				project.writeDescription(IResource.NONE);
1170
		}
1189
		}
1171
1190
1172
		List filters = findFilters();
1191
//		List filters = findFilters();
1173
		if ((filters != null) && (filters.size() > 0)) {
1192
//		if ((filters != null) && (filters.size() > 0)) {
1174
			// delete resource filters
1193
//			// delete resource filters
1175
			Project project = (Project) getProject();
1194
//			Project project = (Project) getProject();
1176
			ProjectDescription description = project.internalGetDescription();
1195
//			ProjectDescription description = project.internalGetDescription();
1177
			for (Iterator it = filters.iterator(); it.hasNext();)
1196
//			for (Iterator it = filters.iterator(); it.hasNext();)
1178
				description.setFilters(((IResource) it.next()).getProjectRelativePath(), null);
1197
//				description.setFilters(((IResource) it.next()).getProjectRelativePath(), null);
1179
			project.writeDescription(IResource.NONE);
1198
//			project.writeDescription(IResource.NONE);
1180
		}
1199
//		}
1181
1200
1182
		// check if we deleted a preferences file 
1201
		// check if we deleted a preferences file 
1183
		ProjectPreferences.deleted(this);
1202
		ProjectPreferences.deleted(this);
Lines 1552-1560 Link Here
1552
		ProjectDescription desc = ((Project) project).internalGetDescription();
1571
		ProjectDescription desc = ((Project) project).internalGetDescription();
1553
		if (desc == null)
1572
		if (desc == null)
1554
			return false;
1573
			return false;
1555
		LinkedList/*<FilterDescription>*/  filters = desc.getFilter(getProjectRelativePath());
1574
		LinkedList filters;
1556
		if ((filters != null) && (filters.size() > 0))
1575
		try {
1557
			return true;
1576
			filters = new LinkedList(Arrays.asList(getFilters())) /*desc.getFilter(getProjectRelativePath())*/;
1577
			if ((filters != null) && (filters.size() > 0))
1578
				return true;
1579
		} catch (CoreException e) {
1580
			// TODO Auto-generated catch block
1581
			e.printStackTrace();
1582
		}
1583
		
1558
		return false;
1584
		return false;
1559
	}
1585
	}
1560
1586
Lines 2182-2188 Link Here
2182
			LinkedList/*<Filter>*/currentExcludeFilters = new LinkedList/*<FilterDescription>*/();
2208
			LinkedList/*<Filter>*/currentExcludeFilters = new LinkedList/*<FilterDescription>*/();
2183
			LinkedList/*<FilterDescription>*/filters = null;
2209
			LinkedList/*<FilterDescription>*/filters = null;
2184
			if (project.internalGetDescription() != null) {
2210
			if (project.internalGetDescription() != null) {
2185
				filters = project.internalGetDescription().getFilter(relativePath);
2211
				try {
2212
					filters = new LinkedList(Arrays.asList(getFilters()));
2213
				} catch (CoreException e) {
2214
					// TODO Auto-generated catch block
2215
					e.printStackTrace();
2216
				}
2217
				
2186
				if (filters != null) {
2218
				if (filters != null) {
2187
					Iterator/*FilterDescription*/it = filters.iterator();
2219
					Iterator/*FilterDescription*/it = filters.iterator();
2188
					while (it.hasNext()) {
2220
					while (it.hasNext()) {
Lines 2204-2210 Link Here
2204
				// verify inherited filters
2236
				// verify inherited filters
2205
				while (relativePath.segmentCount() > 0) {
2237
				while (relativePath.segmentCount() > 0) {
2206
					relativePath = relativePath.removeLastSegments(1);
2238
					relativePath = relativePath.removeLastSegments(1);
2207
					filters = project.internalGetDescription().getFilter(relativePath);
2239
					try {
2240
						filters = new LinkedList(Arrays.asList(getFilters()));
2241
					} catch (CoreException e) {
2242
						// TODO Auto-generated catch block
2243
						e.printStackTrace();
2244
					}
2208
					if (filters != null) {
2245
					if (filters != null) {
2209
						Iterator/*FilterDescription*/it = filters.iterator();
2246
						Iterator/*FilterDescription*/it = filters.iterator();
2210
						while (it.hasNext()) {
2247
						while (it.hasNext()) {
(-)src/org/eclipse/core/internal/resources/ResourceTree.java (-1 / +1 lines)
Lines 695-701 Link Here
695
				//moving linked resources may have modified the description in memory
695
				//moving linked resources may have modified the description in memory
696
				((ProjectDescription) destDescription).setLinkDescriptions(destination.internalGetDescription().getLinks());
696
				((ProjectDescription) destDescription).setLinkDescriptions(destination.internalGetDescription().getLinks());
697
				// moving filters may have modified the description in memory
697
				// moving filters may have modified the description in memory
698
				((ProjectDescription) destDescription).setFilterDescriptions(destination.internalGetDescription().getFilters());
698
//				((ProjectDescription) destDescription).setFilterDescriptions(destination.internalGetDescription().getFilters());
699
				// moving variables may have modified the description in memory
699
				// moving variables may have modified the description in memory
700
				((ProjectDescription) destDescription).setVariableDescriptions(destination.internalGetDescription().getVariables());
700
				((ProjectDescription) destDescription).setVariableDescriptions(destination.internalGetDescription().getVariables());
701
				destination.internalSetDescription(destDescription, true);
701
				destination.internalSetDescription(destDescription, true);
(-)src/org/eclipse/core/internal/resources/Workspace.java (-14 / +14 lines)
Lines 776-795 Link Here
776
		}
776
		}
777
777
778
		// update filters in project descriptions
778
		// update filters in project descriptions
779
		if (source.hasFilters() && source.getProject().exists()) {
779
//		if (source.hasFilters() && source.getProject().exists()) {
780
			Project sourceProject = (Project) source.getProject();
780
//			Project sourceProject = (Project) source.getProject();
781
			LinkedList/*<FilterDescription>*/ originalDescriptions = sourceProject.internalGetDescription().getFilter(source.getProjectRelativePath());
781
//			LinkedList/*<FilterDescription>*/ originalDescriptions = sourceProject.internalGetDescription().getFilter(source.getProjectRelativePath());
782
			LinkedList/*<FilterDescription>*/ filterDescriptions = FilterDescription.copy(originalDescriptions, destinationResource);
782
//			LinkedList/*<FilterDescription>*/ filterDescriptions = FilterDescription.copy(originalDescriptions, destinationResource);
783
			if (moveResources && !movingProject) {
783
//			if (moveResources && !movingProject) {
784
				if (((Project) source.getProject())
784
//				if (((Project) source.getProject())
785
						.internalGetDescription()
785
//						.internalGetDescription()
786
						.setFilters(source.getProjectRelativePath(), null))
786
//						.setFilters(source.getProjectRelativePath(), null))
787
					((Project) source.getProject()).writeDescription(updateFlags);
787
//					((Project) source.getProject()).writeDescription(updateFlags);
788
			}
788
//			}
789
			Project project = (Project) destinationResource.getProject();
789
//			Project project = (Project) destinationResource.getProject();
790
			project.internalGetDescription().setFilters(destinationResource.getProjectRelativePath(), filterDescriptions);
790
//			project.internalGetDescription().setFilters(destinationResource.getProjectRelativePath(), filterDescriptions);
791
			project.writeDescription(updateFlags);
791
//			project.writeDescription(updateFlags);
792
		}
792
//		}
793
793
794
		// do the recursion. if we have a file then it has no members so return. otherwise
794
		// do the recursion. if we have a file then it has no members so return. otherwise
795
		// recursively call this method on the container's members if the depth tells us to
795
		// recursively call this method on the container's members if the depth tells us to

Return to bug 298100