1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Cosmetics.

This commit is contained in:
Sergey Prigogin 2010-08-23 05:04:50 +00:00
parent 7dafe8ec23
commit 06cdef2d93

View file

@ -527,7 +527,7 @@ public class TranslationUnit extends Openable implements ITranslationUnit {
while (iterator.hasNext()) { while (iterator.hasNext()) {
ICElement element = iterator.next(); ICElement element = iterator.next();
if (element instanceof Openable) { if (element instanceof Openable) {
((Openable)element).closeBuffer(); ((Openable) element).closeBuffer();
} }
} }
throw newNotPresentException(); throw newNotPresentException();
@ -541,8 +541,8 @@ public class TranslationUnit extends Openable implements ITranslationUnit {
} }
} }
if (info instanceof ASTHolderTUInfo) { if (info instanceof ASTHolderTUInfo) {
final IASTTranslationUnit ast= ((ASTHolderTUInfo)info).fAST; final IASTTranslationUnit ast= ((ASTHolderTUInfo) info).fAST;
((ASTHolderTUInfo)info).fAST= null; ((ASTHolderTUInfo) info).fAST= null;
return ast; return ast;
} }
return null; return null;
@ -559,7 +559,6 @@ public class TranslationUnit extends Openable implements ITranslationUnit {
@Override @Override
protected IBuffer openBuffer(IProgressMonitor pm) throws CModelException { 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(); BufferManager bufManager = getBufferManager();
IBuffer buffer = getBufferFactory().createBuffer(this); IBuffer buffer = getBufferFactory().createBuffer(this);
@ -626,7 +625,7 @@ public class TranslationUnit extends Openable implements ITranslationUnit {
} }
} catch (Exception e) { } catch (Exception e) {
// use the debug log for this exception. // use the debug log for this exception.
Util.debugLog( "Exception in CModelBuilder", DebugLogConstants.MODEL); //$NON-NLS-1$ Util.debugLog("Exception in CModelBuilder", DebugLogConstants.MODEL); //$NON-NLS-1$
} }
} }
@ -641,7 +640,7 @@ public class TranslationUnit extends Openable implements ITranslationUnit {
mb.parse(quickParseMode); mb.parse(quickParseMode);
} catch (Exception e) { } catch (Exception e) {
// use the debug log for this exception. // use the debug log for this exception.
Util.debugLog( "Exception in contributed model builder", DebugLogConstants.MODEL); //$NON-NLS-1$ Util.debugLog("Exception in contributed model builder", DebugLogConstants.MODEL); //$NON-NLS-1$
} }
} }
@ -650,36 +649,28 @@ public class TranslationUnit extends Openable implements ITranslationUnit {
} }
public boolean isHeaderUnit() { public boolean isHeaderUnit() {
return ( return CCorePlugin.CONTENT_TYPE_CHEADER.equals(contentTypeId)
CCorePlugin.CONTENT_TYPE_CHEADER.equals(contentTypeId) || CCorePlugin.CONTENT_TYPE_CXXHEADER.equals(contentTypeId);
|| CCorePlugin.CONTENT_TYPE_CXXHEADER.equals(contentTypeId)
);
} }
public boolean isSourceUnit() { public boolean isSourceUnit() {
if (isHeaderUnit()) if (isHeaderUnit())
return false; return false;
return ( return CCorePlugin.CONTENT_TYPE_CSOURCE.equals(contentTypeId)
CCorePlugin.CONTENT_TYPE_CSOURCE.equals(contentTypeId)
|| CCorePlugin.CONTENT_TYPE_CXXSOURCE.equals(contentTypeId) || CCorePlugin.CONTENT_TYPE_CXXSOURCE.equals(contentTypeId)
|| CCorePlugin.CONTENT_TYPE_ASMSOURCE.equals(contentTypeId) || CCorePlugin.CONTENT_TYPE_ASMSOURCE.equals(contentTypeId)
|| LanguageManager.getInstance().isContributedContentType(contentTypeId) || LanguageManager.getInstance().isContributedContentType(contentTypeId);
);
} }
public boolean isCLanguage() { public boolean isCLanguage() {
return ( return CCorePlugin.CONTENT_TYPE_CSOURCE.equals(contentTypeId)
CCorePlugin.CONTENT_TYPE_CSOURCE.equals(contentTypeId) || CCorePlugin.CONTENT_TYPE_CHEADER.equals(contentTypeId);
|| CCorePlugin.CONTENT_TYPE_CHEADER.equals(contentTypeId)
);
} }
public boolean isCXXLanguage() { public boolean isCXXLanguage() {
return ( return CCorePlugin.CONTENT_TYPE_CXXSOURCE.equals(contentTypeId)
CCorePlugin.CONTENT_TYPE_CXXSOURCE.equals(contentTypeId) || CCorePlugin.CONTENT_TYPE_CXXHEADER.equals(contentTypeId);
|| CCorePlugin.CONTENT_TYPE_CXXHEADER.equals(contentTypeId)
);
} }
public boolean isASMLanguage() { public boolean isASMLanguage() {
@ -773,7 +764,7 @@ public class TranslationUnit extends Openable implements ITranslationUnit {
public IASTTranslationUnit getAST(IIndex index, int style, IProgressMonitor monitor) throws CoreException { public IASTTranslationUnit getAST(IIndex index, int style, IProgressMonitor monitor) throws CoreException {
ITranslationUnit configureWith = getSourceContextTU(index, style); ITranslationUnit configureWith = getSourceContextTU(index, style);
IScannerInfo scanInfo= configureWith.getScannerInfo( (style & AST_SKIP_IF_NO_BUILD_INFO) == 0); IScannerInfo scanInfo= configureWith.getScannerInfo((style & AST_SKIP_IF_NO_BUILD_INFO) == 0);
if (scanInfo == null) { if (scanInfo == null) {
return null; return null;
} }
@ -883,7 +874,7 @@ public class TranslationUnit extends Openable implements ITranslationUnit {
public IASTCompletionNode getCompletionNode(IIndex index, int style, int offset) throws CoreException { public IASTCompletionNode getCompletionNode(IIndex index, int style, int offset) throws CoreException {
ITranslationUnit configureWith= getSourceContextTU(index, style); ITranslationUnit configureWith= getSourceContextTU(index, style);
IScannerInfo scanInfo = configureWith.getScannerInfo( (style & ITranslationUnit.AST_SKIP_IF_NO_BUILD_INFO) == 0); IScannerInfo scanInfo = configureWith.getScannerInfo((style & ITranslationUnit.AST_SKIP_IF_NO_BUILD_INFO) == 0);
if (scanInfo == null) { if (scanInfo == null) {
return null; return null;
} }
@ -1039,32 +1030,32 @@ public class TranslationUnit extends Openable implements ITranslationUnit {
case ICElement.C_TEMPLATE_METHOD_DECLARATION: case ICElement.C_TEMPLATE_METHOD_DECLARATION:
// search for matching function // search for matching function
for (ICElement element2 : children) { for (ICElement element2 : children) {
if (elementType == element2.getElementType() if (elementType == element2.getElementType()
&& elementName.equals(element2.getElementName())) { && elementName.equals(element2.getElementName())) {
assert element2 instanceof IFunctionDeclaration; assert element2 instanceof IFunctionDeclaration;
String[] functionParams= ((IFunctionDeclaration)element2).getParameterTypes(); String[] functionParams= ((IFunctionDeclaration)element2).getParameterTypes();
if (Arrays.equals(functionParams, mementoParams)) { if (Arrays.equals(functionParams, mementoParams)) {
element= (CElement) element2; element= (CElement) element2;
break; break;
}
} }
} }
}
break; break;
case ICElement.C_TEMPLATE_CLASS: case ICElement.C_TEMPLATE_CLASS:
case ICElement.C_TEMPLATE_STRUCT: case ICElement.C_TEMPLATE_STRUCT:
case ICElement.C_TEMPLATE_UNION: case ICElement.C_TEMPLATE_UNION:
// search for matching template type // search for matching template type
for (ICElement element2 : children) { for (ICElement element2 : children) {
if (elementType == element2.getElementType() if (elementType == element2.getElementType()
&& elementName.equals(element2.getElementName())) { && elementName.equals(element2.getElementName())) {
assert element2 instanceof ITemplate; assert element2 instanceof ITemplate;
String[] templateParams= ((ITemplate)element2).getTemplateParameterTypes(); String[] templateParams= ((ITemplate)element2).getTemplateParameterTypes();
if (Arrays.equals(templateParams, mementoParams)) { if (Arrays.equals(templateParams, mementoParams)) {
element= (CElement) element2; element= (CElement) element2;
break; break;
}
} }
} }
}
break; break;
default: default:
// search for matching element // search for matching element