1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-08 16:55:38 +02:00

Bug 133881 - Make refreshing after building optional

Work in progress.
This commit is contained in:
Chris Recoskie 2011-04-05 20:03:54 +00:00
parent d803a052f5
commit 1c69515ad4
3 changed files with 55 additions and 20 deletions

View file

@ -47,9 +47,26 @@ public class ExclusionInstance {
public static final String FILE_VALUE = "FILE"; //$NON-NLS-1$
public static final String DISPLAY_STRING_ATTRIBUTE_NAME = "displayString"; //$NON-NLS-1$
private ExclusionType fInstanceExclusionType;
private IResource fResource;
private String fDisplayString;
protected ExclusionType fInstanceExclusionType;
protected IResource fResource;
protected String fDisplayString;
protected RefreshExclusion fParent;
/**
* Returns the parent exclusion of this exclusion instance.
*
* @return RefreshExclusion
*/
public RefreshExclusion getParentExclusion() {
return fParent;
}
/**
* @param parent the RefreshExclusion to set as the parent.
*/
public void setParentExclusion(RefreshExclusion parent) {
fParent = parent;
}
public ExclusionType getExclusionType() {
return fInstanceExclusionType;

View file

@ -52,9 +52,31 @@ public abstract class RefreshExclusion {
protected List<ExclusionInstance> fExclusionInstanceList = new LinkedList<ExclusionInstance>();
protected List<RefreshExclusion> fNestedExclusions = new LinkedList<RefreshExclusion>();
protected ExclusionType fExclusionType;
protected RefreshExclusion fParent;
protected RefreshExclusion fParentExclusion;
protected IResource fParentResource;
protected String fContributorId;
/**
* If this exclusion is a direct descendant of a resource, returns that resource.
* Otherwise, returns null;
*
* @return IResource
*/
public IResource getParentResource() {
return fParentResource;
}
/**
* Sets the parent resource of this exclusion.
*
* @param parentResource the parent resource to set
*/
public void setParentResource(IResource parentResource) {
this.fParentResource = parentResource;
}
/**
* @return a String corresponding to the ID of the RefreshExclusionContributor that was used to create
* this exclusion.
@ -72,12 +94,12 @@ public abstract class RefreshExclusion {
*
* @return RefreshExclusion
*/
public RefreshExclusion getParent() {
return fParent;
public RefreshExclusion getParentExclusion() {
return fParentExclusion;
}
public void setParent(RefreshExclusion parent) {
fParent = parent;
public void setParentExclusion(RefreshExclusion parent) {
fParentExclusion = parent;
}
public ExclusionType getExclusionType() {
@ -114,6 +136,7 @@ public abstract class RefreshExclusion {
* @param exclusionInstance
*/
public void addExclusionInstance(ExclusionInstance exclusionInstance) {
exclusionInstance.setParentExclusion(this);
fExclusionInstanceList.add(exclusionInstance);
}
@ -136,7 +159,7 @@ public abstract class RefreshExclusion {
public void addNestedExclusion(RefreshExclusion exclusion) {
fNestedExclusions.add(exclusion);
exclusion.setParent(this);
exclusion.setParentExclusion(this);
}
/**
@ -249,7 +272,7 @@ public abstract class RefreshExclusion {
}
// set parent
newExclusion.fParent = parent;
newExclusion.fParentExclusion = parent;
newExclusion.fContributorId = exclusionElement.getAttribute(CONTRIBUTOR_ID_ATTRIBUTE_NAME);

View file

@ -11,15 +11,14 @@
package org.eclipse.cdt.core.resources;
import java.io.StringWriter;
import java.util.Collections;
import java.util.LinkedHashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;
import java.util.TreeMap;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.OutputKeys;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerConfigurationException;
import javax.xml.transform.TransformerException;
@ -64,7 +63,7 @@ public class RefreshScopeManager {
}
private TreeMap<IProject, Set<IResource>> fProjectToResourcesMap;
private TreeMap<IProject, LinkedHashSet<IResource>> fProjectToResourcesMap;
private TreeMap<IResource, List<RefreshExclusion>> fResourceToExclusionsMap;
private static RefreshScopeManager fInstance;
@ -89,12 +88,8 @@ public class RefreshScopeManager {
* @param project
* @return Set<IResource>
*/
public Set<IResource> getResourcesToRefresh(IProject project) {
Set<IResource> retval = fProjectToResourcesMap.get(project);
if(retval == null) {
return Collections.emptySet();
}
public List<IResource> getResourcesToRefresh(IProject project) {
List<IResource> retval = new LinkedList<IResource>(fProjectToResourcesMap.get(project));
return retval;
}