1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 22:52:11 +02:00

Cosmetics.

This commit is contained in:
Sergey Prigogin 2010-10-20 23:21:36 +00:00
parent e9064b5093
commit 2f97f50ca5
3 changed files with 528 additions and 519 deletions

View file

@ -389,6 +389,7 @@ public interface ICElement extends IAdaptable {
* @return the corresponding resource, or <code>null</code> if none * @return the corresponding resource, or <code>null</code> if none
*/ */
IResource getResource(); IResource getResource();
/** /**
* Returns whether this C element is read-only. An element is read-only * Returns whether this C element is read-only. An element is read-only
* if its structure cannot be modified by the C model. * if its structure cannot be modified by the C model.

View file

@ -22,6 +22,7 @@ import org.eclipse.cdt.core.model.CModelException;
*/ */
public class BatchOperation extends CModelOperation { public class BatchOperation extends CModelOperation {
protected IWorkspaceRunnable runnable; protected IWorkspaceRunnable runnable;
public BatchOperation(IWorkspaceRunnable runnable) { public BatchOperation(IWorkspaceRunnable runnable) {
this.runnable = runnable; this.runnable = runnable;
} }

View file

@ -296,13 +296,13 @@ public class TranslationUnit extends Openable implements ITranslationUnit {
public INamespace[] getNamespaces() throws CModelException { public INamespace[] getNamespaces() throws CModelException {
ICElement[] celements = getChildren(); ICElement[] celements = getChildren();
ArrayList<ICElement> aList = new ArrayList<ICElement>(); ArrayList<ICElement> elementList = new ArrayList<ICElement>();
for (ICElement celement : celements) { for (ICElement celement : celements) {
if (celement.getElementType() == ICElement.C_NAMESPACE) { if (celement.getElementType() == ICElement.C_NAMESPACE) {
aList.add(celement); elementList.add(celement);
} }
} }
return aList.toArray(new INamespace[0]); return elementList.toArray(new INamespace[0]);
} }
protected void setLocationURI(URI loc) { protected void setLocationURI(URI loc) {
@ -356,8 +356,7 @@ public class TranslationUnit extends Openable implements ITranslationUnit {
getSourceManipulationInfo().move(container, sibling, rename, force, monitor); getSourceManipulationInfo().move(container, sibling, rename, force, monitor);
} }
public void rename(String name, boolean force, IProgressMonitor monitor) public void rename(String name, boolean force, IProgressMonitor monitor) throws CModelException {
throws CModelException {
getSourceManipulationInfo().rename(name, force, monitor); getSourceManipulationInfo().rename(name, force, monitor);
} }
@ -418,7 +417,8 @@ public class TranslationUnit extends Openable implements ITranslationUnit {
} }
@Override @Override
protected boolean buildStructure(OpenableInfo info, IProgressMonitor pm, Map<ICElement, CElementInfo> newElements, IResource underlyingResource) throws CModelException { protected boolean buildStructure(OpenableInfo info, IProgressMonitor pm,
Map<ICElement, CElementInfo> newElements, IResource underlyingResource) throws CModelException {
TranslationUnitInfo unitInfo = (TranslationUnitInfo) info; TranslationUnitInfo unitInfo = (TranslationUnitInfo) info;
// generate structure // generate structure
@ -460,7 +460,7 @@ public class TranslationUnit extends Openable implements ITranslationUnit {
return getWorkingCopy(monitor, null); return getWorkingCopy(monitor, null);
} }
public IWorkingCopy getWorkingCopy(IProgressMonitor monitor, IBufferFactory factory) throws CModelException{ public IWorkingCopy getWorkingCopy(IProgressMonitor monitor, IBufferFactory factory) throws CModelException {
WorkingCopy workingCopy; WorkingCopy workingCopy;
IFile file= getFile(); IFile file= getFile();
if (file != null) { if (file != null) {
@ -482,7 +482,8 @@ public class TranslationUnit extends Openable implements ITranslationUnit {
} }
@Override @Override
protected void openParent(CElementInfo childInfo, Map<ICElement, CElementInfo> newElements, IProgressMonitor pm) throws CModelException { protected void openParent(CElementInfo childInfo, Map<ICElement, CElementInfo> newElements,
IProgressMonitor pm) throws CModelException {
try { try {
super.openParent(childInfo, newElements, pm); super.openParent(childInfo, newElements, pm);
} catch (CModelException e) { } catch (CModelException e) {
@ -503,7 +504,8 @@ public class TranslationUnit extends Openable implements ITranslationUnit {
makeConsistent(forced, monitor); makeConsistent(forced, monitor);
} }
protected IASTTranslationUnit makeConsistent(boolean computeAST, IProgressMonitor monitor) throws CModelException { protected IASTTranslationUnit makeConsistent(boolean computeAST, IProgressMonitor monitor)
throws CModelException {
if (!computeAST && isConsistent()) { if (!computeAST && isConsistent()) {
return null; return null;
} }
@ -629,7 +631,8 @@ public class TranslationUnit extends Openable implements ITranslationUnit {
} }
} }
private void parseUsingContributedModelBuilder(IContributedModelBuilder mb, boolean quickParseMode, IProgressMonitor monitor) { private void parseUsingContributedModelBuilder(IContributedModelBuilder mb, boolean quickParseMode,
IProgressMonitor monitor) {
// We did reuse the shared info cache in the internal model builder. // We did reuse the shared info cache in the internal model builder.
// This has been fixed (bug 273471). // This has been fixed (bug 273471).
// Contributed model builders cannot apply the same fix. // Contributed model builders cannot apply the same fix.
@ -717,7 +720,8 @@ public class TranslationUnit extends Openable implements ITranslationUnit {
language = LanguageManager.getInstance().getLanguageForFile(file, configuration, contentTypeId); language = LanguageManager.getInstance().getLanguageForFile(file, configuration, contentTypeId);
} else { } else {
String filename = getElementName(); String filename = getElementName();
language = LanguageManager.getInstance().getLanguageForFile(new Path(filename), getCProject().getProject(), configuration, contentTypeId); language = LanguageManager.getInstance().getLanguageForFile(new Path(filename),
getCProject().getProject(), configuration, contentTypeId);
} }
return language; return language;
} }
@ -794,7 +798,8 @@ public class TranslationUnit extends Openable implements ITranslationUnit {
} else { } else {
log= ParserUtil.getParserLogService(); log= ParserUtil.getParserLogService();
} }
return ((AbstractLanguage) language).getASTTranslationUnit(fileContent, scanInfo, crf, index, options, log); return ((AbstractLanguage) language).getASTTranslationUnit(fileContent, scanInfo, crf, index,
options, log);
} }
} }
return null; return null;
@ -811,7 +816,8 @@ public class TranslationUnit extends Openable implements ITranslationUnit {
} }
if (index != null && (style & AST_SKIP_INDEXED_HEADERS) != 0) { if (index != null && (style & AST_SKIP_INDEXED_HEADERS) != 0) {
IndexBasedFileContentProvider ibcf= new IndexBasedFileContentProvider(index, pathResolver, linkageID, fileContentsProvider); IndexBasedFileContentProvider ibcf= new IndexBasedFileContentProvider(index, pathResolver, linkageID,
fileContentsProvider);
if ((style & AST_CONFIGURE_USING_SOURCE_CONTEXT) != 0) { if ((style & AST_CONFIGURE_USING_SOURCE_CONTEXT) != 0) {
ibcf.setSupportFillGapFromContextToHeader(true); ibcf.setSupportFillGapFromContextToHeader(true);
} }
@ -885,7 +891,8 @@ public class TranslationUnit extends Openable implements ITranslationUnit {
fLanguageOfContext= language; fLanguageOfContext= language;
if (language != null) { if (language != null) {
IncludeFileContentProvider crf= getIncludeFileContentProvider(style, index, language.getLinkageID()); IncludeFileContentProvider crf= getIncludeFileContentProvider(style, index, language.getLinkageID());
IASTCompletionNode result = language.getCompletionNode(fileContent, scanInfo, crf, index, ParserUtil.getParserLogService(), offset); IASTCompletionNode result = language.getCompletionNode(fileContent, scanInfo, crf, index,
ParserUtil.getParserLogService(), offset);
if (result != null) { if (result != null) {
final IASTTranslationUnit ast = result.getTranslationUnit(); final IASTTranslationUnit ast = result.getTranslationUnit();
if (ast != null) { if (ast != null) {