mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 22:52:11 +02:00
Bug 410529: Eliminate path entry removal job
Change-Id: I406c9f3b5290c3a0c65773da2c40cb0b3a83c4a1 Signed-off-by: John Dallaway <john@dallaway.org.uk>
This commit is contained in:
parent
9655088708
commit
cb16dfda33
1 changed files with 1 additions and 54 deletions
|
@ -11,6 +11,7 @@
|
||||||
* Markus Schorn (Wind River Systems)
|
* Markus Schorn (Wind River Systems)
|
||||||
* IBM Corporation
|
* IBM Corporation
|
||||||
* James Blackburn (Broadcom Corporation)
|
* James Blackburn (Broadcom Corporation)
|
||||||
|
* John Dallaway - Eliminate path entry removal job (bug 410529)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.model;
|
package org.eclipse.cdt.internal.core.model;
|
||||||
|
|
||||||
|
@ -1440,16 +1441,6 @@ public class PathEntryManager implements IPathEntryStoreListener, IElementChange
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (kind == ICElementDelta.ADDED || kind == ICElementDelta.REMOVED) {
|
if (kind == ICElementDelta.ADDED || kind == ICElementDelta.REMOVED) {
|
||||||
// If the element path maps to the some IPathEntry we need to remove
|
|
||||||
// that entry
|
|
||||||
// but I'm not sure of the side effects so lets just do this for the
|
|
||||||
// ISourceEntry type
|
|
||||||
if (element instanceof ISourceRoot) {
|
|
||||||
ISourceRoot sourceRoot = (ISourceRoot) element;
|
|
||||||
if (kind == ICElementDelta.REMOVED) {
|
|
||||||
updatePathEntryFromDeleteSource(sourceRoot);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true; // add/remove we validate all paths
|
return true; // add/remove we validate all paths
|
||||||
}
|
}
|
||||||
if (type == ICElement.C_MODEL || type == ICElement.C_CCONTAINER || type == ICElement.C_PROJECT) {
|
if (type == ICElement.C_MODEL || type == ICElement.C_CCONTAINER || type == ICElement.C_PROJECT) {
|
||||||
|
@ -1465,50 +1456,6 @@ public class PathEntryManager implements IPathEntryStoreListener, IElementChange
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* The source root been deleted update the path entries
|
|
||||||
*
|
|
||||||
* @param sourceRoot
|
|
||||||
* @throws CModelException
|
|
||||||
*/
|
|
||||||
void updatePathEntryFromDeleteSource(final ISourceRoot sourceRoot) throws CModelException {
|
|
||||||
final ICProject cproject = sourceRoot.getCProject();
|
|
||||||
IPathEntry[] rawEntries = getRawPathEntries(cproject);
|
|
||||||
boolean change = false;
|
|
||||||
ArrayList<IPathEntry> list = new ArrayList<>(rawEntries.length);
|
|
||||||
for (IPathEntry rawEntrie : rawEntries) {
|
|
||||||
if (rawEntrie.getEntryKind() == IPathEntry.CDT_SOURCE) {
|
|
||||||
if (sourceRoot.getPath().equals(rawEntrie.getPath())) {
|
|
||||||
change = true;
|
|
||||||
} else {
|
|
||||||
list.add(rawEntrie);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
list.add(rawEntrie);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (change) {
|
|
||||||
IPathEntry[] newEntries = new IPathEntry[list.size()];
|
|
||||||
list.toArray(newEntries);
|
|
||||||
final IPathEntry[] finalEntries = newEntries;
|
|
||||||
Job updatePathEntry = new WorkspaceJob("PathEntry Update source roots") { //$NON-NLS-1$
|
|
||||||
@Override
|
|
||||||
public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException {
|
|
||||||
// If the path which triggered this change exists when we
|
|
||||||
// run this job then
|
|
||||||
// nothing to do.
|
|
||||||
if (sourceRoot.getResource() == null || !sourceRoot.getResource().exists())
|
|
||||||
setRawPathEntries(cproject, finalEntries, monitor);
|
|
||||||
return Status.OK_STATUS;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
IProject project = cproject.getProject();
|
|
||||||
ISchedulingRule rule = project.getWorkspace().getRoot();
|
|
||||||
updatePathEntry.setRule(rule);
|
|
||||||
updatePathEntry.schedule();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public ICModelStatus validatePathEntry(ICProject cProject, IPathEntry[] entries) {
|
public ICModelStatus validatePathEntry(ICProject cProject, IPathEntry[] entries) {
|
||||||
return PathEntryUtil.validatePathEntry(cProject, entries);
|
return PathEntryUtil.validatePathEntry(cProject, entries);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue