mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-09 18:56:02 +02:00
Index is rebuilt in presence of team-shared index, bug 239464.
This commit is contained in:
parent
e173a7fb80
commit
a2777c2661
6 changed files with 59 additions and 71 deletions
|
@ -102,6 +102,7 @@ public abstract class AbstractIndexerTask extends PDOMWriter {
|
||||||
private List<Object> fFilesToRemove = new ArrayList<Object>();
|
private List<Object> fFilesToRemove = new ArrayList<Object>();
|
||||||
private List<String> fFilesUpFront= new ArrayList<String>();
|
private List<String> fFilesUpFront= new ArrayList<String>();
|
||||||
private int fASTOptions;
|
private int fASTOptions;
|
||||||
|
private int fForceNumberFiles= 0;
|
||||||
|
|
||||||
protected IWritableIndex fIndex;
|
protected IWritableIndex fIndex;
|
||||||
private ITodoTaskUpdater fTodoTaskUpdater;
|
private ITodoTaskUpdater fTodoTaskUpdater;
|
||||||
|
@ -128,6 +129,9 @@ public abstract class AbstractIndexerTask extends PDOMWriter {
|
||||||
public final void setParseUpFront(String[] astFilePaths) {
|
public final void setParseUpFront(String[] astFilePaths) {
|
||||||
fFilesUpFront.addAll(Arrays.asList(astFilePaths));
|
fFilesUpFront.addAll(Arrays.asList(astFilePaths));
|
||||||
}
|
}
|
||||||
|
public final void setForceFirstFiles(int number) {
|
||||||
|
fForceNumberFiles= number;
|
||||||
|
}
|
||||||
|
|
||||||
protected abstract IWritableIndex createIndex();
|
protected abstract IWritableIndex createIndex();
|
||||||
protected abstract ICodeReaderFactory createReaderFactory();
|
protected abstract ICodeReaderFactory createReaderFactory();
|
||||||
|
@ -248,15 +252,17 @@ public abstract class AbstractIndexerTask extends PDOMWriter {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void extractFiles(Map<Integer, List<Object>> files, List<IIndexFragmentFile> iFilesToRemove, IProgressMonitor monitor) throws CoreException {
|
private void extractFiles(Map<Integer, List<Object>> files, List<IIndexFragmentFile> iFilesToRemove, IProgressMonitor monitor) throws CoreException {
|
||||||
final boolean force= (fUpdateFlags & IIndexManager.UPDATE_ALL) != 0;
|
final boolean forceAll= (fUpdateFlags & IIndexManager.UPDATE_ALL) != 0;
|
||||||
final boolean checkTimestamps= (fUpdateFlags & IIndexManager.UPDATE_CHECK_TIMESTAMPS) != 0;
|
final boolean checkTimestamps= (fUpdateFlags & IIndexManager.UPDATE_CHECK_TIMESTAMPS) != 0;
|
||||||
final boolean checkConfig= (fUpdateFlags & IIndexManager.UPDATE_CHECK_CONFIGURATION) != 0;
|
final boolean checkConfig= (fUpdateFlags & IIndexManager.UPDATE_CHECK_CONFIGURATION) != 0;
|
||||||
|
|
||||||
int count= 0;
|
int count= 0;
|
||||||
|
int forceFirst= fForceNumberFiles;
|
||||||
for (final Object tu : fFilesToUpdate) {
|
for (final Object tu : fFilesToUpdate) {
|
||||||
if (monitor.isCanceled())
|
if (monitor.isCanceled())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
final boolean force= forceAll || --forceFirst >= 0;
|
||||||
final IIndexFileLocation ifl= fResolver.resolveFile(tu);
|
final IIndexFileLocation ifl= fResolver.resolveFile(tu);
|
||||||
if (ifl == null)
|
if (ifl == null)
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2006, 2007 Wind River Systems, Inc. and others.
|
* Copyright (c) 2006, 2008 Wind River Systems, Inc. and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -8,7 +8,6 @@
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Markus Schorn - initial API and implementation
|
* Markus Schorn - initial API and implementation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
package org.eclipse.cdt.internal.core.pdom;
|
package org.eclipse.cdt.internal.core.pdom;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
@ -39,9 +38,9 @@ public class CModelListener implements IElementChangedListener, IResourceChangeL
|
||||||
private static final int UPDATE_LR_CHANGED_FILES_COUNT = 5;
|
private static final int UPDATE_LR_CHANGED_FILES_COUNT = 5;
|
||||||
|
|
||||||
private PDOMManager fManager;
|
private PDOMManager fManager;
|
||||||
private LinkedHashMap fLRUs= new LinkedHashMap(UPDATE_LR_CHANGED_FILES_COUNT, 0.75f, true) {
|
private LinkedHashMap<ITranslationUnit, ITranslationUnit> fLRUs= new LinkedHashMap<ITranslationUnit,ITranslationUnit>(UPDATE_LR_CHANGED_FILES_COUNT, 0.75f, true) {
|
||||||
@Override
|
@Override
|
||||||
protected boolean removeEldestEntry(Map.Entry eldest) {
|
protected boolean removeEldestEntry(Map.Entry<ITranslationUnit, ITranslationUnit> eldest) {
|
||||||
return size() > UPDATE_LR_CHANGED_FILES_COUNT;
|
return size() > UPDATE_LR_CHANGED_FILES_COUNT;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -56,21 +55,21 @@ public class CModelListener implements IElementChangedListener, IResourceChangeL
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Walk the delta collecting tu's per project
|
// Walk the delta collecting tu's per project
|
||||||
HashMap changeMap= new HashMap();
|
HashMap<ICProject, DeltaAnalyzer> changeMap= new HashMap<ICProject, DeltaAnalyzer>();
|
||||||
processDelta(event.getDelta(), changeMap);
|
processDelta(event.getDelta(), changeMap);
|
||||||
|
|
||||||
// bug 171834 update last recently changed sources
|
// bug 171834 update last recently changed sources
|
||||||
addLastRecentlyUsed(changeMap);
|
addLastRecentlyUsed(changeMap);
|
||||||
|
|
||||||
for (Iterator it = changeMap.entrySet().iterator(); it.hasNext();) {
|
for (Iterator<?> it = changeMap.entrySet().iterator(); it.hasNext();) {
|
||||||
Map.Entry entry = (Map.Entry) it.next();
|
Map.Entry<?, ?> entry = (Map.Entry<?, ?>) it.next();
|
||||||
ICProject cproject = (ICProject) entry.getKey();
|
ICProject cproject = (ICProject) entry.getKey();
|
||||||
DeltaAnalyzer analyzer= (DeltaAnalyzer) entry.getValue();
|
DeltaAnalyzer analyzer= (DeltaAnalyzer) entry.getValue();
|
||||||
fManager.changeProject(cproject, analyzer.getAddedTUs(), analyzer.getChangedTUs(), analyzer.getRemovedTUs());
|
fManager.changeProject(cproject, analyzer.getForcedTUs(), analyzer.getChangedTUs(), analyzer.getRemovedTUs());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void processDelta(ICElementDelta delta, HashMap changeMap) {
|
private void processDelta(ICElementDelta delta, HashMap<ICProject, DeltaAnalyzer> changeMap) {
|
||||||
int type = delta.getElement().getElementType();
|
int type = delta.getElement().getElementType();
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case ICElement.C_MODEL:
|
case ICElement.C_MODEL:
|
||||||
|
@ -99,7 +98,7 @@ public class CModelListener implements IElementChangedListener, IResourceChangeL
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void processProjectDelta(ICProject project, ICElementDelta delta, HashMap changeMap) {
|
private void processProjectDelta(ICProject project, ICElementDelta delta, HashMap<ICProject, DeltaAnalyzer> changeMap) {
|
||||||
IPDOMIndexer indexer = fManager.getIndexer(project);
|
IPDOMIndexer indexer = fManager.getIndexer(project);
|
||||||
if (indexer != null && indexer.getID().equals(IPDOMManager.ID_NO_INDEXER)) {
|
if (indexer != null && indexer.getID().equals(IPDOMManager.ID_NO_INDEXER)) {
|
||||||
return;
|
return;
|
||||||
|
@ -114,23 +113,15 @@ public class CModelListener implements IElementChangedListener, IResourceChangeL
|
||||||
changeMap.put(project, deltaAnalyzer);
|
changeMap.put(project, deltaAnalyzer);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addLastRecentlyUsed(HashMap changeMap) {
|
private void addLastRecentlyUsed(HashMap<ICProject, DeltaAnalyzer> changeMap) {
|
||||||
boolean addLRUs= false;
|
boolean addLRUs= false;
|
||||||
int count= 0;
|
int count= 0;
|
||||||
ITranslationUnit[] newLRUs= new ITranslationUnit[UPDATE_LR_CHANGED_FILES_COUNT];
|
ITranslationUnit[] newLRUs= new ITranslationUnit[UPDATE_LR_CHANGED_FILES_COUNT];
|
||||||
|
|
||||||
for (Iterator iterator = changeMap.values().iterator(); iterator.hasNext();) {
|
for (Iterator<DeltaAnalyzer> iterator = changeMap.values().iterator(); iterator.hasNext();) {
|
||||||
DeltaAnalyzer analyzer = (DeltaAnalyzer) iterator.next();
|
DeltaAnalyzer analyzer = iterator.next();
|
||||||
List l= analyzer.getAddedList();
|
List<?> l= analyzer.getChangedList();
|
||||||
for (Iterator it = l.iterator(); it.hasNext();) {
|
for (Iterator<?> it = l.iterator(); it.hasNext();) {
|
||||||
ITranslationUnit tu= (ITranslationUnit) it.next();
|
|
||||||
newLRUs[count++ % UPDATE_LR_CHANGED_FILES_COUNT]= tu;
|
|
||||||
if (!addLRUs && tu.isHeaderUnit()) {
|
|
||||||
addLRUs= true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
l= analyzer.getChangedList();
|
|
||||||
for (Iterator it = l.iterator(); it.hasNext();) {
|
|
||||||
ITranslationUnit tu= (ITranslationUnit) it.next();
|
ITranslationUnit tu= (ITranslationUnit) it.next();
|
||||||
newLRUs[count++ % UPDATE_LR_CHANGED_FILES_COUNT]= tu;
|
newLRUs[count++ % UPDATE_LR_CHANGED_FILES_COUNT]= tu;
|
||||||
if (!addLRUs && tu.isHeaderUnit()) {
|
if (!addLRUs && tu.isHeaderUnit()) {
|
||||||
|
@ -141,16 +132,16 @@ public class CModelListener implements IElementChangedListener, IResourceChangeL
|
||||||
|
|
||||||
if (count > 0) {
|
if (count > 0) {
|
||||||
if (addLRUs) {
|
if (addLRUs) {
|
||||||
for (Iterator it = fLRUs.keySet().iterator(); it.hasNext();) {
|
for (Iterator<ITranslationUnit> it = fLRUs.keySet().iterator(); it.hasNext();) {
|
||||||
final ITranslationUnit tu = (ITranslationUnit) it.next();
|
final ITranslationUnit tu = it.next();
|
||||||
if (tu.getResource().exists()) {
|
if (tu.getResource().exists()) {
|
||||||
final ICProject cproject= tu.getCProject();
|
final ICProject cproject= tu.getCProject();
|
||||||
DeltaAnalyzer analyzer= (DeltaAnalyzer) changeMap.get(cproject);
|
DeltaAnalyzer analyzer= changeMap.get(cproject);
|
||||||
if (analyzer == null) {
|
if (analyzer == null) {
|
||||||
analyzer= new DeltaAnalyzer();
|
analyzer= new DeltaAnalyzer();
|
||||||
changeMap.put(cproject, analyzer);
|
changeMap.put(cproject, analyzer);
|
||||||
}
|
}
|
||||||
analyzer.getChangedList().add(tu);
|
analyzer.getForcedList().add(tu);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,6 @@
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Markus Schorn - initial API and implementation
|
* Markus Schorn - initial API and implementation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
package org.eclipse.cdt.internal.core.pdom;
|
package org.eclipse.cdt.internal.core.pdom;
|
||||||
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
@ -30,8 +29,8 @@ public class IndexUpdatePolicy {
|
||||||
private final ICProject fCProject;
|
private final ICProject fCProject;
|
||||||
private int fKind;
|
private int fKind;
|
||||||
|
|
||||||
private HashSet<ITranslationUnit> fAdded= new HashSet<ITranslationUnit>();
|
private HashSet<ITranslationUnit> fForce= new HashSet<ITranslationUnit>();
|
||||||
private HashSet<ITranslationUnit> fChanged= new HashSet<ITranslationUnit>();
|
private HashSet<ITranslationUnit> fTimestamp= new HashSet<ITranslationUnit>();
|
||||||
private HashSet<ITranslationUnit> fRemoved= new HashSet<ITranslationUnit>();
|
private HashSet<ITranslationUnit> fRemoved= new HashSet<ITranslationUnit>();
|
||||||
private IPDOMIndexer fIndexer;
|
private IPDOMIndexer fIndexer;
|
||||||
private boolean fReindexRequested;
|
private boolean fReindexRequested;
|
||||||
|
@ -56,25 +55,13 @@ public class IndexUpdatePolicy {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void clearTUs() {
|
public void clearTUs() {
|
||||||
fAdded.clear();
|
fForce.clear();
|
||||||
fChanged.clear();
|
fTimestamp.clear();
|
||||||
fRemoved.clear();
|
fRemoved.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasTUs() {
|
public boolean hasTUs() {
|
||||||
return !(fAdded.isEmpty() && fChanged.isEmpty() && fRemoved.isEmpty());
|
return !(fForce.isEmpty() && fTimestamp.isEmpty() && fRemoved.isEmpty());
|
||||||
}
|
|
||||||
|
|
||||||
private ITranslationUnit[] getAdded() {
|
|
||||||
return fAdded.toArray(new ITranslationUnit[fAdded.size()]);
|
|
||||||
}
|
|
||||||
|
|
||||||
private ITranslationUnit[] getChanged() {
|
|
||||||
return fChanged.toArray(new ITranslationUnit[fChanged.size()]);
|
|
||||||
}
|
|
||||||
|
|
||||||
private ITranslationUnit[] getRemoved() {
|
|
||||||
return fRemoved.toArray(new ITranslationUnit[fRemoved.size()]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setIndexer(IPDOMIndexer indexer) {
|
public void setIndexer(IPDOMIndexer indexer) {
|
||||||
|
@ -85,7 +72,7 @@ public class IndexUpdatePolicy {
|
||||||
return fIndexer;
|
return fIndexer;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IPDOMIndexerTask handleDelta(ITranslationUnit[] added, ITranslationUnit[] changed, ITranslationUnit[] removed) {
|
public IPDOMIndexerTask handleDelta(ITranslationUnit[] force, ITranslationUnit[] changed, ITranslationUnit[] removed) {
|
||||||
if (isNullIndexer()) {
|
if (isNullIndexer()) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -95,28 +82,27 @@ public class IndexUpdatePolicy {
|
||||||
return null;
|
return null;
|
||||||
case IndexUpdatePolicy.POST_CHANGE:
|
case IndexUpdatePolicy.POST_CHANGE:
|
||||||
if (fIndexer != null) {
|
if (fIndexer != null) {
|
||||||
return fIndexer.createTask(added, changed, removed);
|
return fIndexer.createTask(force, changed, removed);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < removed.length; i++) {
|
for (int i = 0; i < removed.length; i++) {
|
||||||
ITranslationUnit tu = removed[i];
|
ITranslationUnit tu = removed[i];
|
||||||
fAdded.remove(tu);
|
fForce.remove(tu);
|
||||||
fChanged.remove(tu);
|
fTimestamp.remove(tu);
|
||||||
fRemoved.add(tu);
|
fRemoved.add(tu);
|
||||||
}
|
}
|
||||||
for (int i = 0; i < added.length; i++) {
|
for (int i = 0; i < force.length; i++) {
|
||||||
ITranslationUnit tu = added[i];
|
ITranslationUnit tu = force[i];
|
||||||
if (!fChanged.contains(tu)) {
|
fForce.add(tu);
|
||||||
fAdded.add(tu);
|
fTimestamp.remove(tu);
|
||||||
}
|
|
||||||
fRemoved.remove(tu);
|
fRemoved.remove(tu);
|
||||||
}
|
}
|
||||||
for (int i = 0; i < changed.length; i++) {
|
for (int i = 0; i < changed.length; i++) {
|
||||||
ITranslationUnit tu = changed[i];
|
ITranslationUnit tu = changed[i];
|
||||||
if (!fAdded.contains(tu)) {
|
if (!fForce.contains(tu)) {
|
||||||
fChanged.add(tu);
|
fTimestamp.add(tu);
|
||||||
}
|
}
|
||||||
fRemoved.remove(tu);
|
fRemoved.remove(tu);
|
||||||
}
|
}
|
||||||
|
@ -127,13 +113,17 @@ public class IndexUpdatePolicy {
|
||||||
IPDOMIndexerTask task= null;
|
IPDOMIndexerTask task= null;
|
||||||
if (fIndexer != null && hasTUs()) {
|
if (fIndexer != null && hasTUs()) {
|
||||||
if (fKind != IndexUpdatePolicy.MANUAL && !isNullIndexer()) {
|
if (fKind != IndexUpdatePolicy.MANUAL && !isNullIndexer()) {
|
||||||
task= fIndexer.createTask(getAdded(), getChanged(), getRemoved());
|
task= fIndexer.createTask(toarray(fForce), toarray(fTimestamp), toarray(fRemoved));
|
||||||
}
|
}
|
||||||
clearTUs();
|
clearTUs();
|
||||||
}
|
}
|
||||||
return task;
|
return task;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private ITranslationUnit[] toarray(HashSet<ITranslationUnit> set) {
|
||||||
|
return set.toArray(new ITranslationUnit[set.size()]);
|
||||||
|
}
|
||||||
|
|
||||||
private boolean isNullIndexer() {
|
private boolean isNullIndexer() {
|
||||||
return fIndexer != null && fIndexer.getID().equals(IPDOMManager.ID_NO_INDEXER);
|
return fIndexer != null && fIndexer.getID().equals(IPDOMManager.ID_NO_INDEXER);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2007 Wind River Systems, Inc. and others.
|
* Copyright (c) 2007, 2008 Wind River Systems, Inc. and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -8,7 +8,6 @@
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Markus Schorn - initial API and implementation
|
* Markus Schorn - initial API and implementation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
package org.eclipse.cdt.internal.core.pdom.indexer;
|
package org.eclipse.cdt.internal.core.pdom.indexer;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -23,7 +22,7 @@ import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||||
|
|
||||||
public class DeltaAnalyzer {
|
public class DeltaAnalyzer {
|
||||||
private List<ITranslationUnit> fAdded= new ArrayList<ITranslationUnit>();
|
private List<ITranslationUnit> fForce= new ArrayList<ITranslationUnit>();
|
||||||
private List<ITranslationUnit> fChanged= new ArrayList<ITranslationUnit>();
|
private List<ITranslationUnit> fChanged= new ArrayList<ITranslationUnit>();
|
||||||
private List<ITranslationUnit> fRemoved= new ArrayList<ITranslationUnit>();
|
private List<ITranslationUnit> fRemoved= new ArrayList<ITranslationUnit>();
|
||||||
|
|
||||||
|
@ -56,7 +55,7 @@ public class DeltaAnalyzer {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ICElementDelta.ADDED:
|
case ICElementDelta.ADDED:
|
||||||
fAdded.add(tu);
|
fChanged.add(tu);
|
||||||
break;
|
break;
|
||||||
case ICElementDelta.REMOVED:
|
case ICElementDelta.REMOVED:
|
||||||
fRemoved.add(tu);
|
fRemoved.add(tu);
|
||||||
|
@ -67,7 +66,7 @@ public class DeltaAnalyzer {
|
||||||
case ICElement.C_CCONTAINER:
|
case ICElement.C_CCONTAINER:
|
||||||
ICContainer folder= (ICContainer) element;
|
ICContainer folder= (ICContainer) element;
|
||||||
if (delta.getKind() == ICElementDelta.ADDED) {
|
if (delta.getKind() == ICElementDelta.ADDED) {
|
||||||
collectSources(folder, fAdded);
|
collectSources(folder, fChanged);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -77,8 +76,8 @@ public class DeltaAnalyzer {
|
||||||
container.accept(new TranslationUnitCollector(sources, sources, new NullProgressMonitor()));
|
container.accept(new TranslationUnitCollector(sources, sources, new NullProgressMonitor()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public ITranslationUnit[] getAddedTUs() {
|
public ITranslationUnit[] getForcedTUs() {
|
||||||
return fAdded.toArray(new ITranslationUnit[fAdded.size()]);
|
return fForce.toArray(new ITranslationUnit[fForce.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ITranslationUnit[] getChangedTUs() {
|
public ITranslationUnit[] getChangedTUs() {
|
||||||
|
@ -89,8 +88,8 @@ public class DeltaAnalyzer {
|
||||||
return fRemoved.toArray(new ITranslationUnit[fRemoved.size()]);
|
return fRemoved.toArray(new ITranslationUnit[fRemoved.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<ITranslationUnit> getAddedList() {
|
public List<ITranslationUnit> getForcedList() {
|
||||||
return fAdded;
|
return fForce;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<ITranslationUnit> getChangedList() {
|
public List<ITranslationUnit> getChangedList() {
|
||||||
|
|
|
@ -9,7 +9,6 @@
|
||||||
* Markus Schorn - initial API and implementation
|
* Markus Schorn - initial API and implementation
|
||||||
* Sergey Prigogin (Google)
|
* Sergey Prigogin (Google)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
package org.eclipse.cdt.internal.core.pdom.indexer;
|
package org.eclipse.cdt.internal.core.pdom.indexer;
|
||||||
|
|
||||||
import java.text.NumberFormat;
|
import java.text.NumberFormat;
|
||||||
|
@ -20,6 +19,7 @@ import org.eclipse.cdt.core.CCorePlugin;
|
||||||
import org.eclipse.cdt.core.dom.ILinkage;
|
import org.eclipse.cdt.core.dom.ILinkage;
|
||||||
import org.eclipse.cdt.core.dom.IPDOMIndexer;
|
import org.eclipse.cdt.core.dom.IPDOMIndexer;
|
||||||
import org.eclipse.cdt.core.dom.IPDOMIndexerTask;
|
import org.eclipse.cdt.core.dom.IPDOMIndexerTask;
|
||||||
|
import org.eclipse.cdt.core.index.IIndexManager;
|
||||||
import org.eclipse.cdt.core.model.AbstractLanguage;
|
import org.eclipse.cdt.core.model.AbstractLanguage;
|
||||||
import org.eclipse.cdt.core.model.ICProject;
|
import org.eclipse.cdt.core.model.ICProject;
|
||||||
import org.eclipse.cdt.core.model.ILanguage;
|
import org.eclipse.cdt.core.model.ILanguage;
|
||||||
|
@ -54,9 +54,9 @@ public abstract class PDOMIndexerTask extends AbstractIndexerTask implements IPD
|
||||||
private AbstractPDOMIndexer fIndexer;
|
private AbstractPDOMIndexer fIndexer;
|
||||||
private boolean fWriteInfoToLog;
|
private boolean fWriteInfoToLog;
|
||||||
|
|
||||||
protected PDOMIndexerTask(ITranslationUnit[] addFiles, ITranslationUnit[] updateFiles, ITranslationUnit[] removeFiles,
|
protected PDOMIndexerTask(ITranslationUnit[] forceFiles, ITranslationUnit[] updateFiles, ITranslationUnit[] removeFiles,
|
||||||
AbstractPDOMIndexer indexer, boolean isFastIndexer) {
|
AbstractPDOMIndexer indexer, boolean isFastIndexer) {
|
||||||
super(concat(addFiles, updateFiles), removeFiles, new ProjectIndexerInputAdapter(indexer.getProject()), isFastIndexer);
|
super(concat(forceFiles, updateFiles), removeFiles, new ProjectIndexerInputAdapter(indexer.getProject()), isFastIndexer);
|
||||||
fIndexer= indexer;
|
fIndexer= indexer;
|
||||||
setShowActivity(checkDebugOption(TRACE_ACTIVITY, TRUE));
|
setShowActivity(checkDebugOption(TRACE_ACTIVITY, TRUE));
|
||||||
setShowInclusionProblems(checkDebugOption(TRACE_INCLUSION_PROBLEMS, TRUE));
|
setShowInclusionProblems(checkDebugOption(TRACE_INCLUSION_PROBLEMS, TRUE));
|
||||||
|
@ -86,6 +86,8 @@ public abstract class PDOMIndexerTask extends AbstractIndexerTask implements IPD
|
||||||
setIndexFilesWithoutBuildConfiguration(false);
|
setIndexFilesWithoutBuildConfiguration(false);
|
||||||
setIndexHeadersWithoutContext(false);
|
setIndexHeadersWithoutContext(false);
|
||||||
}
|
}
|
||||||
|
setUpdateFlags(IIndexManager.UPDATE_CHECK_TIMESTAMPS);
|
||||||
|
setForceFirstFiles(forceFiles.length);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static ITranslationUnit[] concat(ITranslationUnit[] added, ITranslationUnit[] changed) {
|
private static ITranslationUnit[] concat(ITranslationUnit[] added, ITranslationUnit[] changed) {
|
||||||
|
|
|
@ -87,7 +87,7 @@ public class PDOMUpdateTask implements IPDOMIndexerTask {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ITranslationUnit[] tus= set.toArray(new ITranslationUnit[set.size()]);
|
ITranslationUnit[] tus= set.toArray(new ITranslationUnit[set.size()]);
|
||||||
IPDOMIndexerTask delegate= fIndexer.createTask(tus, NO_TUS, NO_TUS);
|
IPDOMIndexerTask delegate= fIndexer.createTask(NO_TUS, tus, NO_TUS);
|
||||||
if (delegate instanceof PDOMIndexerTask) {
|
if (delegate instanceof PDOMIndexerTask) {
|
||||||
final PDOMIndexerTask task = (PDOMIndexerTask) delegate;
|
final PDOMIndexerTask task = (PDOMIndexerTask) delegate;
|
||||||
task.setUpdateFlags(fUpdateOptions);
|
task.setUpdateFlags(fUpdateOptions);
|
||||||
|
|
Loading…
Add table
Reference in a new issue