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 154680 Details for
Bug 298100
[Filters] Resource Filters could use Markers to keep filter descriptions
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Proposal v01 (dirty)
298100_20091217.txt (text/plain), 31.67 KB, created by
Szymon Brandys
on 2009-12-17 12:35:22 EST
(
hide
)
Description:
Proposal v01 (dirty)
Filename:
MIME Type:
Creator:
Szymon Brandys
Created:
2009-12-17 12:35:22 EST
Size:
31.67 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.core.resources >Index: plugin.xml >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.core.resources/plugin.xml,v >retrieving revision 1.84 >diff -u -r1.84 plugin.xml >--- plugin.xml 18 Nov 2009 21:54:05 -0000 1.84 >+++ plugin.xml 17 Dec 2009 17:37:54 -0000 >@@ -211,4 +211,21 @@ > </run> > </filesystem> > </extension> >+ <extension >+ id="filtermarker" >+ name="Filter Marker" >+ point="org.eclipse.core.resources.markers"> >+ <super >+ type="org.eclipse.core.resources.marker"> >+ </super> >+ <persistent >+ value="false"> >+ </persistent> >+ <attribute >+ name="type"> >+ </attribute> >+ <attribute >+ name="matcherDescription"> >+ </attribute> >+ </extension> > </plugin> >Index: src/org/eclipse/core/internal/localstore/CopyVisitor.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.core.resources/src/org/eclipse/core/internal/localstore/CopyVisitor.java,v >retrieving revision 1.48 >diff -u -r1.48 CopyVisitor.java >--- src/org/eclipse/core/internal/localstore/CopyVisitor.java 2 Dec 2009 09:38:32 -0000 1.48 >+++ src/org/eclipse/core/internal/localstore/CopyVisitor.java 17 Dec 2009 17:37:54 -0000 >@@ -11,7 +11,6 @@ > *******************************************************************************/ > package org.eclipse.core.internal.localstore; > >-import java.util.LinkedList; > import org.eclipse.core.filesystem.EFS; > import org.eclipse.core.filesystem.IFileStore; > import org.eclipse.core.internal.resources.*; >@@ -81,14 +80,14 @@ > return false; > } > // update filters in project descriptions >- if (source.hasFilters()) { >- Project sourceProject = (Project) source.getProject(); >- LinkedList/*<FilterDescription>*/originalDescriptions = sourceProject.internalGetDescription().getFilter(source.getProjectRelativePath()); >- LinkedList/*<FilterDescription>*/filterDescriptions = FilterDescription.copy(originalDescriptions, destination); >- Project project = (Project) destination.getProject(); >- project.internalGetDescription().setFilters(destination.getProjectRelativePath(), filterDescriptions); >- project.writeDescription(updateFlags); >- } >+// if (source.hasFilters()) { >+// Project sourceProject = (Project) source.getProject(); >+// LinkedList/*<FilterDescription>*/originalDescriptions = sourceProject.internalGetDescription().getFilter(source.getProjectRelativePath()); >+// LinkedList/*<FilterDescription>*/filterDescriptions = FilterDescription.copy(originalDescriptions, destination); >+// Project project = (Project) destination.getProject(); >+// project.internalGetDescription().setFilters(destination.getProjectRelativePath(), filterDescriptions); >+// project.writeDescription(updateFlags); >+// } > > IFileStore sourceStore = node.getStore(); > IFileStore destinationStore = destination.getStore(); >Index: src/org/eclipse/core/internal/resources/FilterTypeManager.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/FilterTypeManager.java,v >retrieving revision 1.4 >diff -u -r1.4 FilterTypeManager.java >--- src/org/eclipse/core/internal/resources/FilterTypeManager.java 18 Nov 2009 21:54:05 -0000 1.4 >+++ src/org/eclipse/core/internal/resources/FilterTypeManager.java 17 Dec 2009 17:37:54 -0000 >@@ -12,8 +12,7 @@ > package org.eclipse.core.internal.resources; > > import java.util.HashMap; >-import org.eclipse.core.resources.IFilterMatcherDescriptor; >-import org.eclipse.core.resources.ResourcesPlugin; >+import org.eclipse.core.resources.*; > import org.eclipse.core.resources.filtermatchers.AbstractFileInfoMatcher; > import org.eclipse.core.runtime.*; > >@@ -102,5 +101,23 @@ > > public void startup(IProgressMonitor monitor) { > //nothing to do >+ >+// ResourcesPlugin.getWorkspace().addResourceChangeListener(new IResourceChangeListener() { >+// public void resourceChanged(IResourceChangeEvent event) { >+// IMarkerDelta[] mDelta = event.getDelta().getMarkerDeltas(); >+// if (mDelta.length != 0) { >+// if (mDelta[0].getKind() == IResourceDelta.ADDED) { >+// try { >+// ((ProjectDescription) mDelta[0].getResource().getProject().getDescription()).addFilterDescription(new FilterDescription(mDelta[0].getResource(), ((Integer) mDelta[0].getAttribute("type")).intValue(), //$NON-NLS-1$ >+// (FileInfoMatcherDescription) mDelta[0].getAttribute("matcherDescription"))); //$NON-NLS-1$ >+// ((Project)mDelta[0].getResource().getProject()).writeDescription(IResource.NONE); >+// } catch (CoreException e) { >+// // TODO Auto-generated catch block >+// e.printStackTrace(); >+// } >+// } >+// } >+// } >+// }, IResourceChangeEvent.POST_CHANGE); > } > } >Index: src/org/eclipse/core/internal/resources/ModelObjectWriter.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/ModelObjectWriter.java,v >retrieving revision 1.35 >diff -u -r1.35 ModelObjectWriter.java >--- src/org/eclipse/core/internal/resources/ModelObjectWriter.java 2 Dec 2009 09:38:32 -0000 1.35 >+++ src/org/eclipse/core/internal/resources/ModelObjectWriter.java 17 Dec 2009 17:37:54 -0000 >@@ -219,16 +219,17 @@ > Collections.sort(sorted); > write(LINKED_RESOURCES, sorted, writer); > } >- HashMap filters = description.getFilters(); >- if (filters != null) { >- List sorted = new ArrayList(); >- for (Iterator it = filters.values().iterator(); it.hasNext();) { >- List list = (List) it.next(); >- sorted.addAll(list); >- } >- Collections.sort(sorted); >- write(FILTERED_RESOURCES, sorted, writer); >- } >+ >+// HashMap filters = description.getFilters(); >+// if (filters != null) { >+// List sorted = new ArrayList(); >+// for (Iterator it = filters.values().iterator(); it.hasNext();) { >+// List list = (List) it.next(); >+// sorted.addAll(list); >+// } >+// Collections.sort(sorted); >+// write(FILTERED_RESOURCES, sorted, writer); >+// } > HashMap variables = description.getVariables(); > if (variables != null) { > List sorted = new ArrayList(variables.values()); >Index: src/org/eclipse/core/internal/resources/ProjectDescription.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/ProjectDescription.java,v >retrieving revision 1.44 >diff -u -r1.44 ProjectDescription.java >--- src/org/eclipse/core/internal/resources/ProjectDescription.java 5 Oct 2009 21:40:29 -0000 1.44 >+++ src/org/eclipse/core/internal/resources/ProjectDescription.java 17 Dec 2009 17:37:54 -0000 >@@ -181,11 +181,11 @@ > * Returns the filter for the given resource name. Returns null if > * no such filter exists. > */ >- synchronized public LinkedList/*<FilterDescription>*/ getFilter(IPath aPath) { >- if (filterDescriptions == null) >- return null; >- return (LinkedList /*<FilterDescription> */) filterDescriptions.get(aPath); >- } >+// synchronized public LinkedList/*<FilterDescription>*/ getFilter(IPath aPath) { >+// if (filterDescriptions == null) >+// return null; >+// return (LinkedList /*<FilterDescription> */) filterDescriptions.get(aPath); >+// } > > /** > * Returns the map of link descriptions (IPath (project relative path) -> LinkDescription). >@@ -201,9 +201,9 @@ > * Since this method is only used internally, it never creates a copy. > * Returns null if the project does not have any filtered resources. > */ >- public HashMap getFilters() { >- return filterDescriptions; >- } >+// public HashMap getFilters() { >+// return filterDescriptions; >+// } > > /** > * Returns the map of variable descriptions (String (variable name) -> >@@ -300,11 +300,11 @@ > if (!Arrays.equals(natures, description.getNatureIds(false))) > return true; > >- HashMap otherFilters = description.getFilters(); >- if ((filterDescriptions == null) && (otherFilters != null)) >- return otherFilters != null; >- if ((filterDescriptions != null) && !filterDescriptions.equals(otherFilters)) >- return true; >+// HashMap otherFilters = description.getFilters(); >+// if ((filterDescriptions == null) && (otherFilters != null)) >+// return otherFilters != null; >+// if ((filterDescriptions != null) && !filterDescriptions.equals(otherFilters)) >+// return true; > > HashMap otherVariables = description.getVariables(); > if ((variableDescriptions == null) && (otherVariables != null)) >@@ -431,35 +431,45 @@ > * Add the description of a filter. Setting to a description of null will > * remove the filter from the project description. > */ >- synchronized public void addFilter(IPath path, FilterDescription description) { >- Assert.isNotNull(description); >- if (filterDescriptions == null) >- filterDescriptions = new HashMap(10); >- LinkedList/*<FilterDescription>*/ descList = (LinkedList /*<FilterDescription> */) filterDescriptions.get(path); >- if (descList == null) { >- descList = new LinkedList/*<FilterDescription>*/(); >- filterDescriptions.put(path, descList); >- } >+// synchronized public void addFilter(IPath path, FilterDescription description) { >+// Assert.isNotNull(description); >+// if (filterDescriptions == null) >+// filterDescriptions = new HashMap(10); >+// LinkedList/*<FilterDescription>*/ descList = (LinkedList /*<FilterDescription> */) filterDescriptions.get(path); >+// if (descList == null) { >+// descList = new LinkedList/*<FilterDescription>*/(); >+// filterDescriptions.put(path, descList); >+// } >+// descList.add(description); >+// } >+ >+ LinkedList descList = new LinkedList(); >+ >+ public void addFilterDescription(FilterDescription description) { > descList.add(description); > } > >+ public void removeFilterDescription(FilterDescription description) { >+ descList.remove(description); >+ } >+ > /** > * Add the description of a filter. Setting to a description of null will > * remove the filter from the project description. > */ >- synchronized public void removeFilter(IPath path, FilterDescription description) { >- if (filterDescriptions != null) { >- LinkedList/*<FilterDescription>*/ descList = (LinkedList /*<FilterDescription> */) filterDescriptions.get(path); >- if (descList != null) { >- descList.remove(description); >- if (descList.size() == 0) { >- filterDescriptions.remove(path); >- if (filterDescriptions.size() == 0) >- filterDescriptions = null; >- } >- } >- } >- } >+// synchronized public void removeFilter(IPath path, FilterDescription description) { >+// if (filterDescriptions != null) { >+// LinkedList/*<FilterDescription>*/ descList = (LinkedList /*<FilterDescription> */) filterDescriptions.get(path); >+// if (descList != null) { >+// descList.remove(description); >+// if (descList.size() == 0) { >+// filterDescriptions.remove(path); >+// if (filterDescriptions.size() == 0) >+// filterDescriptions = null; >+// } >+// } >+// } >+// } > > /** > * Sets the description of a variable. Setting to a description of null will >Index: src/org/eclipse/core/internal/resources/Resource.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/Resource.java,v >retrieving revision 1.178 >diff -u -r1.178 Resource.java >--- src/org/eclipse/core/internal/resources/Resource.java 9 Dec 2009 15:38:03 -0000 1.178 >+++ src/org/eclipse/core/internal/resources/Resource.java 17 Dec 2009 17:37:55 -0000 >@@ -17,12 +17,7 @@ > *******************************************************************************/ > package org.eclipse.core.internal.resources; > >-import org.eclipse.core.resources.IFile; >-import org.eclipse.core.runtime.IProgressMonitor; >- >-import org.eclipse.core.internal.utils.Messages; >-import org.eclipse.core.internal.utils.Policy; >-import org.eclipse.core.runtime.OperationCanceledException; >+import org.eclipse.core.runtime.CoreException; > > import java.net.URI; > import java.net.URISyntaxException; >@@ -716,112 +711,136 @@ > * @see IContainer#createFilter(int, IFileInfoMatcherDescription, int, IProgressMonitor) > */ > public IResourceFilterDescription createFilter(int type, IFileInfoMatcherDescription matcherDescription, int updateFlags, IProgressMonitor monitor) throws CoreException { >- Assert.isNotNull(getProject()); >- monitor = Policy.monitorFor(monitor); >+ // Assert.isNotNull(getProject()); >+ // monitor = Policy.monitorFor(monitor); > FilterDescription filter = null; >- try { >- String message = NLS.bind(Messages.links_creating, getFullPath()); >- monitor.beginTask(message, Policy.totalWork); >- Policy.checkCanceled(monitor); >- checkValidPath(path, FOLDER | PROJECT, true); >- final ISchedulingRule rule = workspace.getRuleFactory().createRule(this); >- try { >- workspace.prepareOperation(rule, monitor); >- workspace.broadcastEvent(LifecycleEvent.newEvent(LifecycleEvent.PRE_FILTER_ADD, this)); >- workspace.beginOperation(true); >- monitor.worked(Policy.opWork * 5 / 100); >- //save the filter in the project description >- filter = new FilterDescription(this, type, matcherDescription); >- filter.setId(System.currentTimeMillis()); >- >- Project project = (Project) getProject(); >- project.internalGetDescription().addFilter(getProjectRelativePath(), filter); >- project.writeDescription(IResource.NONE); >- monitor.worked(Policy.opWork * 5 / 100); >- >- //refresh to discover any new resources below this folder >- if (getType() != IResource.FILE) { >- //refresh either in background or foreground >- if ((updateFlags & IResource.BACKGROUND_REFRESH) != 0) { >- workspace.refreshManager.refresh(this); >- monitor.worked(Policy.opWork * 90 / 100); >- } else { >- refreshLocal(DEPTH_INFINITE, Policy.subMonitorFor(monitor, Policy.opWork * 90 / 100)); >- } >- } else >- monitor.worked(Policy.opWork * 90 / 100); >- } catch (OperationCanceledException e) { >- workspace.getWorkManager().operationCanceled(); >- throw e; >- } finally { >- workspace.endOperation(rule, true, Policy.subMonitorFor(monitor, Policy.endOpWork)); >- } >- } finally { >- monitor.done(); >- } >+ // try { >+ // String message = NLS.bind(Messages.links_creating, getFullPath()); >+ // monitor.beginTask(message, Policy.totalWork); >+ // Policy.checkCanceled(monitor); >+ // checkValidPath(path, FOLDER | PROJECT, true); >+ // final ISchedulingRule rule = workspace.getRuleFactory().createRule(this); >+ // try { >+ // workspace.prepareOperation(rule, monitor); >+ // workspace.broadcastEvent(LifecycleEvent.newEvent(LifecycleEvent.PRE_FILTER_ADD, this)); >+ // workspace.beginOperation(true); >+ // monitor.worked(Policy.opWork * 5 / 100); >+ //save the filter in the project description >+ filter = new FilterDescription(this, type, matcherDescription); >+ // filter.setId(System.currentTimeMillis()); >+ >+ // Project project = (Project) getProject(); >+ // project.internalGetDescription().addFilter(getProjectRelativePath(), filter); >+ // project.writeDescription(IResource.NONE); >+ // monitor.worked(Policy.opWork * 5 / 100); >+ >+ IMarker filterMarker = createMarker("org.eclipse.core.resources.filtermarker"); //$NON-NLS-1$ >+ filterMarker.setAttribute("type", new Integer(type)); //$NON-NLS-1$ >+ filterMarker.setAttribute("matcherDescription", matcherDescription); //$NON-NLS-1$ >+ filter.setId(filterMarker.getId()); >+ >+ //refresh to discover any new resources below this folder >+ if (getType() != IResource.FILE) { >+ //refresh either in background or foreground >+ if ((updateFlags & IResource.BACKGROUND_REFRESH) != 0) { >+ workspace.refreshManager.refresh(this); >+// monitor.worked(Policy.opWork * 90 / 100); >+ } else { >+ refreshLocal(DEPTH_INFINITE, null/*Policy.subMonitorFor(monitor, Policy.opWork * 90 / 100)*/); >+ } >+ } >+// } else >+ // monitor.worked(Policy.opWork * 90 / 100); >+ // } catch (OperationCanceledException e) { >+ >+ // workspace.getWorkManager().operationCanceled(); >+ // throw e; >+ // } finally { >+ // workspace.endOperation(rule, true, Policy.subMonitorFor(monitor, Policy.endOpWork)); >+ // } >+ // } finally { >+ // monitor.done(); >+ // } > return filter; > } > > public void removeFilter(IResourceFilterDescription filterDescription, int updateFlags, IProgressMonitor monitor) throws CoreException { >- monitor = Policy.monitorFor(monitor); >- try { >- String message = NLS.bind(Messages.links_creating, getFullPath()); >- monitor.beginTask(message, Policy.totalWork); >- Policy.checkCanceled(monitor); >- checkValidPath(path, FOLDER | PROJECT, true); >- final ISchedulingRule rule = workspace.getRuleFactory().createRule(this); >- try { >- workspace.prepareOperation(rule, monitor); >- workspace.broadcastEvent(LifecycleEvent.newEvent(LifecycleEvent.PRE_FILTER_REMOVE, this)); >- workspace.beginOperation(true); >- monitor.worked(Policy.opWork * 5 / 100); >- //save the filter in the project description >- Project project = (Project) getProject(); >- project.internalGetDescription().removeFilter(getProjectRelativePath(), (FilterDescription)filterDescription); >- project.writeDescription(IResource.NONE); >- monitor.worked(Policy.opWork * 5 / 100); >- >- //refresh to discover any new resources below this linked location >- if (getType() != IResource.FILE) { >- //refresh either in background or foreground >- if ((updateFlags & IResource.BACKGROUND_REFRESH) != 0) { >- workspace.refreshManager.refresh(this); >- monitor.worked(Policy.opWork * 90 / 100); >- } else { >- refreshLocal(DEPTH_INFINITE, Policy.subMonitorFor(monitor, Policy.opWork * 90 / 100)); >- } >- } else >- monitor.worked(Policy.opWork * 90 / 100); >- } catch (OperationCanceledException e) { >- workspace.getWorkManager().operationCanceled(); >- throw e; >- } finally { >- workspace.endOperation(rule, true, Policy.subMonitorFor(monitor, Policy.endOpWork)); >- } >- } finally { >- monitor.done(); >- } >+ // monitor = Policy.monitorFor(monitor); >+ // try { >+ // String message = NLS.bind(Messages.links_creating, getFullPath()); >+ // monitor.beginTask(message, Policy.totalWork); >+ // Policy.checkCanceled(monitor); >+ // checkValidPath(path, FOLDER | PROJECT, true); >+ // final ISchedulingRule rule = workspace.getRuleFactory().createRule(this); >+ // try { >+ // workspace.prepareOperation(rule, monitor); >+ // workspace.broadcastEvent(LifecycleEvent.newEvent(LifecycleEvent.PRE_FILTER_REMOVE, this)); >+ // workspace.beginOperation(true); >+ // monitor.worked(Policy.opWork * 5 / 100); >+ // //save the filter in the project description >+ // Project project = (Project) getProject(); >+ // project.internalGetDescription().removeFilter(getProjectRelativePath(), (FilterDescription)filterDescription); >+ // project.writeDescription(IResource.NONE); >+ // monitor.worked(Policy.opWork * 5 / 100); >+ >+ IMarker filterMarker = findMarker(((FilterDescription) filterDescription).getId()); >+ filterMarker.delete(); >+ >+ // //refresh to discover any new resources below this linked location >+ if (getType() != IResource.FILE) { >+ //refresh either in background or foreground >+ if ((updateFlags & IResource.BACKGROUND_REFRESH) != 0) { >+ workspace.refreshManager.refresh(this); >+// monitor.worked(Policy.opWork * 90 / 100); >+ } else { >+ refreshLocal(DEPTH_INFINITE, null /*Policy.subMonitorFor(monitor, Policy.opWork * 90 / 100)*/); >+ } >+ } >+ // } else >+ // monitor.worked(Policy.opWork * 90 / 100); >+ // } catch (OperationCanceledException e) { >+ // workspace.getWorkManager().operationCanceled(); >+ // throw e; >+ // } finally { >+ // workspace.endOperation(rule, true, Policy.subMonitorFor(monitor, Policy.endOpWork)); >+ // } >+ // } finally { >+ // monitor.done(); >+ // } > } > > /* (non-Javadoc) > * @see org.eclipse.core.resources.IContainer#getFilters() > */ > public IResourceFilterDescription[] getFilters() throws CoreException { >- IResourceFilterDescription[] results = null; >- checkValidPath(path, FOLDER | PROJECT, true); >- Project project = (Project) getProject(); >- ProjectDescription desc = project.internalGetDescription(); >- if (desc != null) { >- LinkedList/*<FilterDescription>*/ list = desc.getFilter(getProjectRelativePath()); >- if (list != null) { >- results = new IResourceFilterDescription[list.size()]; >- for (int i = 0; i < list.size(); i++) { >- results[i] = (FilterDescription) list.get(i); >- } >- return results; >- } >+ IMarker[] filterMarkers = findMarkers("org.eclipse.core.resources.filtermarker", false, IResource.DEPTH_ZERO); //$NON-NLS-1$ >+ >+ FilterDescription[] filterDescriptions = new FilterDescription[filterMarkers.length]; >+ >+ for (int i = 0; i < filterMarkers.length; i++) { >+ FilterDescription filterDescription = new FilterDescription(this, ((Integer) filterMarkers[i].getAttribute("type")).intValue(), //$NON-NLS-1$ >+ (FileInfoMatcherDescription) filterMarkers[i].getAttribute("matcherDescription")); //$NON-NLS-1$ >+ filterDescription.setId(filterMarkers[i].getId()); >+ filterDescriptions[i] = filterDescription; > } >- return new IResourceFilterDescription[0]; >+ >+ return filterDescriptions; >+ >+// IResourceFilterDescription[] results = null; >+// checkValidPath(path, FOLDER | PROJECT, true); >+// Project project = (Project) getProject(); >+// ProjectDescription desc = project.internalGetDescription(); >+// if (desc != null) { >+// LinkedList/*<FilterDescription>*/ list = desc.getFilter(getProjectRelativePath()); >+// if (list != null) { >+// results = new IResourceFilterDescription[list.size()]; >+// for (int i = 0; i < list.size(); i++) { >+// results[i] = (FilterDescription) list.get(i); >+// } >+// return results; >+// } >+// } >+// return new IResourceFilterDescription[0]; > } > > /* (non-Javadoc) >@@ -991,18 +1010,18 @@ > } > } > >- List filters = findFilters(); >- if ((filters != null) && (filters.size() > 0)) { >- // delete resource filters >- Project project = (Project) getProject(); >- ProjectDescription description = project.internalGetDescription(); >- if (description != null) { >- for (Iterator it = filters.iterator(); it.hasNext();) >- description.setFilters(((IResource) it.next()).getProjectRelativePath(), null); >- project.internalSetDescription(description, true); >- project.writeDescription(IResource.FORCE); >- } >- } >+// List filters = findFilters(); >+// if ((filters != null) && (filters.size() > 0)) { >+// // delete resource filters >+// Project project = (Project) getProject(); >+// ProjectDescription description = project.internalGetDescription(); >+// if (description != null) { >+// for (Iterator it = filters.iterator(); it.hasNext();) >+// description.setFilters(((IResource) it.next()).getProjectRelativePath(), null); >+// project.internalSetDescription(description, true); >+// project.writeDescription(IResource.FORCE); >+// } >+// } > > // Delete properties after the resource is deleted from the tree. See bug 84584. > CoreException err = null; >@@ -1046,26 +1065,26 @@ > * Returns a list of all filtered resources at or below this resource, or null if there > * are no links. > */ >- private List findFilters() { >- Project project = (Project) getProject(); >- ProjectDescription description = project.internalGetDescription(); >- List filters = null; >- if (description != null) { >- HashMap filterMap = description.getFilters(); >- if (filterMap != null) { >- IPath myPath = getProjectRelativePath(); >- for (Iterator it = filterMap.keySet().iterator(); it.hasNext();) { >- IPath filterPath = (IPath) it.next(); >- if (myPath.isPrefixOf(filterPath)) { >- if (filters == null) >- filters = new ArrayList(); >- filters.add(workspace.newResource(project.getFullPath().append(filterPath), IResource.FOLDER)); >- } >- } >- } >- } >- return filters; >- } >+// private List findFilters() { >+// Project project = (Project) getProject(); >+// ProjectDescription description = project.internalGetDescription(); >+// List filters = null; >+// if (description != null) { >+// HashMap filterMap = description.getFilters(); >+// if (filterMap != null) { >+// IPath myPath = getProjectRelativePath(); >+// for (Iterator it = filterMap.keySet().iterator(); it.hasNext();) { >+// IPath filterPath = (IPath) it.next(); >+// if (myPath.isPrefixOf(filterPath)) { >+// if (filters == null) >+// filters = new ArrayList(); >+// filters.add(workspace.newResource(project.getFullPath().append(filterPath), IResource.FOLDER)); >+// } >+// } >+// } >+// } >+// return filters; >+// } > > /* (non-Javadoc) > * @see IResource#equals(Object) >@@ -1169,15 +1188,15 @@ > project.writeDescription(IResource.NONE); > } > >- List filters = findFilters(); >- if ((filters != null) && (filters.size() > 0)) { >- // delete resource filters >- Project project = (Project) getProject(); >- ProjectDescription description = project.internalGetDescription(); >- for (Iterator it = filters.iterator(); it.hasNext();) >- description.setFilters(((IResource) it.next()).getProjectRelativePath(), null); >- project.writeDescription(IResource.NONE); >- } >+// List filters = findFilters(); >+// if ((filters != null) && (filters.size() > 0)) { >+// // delete resource filters >+// Project project = (Project) getProject(); >+// ProjectDescription description = project.internalGetDescription(); >+// for (Iterator it = filters.iterator(); it.hasNext();) >+// description.setFilters(((IResource) it.next()).getProjectRelativePath(), null); >+// project.writeDescription(IResource.NONE); >+// } > > // check if we deleted a preferences file > ProjectPreferences.deleted(this); >@@ -1552,9 +1571,16 @@ > ProjectDescription desc = ((Project) project).internalGetDescription(); > if (desc == null) > return false; >- LinkedList/*<FilterDescription>*/ filters = desc.getFilter(getProjectRelativePath()); >- if ((filters != null) && (filters.size() > 0)) >- return true; >+ LinkedList filters; >+ try { >+ filters = new LinkedList(Arrays.asList(getFilters())) /*desc.getFilter(getProjectRelativePath())*/; >+ if ((filters != null) && (filters.size() > 0)) >+ return true; >+ } catch (CoreException e) { >+ // TODO Auto-generated catch block >+ e.printStackTrace(); >+ } >+ > return false; > } > >@@ -2182,7 +2208,13 @@ > LinkedList/*<Filter>*/currentExcludeFilters = new LinkedList/*<FilterDescription>*/(); > LinkedList/*<FilterDescription>*/filters = null; > if (project.internalGetDescription() != null) { >- filters = project.internalGetDescription().getFilter(relativePath); >+ try { >+ filters = new LinkedList(Arrays.asList(getFilters())); >+ } catch (CoreException e) { >+ // TODO Auto-generated catch block >+ e.printStackTrace(); >+ } >+ > if (filters != null) { > Iterator/*FilterDescription*/it = filters.iterator(); > while (it.hasNext()) { >@@ -2204,7 +2236,12 @@ > // verify inherited filters > while (relativePath.segmentCount() > 0) { > relativePath = relativePath.removeLastSegments(1); >- filters = project.internalGetDescription().getFilter(relativePath); >+ try { >+ filters = new LinkedList(Arrays.asList(getFilters())); >+ } catch (CoreException e) { >+ // TODO Auto-generated catch block >+ e.printStackTrace(); >+ } > if (filters != null) { > Iterator/*FilterDescription*/it = filters.iterator(); > while (it.hasNext()) { >Index: src/org/eclipse/core/internal/resources/ResourceTree.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/ResourceTree.java,v >retrieving revision 1.78 >diff -u -r1.78 ResourceTree.java >--- src/org/eclipse/core/internal/resources/ResourceTree.java 5 Oct 2009 21:39:46 -0000 1.78 >+++ src/org/eclipse/core/internal/resources/ResourceTree.java 17 Dec 2009 17:37:55 -0000 >@@ -695,7 +695,7 @@ > //moving linked resources may have modified the description in memory > ((ProjectDescription) destDescription).setLinkDescriptions(destination.internalGetDescription().getLinks()); > // moving filters may have modified the description in memory >- ((ProjectDescription) destDescription).setFilterDescriptions(destination.internalGetDescription().getFilters()); >+// ((ProjectDescription) destDescription).setFilterDescriptions(destination.internalGetDescription().getFilters()); > // moving variables may have modified the description in memory > ((ProjectDescription) destDescription).setVariableDescriptions(destination.internalGetDescription().getVariables()); > destination.internalSetDescription(destDescription, true); >Index: src/org/eclipse/core/internal/resources/Workspace.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/Workspace.java,v >retrieving revision 1.225 >diff -u -r1.225 Workspace.java >--- src/org/eclipse/core/internal/resources/Workspace.java 2 Dec 2009 09:38:32 -0000 1.225 >+++ src/org/eclipse/core/internal/resources/Workspace.java 17 Dec 2009 17:37:56 -0000 >@@ -776,20 +776,20 @@ > } > > // update filters in project descriptions >- if (source.hasFilters() && source.getProject().exists()) { >- Project sourceProject = (Project) source.getProject(); >- LinkedList/*<FilterDescription>*/ originalDescriptions = sourceProject.internalGetDescription().getFilter(source.getProjectRelativePath()); >- LinkedList/*<FilterDescription>*/ filterDescriptions = FilterDescription.copy(originalDescriptions, destinationResource); >- if (moveResources && !movingProject) { >- if (((Project) source.getProject()) >- .internalGetDescription() >- .setFilters(source.getProjectRelativePath(), null)) >- ((Project) source.getProject()).writeDescription(updateFlags); >- } >- Project project = (Project) destinationResource.getProject(); >- project.internalGetDescription().setFilters(destinationResource.getProjectRelativePath(), filterDescriptions); >- project.writeDescription(updateFlags); >- } >+// if (source.hasFilters() && source.getProject().exists()) { >+// Project sourceProject = (Project) source.getProject(); >+// LinkedList/*<FilterDescription>*/ originalDescriptions = sourceProject.internalGetDescription().getFilter(source.getProjectRelativePath()); >+// LinkedList/*<FilterDescription>*/ filterDescriptions = FilterDescription.copy(originalDescriptions, destinationResource); >+// if (moveResources && !movingProject) { >+// if (((Project) source.getProject()) >+// .internalGetDescription() >+// .setFilters(source.getProjectRelativePath(), null)) >+// ((Project) source.getProject()).writeDescription(updateFlags); >+// } >+// Project project = (Project) destinationResource.getProject(); >+// project.internalGetDescription().setFilters(destinationResource.getProjectRelativePath(), filterDescriptions); >+// project.writeDescription(updateFlags); >+// } > > // do the recursion. if we have a file then it has no members so return. otherwise > // recursively call this method on the container's members if the depth tells us to
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 298100
: 154680