mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Cosmetics.
This commit is contained in:
parent
365587f654
commit
ad6104f082
8 changed files with 69 additions and 86 deletions
|
@ -133,7 +133,7 @@ public class CModelManager implements IResourceChangeListener, IContentTypeChang
|
||||||
/**
|
/**
|
||||||
* Set of elements which are out of sync with their buffers.
|
* Set of elements which are out of sync with their buffers.
|
||||||
*/
|
*/
|
||||||
protected Map<ICElement,ICElement> elementsOutOfSynchWithBuffers = new HashMap<ICElement, ICElement>(11);
|
protected Map<ICElement, ICElement> elementsOutOfSynchWithBuffers = new HashMap<ICElement, ICElement>(11);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Temporary cache of newly opened elements
|
* Temporary cache of newly opened elements
|
||||||
|
@ -378,11 +378,11 @@ public class CModelManager implements IResourceChangeListener, IContentTypeChang
|
||||||
|
|
||||||
if (bin.getType() == IBinaryFile.ARCHIVE) {
|
if (bin.getType() == IBinaryFile.ARCHIVE) {
|
||||||
ArchiveContainer vlib = (ArchiveContainer)cproject.getArchiveContainer();
|
ArchiveContainer vlib = (ArchiveContainer)cproject.getArchiveContainer();
|
||||||
celement = new Archive(cfolder, file, (IBinaryArchive)bin);
|
celement = new Archive(cfolder, file, (IBinaryArchive) bin);
|
||||||
vlib.addChild(celement);
|
vlib.addChild(celement);
|
||||||
} else {
|
} else {
|
||||||
BinaryContainer vbin = (BinaryContainer)cproject.getBinaryContainer();
|
BinaryContainer vbin = (BinaryContainer)cproject.getBinaryContainer();
|
||||||
celement = new Binary(cfolder, file, (IBinaryObject)bin);
|
celement = new Binary(cfolder, file, (IBinaryObject) bin);
|
||||||
vbin.addChild(celement);
|
vbin.addChild(celement);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -421,7 +421,7 @@ public class CModelManager implements IResourceChangeListener, IContentTypeChang
|
||||||
} catch (CModelException e) {
|
} catch (CModelException e) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// if the file exists and it has a known C/C++ file extension then just create
|
// If the file exists and it has a known C/C++ file extension then just create
|
||||||
// an external translation unit for it.
|
// an external translation unit for it.
|
||||||
if (contentTypeId != null && path.toFile().exists()) {
|
if (contentTypeId != null && path.toFile().exists()) {
|
||||||
// TODO: use URI
|
// TODO: use URI
|
||||||
|
@ -470,41 +470,42 @@ public class CModelManager implements IResourceChangeListener, IContentTypeChang
|
||||||
IFileStore fileStore = null;
|
IFileStore fileStore = null;
|
||||||
try {
|
try {
|
||||||
fileStore = EFS.getStore(locationURI);
|
fileStore = EFS.getStore(locationURI);
|
||||||
} catch (CoreException e1) {
|
} catch (CoreException e) {
|
||||||
CCorePlugin.log(e1);
|
CCorePlugin.log(e);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
final String contentTypeId = CoreModel.getRegistedContentTypeId(project, fileStore.getName());
|
final String contentTypeId = CoreModel.getRegistedContentTypeId(project, fileStore.getName());
|
||||||
if (!Util.isNonZeroLengthFile(locationURI)) {
|
if (!Util.isNonZeroLengthFile(locationURI)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
IIncludeReference[] includeReferences = cproject.getIncludeReferences();
|
IIncludeReference[] includeReferences = cproject.getIncludeReferences();
|
||||||
for (IIncludeReference includeReference : includeReferences) {
|
for (IIncludeReference includeReference : includeReferences) {
|
||||||
// crecoskie
|
// crecoskie
|
||||||
// TODO FIXME: include entries don't handle URIs yet
|
// TODO FIXME: include entries don't handle URIs yet
|
||||||
IPath path = URIUtil.toPath(locationURI);
|
IPath path = URIUtil.toPath(locationURI);
|
||||||
if (path != null && includeReference.isOnIncludeEntry(path)) {
|
if (path != null && includeReference.isOnIncludeEntry(path)) {
|
||||||
String headerContentTypeId= contentTypeId;
|
String headerContentTypeId= contentTypeId;
|
||||||
if (headerContentTypeId == null) {
|
if (headerContentTypeId == null) {
|
||||||
headerContentTypeId= CoreModel.hasCCNature(project) ? CCorePlugin.CONTENT_TYPE_CXXHEADER : CCorePlugin.CONTENT_TYPE_CHEADER;
|
headerContentTypeId= CoreModel.hasCCNature(project) ?
|
||||||
}
|
CCorePlugin.CONTENT_TYPE_CXXHEADER : CCorePlugin.CONTENT_TYPE_CHEADER;
|
||||||
|
|
||||||
return new ExternalTranslationUnit(includeReference, locationURI, headerContentTypeId);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return new ExternalTranslationUnit(includeReference, locationURI, headerContentTypeId);
|
||||||
}
|
}
|
||||||
} catch (CModelException e) {
|
|
||||||
}
|
}
|
||||||
|
} catch (CModelException e) {
|
||||||
|
}
|
||||||
|
|
||||||
// if the file exists and it has a known C/C++ file extension then just create
|
// if the file exists and it has a known C/C++ file extension then just create
|
||||||
// an external translation unit for it.
|
// an external translation unit for it.
|
||||||
IFileInfo info = fileStore.fetchInfo();
|
IFileInfo info = fileStore.fetchInfo();
|
||||||
|
|
||||||
if (contentTypeId != null && info != null && info.exists()) {
|
if (contentTypeId != null && info != null && info.exists()) {
|
||||||
return new ExternalTranslationUnit(cproject, locationURI, contentTypeId);
|
return new ExternalTranslationUnit(cproject, locationURI, contentTypeId);
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -663,11 +664,11 @@ public class CModelManager implements IResourceChangeListener, IContentTypeChang
|
||||||
}
|
}
|
||||||
|
|
||||||
URI fileUri = file.getLocationURI();
|
URI fileUri = file.getLocationURI();
|
||||||
//Avoid name special devices, empty files and the like
|
// Avoid name special devices, empty files and the like
|
||||||
if (!Util.isNonZeroLengthFile(fileUri)) {
|
if (!Util.isNonZeroLengthFile(fileUri)) {
|
||||||
// PR:xxx the EFS does not seem to work for newly created file
|
// PR:xxx the EFS does not seem to work for newly created file
|
||||||
// so before bailing out give another try?
|
// so before bailing out give another try?
|
||||||
//Avoid name special devices, empty files and the like
|
// Avoid name special devices, empty files and the like
|
||||||
if("file".equals(fileUri.getScheme())) { //$NON-NLS-1$
|
if("file".equals(fileUri.getScheme())) { //$NON-NLS-1$
|
||||||
File f = new File(fileUri);
|
File f = new File(fileUri);
|
||||||
if (f.length() == 0) {
|
if (f.length() == 0) {
|
||||||
|
@ -770,14 +771,14 @@ public class CModelManager implements IResourceChangeListener, IContentTypeChang
|
||||||
runner = binaryRunners.get(project);
|
runner = binaryRunners.get(project);
|
||||||
}
|
}
|
||||||
if (runner == null) {
|
if (runner == null) {
|
||||||
// creation of BinaryRunner must occur outside the synchronized block
|
// Creation of BinaryRunner must occur outside the synchronized block
|
||||||
runner = new BinaryRunner(project);
|
runner = new BinaryRunner(project);
|
||||||
synchronized (binaryRunners) {
|
synchronized (binaryRunners) {
|
||||||
if (binaryRunners.get(project) == null) {
|
if (binaryRunners.get(project) == null) {
|
||||||
binaryRunners.put(project, runner);
|
binaryRunners.put(project, runner);
|
||||||
runner.start();
|
runner.start();
|
||||||
} else {
|
} else {
|
||||||
// another thread was faster
|
// Another thread was faster
|
||||||
runner = binaryRunners.get(project);
|
runner = binaryRunners.get(project);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -920,12 +921,12 @@ public class CModelManager implements IResourceChangeListener, IContentTypeChang
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ((flags & ICDescriptionDelta.EXT_REF) != 0) {
|
if ((flags & ICDescriptionDelta.EXT_REF) != 0) {
|
||||||
// update binary parsers
|
// Update binary parsers
|
||||||
IProject project = newDes.getProject();
|
IProject project = newDes.getProject();
|
||||||
try {
|
try {
|
||||||
ICConfigExtensionReference[] newExts = CCorePlugin.getDefault().getDefaultBinaryParserExtensions(project);
|
ICConfigExtensionReference[] newExts = CCorePlugin.getDefault().getDefaultBinaryParserExtensions(project);
|
||||||
BinaryParserConfig[] currentConfigs = binaryParsersMap.get(project);
|
BinaryParserConfig[] currentConfigs = binaryParsersMap.get(project);
|
||||||
// anything added/removed
|
// Anything added/removed
|
||||||
if (currentConfigs != null) {
|
if (currentConfigs != null) {
|
||||||
if (newExts.length != currentConfigs.length) {
|
if (newExts.length != currentConfigs.length) {
|
||||||
resetBinaryParser(project);
|
resetBinaryParser(project);
|
||||||
|
@ -959,9 +960,6 @@ public class CModelManager implements IResourceChangeListener, IContentTypeChang
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.core.runtime.content.IContentTypeManager.IContentTypeListener#contentTypeChanged()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void contentTypeChanged(ContentTypeChangeEvent event) {
|
public void contentTypeChanged(ContentTypeChangeEvent event) {
|
||||||
ContentTypeProcessor.processContentTypeChanges(new ContentTypeChangeEvent[]{ event });
|
ContentTypeProcessor.processContentTypeChanges(new ContentTypeChangeEvent[]{ event });
|
||||||
|
@ -1048,7 +1046,7 @@ public class CModelManager implements IResourceChangeListener, IContentTypeChang
|
||||||
System.out.println(deltaToNotify == null ? "<NONE>" : deltaToNotify.toString()); //$NON-NLS-1$
|
System.out.println(deltaToNotify == null ? "<NONE>" : deltaToNotify.toString()); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
if (deltaToNotify != null) {
|
if (deltaToNotify != null) {
|
||||||
// flush now so as to keep listener reactions to post their own deltas for subsequent iteration
|
// flush now so as to keep listener reactions to post their own deltas for subsequent iteration
|
||||||
this.flush();
|
this.flush();
|
||||||
notifyListeners(deltaToNotify, ElementChangedEvent.POST_CHANGE, listeners, listenerMask, listenerCount);
|
notifyListeners(deltaToNotify, ElementChangedEvent.POST_CHANGE, listeners, listenerMask, listenerCount);
|
||||||
}
|
}
|
||||||
|
@ -1061,7 +1059,7 @@ public class CModelManager implements IResourceChangeListener, IContentTypeChang
|
||||||
System.out.println(deltaToNotify == null ? "<NONE>" : deltaToNotify.toString()); //$NON-NLS-1$
|
System.out.println(deltaToNotify == null ? "<NONE>" : deltaToNotify.toString()); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
if (deltaToNotify != null) {
|
if (deltaToNotify != null) {
|
||||||
// flush now so as to keep listener reactions to post their own deltas for subsequent iteration
|
// Flush now so as to keep listener reactions to post their own deltas for subsequent iteration
|
||||||
this.reconcileDeltas = new HashMap<IWorkingCopy, ICElementDelta>();
|
this.reconcileDeltas = new HashMap<IWorkingCopy, ICElementDelta>();
|
||||||
notifyListeners(deltaToNotify, ElementChangedEvent.POST_RECONCILE, listeners, listenerMask, listenerCount);
|
notifyListeners(deltaToNotify, ElementChangedEvent.POST_RECONCILE, listeners, listenerMask, listenerCount);
|
||||||
}
|
}
|
||||||
|
@ -1069,7 +1067,7 @@ public class CModelManager implements IResourceChangeListener, IContentTypeChang
|
||||||
|
|
||||||
private void fireShiftEvent(ICElementDelta deltaToNotify, IElementChangedListener[] listeners,
|
private void fireShiftEvent(ICElementDelta deltaToNotify, IElementChangedListener[] listeners,
|
||||||
int[] listenerMask, int listenerCount) {
|
int[] listenerMask, int listenerCount) {
|
||||||
// post change deltas
|
// Post change deltas
|
||||||
if (Util.VERBOSE_DELTA) {
|
if (Util.VERBOSE_DELTA) {
|
||||||
System.out.println("FIRING POST_SHIFT event [" + Thread.currentThread() + "]:"); //$NON-NLS-1$//$NON-NLS-2$
|
System.out.println("FIRING POST_SHIFT event [" + Thread.currentThread() + "]:"); //$NON-NLS-1$//$NON-NLS-2$
|
||||||
System.out.println(deltaToNotify == null ? "<NONE>" : deltaToNotify.toString()); //$NON-NLS-1$
|
System.out.println(deltaToNotify == null ? "<NONE>" : deltaToNotify.toString()); //$NON-NLS-1$
|
||||||
|
@ -1092,7 +1090,7 @@ public class CModelManager implements IResourceChangeListener, IContentTypeChang
|
||||||
System.out.print("Listener #" + (i + 1) + "=" + listener.toString());//$NON-NLS-1$//$NON-NLS-2$
|
System.out.print("Listener #" + (i + 1) + "=" + listener.toString());//$NON-NLS-1$//$NON-NLS-2$
|
||||||
start = System.currentTimeMillis();
|
start = System.currentTimeMillis();
|
||||||
}
|
}
|
||||||
// wrap callbacks with Safe runnable for subsequent listeners to be called when some are causing grief
|
// Wrap callbacks with Safe runnable for subsequent listeners to be called when some are causing grief
|
||||||
SafeRunner.run(new ISafeRunnable() {
|
SafeRunner.run(new ISafeRunnable() {
|
||||||
@Override
|
@Override
|
||||||
public void handleException(Throwable exception) {
|
public void handleException(Throwable exception) {
|
||||||
|
|
|
@ -10,7 +10,6 @@
|
||||||
* Anton Leherbauer (Wind River Systems)
|
* Anton Leherbauer (Wind River Systems)
|
||||||
* Warren Paul (Nokia) - Bug 218266
|
* Warren Paul (Nokia) - Bug 218266
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
package org.eclipse.cdt.internal.core.model;
|
package org.eclipse.cdt.internal.core.model;
|
||||||
|
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* IBM Rational Software - Initial API and implementation
|
* IBM Rational Software - Initial API and implementation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.parser.scanner;
|
package org.eclipse.cdt.internal.core.parser.scanner;
|
||||||
|
|
||||||
|
@ -14,10 +14,8 @@ import java.io.File;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author jcamelon
|
* @author jcamelon
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public class ScannerUtility {
|
public class ScannerUtility {
|
||||||
|
|
||||||
static final char DOT = '.';
|
static final char DOT = '.';
|
||||||
static final char SLASH = '/';
|
static final char SLASH = '/';
|
||||||
static final char BSLASH = '\\';
|
static final char BSLASH = '\\';
|
||||||
|
@ -68,8 +66,7 @@ public class ScannerUtility {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (int i= 0; i < len; i++) {
|
||||||
for (int i=0; i<len; i++) {
|
|
||||||
char c = ein[i];
|
char c = ein[i];
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case QUOTE: // quotes are removed
|
case QUOTE: // quotes are removed
|
||||||
|
@ -83,35 +80,24 @@ public class ScannerUtility {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case DOT:
|
case DOT:
|
||||||
// no separator before, not a 1st string symbol.
|
// No separator before, not a 1st string symbol.
|
||||||
if (noSepBefore && j>0)
|
if (noSepBefore && j > 0) {
|
||||||
aus[j++] = c;
|
aus[j++] = c;
|
||||||
else { // separator before "." !
|
} else { // Separator before "."
|
||||||
if (i < len1) {
|
if (i < len1) {
|
||||||
c = ein[i+1]; // check for next symbol
|
c = ein[i + 1]; // Check for next symbol
|
||||||
// check for "/./" case
|
// Check for "/./" case
|
||||||
if (c == SLASH || c == BSLASH) {
|
if (c == SLASH || c == BSLASH) {
|
||||||
// write nothing to output
|
// Write nothing to output, skip the next symbol
|
||||||
// skip the next symbol
|
|
||||||
i++;
|
i++;
|
||||||
noSepBefore = false;
|
noSepBefore = false;
|
||||||
}
|
} else { // Process as usual
|
||||||
// symbol other than "." - write it also
|
|
||||||
else if (c != DOT) {
|
|
||||||
i++;
|
i++;
|
||||||
noSepBefore = true;
|
noSepBefore = true;
|
||||||
aus[j++] = DOT;
|
aus[j++] = DOT;
|
||||||
aus[j++] = c;
|
aus[j++] = c;
|
||||||
}
|
}
|
||||||
// Processed as usual
|
}
|
||||||
else {
|
|
||||||
i++;
|
|
||||||
noSepBefore = true;
|
|
||||||
aus[j++] = DOT;
|
|
||||||
aus[j++] = DOT;
|
|
||||||
}
|
|
||||||
} else
|
|
||||||
{} // do nothing when "." is last symbol
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -125,10 +111,10 @@ public class ScannerUtility {
|
||||||
/**
|
/**
|
||||||
* @param path - include path
|
* @param path - include path
|
||||||
* @param fileName - include file name
|
* @param fileName - include file name
|
||||||
* @return - reconsiled path
|
* @return - reconciled path
|
||||||
*/
|
*/
|
||||||
public static String createReconciledPath(String path, String fileName) {
|
public static String createReconciledPath(String path, String fileName) {
|
||||||
boolean pathEmpty = (path == null || path.length() == 0);
|
boolean pathEmpty = (path == null || path.length() == 0);
|
||||||
return (pathEmpty ? fileName : reconcilePath(path + File.separatorChar + fileName));
|
return pathEmpty ? fileName : reconcilePath(path + File.separatorChar + fileName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -307,6 +307,7 @@ public abstract class AbstractIndexerTask extends PDOMWriter {
|
||||||
private final LinkedList<AbstractIndexerTask> fUrgentTasks;
|
private final LinkedList<AbstractIndexerTask> fUrgentTasks;
|
||||||
boolean fTaskCompleted;
|
boolean fTaskCompleted;
|
||||||
private IndexerProgress fInfo= new IndexerProgress();
|
private IndexerProgress fInfo= new IndexerProgress();
|
||||||
|
|
||||||
public AbstractIndexerTask(Object[] filesToUpdate, Object[] filesToRemove,
|
public AbstractIndexerTask(Object[] filesToUpdate, Object[] filesToRemove,
|
||||||
IndexerInputAdapter resolver, boolean fastIndexer) {
|
IndexerInputAdapter resolver, boolean fastIndexer) {
|
||||||
super(resolver);
|
super(resolver);
|
||||||
|
@ -384,6 +385,7 @@ public abstract class AbstractIndexerTask extends PDOMWriter {
|
||||||
protected abstract IWritableIndex createIndex();
|
protected abstract IWritableIndex createIndex();
|
||||||
protected abstract IIncludeFileResolutionHeuristics createIncludeHeuristics();
|
protected abstract IIncludeFileResolutionHeuristics createIncludeHeuristics();
|
||||||
protected abstract IncludeFileContentProvider createReaderFactory();
|
protected abstract IncludeFileContentProvider createReaderFactory();
|
||||||
|
|
||||||
protected ITodoTaskUpdater createTodoTaskUpdater() {
|
protected ITodoTaskUpdater createTodoTaskUpdater() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,10 +6,9 @@
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* QNX - Initial API and implementation
|
* QNX - Initial API and implementation
|
||||||
* Markus Schorn (Wind River Systems)
|
* Markus Schorn (Wind River Systems)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
package org.eclipse.cdt.internal.core.pdom.indexer;
|
package org.eclipse.cdt.internal.core.pdom.indexer;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.model.ITranslationUnit;
|
import org.eclipse.cdt.core.model.ITranslationUnit;
|
||||||
|
@ -20,6 +19,7 @@ import org.eclipse.cdt.internal.core.dom.IIncludeFileResolutionHeuristics;
|
||||||
* Configures the abstract indexer to return tasks suitable for fast indexing.
|
* Configures the abstract indexer to return tasks suitable for fast indexing.
|
||||||
*/
|
*/
|
||||||
class PDOMFastIndexerTask extends PDOMIndexerTask {
|
class PDOMFastIndexerTask extends PDOMIndexerTask {
|
||||||
|
|
||||||
public PDOMFastIndexerTask(PDOMFastIndexer indexer, ITranslationUnit[] added,
|
public PDOMFastIndexerTask(PDOMFastIndexer indexer, ITranslationUnit[] added,
|
||||||
ITranslationUnit[] changed, ITranslationUnit[] removed) {
|
ITranslationUnit[] changed, ITranslationUnit[] removed) {
|
||||||
super(added, changed, removed, indexer, true);
|
super(added, changed, removed, indexer, true);
|
||||||
|
|
|
@ -43,7 +43,7 @@ import org.eclipse.osgi.util.NLS;
|
||||||
*/
|
*/
|
||||||
public class PDOMUpdateTask implements IPDOMIndexerTask {
|
public class PDOMUpdateTask implements IPDOMIndexerTask {
|
||||||
protected static final String TRUE= String.valueOf(true);
|
protected static final String TRUE= String.valueOf(true);
|
||||||
protected static final ITranslationUnit[] NO_TUS = new ITranslationUnit[0];
|
protected static final ITranslationUnit[] NO_TUS = {};
|
||||||
|
|
||||||
private final IPDOMIndexer fIndexer;
|
private final IPDOMIndexer fIndexer;
|
||||||
private final IndexerProgress fProgress;
|
private final IndexerProgress fProgress;
|
||||||
|
@ -89,7 +89,8 @@ public class PDOMUpdateTask implements IPDOMIndexerTask {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createDelegate(ICProject project, IProgressMonitor monitor) throws CoreException, InterruptedException {
|
private void createDelegate(ICProject project, IProgressMonitor monitor)
|
||||||
|
throws CoreException, InterruptedException {
|
||||||
HashSet<ITranslationUnit> set= new HashSet<ITranslationUnit>();
|
HashSet<ITranslationUnit> set= new HashSet<ITranslationUnit>();
|
||||||
TranslationUnitCollector collector= new TranslationUnitCollector(set, set, monitor);
|
TranslationUnitCollector collector= new TranslationUnitCollector(set, set, monitor);
|
||||||
boolean haveProject= false;
|
boolean haveProject= false;
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* 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;
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ import org.eclipse.core.runtime.Path;
|
||||||
* Heuristics for picking up includes from the project
|
* Heuristics for picking up includes from the project
|
||||||
*/
|
*/
|
||||||
public class ProjectIndexerIncludeResolutionHeuristics implements IIncludeFileResolutionHeuristics {
|
public class ProjectIndexerIncludeResolutionHeuristics implements IIncludeFileResolutionHeuristics {
|
||||||
private static final String TRUE = "true"; //$NON-NLS-1$
|
private static final String TRUE = String.valueOf(true);
|
||||||
|
|
||||||
private IProject fProject;
|
private IProject fProject;
|
||||||
private IProject[] fProjects;
|
private IProject[] fProjects;
|
||||||
|
@ -52,8 +52,7 @@ public class ProjectIndexerIncludeResolutionHeuristics implements IIncludeFileRe
|
||||||
|
|
||||||
if (fProject == null)
|
if (fProject == null)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
|
|
||||||
if (fProjects == null) {
|
if (fProjects == null) {
|
||||||
if (fProject.isOpen()) {
|
if (fProject.isOpen()) {
|
||||||
String val= IndexerPreferences.get(fProject, IndexerPreferences.KEY_INCLUDE_HEURISTICS, TRUE);
|
String val= IndexerPreferences.get(fProject, IndexerPreferences.KEY_INCLUDE_HEURISTICS, TRUE);
|
||||||
|
@ -77,8 +76,7 @@ public class ProjectIndexerIncludeResolutionHeuristics implements IIncludeFileRe
|
||||||
|
|
||||||
return bestLocation.toString();
|
return bestLocation.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private IResource selectBest(IFile[] files, char[] currentFullPath) {
|
private IResource selectBest(IFile[] files, char[] currentFullPath) {
|
||||||
IFile best= files[0];
|
IFile best= files[0];
|
||||||
int bestScore= computeScore(best.getFullPath().toString().toCharArray(), currentFullPath);
|
int bestScore= computeScore(best.getFullPath().toString().toCharArray(), currentFullPath);
|
||||||
|
@ -96,14 +94,14 @@ public class ProjectIndexerIncludeResolutionHeuristics implements IIncludeFileRe
|
||||||
|
|
||||||
private int computeScore(char[] path1, char[] path2) {
|
private int computeScore(char[] path1, char[] path2) {
|
||||||
final int limit= Math.min(path1.length, path2.length);
|
final int limit= Math.min(path1.length, path2.length);
|
||||||
int match=0;
|
int match= 0;
|
||||||
for (int i = 0; i < limit; i++) {
|
for (int i = 0; i < limit; i++) {
|
||||||
if (path1[i] != path2[i])
|
if (path1[i] != path2[i])
|
||||||
break;
|
break;
|
||||||
if (path1[i] == '/')
|
if (path1[i] == '/')
|
||||||
match= i;
|
match= i;
|
||||||
}
|
}
|
||||||
// prefer shortest path with longest matches with
|
// Prefer shortest path with longest matches with.
|
||||||
return (match << 16) - path1.length;
|
return (match << 16) - path1.length;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -115,7 +113,7 @@ public class ProjectIndexerIncludeResolutionHeuristics implements IIncludeFileRe
|
||||||
|
|
||||||
List<IProject> projectsToSearch= new ArrayList<IProject>();
|
List<IProject> projectsToSearch= new ArrayList<IProject>();
|
||||||
projectsToSearch.add(prj);
|
projectsToSearch.add(prj);
|
||||||
for (int i=0; i<projectsToSearch.size(); i++) {
|
for (int i= 0; i < projectsToSearch.size(); i++) {
|
||||||
IProject project= projectsToSearch.get(i);
|
IProject project= projectsToSearch.get(i);
|
||||||
IProject[] nextLevel;
|
IProject[] nextLevel;
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Markus Schorn - initial API and implementation
|
* Markus Schorn - initial API and implementation
|
||||||
* Sergey Prigogin (Google)
|
* Sergey Prigogin (Google)
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.ui.search.actions;
|
package org.eclipse.cdt.internal.ui.search.actions;
|
||||||
|
|
||||||
|
@ -98,7 +98,6 @@ import org.eclipse.cdt.internal.ui.viewsupport.CElementLabels;
|
||||||
import org.eclipse.cdt.internal.ui.viewsupport.IndexUI;
|
import org.eclipse.cdt.internal.ui.viewsupport.IndexUI;
|
||||||
|
|
||||||
class OpenDeclarationsJob extends Job implements ASTRunnable {
|
class OpenDeclarationsJob extends Job implements ASTRunnable {
|
||||||
|
|
||||||
private enum NameKind { REFERENCE, DECLARATION, USING_DECL, DEFINITION }
|
private enum NameKind { REFERENCE, DECLARATION, USING_DECL, DEFINITION }
|
||||||
|
|
||||||
private final SelectionParseAction fAction;
|
private final SelectionParseAction fAction;
|
||||||
|
|
Loading…
Add table
Reference in a new issue