mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Bug 133881 - Make refreshing after building optional
Work in progress.
This commit is contained in:
parent
60487e7a57
commit
4cb96045d3
10 changed files with 359 additions and 102 deletions
|
@ -5,9 +5,12 @@ Bundle-SymbolicName: org.eclipse.cdt.core.tests; singleton:=true
|
|||
Bundle-Version: 5.3.0.qualifier
|
||||
Bundle-Activator: org.eclipse.cdt.core.testplugin.CTestPlugin
|
||||
Export-Package: org.eclipse.cdt.core.cdescriptor.tests,
|
||||
org.eclipse.cdt.core.envvar,
|
||||
org.eclipse.cdt.core.internal.efsextension.tests,
|
||||
org.eclipse.cdt.core.internal.errorparsers.tests;x-internal:=true,
|
||||
org.eclipse.cdt.core.internal.index.provider.test;x-internal:=true,
|
||||
org.eclipse.cdt.core.internal.tests;x-internal:=true,
|
||||
org.eclipse.cdt.core.internal.tests.filesystem.ram,
|
||||
org.eclipse.cdt.core.language,
|
||||
org.eclipse.cdt.core.model.tests,
|
||||
org.eclipse.cdt.core.parser.tests,
|
||||
|
@ -22,6 +25,7 @@ Export-Package: org.eclipse.cdt.core.cdescriptor.tests,
|
|||
org.eclipse.cdt.core.parser.tests.rewrite.changegenerator.replace,
|
||||
org.eclipse.cdt.core.parser.tests.rewrite.comenthandler,
|
||||
org.eclipse.cdt.core.parser.tests.scanner,
|
||||
org.eclipse.cdt.core.resources.tests,
|
||||
org.eclipse.cdt.core.settings.model,
|
||||
org.eclipse.cdt.core.suite,
|
||||
org.eclipse.cdt.core.testplugin,
|
||||
|
@ -30,7 +34,8 @@ Export-Package: org.eclipse.cdt.core.cdescriptor.tests,
|
|||
org.eclipse.cdt.core.tests.templateengine,
|
||||
org.eclipse.cdt.core.winreg.tests,
|
||||
org.eclipse.cdt.internal.index.tests;x-internal:=true,
|
||||
org.eclipse.cdt.internal.pdom.tests;x-internal:=true
|
||||
org.eclipse.cdt.internal.pdom.tests;x-internal:=true,
|
||||
org.eclipse.cdt.utils
|
||||
Require-Bundle: org.eclipse.core.resources,
|
||||
org.eclipse.cdt.core,
|
||||
org.junit,
|
||||
|
|
|
@ -16,6 +16,8 @@ import java.util.List;
|
|||
import junit.framework.TestCase;
|
||||
|
||||
import org.eclipse.cdt.core.CProjectNature;
|
||||
import org.eclipse.cdt.core.resources.ExclusionInstance;
|
||||
import org.eclipse.cdt.core.resources.ExclusionType;
|
||||
import org.eclipse.cdt.core.resources.RefreshExclusion;
|
||||
import org.eclipse.cdt.core.resources.RefreshScopeManager;
|
||||
import org.eclipse.cdt.core.testplugin.CTestPlugin;
|
||||
|
@ -154,22 +156,6 @@ public class RefreshScopeTests extends TestCase {
|
|||
|
||||
}
|
||||
|
||||
public class TestExclusion extends RefreshExclusion {
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "TestExclusion";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testExclusion(IResource resource) {
|
||||
// if the resource name ends in a 2, then we pass
|
||||
String name = resource.getName();
|
||||
return name.endsWith("2");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void testAddRemoveExclusion() {
|
||||
RefreshScopeManager manager = RefreshScopeManager.getInstance();
|
||||
manager.addResourceToRefresh(fProject, fProject);
|
||||
|
@ -199,5 +185,84 @@ public class RefreshScopeTests extends TestCase {
|
|||
|
||||
}
|
||||
|
||||
public void testPersistAndLoad() {
|
||||
RefreshScopeManager manager = RefreshScopeManager.getInstance();
|
||||
manager.addResourceToRefresh(fProject, fProject);
|
||||
|
||||
RefreshExclusion exclusion1 = new TestExclusion();
|
||||
manager.addExclusion(fProject, exclusion1);
|
||||
RefreshExclusion exclusion2 = new TestExclusion();
|
||||
manager.addExclusion(fProject, exclusion2);
|
||||
|
||||
// add a nested exclusion to the first exclusion
|
||||
RefreshExclusion exclusion3 = new TestExclusion();
|
||||
exclusion1.addNestedExclusion(exclusion3);
|
||||
|
||||
// add an instance to the second exclusion
|
||||
ExclusionInstance instance = new ExclusionInstance();
|
||||
instance.setDisplayString("foo");
|
||||
instance.setResource(fFolder2);
|
||||
instance.setExclusionType(ExclusionType.RESOURCE);
|
||||
instance.setParentExclusion(exclusion2);
|
||||
|
||||
try {
|
||||
manager.persistSettings();
|
||||
} catch (CoreException e) {
|
||||
fail();
|
||||
}
|
||||
|
||||
// now clear all the settings out of the manager
|
||||
manager.clearAllData();
|
||||
|
||||
// now load the settings
|
||||
try {
|
||||
manager.loadSettings();
|
||||
} catch (CoreException e) {
|
||||
fail();
|
||||
}
|
||||
|
||||
// make sure we got the same stuff we saved
|
||||
|
||||
// the project should be set to refresh its root
|
||||
List<IResource> resources = manager.getResourcesToRefresh(fProject);
|
||||
assertEquals(resources.size(), 1);
|
||||
assertEquals(resources.toArray(new IResource[0])[0], fProject);
|
||||
|
||||
// there should be 2 top-level exclusions
|
||||
List<RefreshExclusion> exclusions = manager.getExclusions(fProject);
|
||||
assertEquals(exclusions.size(), 2);
|
||||
RefreshExclusion[] exclusionsArray = exclusions.toArray(new RefreshExclusion[0]);
|
||||
|
||||
// both exclusions should have parent resource set to the project
|
||||
assertEquals(exclusionsArray[0].getParentResource(), fProject);
|
||||
assertEquals(exclusionsArray[1].getParentResource(), fProject);
|
||||
|
||||
// the first exclusion should have one nested exclusion
|
||||
List<RefreshExclusion> nestedExclusions1 = exclusionsArray[0].getNestedExclusions();
|
||||
assertEquals(nestedExclusions1.size(), 1);
|
||||
RefreshExclusion[] nestedExclusionsArray = nestedExclusions1.toArray(new RefreshExclusion[0]);
|
||||
// the nested exclusion should have its parent exclusion set properly
|
||||
assertEquals(nestedExclusionsArray[0].getParentExclusion(), exclusionsArray[0]);
|
||||
|
||||
// the second exclusion should have no nested exclusions
|
||||
List<RefreshExclusion> nestedExclusions2 = exclusionsArray[1].getNestedExclusions();
|
||||
assertEquals(nestedExclusions2.size(), 0);
|
||||
|
||||
// the second exclusion should have an instance
|
||||
List<ExclusionInstance> instances = exclusionsArray[1].getExclusionInstances();
|
||||
assertEquals(instances.size(), 1);
|
||||
ExclusionInstance[] instancesArray = instances.toArray(new ExclusionInstance[0]);
|
||||
ExclusionInstance loadedInstance = instancesArray[0];
|
||||
|
||||
// check the contents of the instance
|
||||
assertEquals(exclusionsArray[1], loadedInstance.getParentExclusion());
|
||||
assertEquals("foo", loadedInstance.getDisplayString());
|
||||
assertEquals(fFolder2, loadedInstance.getResource());
|
||||
assertEquals(ExclusionType.RESOURCE, loadedInstance.getExclusionType());
|
||||
|
||||
// cleanup
|
||||
manager.clearAllData();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
package org.eclipse.cdt.core.resources.tests;
|
||||
|
||||
import org.eclipse.cdt.core.resources.RefreshExclusion;
|
||||
import org.eclipse.core.resources.IResource;
|
||||
|
||||
public class TestExclusion extends RefreshExclusion {
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "TestExclusion";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testExclusion(IResource resource) {
|
||||
// if the resource name ends in a 2, then we pass
|
||||
String name = resource.getName();
|
||||
return name.endsWith("2");
|
||||
}
|
||||
|
||||
}
|
|
@ -21,6 +21,7 @@ public class Messages extends NLS {
|
|||
public static String RefreshScopeManager_0;
|
||||
public static String RefreshScopeManager_1;
|
||||
public static String RefreshScopeManager_2;
|
||||
public static String RefreshScopeManager_3;
|
||||
static {
|
||||
// initialize resource bundle
|
||||
NLS.initializeMessages(BUNDLE_NAME, Messages.class);
|
||||
|
|
|
@ -16,6 +16,7 @@ import java.util.LinkedList;
|
|||
import java.util.List;
|
||||
|
||||
import org.eclipse.core.resources.IResource;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.Node;
|
||||
|
@ -51,12 +52,12 @@ public abstract class RefreshExclusion {
|
|||
|
||||
protected List<ExclusionInstance> fExclusionInstanceList = new LinkedList<ExclusionInstance>();
|
||||
protected List<RefreshExclusion> fNestedExclusions = new LinkedList<RefreshExclusion>();
|
||||
protected ExclusionType fExclusionType;
|
||||
protected ExclusionType fExclusionType = ExclusionType.RESOURCE;
|
||||
protected RefreshExclusion fParentExclusion;
|
||||
protected IResource fParentResource;
|
||||
|
||||
|
||||
protected String fContributorId;
|
||||
protected String fContributorId = ""; //$NON-NLS-1$
|
||||
|
||||
/**
|
||||
* If this exclusion is a direct descendant of a resource, returns that resource.
|
||||
|
@ -232,97 +233,107 @@ public abstract class RefreshExclusion {
|
|||
}
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
public static RefreshExclusion loadData(Element exclusionElement, RefreshExclusion parent) {
|
||||
public static List<RefreshExclusion> loadData(Element parentElement, RefreshExclusion parent) throws CoreException {
|
||||
|
||||
List<RefreshExclusion> exclusions = new LinkedList<RefreshExclusion>();
|
||||
|
||||
// the parent element might contain any number of exclusions... iterate through the list
|
||||
NodeList exclusionsList = parentElement.getElementsByTagName(EXCLUSION_ELEMENT_NAME);
|
||||
|
||||
// create an object of the proper type using zero-argument constructor
|
||||
RefreshExclusion newExclusion = null;
|
||||
String classname = exclusionElement.getAttribute(CLASS_ATTRIBUTE_NAME);
|
||||
Class extensionClass;
|
||||
try {
|
||||
extensionClass = Class.forName(classname);
|
||||
|
||||
Class[] parameterTypes = new Class[0];
|
||||
Constructor constructor = extensionClass.getConstructor(parameterTypes);
|
||||
newExclusion = (RefreshExclusion) constructor.newInstance((Object[]) null);
|
||||
} catch (Exception e) {
|
||||
// error
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
|
||||
// load the exclusion type
|
||||
String exclusionTypeString = exclusionElement.getAttribute(EXCLUSION_TYPE_ATTRIBUTE_NAME);
|
||||
if (exclusionTypeString != null) {
|
||||
if (exclusionTypeString.equals(FILE_VALUE)) {
|
||||
newExclusion.fExclusionType = org.eclipse.cdt.core.resources.ExclusionType.FILE;
|
||||
}
|
||||
|
||||
else if (exclusionTypeString.equals(FOLDER_VALUE)) {
|
||||
newExclusion.fExclusionType = org.eclipse.cdt.core.resources.ExclusionType.FOLDER;
|
||||
}
|
||||
|
||||
else if (exclusionTypeString.equals(RESOURCE_VALUE)) {
|
||||
newExclusion.fExclusionType = org.eclipse.cdt.core.resources.ExclusionType.RESOURCE;
|
||||
}
|
||||
|
||||
else {
|
||||
// error
|
||||
}
|
||||
}
|
||||
|
||||
// set parent
|
||||
newExclusion.fParentExclusion = parent;
|
||||
|
||||
newExclusion.fContributorId = exclusionElement.getAttribute(CONTRIBUTOR_ID_ATTRIBUTE_NAME);
|
||||
|
||||
// get the extension element
|
||||
NodeList extensionList = exclusionElement.getElementsByTagName(EXTENSION_DATA_ELEMENT_NAME);
|
||||
|
||||
for(int k = 0; k < extensionList.getLength(); k++) {
|
||||
Node node = extensionList.item(k);
|
||||
// the node will be an Element
|
||||
if(node instanceof Element) {
|
||||
Element extensionElement = (Element) node;
|
||||
|
||||
// load the extension's data
|
||||
newExclusion.loadExtendedData(extensionElement);
|
||||
}
|
||||
}
|
||||
|
||||
// load instances
|
||||
NodeList instanceList = exclusionElement.getElementsByTagName(INSTANCE_ELEMENT_NAME);
|
||||
|
||||
for(int k = 0; k < instanceList.getLength(); k++) {
|
||||
Node node = instanceList.item(k);
|
||||
for(int i = 0; i < exclusionsList.getLength(); i++) {
|
||||
Node node = exclusionsList.item(i);
|
||||
|
||||
// the node will be an element
|
||||
// node should be an element
|
||||
if(node instanceof Element) {
|
||||
Element instanceElement = (Element) node;
|
||||
Element exclusionElement = (Element) node;
|
||||
// create an object of the proper type using zero-argument constructor
|
||||
RefreshExclusion newExclusion = null;
|
||||
String classname = exclusionElement.getAttribute(CLASS_ATTRIBUTE_NAME);
|
||||
Class extensionClass;
|
||||
try {
|
||||
extensionClass = Class.forName(classname);
|
||||
|
||||
Class[] parameterTypes = new Class[0];
|
||||
Constructor constructor = extensionClass.getConstructor(parameterTypes);
|
||||
newExclusion = (RefreshExclusion) constructor.newInstance((Object[]) null);
|
||||
} catch (Exception e) {
|
||||
// error
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
|
||||
// load the exclusion type
|
||||
String exclusionTypeString = exclusionElement.getAttribute(EXCLUSION_TYPE_ATTRIBUTE_NAME);
|
||||
if (exclusionTypeString != null) {
|
||||
if (exclusionTypeString.equals(FILE_VALUE)) {
|
||||
newExclusion.fExclusionType = org.eclipse.cdt.core.resources.ExclusionType.FILE;
|
||||
}
|
||||
|
||||
else if (exclusionTypeString.equals(FOLDER_VALUE)) {
|
||||
newExclusion.fExclusionType = org.eclipse.cdt.core.resources.ExclusionType.FOLDER;
|
||||
}
|
||||
|
||||
else if (exclusionTypeString.equals(RESOURCE_VALUE)) {
|
||||
newExclusion.fExclusionType = org.eclipse.cdt.core.resources.ExclusionType.RESOURCE;
|
||||
}
|
||||
|
||||
else {
|
||||
// error
|
||||
}
|
||||
}
|
||||
|
||||
// set parent
|
||||
newExclusion.fParentExclusion = parent;
|
||||
|
||||
newExclusion.fContributorId = exclusionElement.getAttribute(CONTRIBUTOR_ID_ATTRIBUTE_NAME);
|
||||
|
||||
// get the extension element
|
||||
NodeList extensionList = exclusionElement.getElementsByTagName(EXTENSION_DATA_ELEMENT_NAME);
|
||||
|
||||
for(int k = 0; k < extensionList.getLength(); k++) {
|
||||
Node node1 = extensionList.item(k);
|
||||
// the node will be an Element
|
||||
if(node1 instanceof Element) {
|
||||
Element extensionElement = (Element) node1;
|
||||
|
||||
// load the extension's data
|
||||
newExclusion.loadExtendedData(extensionElement);
|
||||
}
|
||||
}
|
||||
|
||||
// load instances
|
||||
NodeList instanceList = exclusionElement.getElementsByTagName(INSTANCE_ELEMENT_NAME);
|
||||
|
||||
for(int k = 0; k < instanceList.getLength(); k++) {
|
||||
Node node1 = instanceList.item(k);
|
||||
|
||||
// the node will be an element
|
||||
if(node1 instanceof Element) {
|
||||
Element instanceElement = (Element) node1;
|
||||
|
||||
// load the instance data
|
||||
ExclusionInstance instance = ExclusionInstance.loadInstanceData(instanceElement);
|
||||
newExclusion.fExclusionInstanceList.add(instance);
|
||||
}
|
||||
}
|
||||
|
||||
// load nested exclusions
|
||||
List<RefreshExclusion> nestedExclusions = loadData(exclusionElement, newExclusion);
|
||||
|
||||
// add to parent
|
||||
for(RefreshExclusion nestedExclusion : nestedExclusions) {
|
||||
newExclusion.addNestedExclusion(nestedExclusion);
|
||||
}
|
||||
|
||||
// add the new exclusion to the list of exclusions to return
|
||||
exclusions.add(newExclusion);
|
||||
|
||||
// load the instance data
|
||||
ExclusionInstance instance = ExclusionInstance.loadInstanceData(instanceElement);
|
||||
newExclusion.fExclusionInstanceList.add(instance);
|
||||
}
|
||||
}
|
||||
|
||||
// load nested exclusions
|
||||
NodeList nestedExclusionsList = exclusionElement.getElementsByTagName(EXCLUSION_ELEMENT_NAME);
|
||||
|
||||
for(int k = 0; k < nestedExclusionsList.getLength(); k++) {
|
||||
Node node = nestedExclusionsList.item(k);
|
||||
|
||||
// the node will be an element
|
||||
if(node instanceof Element) {
|
||||
Element nestedExclusionElement = (Element) node;
|
||||
|
||||
// load the nested exclusion
|
||||
RefreshExclusion nestedExclusion = loadData(nestedExclusionElement, newExclusion);
|
||||
newExclusion.addNestedExclusion(nestedExclusion);
|
||||
}
|
||||
}
|
||||
|
||||
return newExclusion;
|
||||
return exclusions;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -10,7 +10,11 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.cdt.core.resources;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.StringReader;
|
||||
import java.io.StringWriter;
|
||||
import java.text.MessageFormat;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.LinkedList;
|
||||
|
@ -27,12 +31,19 @@ import javax.xml.transform.dom.DOMSource;
|
|||
import javax.xml.transform.stream.StreamResult;
|
||||
|
||||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
import org.eclipse.cdt.core.CProjectNature;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.resources.IResource;
|
||||
import org.eclipse.core.resources.IWorkspaceRoot;
|
||||
import org.eclipse.core.resources.ResourcesPlugin;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.QualifiedName;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.Node;
|
||||
import org.w3c.dom.NodeList;
|
||||
import org.xml.sax.InputSource;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
/**
|
||||
* The RefreshScopeManager provides access to settings pertaining to refreshes performed during
|
||||
|
@ -139,6 +150,15 @@ public class RefreshScopeManager {
|
|||
resourceSet.clear();
|
||||
|
||||
}
|
||||
|
||||
public void clearAllResourcesToRefresh() {
|
||||
fProjectToResourcesMap.clear();
|
||||
}
|
||||
|
||||
public void clearAllData() {
|
||||
clearAllResourcesToRefresh();
|
||||
clearAllExclusions();
|
||||
}
|
||||
|
||||
private HashMap<IProject, LinkedHashSet<IResource>> getProjectToResourcesMap() {
|
||||
if(fProjectToResourcesMap == null) {
|
||||
|
@ -251,8 +271,101 @@ public class RefreshScopeManager {
|
|||
}
|
||||
}
|
||||
|
||||
public void loadSettings() {
|
||||
public void loadSettings() throws CoreException {
|
||||
// iterate through all projects in the workspace. If they are C projects, attempt to load settings from them.
|
||||
IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot();
|
||||
|
||||
for(IProject project : workspaceRoot.getProjects()) {
|
||||
if(project.isOpen()) {
|
||||
if(project.hasNature(CProjectNature.C_NATURE_ID)) {
|
||||
String xmlString = project.getPersistentProperty(REFRESH_SCOPE_PROPERTY_NAME);
|
||||
|
||||
// if there are no settings, then configure the default behaviour of refreshing the entire project,
|
||||
// with no exclusions
|
||||
if (xmlString == null) {
|
||||
addResourceToRefresh(project, project);
|
||||
}
|
||||
|
||||
else {
|
||||
// convert the XML string to a DOM model
|
||||
|
||||
DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
|
||||
DocumentBuilder docBuilder = null;
|
||||
try {
|
||||
docBuilder = docBuilderFactory.newDocumentBuilder();
|
||||
} catch (ParserConfigurationException e) {
|
||||
throw new CoreException(CCorePlugin.createStatus(Messages.RefreshScopeManager_0, e));
|
||||
}
|
||||
|
||||
Document doc = null;
|
||||
|
||||
try {
|
||||
doc = docBuilder.parse(new InputSource(new StringReader(xmlString)));
|
||||
} catch (SAXException e) {
|
||||
throw new CoreException(CCorePlugin.createStatus(MessageFormat.format(Messages.RefreshScopeManager_3, project.getName()), e));
|
||||
} catch (IOException e) {
|
||||
throw new CoreException(CCorePlugin.createStatus(MessageFormat.format(Messages.RefreshScopeManager_3, project.getName()), e));
|
||||
}
|
||||
|
||||
// walk the DOM and load the settings
|
||||
|
||||
// for now ignore the version attribute, as we only have version 1 at this time
|
||||
|
||||
// iterate through the resource element nodes
|
||||
NodeList nodeList = doc.getElementsByTagName(RESOURCE_ELEMENT_NAME);
|
||||
|
||||
for(int k = 0; k < nodeList.getLength(); k++) {
|
||||
Node node = nodeList.item(k);
|
||||
|
||||
// node will be an element
|
||||
if(node instanceof Element) {
|
||||
Element resourceElement = (Element) node;
|
||||
|
||||
// get the resource path
|
||||
String resourcePath = resourceElement.getAttribute(WORKSPACE_PATH_ATTRIBUTE_NAME);
|
||||
|
||||
if(resourcePath == null) {
|
||||
// error
|
||||
|
||||
}
|
||||
|
||||
else {
|
||||
// find the resource
|
||||
IResource resource = workspaceRoot.findMember(resourcePath);
|
||||
|
||||
if(resource == null) {
|
||||
// error
|
||||
}
|
||||
|
||||
else {
|
||||
addResourceToRefresh(project, resource);
|
||||
|
||||
// load any exclusions
|
||||
List<RefreshExclusion> exclusions = RefreshExclusion.loadData(resourceElement, null);
|
||||
|
||||
// add them
|
||||
for(RefreshExclusion exclusion : exclusions) {
|
||||
addExclusion(resource, exclusion);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void clearExclusions(IResource resource) {
|
||||
getResourcesToExclusionsMap();
|
||||
List<RefreshExclusion> exclusions = fResourceToExclusionsMap.get(resource);
|
||||
exclusions.clear();
|
||||
}
|
||||
|
||||
public void clearAllExclusions() {
|
||||
fResourceToExclusionsMap.clear();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -11,3 +11,5 @@
|
|||
RefreshScopeManager_0=Error instantiating XML document builder.
|
||||
RefreshScopeManager_1=Error instantiating XML transformer.
|
||||
RefreshScopeManager_2=Error transforming XML.
|
||||
RefreshScopeManager_3=Error parsing refresh settings from project {0}
|
||||
|
||||
|
|
|
@ -78,6 +78,13 @@
|
|||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
<attribute name="isTest" type="boolean">
|
||||
<annotation>
|
||||
<documentation>
|
||||
Attribute indicating this contribution is for testing purposes and hence the given contributor should not be considered for contributions to the UI.
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
</complexType>
|
||||
</element>
|
||||
|
||||
|
|
|
@ -68,6 +68,11 @@ public class RefreshExclusionContributionManager {
|
|||
String id = configElement.getAttribute("id"); //$NON-NLS-1$
|
||||
String name = configElement.getAttribute("name"); //$NON-NLS-1$
|
||||
String utility = configElement.getAttribute("class"); //$NON-NLS-1$
|
||||
boolean isTest = false;
|
||||
String isTestString = configElement.getAttribute("isTest");
|
||||
if(isTestString != null) {
|
||||
isTest = Boolean.getBoolean(isTestString);
|
||||
}
|
||||
|
||||
if (utility != null) {
|
||||
try {
|
||||
|
@ -76,6 +81,7 @@ public class RefreshExclusionContributionManager {
|
|||
RefreshExclusionContributor exclusionContributor = (RefreshExclusionContributor) execExt;
|
||||
exclusionContributor.setID(id);
|
||||
exclusionContributor.setName(name);
|
||||
exclusionContributor.setIsTest(isTest);
|
||||
fIDtoContributorsMap.put(id, exclusionContributor);
|
||||
|
||||
}
|
||||
|
@ -94,6 +100,24 @@ public class RefreshExclusionContributionManager {
|
|||
}
|
||||
|
||||
public List<RefreshExclusionContributor> getContributors() {
|
||||
return new LinkedList<RefreshExclusionContributor>(fIDtoContributorsMap.values());
|
||||
return getContributors(false);
|
||||
}
|
||||
|
||||
public List<RefreshExclusionContributor> getContributors(boolean returnTestContributors) {
|
||||
List<RefreshExclusionContributor> retVal = new LinkedList<RefreshExclusionContributor>();
|
||||
|
||||
if(!returnTestContributors) {
|
||||
for(RefreshExclusionContributor contributor : fIDtoContributorsMap.values()) {
|
||||
if(!contributor.isTest()) {
|
||||
retVal.add(contributor);
|
||||
}
|
||||
}
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
else {
|
||||
return new LinkedList<RefreshExclusionContributor>(fIDtoContributorsMap.values());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,6 +29,7 @@ public abstract class RefreshExclusionContributor {
|
|||
|
||||
protected String fID;
|
||||
protected String fName;
|
||||
protected boolean fIsTest;
|
||||
|
||||
public String getID() {
|
||||
return fID;
|
||||
|
@ -38,6 +39,14 @@ public abstract class RefreshExclusionContributor {
|
|||
fID = id;
|
||||
}
|
||||
|
||||
public boolean isTest() {
|
||||
return fIsTest;
|
||||
}
|
||||
|
||||
public void setIsTest(boolean isTest) {
|
||||
fIsTest = isTest;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the human-readable name of this exclusion type.
|
||||
*
|
||||
|
|
Loading…
Add table
Reference in a new issue