1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-09 02:36:01 +02:00

Cosmetics.

This commit is contained in:
Sergey Prigogin 2012-03-17 21:53:29 -07:00
parent d3b2a6305b
commit 0496018fad
5 changed files with 101 additions and 107 deletions

View file

@ -447,14 +447,14 @@ public class TranslationUnit extends Openable implements ITranslationUnit {
Map<ICElement, CElementInfo> newElements, IResource underlyingResource) throws CModelException {
TranslationUnitInfo unitInfo = (TranslationUnitInfo) info;
// generate structure
// Generate structure
this.parse(newElements, pm);
// /////////////////////////////////////////////////////////////
if (isWorkingCopy()) {
ITranslationUnit original = ((IWorkingCopy)this).getOriginalElement();
// might be IResource.NULL_STAMP if original does not exist
// Might be IResource.NULL_STAMP if original does not exist
IResource r = original.getResource();
if (r != null && r instanceof IFile) {
unitInfo.fTimestamp = ((IFile) r).getModificationStamp();
@ -499,7 +499,7 @@ public class TranslationUnit extends Openable implements ITranslationUnit {
} else {
workingCopy= new WorkingCopy(getParent(), getLocationURI(), getContentTypeId(), factory);
}
// open the working copy now to ensure contents are that of the current state of this element
// Open the working copy now to ensure contents are that of the current state of this element
workingCopy.open(monitor);
return workingCopy;
}
@ -541,7 +541,7 @@ public class TranslationUnit extends Openable implements ITranslationUnit {
return null;
}
// create a new info and make it the current info
// Create a new info and make it the current info
// (this will remove the info and its children just before storing the new infos)
CModelManager manager = CModelManager.getDefault();
boolean hadTemporaryCache = manager.hasTemporaryCache();
@ -555,7 +555,7 @@ public class TranslationUnit extends Openable implements ITranslationUnit {
Map<ICElement, CElementInfo> newElements = manager.getTemporaryCache();
openWhenClosed(info, monitor);
if (newElements.get(this) == null) {
// close any buffer that was opened for the new elements
// Close any buffer that was opened for the new elements
Iterator<ICElement> iterator = newElements.keySet().iterator();
while (iterator.hasNext()) {
ICElement element = iterator.next();
@ -593,13 +593,13 @@ public class TranslationUnit extends Openable implements ITranslationUnit {
@Override
protected IBuffer openBuffer(IProgressMonitor pm) throws CModelException {
// create buffer - translation units only use default buffer factory
// Create buffer - translation units only use default buffer factory
BufferManager bufManager = getBufferManager();
IBuffer buffer = getBufferFactory().createBuffer(this);
if (buffer == null)
return null;
// set the buffer source
// Set the buffer source
if (buffer.getCharacters() == null) {
IResource resource = this.getResource();
if (resource != null && resource.getType() == IResource.FILE) {
@ -620,10 +620,10 @@ public class TranslationUnit extends Openable implements ITranslationUnit {
}
}
// add buffer to buffer cache
// Add buffer to buffer cache
bufManager.addBuffer(buffer);
// listen to buffer changes
// Listen to buffer changes
buffer.addBufferChangedListener(this);
return buffer;
@ -889,6 +889,7 @@ public class TranslationUnit extends Openable implements ITranslationUnit {
}
private static final int[] CTX_LINKAGES= { ILinkage.CPP_LINKAGE_ID, ILinkage.C_LINKAGE_ID };
public IIndexFile[] getContextToHeader(IIndex index, int style) {
if (index != null && (style & AST_CONFIGURE_USING_SOURCE_CONTEXT) != 0) {
try {

View file

@ -2125,7 +2125,7 @@ public class CPPVisitor extends ASTQueries {
}
IType type = expr.getExpressionType();
if (spec.getType() == IASTSimpleDeclSpecifier.t_decltype) {
switch((expr).getValueCategory()) {
switch (expr.getValueCategory()) {
case XVALUE:
type= new CPPReferenceType(type, true);
break;

View file

@ -469,6 +469,7 @@ public class PDOM extends PlatformObject implements IPDOM {
public int compare(long record) throws CoreException {
return 0;
}
@Override
public boolean visit(long record) throws CoreException {
PDOMFile file = PDOMFile.recreateFile(PDOM.this, record);

View file

@ -10,19 +10,17 @@
* Andrew Ferguson (Symbian) - Provide B-tree deletion routine
* Markus Schorn (Wind River Systems)
*******************************************************************************/
package org.eclipse.cdt.internal.core.pdom.db;
import com.ibm.icu.text.MessageFormat;
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import com.ibm.icu.text.MessageFormat;
/**
* @author Doug Schaefer
*
*/
public class BTree {
// Constants for internal deletion routine (see deleteImp doc)
@ -113,10 +111,10 @@ public class BTree {
// if this node is full (last record isn't null), split it
if (getRecord(chunk, node, MAX_RECORDS - 1) != 0) {
long median = getRecord(chunk, node, MEDIAN_RECORD);
if (median == record)
if (median == record) {
// found it, never mind
return median;
else {
} else {
// split it
// create the new node and move the larger records over
long newnode = allocateNode();
@ -171,16 +169,13 @@ public class BTree {
long checkRec= getRecord(chunk, node, middle);
if (checkRec == 0) {
upper= middle;
}
else {
} else {
int compare= cmp.compare(checkRec, record);
if (compare > 0) {
upper= middle;
}
else if (compare < 0) {
} else if (compare < 0) {
lower= middle + 1;
}
else {
} else {
// found it, no insert, just return the record
return record;
}
@ -561,13 +556,11 @@ public class BTree {
long checkRec = getRecord(chunk, node, middle);
if (checkRec == 0) {
upper= middle;
}
else {
} else {
int compare= visitor.compare(checkRec);
if (compare >= 0) {
upper= middle;
}
else {
} else {
lower= middle + 1;
}
}
@ -584,8 +577,7 @@ public class BTree {
if (compare > 0) {
// start point is to the left
return accept(getChild(chunk, node, i), visitor);
}
else if (compare == 0) {
} else if (compare == 0) {
if (!accept(getChild(chunk, node, i), visitor))
return false;
if (!visitor.visit(record))