mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-08 02:06:01 +02:00
Bug 133881 - Make refreshing after building optional
- serialize/deserialize to/from C project description - fix stack overflow issue on load - move ResourceExclusion and friends to internal packages
This commit is contained in:
parent
2fab85bf17
commit
b609ec68ba
14 changed files with 275 additions and 331 deletions
|
@ -161,7 +161,7 @@ public class RefreshPolicyTab extends AbstractCPropertyTab {
|
||||||
|
|
||||||
public Object[] getChildren() {
|
public Object[] getChildren() {
|
||||||
if (isExclusion()) {
|
if (isExclusion()) {
|
||||||
List children = new ArrayList(exclusion_instances);
|
List<Object> children = new ArrayList<Object>(exclusion_instances);
|
||||||
if (exceptions_node != null)
|
if (exceptions_node != null)
|
||||||
children.add(exceptions_node);
|
children.add(exceptions_node);
|
||||||
return children.toArray();
|
return children.toArray();
|
||||||
|
@ -603,7 +603,7 @@ public class RefreshPolicyTab extends AbstractCPropertyTab {
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
fManager.persistSettings();
|
fManager.persistSettings(getResDesc().getConfiguration().getProjectDescription());
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
// TODO Auto-generated catch block
|
// TODO Auto-generated catch block
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|
|
@ -19,16 +19,19 @@ import junit.framework.Test;
|
||||||
import junit.framework.TestCase;
|
import junit.framework.TestCase;
|
||||||
import junit.framework.TestSuite;
|
import junit.framework.TestSuite;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.CProjectNature;
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
|
import org.eclipse.cdt.core.dom.IPDOMManager;
|
||||||
|
import org.eclipse.cdt.core.model.ICProject;
|
||||||
import org.eclipse.cdt.core.resources.ExclusionInstance;
|
import org.eclipse.cdt.core.resources.ExclusionInstance;
|
||||||
import org.eclipse.cdt.core.resources.ExclusionType;
|
import org.eclipse.cdt.core.resources.ExclusionType;
|
||||||
import org.eclipse.cdt.core.resources.RefreshExclusion;
|
import org.eclipse.cdt.core.resources.RefreshExclusion;
|
||||||
import org.eclipse.cdt.core.resources.RefreshScopeManager;
|
import org.eclipse.cdt.core.resources.RefreshScopeManager;
|
||||||
import org.eclipse.cdt.core.resources.ResourceExclusion;
|
import org.eclipse.cdt.core.settings.model.ICProjectDescription;
|
||||||
|
import org.eclipse.cdt.core.testplugin.CProjectHelper;
|
||||||
import org.eclipse.cdt.core.testplugin.CTestPlugin;
|
import org.eclipse.cdt.core.testplugin.CTestPlugin;
|
||||||
|
import org.eclipse.cdt.internal.core.resources.ResourceExclusion;
|
||||||
import org.eclipse.core.resources.IFolder;
|
import org.eclipse.core.resources.IFolder;
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
import org.eclipse.core.resources.IProjectDescription;
|
|
||||||
import org.eclipse.core.resources.IResource;
|
import org.eclipse.core.resources.IResource;
|
||||||
import org.eclipse.core.resources.IWorkspaceRoot;
|
import org.eclipse.core.resources.IWorkspaceRoot;
|
||||||
import org.eclipse.core.resources.IWorkspaceRunnable;
|
import org.eclipse.core.resources.IWorkspaceRunnable;
|
||||||
|
@ -60,20 +63,8 @@ public class RefreshScopeTests extends TestCase {
|
||||||
// create project
|
// create project
|
||||||
CTestPlugin.getWorkspace().run(new IWorkspaceRunnable() {
|
CTestPlugin.getWorkspace().run(new IWorkspaceRunnable() {
|
||||||
public void run(IProgressMonitor monitor) throws CoreException {
|
public void run(IProgressMonitor monitor) throws CoreException {
|
||||||
IWorkspaceRoot root = CTestPlugin.getWorkspace().getRoot();
|
ICProject cProject = CProjectHelper.createNewStileCProject("testRefreshScope", IPDOMManager.ID_NO_INDEXER, false);
|
||||||
IProject project = root.getProject("testRefreshScope");
|
fProject = cProject.getProject();
|
||||||
if (!project.exists()) {
|
|
||||||
project.create(null);
|
|
||||||
} else {
|
|
||||||
project.refreshLocal(IResource.DEPTH_INFINITE, null);
|
|
||||||
}
|
|
||||||
if (!project.isOpen()) {
|
|
||||||
project.open(null);
|
|
||||||
}
|
|
||||||
if (!project.hasNature(CProjectNature.C_NATURE_ID)) {
|
|
||||||
addNatureToProject(project, CProjectNature.C_NATURE_ID, null);
|
|
||||||
}
|
|
||||||
fProject = project;
|
|
||||||
}
|
}
|
||||||
}, null);
|
}, null);
|
||||||
|
|
||||||
|
@ -120,16 +111,6 @@ public class RefreshScopeTests extends TestCase {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void addNatureToProject(IProject proj, String natureId, IProgressMonitor monitor) throws CoreException {
|
|
||||||
IProjectDescription description = proj.getDescription();
|
|
||||||
String[] prevNatures = description.getNatureIds();
|
|
||||||
String[] newNatures = new String[prevNatures.length + 1];
|
|
||||||
System.arraycopy(prevNatures, 0, newNatures, 0, prevNatures.length);
|
|
||||||
newNatures[prevNatures.length] = natureId;
|
|
||||||
description.setNatureIds(newNatures);
|
|
||||||
proj.setDescription(description, monitor);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see junit.framework.TestCase#tearDown()
|
* @see junit.framework.TestCase#tearDown()
|
||||||
*/
|
*/
|
||||||
|
@ -248,8 +229,11 @@ public class RefreshScopeTests extends TestCase {
|
||||||
instance.setParentExclusion(exclusion2);
|
instance.setParentExclusion(exclusion2);
|
||||||
exclusion2.addExclusionInstance(instance);
|
exclusion2.addExclusionInstance(instance);
|
||||||
|
|
||||||
|
ICProjectDescription projectDescription = CCorePlugin.getDefault().getProjectDescription(fProject, true);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
manager.persistSettings();
|
manager.persistSettings(projectDescription);
|
||||||
|
CCorePlugin.getDefault().setProjectDescription(fProject, projectDescription);
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
fail();
|
fail();
|
||||||
}
|
}
|
||||||
|
@ -273,7 +257,7 @@ public class RefreshScopeTests extends TestCase {
|
||||||
|
|
||||||
// there should be 2 top-level exclusions
|
// there should be 2 top-level exclusions
|
||||||
List<RefreshExclusion> exclusions = manager.getExclusions(fProject);
|
List<RefreshExclusion> exclusions = manager.getExclusions(fProject);
|
||||||
assertEquals(exclusions.size(), 2);
|
assertEquals(2, exclusions.size());
|
||||||
RefreshExclusion[] exclusionsArray = exclusions.toArray(new RefreshExclusion[0]);
|
RefreshExclusion[] exclusionsArray = exclusions.toArray(new RefreshExclusion[0]);
|
||||||
|
|
||||||
// both exclusions should have parent resource set to the project
|
// both exclusions should have parent resource set to the project
|
||||||
|
@ -434,9 +418,11 @@ public class RefreshScopeTests extends TestCase {
|
||||||
List<RefreshExclusion> exclusions = manager.getExclusions(fProject);
|
List<RefreshExclusion> exclusions = manager.getExclusions(fProject);
|
||||||
assertEquals(0, exclusions.size());
|
assertEquals(0, exclusions.size());
|
||||||
|
|
||||||
|
ICProjectDescription projectDescription = CCorePlugin.getDefault().getProjectDescription(fProject);
|
||||||
|
|
||||||
// now try persisting the data and loading it
|
// now try persisting the data and loading it
|
||||||
try {
|
try {
|
||||||
manager.persistSettings();
|
manager.persistSettings(projectDescription);
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
fail();
|
fail();
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,7 +40,12 @@ Export-Package: org.eclipse.cdt.core,
|
||||||
org.eclipse.cdt.core.templateengine,
|
org.eclipse.cdt.core.templateengine,
|
||||||
org.eclipse.cdt.core.templateengine.process,
|
org.eclipse.cdt.core.templateengine.process,
|
||||||
org.eclipse.cdt.core.templateengine.process.processes,
|
org.eclipse.cdt.core.templateengine.process.processes,
|
||||||
org.eclipse.cdt.internal.core;x-friends:="org.eclipse.cdt.ui,org.eclipse.cdt.debug.core,org.eclipse.cdt.managedbuilder.core,org.eclipse.cdt.make.core,org.eclipse.cdt.make.ui",
|
org.eclipse.cdt.internal.core;
|
||||||
|
x-friends:="org.eclipse.cdt.ui,
|
||||||
|
org.eclipse.cdt.debug.core,
|
||||||
|
org.eclipse.cdt.managedbuilder.core,
|
||||||
|
org.eclipse.cdt.make.core,
|
||||||
|
org.eclipse.cdt.make.ui",
|
||||||
org.eclipse.cdt.internal.core.browser;x-friends:="org.eclipse.cdt.ui",
|
org.eclipse.cdt.internal.core.browser;x-friends:="org.eclipse.cdt.ui",
|
||||||
org.eclipse.cdt.internal.core.cdtvariables;x-internal:=true,
|
org.eclipse.cdt.internal.core.cdtvariables;x-internal:=true,
|
||||||
org.eclipse.cdt.internal.core.dom;x-internal:=true,
|
org.eclipse.cdt.internal.core.dom;x-internal:=true,
|
||||||
|
|
|
@ -743,5 +743,12 @@
|
||||||
version="5.0.0">
|
version="5.0.0">
|
||||||
</CProjectStorageType>
|
</CProjectStorageType>
|
||||||
</extension>
|
</extension>
|
||||||
|
<extension
|
||||||
|
point="org.eclipse.cdt.core.RefreshExclusionFactory">
|
||||||
|
<exclusionFactory
|
||||||
|
exclusionClass="org.eclipse.cdt.internal.core.resources.ResourceExclusion"
|
||||||
|
factoryClass="org.eclipse.cdt.internal.core.resources.ResourceExclusionFactory">
|
||||||
|
</exclusionFactory>
|
||||||
|
</extension>
|
||||||
|
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
|
@ -10,10 +10,9 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.core.resources;
|
package org.eclipse.cdt.core.resources;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.settings.model.ICStorageElement;
|
||||||
import org.eclipse.core.resources.IResource;
|
import org.eclipse.core.resources.IResource;
|
||||||
import org.eclipse.core.resources.ResourcesPlugin;
|
import org.eclipse.core.resources.ResourcesPlugin;
|
||||||
import org.w3c.dom.Document;
|
|
||||||
import org.w3c.dom.Element;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a particular instance of an exclusion. E.g., if an exclusion allowed
|
* Represents a particular instance of an exclusion. E.g., if an exclusion allowed
|
||||||
|
@ -100,9 +99,9 @@ public class ExclusionInstance {
|
||||||
fDisplayString = displayString;
|
fDisplayString = displayString;
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized void persistInstanceData(Document doc, Element exclusionElement) {
|
public synchronized void persistInstanceData(ICStorageElement exclusionElement) {
|
||||||
|
|
||||||
Element instanceElement = doc.createElement(INSTANCE_ELEMENT_NAME);
|
ICStorageElement instanceElement = exclusionElement.createChild(INSTANCE_ELEMENT_NAME);
|
||||||
|
|
||||||
// persist the type of the object we are
|
// persist the type of the object we are
|
||||||
instanceElement.setAttribute(CLASS_ATTRIBUTE_NAME, this.getClass().getName());
|
instanceElement.setAttribute(CLASS_ATTRIBUTE_NAME, this.getClass().getName());
|
||||||
|
@ -137,25 +136,22 @@ public class ExclusionInstance {
|
||||||
instanceElement.setAttribute(DISPLAY_STRING_ATTRIBUTE_NAME, fDisplayString);
|
instanceElement.setAttribute(DISPLAY_STRING_ATTRIBUTE_NAME, fDisplayString);
|
||||||
}
|
}
|
||||||
|
|
||||||
exclusionElement.appendChild(instanceElement);
|
|
||||||
|
|
||||||
// persist any data from extenders
|
// persist any data from extenders
|
||||||
persistExtendedInstanceData(doc, instanceElement);
|
persistExtendedInstanceData(instanceElement);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected synchronized void persistExtendedInstanceData(Document doc, Element instanceElement) {
|
protected synchronized void persistExtendedInstanceData(ICStorageElement instanceElement) {
|
||||||
// override to provide extension specific behaviour if desired
|
// override to provide extension specific behaviour if desired
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized static ExclusionInstance loadInstanceData(Element instanceElement) {
|
public synchronized static ExclusionInstance loadInstanceData(ICStorageElement instanceElement, RefreshScopeManager manager) {
|
||||||
|
|
||||||
String className = instanceElement.getAttribute(CLASS_ATTRIBUTE_NAME);
|
String className = instanceElement.getAttribute(CLASS_ATTRIBUTE_NAME);
|
||||||
|
|
||||||
ExclusionInstance newInstance = null;
|
ExclusionInstance newInstance = null;
|
||||||
|
|
||||||
// see if there is a custom instance class
|
// see if there is a custom instance class
|
||||||
RefreshScopeManager manager = RefreshScopeManager.getInstance();
|
|
||||||
newInstance = manager.getInstanceForClassName(className);
|
newInstance = manager.getInstanceForClassName(className);
|
||||||
|
|
||||||
if(newInstance == null) {
|
if(newInstance == null) {
|
||||||
|
@ -200,7 +196,7 @@ public class ExclusionInstance {
|
||||||
return newInstance;
|
return newInstance;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected synchronized void loadExtendedInstanceData(Element instanceElement) {
|
protected synchronized void loadExtendedInstanceData(ICStorageElement child) {
|
||||||
// override to provide extension specific behaviour if desired
|
// override to provide extension specific behaviour if desired
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -15,12 +15,9 @@ import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
|
import org.eclipse.cdt.core.settings.model.ICStorageElement;
|
||||||
import org.eclipse.core.resources.IResource;
|
import org.eclipse.core.resources.IResource;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
import org.w3c.dom.Document;
|
|
||||||
import org.w3c.dom.Element;
|
|
||||||
import org.w3c.dom.Node;
|
|
||||||
import org.w3c.dom.NodeList;
|
|
||||||
|
|
||||||
import com.ibm.icu.text.MessageFormat;
|
import com.ibm.icu.text.MessageFormat;
|
||||||
|
|
||||||
|
@ -207,9 +204,9 @@ public abstract class RefreshExclusion {
|
||||||
fNestedExclusions.remove(exclusion);
|
fNestedExclusions.remove(exclusion);
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized void persistData(Document doc, Element parentElement) {
|
public synchronized void persistData(ICStorageElement parentElement) {
|
||||||
// persist the common data that all RefreshExclusions have
|
// persist the common data that all RefreshExclusions have
|
||||||
Element exclusionElement = doc.createElement(EXCLUSION_ELEMENT_NAME);
|
ICStorageElement exclusionElement = parentElement.createChild(EXCLUSION_ELEMENT_NAME);
|
||||||
|
|
||||||
// persist the type of the object we are
|
// persist the type of the object we are
|
||||||
exclusionElement.setAttribute(CLASS_ATTRIBUTE_NAME, this.getClass().getName());
|
exclusionElement.setAttribute(CLASS_ATTRIBUTE_NAME, this.getClass().getName());
|
||||||
|
@ -239,144 +236,112 @@ public abstract class RefreshExclusion {
|
||||||
|
|
||||||
exclusionElement.setAttribute(CONTRIBUTOR_ID_ATTRIBUTE_NAME, getContributorId());
|
exclusionElement.setAttribute(CONTRIBUTOR_ID_ATTRIBUTE_NAME, getContributorId());
|
||||||
|
|
||||||
parentElement.appendChild(exclusionElement);
|
|
||||||
|
|
||||||
// persist instances
|
// persist instances
|
||||||
for(ExclusionInstance instance : fExclusionInstanceList) {
|
for(ExclusionInstance instance : fExclusionInstanceList) {
|
||||||
instance.persistInstanceData(doc, exclusionElement);
|
instance.persistInstanceData(exclusionElement);
|
||||||
}
|
}
|
||||||
|
|
||||||
// provide a place for extenders to store their own data
|
// provide a place for extenders to store their own data
|
||||||
Element extensionElement = doc.createElement(EXTENSION_DATA_ELEMENT_NAME);
|
ICStorageElement extensionElement = exclusionElement.createChild(EXTENSION_DATA_ELEMENT_NAME);
|
||||||
exclusionElement.appendChild(extensionElement);
|
|
||||||
|
|
||||||
// call extender to store any extender-specific data
|
// call extender to store any extender-specific data
|
||||||
persistExtendedData(doc, extensionElement);
|
persistExtendedData(extensionElement);
|
||||||
|
|
||||||
// persist nested exclusions
|
// persist nested exclusions
|
||||||
for(RefreshExclusion exclusion : fNestedExclusions) {
|
for(RefreshExclusion exclusion : fNestedExclusions) {
|
||||||
exclusion.persistData(doc, exclusionElement);
|
exclusion.persistData(exclusionElement);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected synchronized void persistExtendedData(Document doc, Element extensionElement) {
|
protected synchronized void persistExtendedData(ICStorageElement extensionElement) {
|
||||||
// override to provide extension specific behaviour if desired
|
// override to provide extension specific behaviour if desired
|
||||||
}
|
}
|
||||||
|
|
||||||
protected synchronized void loadExtendedData(Element parentElement) {
|
protected synchronized void loadExtendedData(ICStorageElement grandchild) {
|
||||||
// override to provide extension specific behaviour if desired
|
// override to provide extension specific behaviour if desired
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized static List<RefreshExclusion> loadData(Element parentElement, RefreshExclusion parentExclusion, IResource parentResource) throws CoreException {
|
public synchronized static List<RefreshExclusion> loadData(ICStorageElement parentElement,
|
||||||
|
RefreshExclusion parentExclusion, IResource parentResource, RefreshScopeManager manager) throws CoreException {
|
||||||
|
|
||||||
List<RefreshExclusion> exclusions = new LinkedList<RefreshExclusion>();
|
List<RefreshExclusion> exclusions = new LinkedList<RefreshExclusion>();
|
||||||
|
|
||||||
// the parent element might contain any number of exclusions... iterate through the list
|
// the parent element might contain any number of exclusions... iterate through the list
|
||||||
NodeList childNodes = parentElement.getChildNodes();
|
ICStorageElement[] children = parentElement.getChildren();
|
||||||
|
|
||||||
for (int i = 0; i < childNodes.getLength(); i++) {
|
for (ICStorageElement child : children) {
|
||||||
Node node = childNodes.item(i);
|
|
||||||
|
|
||||||
// node should be an element
|
if (child.getName().equals(EXCLUSION_ELEMENT_NAME)) {
|
||||||
if (node instanceof Element) {
|
|
||||||
Element exclusionElement = (Element) node;
|
|
||||||
|
|
||||||
if (exclusionElement.getNodeName().equals(EXCLUSION_ELEMENT_NAME)) {
|
// create an object of the proper type
|
||||||
|
String className = child.getAttribute(CLASS_ATTRIBUTE_NAME);
|
||||||
|
RefreshExclusion newExclusion = manager.getExclusionForClassName(className);
|
||||||
|
|
||||||
// create an object of the proper type
|
if (newExclusion == null) {
|
||||||
String className = exclusionElement.getAttribute(CLASS_ATTRIBUTE_NAME);
|
throw new CoreException(CCorePlugin.createStatus(MessageFormat.format(
|
||||||
RefreshScopeManager manager = RefreshScopeManager.getInstance();
|
Messages.RefreshExclusion_0, className)));
|
||||||
RefreshExclusion newExclusion = manager.getExclusionForClassName(className);
|
|
||||||
|
|
||||||
if (newExclusion == null) {
|
|
||||||
throw new CoreException(CCorePlugin.createStatus(MessageFormat.format(
|
|
||||||
Messages.RefreshExclusion_0, className)));
|
|
||||||
}
|
|
||||||
|
|
||||||
// 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 if nested
|
|
||||||
newExclusion.fParentExclusion = parentExclusion;
|
|
||||||
|
|
||||||
// set parent resource if there is one
|
|
||||||
newExclusion.fParentResource = parentResource;
|
|
||||||
|
|
||||||
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 exclusionChildNodes = exclusionElement.getChildNodes();
|
|
||||||
|
|
||||||
for (int k = 0; k < exclusionChildNodes.getLength(); k++) {
|
|
||||||
Node node1 = exclusionChildNodes.item(k);
|
|
||||||
|
|
||||||
// the node will be an element
|
|
||||||
if (node1 instanceof Element) {
|
|
||||||
Element instanceElement = (Element) node1;
|
|
||||||
|
|
||||||
// is the node an instance?
|
|
||||||
if (instanceElement.getNodeName().equals(INSTANCE_ELEMENT_NAME)) {
|
|
||||||
|
|
||||||
// load the instance data
|
|
||||||
ExclusionInstance instance = ExclusionInstance
|
|
||||||
.loadInstanceData(instanceElement);
|
|
||||||
newExclusion.fExclusionInstanceList.add(instance);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// load nested exclusions
|
|
||||||
List<RefreshExclusion> nestedExclusions = loadData(exclusionElement,
|
|
||||||
newExclusion, null);
|
|
||||||
|
|
||||||
// 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 exclusion type
|
||||||
|
String exclusionTypeString = child.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 if nested
|
||||||
|
newExclusion.fParentExclusion = parentExclusion;
|
||||||
|
|
||||||
|
// set parent resource if there is one
|
||||||
|
newExclusion.fParentResource = parentResource;
|
||||||
|
|
||||||
|
newExclusion.fContributorId = child.getAttribute(CONTRIBUTOR_ID_ATTRIBUTE_NAME);
|
||||||
|
|
||||||
|
// get the extension element
|
||||||
|
ICStorageElement[] grandchildren = child.getChildren();
|
||||||
|
|
||||||
|
for (ICStorageElement grandchild : grandchildren) {
|
||||||
|
|
||||||
|
if (grandchild.getName().equals(RefreshExclusion.EXTENSION_DATA_ELEMENT_NAME)) {
|
||||||
|
|
||||||
|
// load the extension's data
|
||||||
|
newExclusion.loadExtendedData(grandchild);
|
||||||
|
}
|
||||||
|
|
||||||
|
else if (grandchild.getName().equals(INSTANCE_ELEMENT_NAME)) {
|
||||||
|
|
||||||
|
// load the instance data
|
||||||
|
ExclusionInstance instance = ExclusionInstance.loadInstanceData(grandchild, manager);
|
||||||
|
newExclusion.fExclusionInstanceList.add(instance);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// load nested exclusions
|
||||||
|
List<RefreshExclusion> nestedExclusions = loadData(child, newExclusion, null, manager);
|
||||||
|
|
||||||
|
// add to parent
|
||||||
|
for (RefreshExclusion nestedExclusion : nestedExclusions) {
|
||||||
|
newExclusion.addNestedExclusion(nestedExclusion);
|
||||||
|
}
|
||||||
|
|
||||||
|
// add the new exclusion to the list of exclusions to return
|
||||||
|
exclusions.add(newExclusion);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return exclusions;
|
return exclusions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,26 +10,16 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.core.resources;
|
package org.eclipse.cdt.core.resources;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.StringReader;
|
|
||||||
import java.io.StringWriter;
|
|
||||||
import java.text.MessageFormat;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.LinkedHashSet;
|
import java.util.LinkedHashSet;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import javax.xml.parsers.DocumentBuilder;
|
|
||||||
import javax.xml.parsers.DocumentBuilderFactory;
|
|
||||||
import javax.xml.parsers.ParserConfigurationException;
|
|
||||||
import javax.xml.transform.Transformer;
|
|
||||||
import javax.xml.transform.TransformerConfigurationException;
|
|
||||||
import javax.xml.transform.TransformerException;
|
|
||||||
import javax.xml.transform.TransformerFactory;
|
|
||||||
import javax.xml.transform.dom.DOMSource;
|
|
||||||
import javax.xml.transform.stream.StreamResult;
|
|
||||||
|
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
import org.eclipse.cdt.core.CProjectNature;
|
import org.eclipse.cdt.core.CProjectNature;
|
||||||
|
import org.eclipse.cdt.core.settings.model.ICProjectDescription;
|
||||||
|
import org.eclipse.cdt.core.settings.model.ICStorageElement;
|
||||||
|
import org.eclipse.cdt.internal.core.settings.model.CProjectDescriptionManager;
|
||||||
import org.eclipse.core.resources.IContainer;
|
import org.eclipse.core.resources.IContainer;
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
import org.eclipse.core.resources.IResource;
|
import org.eclipse.core.resources.IResource;
|
||||||
|
@ -46,13 +36,6 @@ import org.eclipse.core.runtime.IExtension;
|
||||||
import org.eclipse.core.runtime.IExtensionPoint;
|
import org.eclipse.core.runtime.IExtensionPoint;
|
||||||
import org.eclipse.core.runtime.IProgressMonitor;
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
import org.eclipse.core.runtime.Platform;
|
import org.eclipse.core.runtime.Platform;
|
||||||
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
|
* The RefreshScopeManager provides access to settings pertaining to refreshes performed during
|
||||||
|
@ -76,7 +59,7 @@ public class RefreshScopeManager {
|
||||||
public static final String RESOURCE_ELEMENT_NAME = "resource"; //$NON-NLS-1$
|
public static final String RESOURCE_ELEMENT_NAME = "resource"; //$NON-NLS-1$
|
||||||
public static final String VERSION_NUMBER_ATTRIBUTE_NAME = "versionNumber"; //$NON-NLS-1$
|
public static final String VERSION_NUMBER_ATTRIBUTE_NAME = "versionNumber"; //$NON-NLS-1$
|
||||||
public static final String VERSION_ELEMENT_NAME = "version"; //$NON-NLS-1$
|
public static final String VERSION_ELEMENT_NAME = "version"; //$NON-NLS-1$
|
||||||
public static final QualifiedName REFRESH_SCOPE_PROPERTY_NAME = new QualifiedName(CCorePlugin.PLUGIN_ID, "refreshScope"); //$NON-NLS-1$
|
public static final String REFRESH_SCOPE_STORAGE_NAME = "refreshScope"; //$NON-NLS-1$
|
||||||
public static final String EXTENSION_ID = "RefreshExclusionFactory"; //$NON-NLS-1$
|
public static final String EXTENSION_ID = "RefreshExclusionFactory"; //$NON-NLS-1$
|
||||||
public static final Object EXCLUSION_FACTORY = "exclusionFactory"; //$NON-NLS-1$
|
public static final Object EXCLUSION_FACTORY = "exclusionFactory"; //$NON-NLS-1$
|
||||||
public static final String EXCLUSION_CLASS = "exclusionClass"; //$NON-NLS-1$
|
public static final String EXCLUSION_CLASS = "exclusionClass"; //$NON-NLS-1$
|
||||||
|
@ -89,6 +72,8 @@ public class RefreshScopeManager {
|
||||||
private HashMap<String, RefreshExclusionFactory> fClassnameToExclusionFactoryMap;
|
private HashMap<String, RefreshExclusionFactory> fClassnameToExclusionFactoryMap;
|
||||||
|
|
||||||
private static RefreshScopeManager fInstance;
|
private static RefreshScopeManager fInstance;
|
||||||
|
private boolean fIsLoading = false;
|
||||||
|
private boolean fIsLoaded = false;
|
||||||
|
|
||||||
private RefreshScopeManager(){
|
private RefreshScopeManager(){
|
||||||
fClassnameToExclusionFactoryMap = new HashMap<String, RefreshExclusionFactory>();
|
fClassnameToExclusionFactoryMap = new HashMap<String, RefreshExclusionFactory>();
|
||||||
|
@ -288,12 +273,14 @@ public class RefreshScopeManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized void clearAllResourcesToRefresh() {
|
public synchronized void clearAllResourcesToRefresh() {
|
||||||
|
getProjectToResourcesMap();
|
||||||
fProjectToResourcesMap.clear();
|
fProjectToResourcesMap.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized void clearAllData() {
|
public synchronized void clearAllData() {
|
||||||
clearAllResourcesToRefresh();
|
clearAllResourcesToRefresh();
|
||||||
clearAllExclusions();
|
clearAllExclusions();
|
||||||
|
fIsLoaded = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private HashMap<IProject, LinkedHashSet<IResource>> getProjectToResourcesMap() {
|
private HashMap<IProject, LinkedHashSet<IResource>> getProjectToResourcesMap() {
|
||||||
|
@ -346,82 +333,58 @@ public class RefreshScopeManager {
|
||||||
exclusions.remove(exclusion);
|
exclusions.remove(exclusion);
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized void persistSettings() throws CoreException {
|
public synchronized void persistSettings(ICProjectDescription projectDescription) throws CoreException {
|
||||||
getProjectToResourcesMap();
|
getProjectToResourcesMap();
|
||||||
getResourcesToExclusionsMap();
|
getResourcesToExclusionsMap();
|
||||||
for(IProject project : fProjectToResourcesMap.keySet()) {
|
for (IProject project : fProjectToResourcesMap.keySet()) {
|
||||||
if (!project.exists()) {
|
if (!project.exists()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// serialize all settings for the project to an XML document which we will use to persist
|
|
||||||
// the data to a persistent resource property
|
// serialize all settings for the project to the C Project Description
|
||||||
DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
|
if (project.isOpen()) {
|
||||||
DocumentBuilder docBuilder = null;
|
if (project.hasNature(CProjectNature.C_NATURE_ID)) {
|
||||||
try {
|
|
||||||
docBuilder = docBuilderFactory.newDocumentBuilder();
|
ICStorageElement storageElement = projectDescription.getStorage(REFRESH_SCOPE_STORAGE_NAME, true);
|
||||||
} catch (ParserConfigurationException e) {
|
storageElement.clear();
|
||||||
throw new CoreException(CCorePlugin.createStatus(Messages.RefreshScopeManager_0, e));
|
|
||||||
|
storageElement.setAttribute(VERSION_NUMBER_ATTRIBUTE_NAME, Integer.toString(fVersion));
|
||||||
|
|
||||||
|
for (IResource resource : fProjectToResourcesMap.get(project)) {
|
||||||
|
|
||||||
|
// create a resource node
|
||||||
|
ICStorageElement resourceElement = storageElement.createChild(RESOURCE_ELEMENT_NAME);
|
||||||
|
resourceElement.setAttribute(WORKSPACE_PATH_ATTRIBUTE_NAME, resource
|
||||||
|
.getFullPath().toString());
|
||||||
|
|
||||||
|
// populate the node with any exclusions
|
||||||
|
List<RefreshExclusion> exclusions = fResourceToExclusionsMap.get(resource);
|
||||||
|
if (exclusions != null) {
|
||||||
|
for (RefreshExclusion exclusion : exclusions) {
|
||||||
|
exclusion.persistData(resourceElement);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// create document root
|
|
||||||
Document doc = docBuilder.newDocument();
|
|
||||||
Element root = doc.createElement("root"); //$NON-NLS-1$
|
|
||||||
doc.appendChild(root);
|
|
||||||
|
|
||||||
Element versionElement = doc.createElement(VERSION_ELEMENT_NAME);
|
|
||||||
versionElement.setAttribute(VERSION_NUMBER_ATTRIBUTE_NAME, Integer.toString(fVersion));
|
|
||||||
root.appendChild(versionElement);
|
|
||||||
|
|
||||||
for(IResource resource : fProjectToResourcesMap.get(project)) {
|
|
||||||
|
|
||||||
// create a resource node
|
|
||||||
Element resourceElement = doc.createElement(RESOURCE_ELEMENT_NAME);
|
|
||||||
resourceElement.setAttribute(WORKSPACE_PATH_ATTRIBUTE_NAME, resource.getFullPath().toString());
|
|
||||||
root.appendChild(resourceElement);
|
|
||||||
|
|
||||||
// populate the node with any exclusions
|
|
||||||
List<RefreshExclusion> exclusions = fResourceToExclusionsMap.get(resource);
|
|
||||||
if (exclusions != null) {
|
|
||||||
for(RefreshExclusion exclusion : exclusions) {
|
|
||||||
exclusion.persistData(doc, resourceElement);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
TransformerFactory transformerFactory = TransformerFactory.newInstance();
|
|
||||||
Transformer transformer;
|
|
||||||
try {
|
|
||||||
transformer = transformerFactory.newTransformer();
|
|
||||||
} catch (TransformerConfigurationException e) {
|
|
||||||
throw new CoreException(CCorePlugin.createStatus(Messages.RefreshScopeManager_1, e));
|
|
||||||
}
|
|
||||||
//transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes"); //$NON-NLS-1$
|
|
||||||
|
|
||||||
//create a string from xml tree
|
|
||||||
StringWriter stringWriter = new StringWriter();
|
|
||||||
StreamResult result = new StreamResult(stringWriter);
|
|
||||||
DOMSource source = new DOMSource(doc);
|
|
||||||
try {
|
|
||||||
transformer.transform(source, result);
|
|
||||||
} catch (TransformerException e) {
|
|
||||||
throw new CoreException(CCorePlugin.createStatus(Messages.RefreshScopeManager_2, e));
|
|
||||||
}
|
|
||||||
String xmlString = stringWriter.toString();
|
|
||||||
|
|
||||||
// use the string as a value for a persistent resource property on the project
|
|
||||||
project.setPersistentProperty(REFRESH_SCOPE_PROPERTY_NAME, xmlString);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized void loadSettings() throws CoreException {
|
public synchronized void loadSettings() throws CoreException {
|
||||||
// iterate through all projects in the workspace. If they are C projects, attempt to load settings
|
if(!fIsLoaded && !fIsLoading) {
|
||||||
// from them.
|
fIsLoading = true;
|
||||||
IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot();
|
// 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()) {
|
for (IProject project : workspaceRoot.getProjects()) {
|
||||||
loadSettings(workspaceRoot, project);
|
loadSettings(workspaceRoot, project);
|
||||||
|
}
|
||||||
|
|
||||||
|
fIsLoaded = true;
|
||||||
|
fIsLoading = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -430,95 +393,57 @@ public class RefreshScopeManager {
|
||||||
* @param project
|
* @param project
|
||||||
* @throws CoreException
|
* @throws CoreException
|
||||||
*/
|
*/
|
||||||
private synchronized void loadSettings(IWorkspaceRoot workspaceRoot, IProject project) throws CoreException {
|
private synchronized void loadSettings(IWorkspaceRoot workspaceRoot, IProject project)
|
||||||
|
throws CoreException {
|
||||||
if (project.isOpen()) {
|
if (project.isOpen()) {
|
||||||
if (project.hasNature(CProjectNature.C_NATURE_ID)) {
|
if (project.hasNature(CProjectNature.C_NATURE_ID)) {
|
||||||
String xmlString = project.getPersistentProperty(REFRESH_SCOPE_PROPERTY_NAME);
|
ICProjectDescription projectDescription = CProjectDescriptionManager.getInstance()
|
||||||
|
.getProjectDescription(project, false);
|
||||||
|
ICStorageElement storageElement = projectDescription.getStorage(
|
||||||
|
REFRESH_SCOPE_STORAGE_NAME, true);
|
||||||
|
|
||||||
// if there are no settings, then configure the default behaviour of refreshing the entire
|
// walk the tree and load the settings
|
||||||
// project,
|
|
||||||
// with no exclusions
|
|
||||||
if (xmlString == null) {
|
|
||||||
addResourceToRefresh(project, project);
|
|
||||||
}
|
|
||||||
|
|
||||||
else {
|
// for now ignore the version attribute, as we only have version 1 at this time
|
||||||
// convert the XML string to a DOM model
|
|
||||||
|
|
||||||
DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory
|
// iterate through the child nodes
|
||||||
.newInstance();
|
ICStorageElement[] children = storageElement.getChildren();
|
||||||
DocumentBuilder docBuilder = null;
|
|
||||||
try {
|
|
||||||
docBuilder = docBuilderFactory.newDocumentBuilder();
|
|
||||||
} catch (ParserConfigurationException e) {
|
|
||||||
throw new CoreException(CCorePlugin.createStatus(
|
|
||||||
Messages.RefreshScopeManager_0, e));
|
|
||||||
}
|
|
||||||
|
|
||||||
Document doc = null;
|
for (ICStorageElement child : children) {
|
||||||
|
|
||||||
try {
|
if (child.getName().equals(RESOURCE_ELEMENT_NAME)) {
|
||||||
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
|
// get the resource path
|
||||||
|
String resourcePath = child.getAttribute(WORKSPACE_PATH_ATTRIBUTE_NAME);
|
||||||
|
|
||||||
// for now ignore the version attribute, as we only have version 1 at this time
|
if (resourcePath == null) {
|
||||||
|
// error
|
||||||
|
|
||||||
// iterate through the child nodes
|
}
|
||||||
NodeList nodeList = doc.getDocumentElement().getChildNodes(); // child of the doc is the root
|
|
||||||
|
|
||||||
for (int k = 0; k < nodeList.getLength(); k++) {
|
else {
|
||||||
Node node = nodeList.item(k);
|
// find the resource
|
||||||
|
IResource resource = workspaceRoot.findMember(resourcePath);
|
||||||
|
|
||||||
// node will be an element
|
if (resource == null) {
|
||||||
if (node instanceof Element) {
|
// error
|
||||||
Element resourceElement = (Element) node;
|
}
|
||||||
|
|
||||||
if (resourceElement.getNodeName().equals(RESOURCE_ELEMENT_NAME)) {
|
else {
|
||||||
|
addResourceToRefresh(project, resource);
|
||||||
|
|
||||||
// get the resource path
|
// load any exclusions
|
||||||
String resourcePath = resourceElement
|
List<RefreshExclusion> exclusions = RefreshExclusion.loadData(
|
||||||
.getAttribute(WORKSPACE_PATH_ATTRIBUTE_NAME);
|
child, null, resource, this);
|
||||||
|
|
||||||
if (resourcePath == null) {
|
// add them
|
||||||
// error
|
for (RefreshExclusion exclusion : exclusions) {
|
||||||
|
addExclusion(resource, exclusion);
|
||||||
}
|
|
||||||
|
|
||||||
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, resource);
|
|
||||||
|
|
||||||
// add them
|
|
||||||
for (RefreshExclusion exclusion : exclusions) {
|
|
||||||
addExclusion(resource, exclusion);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,11 +9,14 @@
|
||||||
* IBM Corporation - initial API and implementation
|
* IBM Corporation - initial API and implementation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
package org.eclipse.cdt.core.resources;
|
package org.eclipse.cdt.internal.core.resources;
|
||||||
|
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.resources.ExclusionInstance;
|
||||||
|
import org.eclipse.cdt.core.resources.Messages;
|
||||||
|
import org.eclipse.cdt.core.resources.RefreshExclusion;
|
||||||
import org.eclipse.core.resources.IContainer;
|
import org.eclipse.core.resources.IContainer;
|
||||||
import org.eclipse.core.resources.IResource;
|
import org.eclipse.core.resources.IResource;
|
||||||
|
|
|
@ -0,0 +1,64 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2011 IBM Corporation and others.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* IBM Corporation - initial API and implementation
|
||||||
|
*******************************************************************************/
|
||||||
|
package org.eclipse.cdt.internal.core.resources;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.resources.ExclusionInstance;
|
||||||
|
import org.eclipse.cdt.core.resources.RefreshExclusion;
|
||||||
|
import org.eclipse.cdt.core.resources.RefreshExclusionFactory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author crecoskie
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class ResourceExclusionFactory extends RefreshExclusionFactory {
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public ResourceExclusionFactory() {
|
||||||
|
// TODO Auto-generated constructor stub
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.resources.RefreshExclusionFactory#createNewExclusion()
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public RefreshExclusion createNewExclusion() {
|
||||||
|
return new ResourceExclusion();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.resources.RefreshExclusionFactory#createNewExclusionInstance()
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public ExclusionInstance createNewExclusionInstance() {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.resources.RefreshExclusionFactory#getExclusionClassname()
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String getExclusionClassname() {
|
||||||
|
return ResourceExclusion.class.getName();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.resources.RefreshExclusionFactory#getInstanceClassname()
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String getInstanceClassname() {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -44,6 +44,7 @@ Export-Package: org.eclipse.cdt.internal.corext;x-internal:=true,
|
||||||
org.eclipse.cdt.internal.ui.refactoring.rename;x-friends:="org.eclipse.cdt.ui.tests",
|
org.eclipse.cdt.internal.ui.refactoring.rename;x-friends:="org.eclipse.cdt.ui.tests",
|
||||||
org.eclipse.cdt.internal.ui.refactoring.togglefunction;x-friends:="org.eclipse.cdt.ui.tests",
|
org.eclipse.cdt.internal.ui.refactoring.togglefunction;x-friends:="org.eclipse.cdt.ui.tests",
|
||||||
org.eclipse.cdt.internal.ui.refactoring.utils;x-friends:="org.eclipse.cdt.ui.tests",
|
org.eclipse.cdt.internal.ui.refactoring.utils;x-friends:="org.eclipse.cdt.ui.tests",
|
||||||
|
org.eclipse.cdt.internal.ui.resources,
|
||||||
org.eclipse.cdt.internal.ui.search;x-internal:=true,
|
org.eclipse.cdt.internal.ui.search;x-internal:=true,
|
||||||
org.eclipse.cdt.internal.ui.search.actions;x-internal:=true,
|
org.eclipse.cdt.internal.ui.search.actions;x-internal:=true,
|
||||||
org.eclipse.cdt.internal.ui.text;x-internal:=true,
|
org.eclipse.cdt.internal.ui.text;x-internal:=true,
|
||||||
|
|
|
@ -606,3 +606,5 @@ transfer.EditorBehavior.description = Preference related to how the editor proce
|
||||||
|
|
||||||
# Refresh Exclusion Contributors
|
# Refresh Exclusion Contributors
|
||||||
RefreshExclusionContributor.name = Resources
|
RefreshExclusionContributor.name = Resources
|
||||||
|
|
||||||
|
extension-point.name = Refresh Exclusion Contributor
|
|
@ -26,7 +26,7 @@
|
||||||
<extension-point id="quickAssistProcessors" name="%quickAssistProcessorExtensionPoint" schema="schema/quickAssistProcessors.exsd"/>
|
<extension-point id="quickAssistProcessors" name="%quickAssistProcessorExtensionPoint" schema="schema/quickAssistProcessors.exsd"/>
|
||||||
<extension-point id="DocCommentOwner" name="%DocCommentOwner.name" schema="schema/DocCommentOwner.exsd"/>
|
<extension-point id="DocCommentOwner" name="%DocCommentOwner.name" schema="schema/DocCommentOwner.exsd"/>
|
||||||
<extension-point id="workingSetConfigurations" name="%workingSetConfigurationsExtensionPoint" schema="schema/workingSetConfigurations.exsd"/>
|
<extension-point id="workingSetConfigurations" name="%workingSetConfigurationsExtensionPoint" schema="schema/workingSetConfigurations.exsd"/>
|
||||||
<extension-point id="RefreshExclusionContributor" name="Refresh Exclusion Contributor" schema="schema/RefreshExclusionContributor.exsd"/>
|
<extension-point id="RefreshExclusionContributor" name="%extension-point.name" schema="schema/RefreshExclusionContributor.exsd"/>
|
||||||
|
|
||||||
<extension
|
<extension
|
||||||
point="org.eclipse.core.runtime.adapters">
|
point="org.eclipse.core.runtime.adapters">
|
||||||
|
@ -3977,7 +3977,7 @@
|
||||||
<extension
|
<extension
|
||||||
point="org.eclipse.cdt.ui.RefreshExclusionContributor">
|
point="org.eclipse.cdt.ui.RefreshExclusionContributor">
|
||||||
<exclusionContributor
|
<exclusionContributor
|
||||||
class="org.eclipse.cdt.ui.resources.ResourceExclusionContributor"
|
class="org.eclipse.cdt.internal.ui.resources.ResourceExclusionContributor"
|
||||||
id="org.eclipse.cdt.ui.ResourceExclusionContributor"
|
id="org.eclipse.cdt.ui.ResourceExclusionContributor"
|
||||||
name="%RefreshExclusionContributor.name">
|
name="%RefreshExclusionContributor.name">
|
||||||
</exclusionContributor>
|
</exclusionContributor>
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
* IBM Corporation - initial API and implementation
|
* IBM Corporation - initial API and implementation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
package org.eclipse.cdt.ui.resources;
|
package org.eclipse.cdt.internal.ui.resources;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
@ -37,12 +37,14 @@ import org.eclipse.swt.widgets.List;
|
||||||
import org.eclipse.swt.widgets.Shell;
|
import org.eclipse.swt.widgets.Shell;
|
||||||
import org.eclipse.ui.dialogs.CheckedTreeSelectionDialog;
|
import org.eclipse.ui.dialogs.CheckedTreeSelectionDialog;
|
||||||
import org.eclipse.ui.model.WorkbenchLabelProvider;
|
import org.eclipse.ui.model.WorkbenchLabelProvider;
|
||||||
import org.w3c.dom.Element;
|
|
||||||
|
|
||||||
import org.eclipse.cdt.core.resources.ExclusionInstance;
|
import org.eclipse.cdt.core.resources.ExclusionInstance;
|
||||||
import org.eclipse.cdt.core.resources.ExclusionType;
|
import org.eclipse.cdt.core.resources.ExclusionType;
|
||||||
import org.eclipse.cdt.core.resources.RefreshExclusion;
|
import org.eclipse.cdt.core.resources.RefreshExclusion;
|
||||||
import org.eclipse.cdt.core.resources.ResourceExclusion;
|
import org.eclipse.cdt.ui.resources.Messages;
|
||||||
|
import org.eclipse.cdt.ui.resources.RefreshExclusionContributor;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.internal.core.resources.ResourceExclusion;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <strong>EXPERIMENTAL</strong>. This class or interface has been added as
|
* <strong>EXPERIMENTAL</strong>. This class or interface has been added as
|
||||||
|
@ -278,13 +280,4 @@ public class ResourceExclusionContributor extends RefreshExclusionContributor {
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.ui.resources.RefreshExclusionContributor#createExclusionFromXML(org.w3c.dom.Element)
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public RefreshExclusion createExclusionFromXML(Element exclusionElement) {
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -11,7 +11,6 @@
|
||||||
package org.eclipse.cdt.ui.resources;
|
package org.eclipse.cdt.ui.resources;
|
||||||
|
|
||||||
import org.eclipse.swt.widgets.Composite;
|
import org.eclipse.swt.widgets.Composite;
|
||||||
import org.w3c.dom.Element;
|
|
||||||
|
|
||||||
import org.eclipse.cdt.core.resources.RefreshExclusion;
|
import org.eclipse.cdt.core.resources.RefreshExclusion;
|
||||||
|
|
||||||
|
@ -68,7 +67,5 @@ public abstract class RefreshExclusionContributor {
|
||||||
* @param exclusion - the RefreshExclusion to be modified
|
* @param exclusion - the RefreshExclusion to be modified
|
||||||
*/
|
*/
|
||||||
abstract public void createProperiesUI(Composite parent, RefreshExclusion exclusion);
|
abstract public void createProperiesUI(Composite parent, RefreshExclusion exclusion);
|
||||||
abstract public RefreshExclusion createExclusionFromXML(Element exclusionElement);
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue