mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-15 04:05:38 +02:00
Cosmetics.
This commit is contained in:
parent
7cdb3eeeb1
commit
3f48af6991
1 changed files with 18 additions and 24 deletions
|
@ -538,7 +538,6 @@ public class PDOMManager implements IWritableIndexManager, IListener {
|
||||||
if (fTraceIndexerSetup)
|
if (fTraceIndexerSetup)
|
||||||
System.out.println("Indexer: Creation for project " + name); //$NON-NLS-1$
|
System.out.println("Indexer: Creation for project " + name); //$NON-NLS-1$
|
||||||
|
|
||||||
|
|
||||||
assert !Thread.holdsLock(fProjectToPDOM);
|
assert !Thread.holdsLock(fProjectToPDOM);
|
||||||
try {
|
try {
|
||||||
synchronized (fUpdatePolicies) {
|
synchronized (fUpdatePolicies) {
|
||||||
|
@ -665,7 +664,7 @@ public class PDOMManager implements IWritableIndexManager, IListener {
|
||||||
getReferencingProjects(indexer.getProject().getProject(), referencing);
|
getReferencingProjects(indexer.getProject().getProject(), referencing);
|
||||||
}
|
}
|
||||||
synchronized (fTaskQueue) {
|
synchronized (fTaskQueue) {
|
||||||
int i=0;
|
int i= 0;
|
||||||
for (IPDOMIndexerTask task : fTaskQueue) {
|
for (IPDOMIndexerTask task : fTaskQueue) {
|
||||||
final IPDOMIndexer ti = task.getIndexer();
|
final IPDOMIndexer ti = task.getIndexer();
|
||||||
if (ti != null && referencing.contains(ti.getProject().getProject())) {
|
if (ti != null && referencing.contains(ti.getProject().getProject())) {
|
||||||
|
@ -864,8 +863,7 @@ public class PDOMManager implements IWritableIndexManager, IListener {
|
||||||
}
|
}
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
CCorePlugin.log(e);
|
CCorePlugin.log(e);
|
||||||
}
|
} finally {
|
||||||
finally {
|
|
||||||
finalpdom.releaseWriteLock();
|
finalpdom.releaseWriteLock();
|
||||||
}
|
}
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
|
@ -1101,12 +1099,11 @@ public class PDOMManager implements IWritableIndexManager, IListener {
|
||||||
try {
|
try {
|
||||||
Job.getJobManager().join(this, monitor);
|
Job.getJobManager().join(this, monitor);
|
||||||
return true;
|
return true;
|
||||||
} catch (OperationCanceledException e1) {
|
} catch (OperationCanceledException e) {
|
||||||
} catch (InterruptedException e1) {
|
} catch (InterruptedException e) {
|
||||||
}
|
}
|
||||||
return Job.getJobManager().find(this).length == 0;
|
return Job.getJobManager().find(this).length == 0;
|
||||||
}
|
} finally {
|
||||||
finally {
|
|
||||||
if (th != null) {
|
if (th != null) {
|
||||||
th.interrupt();
|
th.interrupt();
|
||||||
}
|
}
|
||||||
|
@ -1134,7 +1131,7 @@ public class PDOMManager implements IWritableIndexManager, IListener {
|
||||||
if (fCurrentTask != null) {
|
if (fCurrentTask != null) {
|
||||||
final IndexerProgress info= fCurrentTask.getProgressInformation();
|
final IndexerProgress info= fCurrentTask.getProgressInformation();
|
||||||
sourceCount+= info.fCompletedSources;
|
sourceCount+= info.fCompletedSources;
|
||||||
sourceEstimate+= info.fRequestedFilesCount-info.fPrimaryHeaderCount;
|
sourceEstimate+= info.fRequestedFilesCount - info.fPrimaryHeaderCount;
|
||||||
headerCount+= info.fCompletedHeaders;
|
headerCount+= info.fCompletedHeaders;
|
||||||
// for the ticks we don't consider additional headers
|
// for the ticks we don't consider additional headers
|
||||||
tickCount+= info.fCompletedSources + info.fPrimaryHeaderCount;
|
tickCount+= info.fCompletedSources + info.fPrimaryHeaderCount;
|
||||||
|
@ -1147,7 +1144,7 @@ public class PDOMManager implements IWritableIndexManager, IListener {
|
||||||
new Integer(sourceCount), new Integer(sourceEstimate),
|
new Integer(sourceCount), new Integer(sourceEstimate),
|
||||||
new Integer(headerCount)});
|
new Integer(headerCount)});
|
||||||
if (detail != null) {
|
if (detail != null) {
|
||||||
msg= msg+ ": " + detail; //$NON-NLS-1$
|
msg += ": " + detail; //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
job.subTask(msg);
|
job.subTask(msg);
|
||||||
|
@ -1161,7 +1158,6 @@ public class PDOMManager implements IWritableIndexManager, IListener {
|
||||||
return currentTicks;
|
return currentTicks;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public IWritableIndex getWritableIndex(ICProject project) throws CoreException {
|
public IWritableIndex getWritableIndex(ICProject project) throws CoreException {
|
||||||
return fIndexFactory.getWritableIndex(project);
|
return fIndexFactory.getWritableIndex(project);
|
||||||
}
|
}
|
||||||
|
@ -1193,9 +1189,9 @@ public class PDOMManager implements IWritableIndexManager, IListener {
|
||||||
* @throws IllegalArgumentException if a file exists at targetLocation
|
* @throws IllegalArgumentException if a file exists at targetLocation
|
||||||
*/
|
*/
|
||||||
public void exportProjectPDOM(ICProject cproject, File targetLocation, final IIndexLocationConverter newConverter) throws CoreException {
|
public void exportProjectPDOM(ICProject cproject, File targetLocation, final IIndexLocationConverter newConverter) throws CoreException {
|
||||||
if(targetLocation.exists()) {
|
if (targetLocation.exists()) {
|
||||||
boolean deleted= targetLocation.delete();
|
boolean deleted= targetLocation.delete();
|
||||||
if(!deleted) {
|
if (!deleted) {
|
||||||
throw new IllegalArgumentException(
|
throw new IllegalArgumentException(
|
||||||
MessageFormat.format(Messages.PDOMManager_ExistingFileCollides,
|
MessageFormat.format(Messages.PDOMManager_ExistingFileCollides,
|
||||||
new Object[] {targetLocation})
|
new Object[] {targetLocation})
|
||||||
|
@ -1268,8 +1264,7 @@ public class PDOMManager implements IWritableIndexManager, IListener {
|
||||||
while ((read= stream.read(buffer)) >= 0) {
|
while ((read= stream.read(buffer)) >= 0) {
|
||||||
out.write(buffer, 0, read);
|
out.write(buffer, 0, read);
|
||||||
}
|
}
|
||||||
}
|
} finally {
|
||||||
finally {
|
|
||||||
out.close();
|
out.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1283,8 +1278,7 @@ public class PDOMManager implements IWritableIndexManager, IListener {
|
||||||
pdom.reloadFromFile(newFile);
|
pdom.reloadFromFile(newFile);
|
||||||
storeDatabaseName(project.getProject(), newName);
|
storeDatabaseName(project.getProject(), newName);
|
||||||
writeProjectPDOMProperties(pdom, project.getProject());
|
writeProjectPDOMProperties(pdom, project.getProject());
|
||||||
}
|
} finally {
|
||||||
finally {
|
|
||||||
pdom.releaseWriteLock();
|
pdom.releaseWriteLock();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1483,7 +1477,7 @@ public class PDOMManager implements IWritableIndexManager, IListener {
|
||||||
IResource resource= tu.getResource();
|
IResource resource= tu.getResource();
|
||||||
if (resource instanceof IFile && isSubjectToIndexing(tu.getLanguage())) {
|
if (resource instanceof IFile && isSubjectToIndexing(tu.getLanguage())) {
|
||||||
IIndexFileLocation location= IndexLocationFactory.getWorkspaceIFL((IFile)resource);
|
IIndexFileLocation location= IndexLocationFactory.getWorkspaceIFL((IFile)resource);
|
||||||
if(!areSynchronized(new HashSet<IIndexFileLocation>(), index, resource, location)) {
|
if (!areSynchronized(new HashSet<IIndexFileLocation>(), index, resource, location)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1517,16 +1511,16 @@ public class PDOMManager implements IWritableIndexManager, IListener {
|
||||||
* @throws CoreException
|
* @throws CoreException
|
||||||
*/
|
*/
|
||||||
private static boolean areSynchronized(Set<IIndexFileLocation> trail, IIndex index, IResource resource, IIndexFileLocation location) throws CoreException {
|
private static boolean areSynchronized(Set<IIndexFileLocation> trail, IIndex index, IResource resource, IIndexFileLocation location) throws CoreException {
|
||||||
if(!trail.contains(location)) {
|
if (!trail.contains(location)) {
|
||||||
trail.add(location);
|
trail.add(location);
|
||||||
|
|
||||||
IIndexFile[] file= index.getFiles(location);
|
IIndexFile[] file= index.getFiles(location);
|
||||||
|
|
||||||
// pre-includes may be listed twice (191989)
|
// pre-includes may be listed twice (191989)
|
||||||
if(file.length < 1 || file.length > 2)
|
if (file.length < 1 || file.length > 2)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if(resource.getLocalTimeStamp() != file[0].getTimestamp())
|
if (resource.getLocalTimeStamp() != file[0].getTimestamp())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// if it is up-to-date, the includes have not changed and may
|
// if it is up-to-date, the includes have not changed and may
|
||||||
|
@ -1534,11 +1528,11 @@ public class PDOMManager implements IWritableIndexManager, IListener {
|
||||||
IIndexInclude[] includes= index.findIncludes(file[0]);
|
IIndexInclude[] includes= index.findIncludes(file[0]);
|
||||||
for(IIndexInclude inc : includes) {
|
for(IIndexInclude inc : includes) {
|
||||||
IIndexFileLocation newLocation= inc.getIncludesLocation();
|
IIndexFileLocation newLocation= inc.getIncludesLocation();
|
||||||
if(newLocation != null) {
|
if (newLocation != null) {
|
||||||
String path= newLocation.getFullPath();
|
String path= newLocation.getFullPath();
|
||||||
if(path != null) {
|
if (path != null) {
|
||||||
IResource newResource= ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(path));
|
IResource newResource= ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(path));
|
||||||
if(!areSynchronized(trail, index, newResource, newLocation)) {
|
if (!areSynchronized(trail, index, newResource, newLocation)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue