1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 14:42: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

@ -1,443 +1,444 @@
/*******************************************************************************
* Copyright (c) 2000, 2009 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* QNX Software Systems - Initial API and implementation
* Markus Schorn (Wind River Systems)
* Anton Leherbauer (Wind River Systems)
*******************************************************************************/
package org.eclipse.cdt.core.model;
import java.net.URI;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IPath;
/**
* Common protocol for all elements provided by the C model.
*
* @noextend This interface is not intended to be extended by clients.
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface ICElement extends IAdaptable {
/**
* IResource from 10-20
*/
/**
* Constant representing a C Root workspace (IWorkspaceRoot object).
* A C element with this type can be safely cast to <code>ICModel</code>.
*/
static final int C_MODEL = 10;
/**
* Constant representing a C project(IProject object).
* A C element with this type can be safely cast to <code>ICProject</code>.
*/
static final int C_PROJECT = 11;
/**
* Constant representing a folder(ICContainer object).
* A C element with this type can be safely cast to <code>ICContainer</code>.
*/
static final int C_CCONTAINER = 12;
static final int C_BINARY = 14;
static final int C_ARCHIVE = 18;
/**
* Virtual container serving as a place holder.
*/
static final int C_VCONTAINER = 30;
/**
* Constant representing a C/C++ children of a Translation Unit
*/
static final int C_UNIT = 60;
/**
* Namespace.
*/
static final int C_NAMESPACE = 61;
/**
* Using.
*/
static final int C_USING = 62;
/**
* Enumeration.
*/
static final int C_ENUMERATION = 63;
/**
* Declaration of a class without the definition.
* class C;
*/
static final int C_CLASS_DECLARATION = 64;
/**
* Constant representing a class structure.
*/
static final int C_CLASS = 65;
/**
* Declaration of a structure without the definition.
* struct C;
*/
static final int C_STRUCT_DECLARATION = 66;
/**
* Constant representing a struct structure.
*/
static final int C_STRUCT = 67;
/**
* Declaration of a union without the definition.
* struct C;
*/
static final int C_UNION_DECLARATION = 68;
/**
* Constant representing a union structure.
*/
static final int C_UNION = 69;
/**
* A method definition part of a structure(class, struct, union).
*/
static final int C_METHOD = 70;
/**
* A method declaration part of a structure(class, struct, union).
*/
static final int C_METHOD_DECLARATION = 71;
/**
* A Field definition part of a structure(class, struct, union).
*/
static final int C_FIELD = 72;
/**
* a C/C++ function prototype.
*/
static final int C_FUNCTION_DECLARATION = 73;
/**
* a C/C++ function definition.
*/
static final int C_FUNCTION = 74;
/**
* Preprocessor #include directive.
*/
static final int C_INCLUDE = 75;
/**
* Global variable.
*/
static final int C_VARIABLE = 76;
/**
* variable Declaration.
*/
static final int C_VARIABLE_DECLARATION = 77;
/**
* Local Variable.
*/
static final int C_VARIABLE_LOCAL = 78;
/**
* A preprocessor macro.
*/
static final int C_MACRO = 79;
/**
* a Typedef.
*/
static final int C_TYPEDEF = 80;
/**
* Enumerator.
*/
static final int C_ENUMERATOR = 81;
/**
* C++ template class declaration without a definiton.
*/
static final int C_TEMPLATE_CLASS_DECLARATION = 82;
/**
* C++ template class with definition.
*/
static final int C_TEMPLATE_CLASS = 83;
/**
* C++ template struct.
*/
static final int C_TEMPLATE_STRUCT_DECLARATION = 84;
/**
* C++ template struct.
*/
static final int C_TEMPLATE_STRUCT = 85;
/**
* C++ template union.
*/
static final int C_TEMPLATE_UNION_DECLARATION = 86;
/**
* C++ template union.
*/
static final int C_TEMPLATE_UNION = 87;
/**
* C++ template function declaration.
*/
static final int C_TEMPLATE_FUNCTION_DECLARATION = 88;
/**
* C++ template function.
*/
static final int C_TEMPLATE_FUNCTION = 89;
/**
* C++ template method.
*/
static final int C_TEMPLATE_METHOD_DECLARATION = 90;
/**
* C++ template method.
*/
static final int C_TEMPLATE_METHOD = 91;
/**
* C++ template variable.
*/
static final int C_TEMPLATE_VARIABLE = 92;
/**
* An unknown ICElement. Mainly used to determine what elements are not yet implemented.
* i.e. the new DOM Parser supports open declaration on labels, while the old parser did not
*/
static final int C_UNKNOWN_DECLARATION = 93;
/**
* Assembly label.
*
* @since 5.0
*/
static final int ASM_LABEL= 94;
/**
* Modifier indicating a class constructor
* @deprecated use {@link IMethodDeclaration#isConstructor()}
*/
@Deprecated
static final int C_CLASS_CTOR = 0x100;
/**
* Modifier indicating a class destructor
* @deprecated use {@link IMethodDeclaration#isDestructor()}
*/
@Deprecated
static final int C_CLASS_DTOR = 0x200;
/**
* Modifier indicating a static storage attribute
* @deprecated use {@link IDeclaration#isStatic()}
*/
@Deprecated
static final int C_STORAGE_STATIC = 0x400;
/**
* Modifier indicating an extern storage attribute
* @deprecated not used anymore
*/
@Deprecated
static final int C_STORAGE_EXTERN = 0x800;
/**
* Modifier indicating a private class
* @deprecated use {@link IMember#getVisibility()}
*/
@Deprecated
static final int CPP_PRIVATE = 0x1000;
/**
* Modifier indicating a public class
* @deprecated use {@link IMember#getVisibility()}
*/
@Deprecated
static final int CPP_PUBLIC = 0x2000;
/**
* Modifier indicating a protected class
* @deprecated use {@link IMember#getVisibility()}
*/
@Deprecated
static final int CPP_PROTECTED = 0x4000;
/**
* Modifier indicating a friend class
* @deprecated use {@link IMethodDeclaration#isFriend()}
*/
@Deprecated
static final int CPP_FRIEND = 0x8000;
/**
* Returns whether this C element exists in the model.
*
* @return <code>true</code> if this element exists in the C model
*/
boolean exists();
/**
* Returns the first ancestor of this C element that has the given type.
* Returns <code>null</code> if no such an ancestor can be found.
* This is a handle-only method.
*
* @param ancestorType the given type
* @return the first ancestor of this C element that has the given type, null if no such an ancestor can be found
* @since 2.0
*/
ICElement getAncestor(int ancestorType);
/**
* Returns the name of this element.
*
* @return the element name
*/
String getElementName();
/**
* Returns this element's kind encoded as an integer.
* This is a handle-only method.
*
* @return the kind of element; one of the constants declared in
* <code>ICElement</code>
* @see ICElement
*/
int getElementType();
/**
* Returns the C model.
*
* @return the C model
*/
ICModel getCModel();
/**
* Returns the C project this element is contained in,
* or <code>null</code> if this element is not contained in any C project
*
* @return the containing C project, or <code>null</code> if this element is
* not contained in a C project
*/
ICProject getCProject();
/**
* Returns the element directly containing this element,
* or <code>null</code> if this element has no parent.
*
* @return the parent element, or <code>null</code> if this element has no parent
*/
ICElement getParent();
/**
* Returns the path to the innermost resource enclosing this element.
* If this element is not included in an external archive,
* the path returned is the full, absolute path to the underlying resource,
* relative to the workbench.
* If this element is included in an external archive,
* the path returned is the absolute path to the archive in the file system.
* This is a handle-only method.
*
*/
IPath getPath();
/**
* Returns an absolute URI corresponding to the innermost file enclosing this element.
*
* @since 5.0
* @return the URI corresponding to the location
*/
URI getLocationURI();
/**
* Returns the underlying resource that contains
* this element, or <code>null</code> if this element is not contained
* in a resource.
*
* @return the underlying resource, or <code>null</code> if none
*/
IResource getUnderlyingResource();
/**
* Returns the Corresponding resource for
* this element, or <code>null</code> if this element does not have
* a corresponding resource.
*
* @return the corresponding resource, or <code>null</code> if none
*/
IResource getResource();
/**
* Returns whether this C element is read-only. An element is read-only
* if its structure cannot be modified by the C model.
*
* @return <code>true</code> if this element is read-only
*/
boolean isReadOnly();
/**
* Returns whether the structure of this element is known. For example, for a
* translation unit that could not be parsed, <code>false</code> is returned.
* If the structure of an element is unknown, navigations will return reasonable
* defaults. For example, <code>getChildren</code> will return an empty collection.
* <p>
* Note: This does not imply anything about consistency with the
* underlying resource/buffer contents.
* </p>
*
* @return <code>true</code> if the structure of this element is known
* @exception CModelException if this element does not exist or if an
* exception occurs while accessing its corresponding resource
*/
boolean isStructureKnown() throws CModelException;
/**
* Accept a visitor and walk the ICElement tree with it.
*
* @param visitor
* @throws CModelException
*/
void accept(ICElementVisitor visitor) throws CoreException;
/**
* Returns a string representation of this element handle. The format of the
* string is not specified; however, the identifier is stable across
* workspace sessions, and can be used to recreate this handle via the
* <code>CoreModel.create(String)</code> method.
* <p>
* Some element types, like binaries, do not support handle identifiers and
* return <code>null</code>.
* </p>
*
* @return the string handle identifier, or <code>null</code> if the
* element type is not supported
* @see CoreModel#create(java.lang.String)
*
* @since 5.0
*/
String getHandleIdentifier();
}
/*******************************************************************************
* Copyright (c) 2000, 2009 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* QNX Software Systems - Initial API and implementation
* Markus Schorn (Wind River Systems)
* Anton Leherbauer (Wind River Systems)
*******************************************************************************/
package org.eclipse.cdt.core.model;
import java.net.URI;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IPath;
/**
* Common protocol for all elements provided by the C model.
*
* @noextend This interface is not intended to be extended by clients.
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface ICElement extends IAdaptable {
/**
* IResource from 10-20
*/
/**
* Constant representing a C Root workspace (IWorkspaceRoot object).
* A C element with this type can be safely cast to <code>ICModel</code>.
*/
static final int C_MODEL = 10;
/**
* Constant representing a C project(IProject object).
* A C element with this type can be safely cast to <code>ICProject</code>.
*/
static final int C_PROJECT = 11;
/**
* Constant representing a folder(ICContainer object).
* A C element with this type can be safely cast to <code>ICContainer</code>.
*/
static final int C_CCONTAINER = 12;
static final int C_BINARY = 14;
static final int C_ARCHIVE = 18;
/**
* Virtual container serving as a place holder.
*/
static final int C_VCONTAINER = 30;
/**
* Constant representing a C/C++ children of a Translation Unit
*/
static final int C_UNIT = 60;
/**
* Namespace.
*/
static final int C_NAMESPACE = 61;
/**
* Using.
*/
static final int C_USING = 62;
/**
* Enumeration.
*/
static final int C_ENUMERATION = 63;
/**
* Declaration of a class without the definition.
* class C;
*/
static final int C_CLASS_DECLARATION = 64;
/**
* Constant representing a class structure.
*/
static final int C_CLASS = 65;
/**
* Declaration of a structure without the definition.
* struct C;
*/
static final int C_STRUCT_DECLARATION = 66;
/**
* Constant representing a struct structure.
*/
static final int C_STRUCT = 67;
/**
* Declaration of a union without the definition.
* struct C;
*/
static final int C_UNION_DECLARATION = 68;
/**
* Constant representing a union structure.
*/
static final int C_UNION = 69;
/**
* A method definition part of a structure(class, struct, union).
*/
static final int C_METHOD = 70;
/**
* A method declaration part of a structure(class, struct, union).
*/
static final int C_METHOD_DECLARATION = 71;
/**
* A Field definition part of a structure(class, struct, union).
*/
static final int C_FIELD = 72;
/**
* a C/C++ function prototype.
*/
static final int C_FUNCTION_DECLARATION = 73;
/**
* a C/C++ function definition.
*/
static final int C_FUNCTION = 74;
/**
* Preprocessor #include directive.
*/
static final int C_INCLUDE = 75;
/**
* Global variable.
*/
static final int C_VARIABLE = 76;
/**
* variable Declaration.
*/
static final int C_VARIABLE_DECLARATION = 77;
/**
* Local Variable.
*/
static final int C_VARIABLE_LOCAL = 78;
/**
* A preprocessor macro.
*/
static final int C_MACRO = 79;
/**
* a Typedef.
*/
static final int C_TYPEDEF = 80;
/**
* Enumerator.
*/
static final int C_ENUMERATOR = 81;
/**
* C++ template class declaration without a definiton.
*/
static final int C_TEMPLATE_CLASS_DECLARATION = 82;
/**
* C++ template class with definition.
*/
static final int C_TEMPLATE_CLASS = 83;
/**
* C++ template struct.
*/
static final int C_TEMPLATE_STRUCT_DECLARATION = 84;
/**
* C++ template struct.
*/
static final int C_TEMPLATE_STRUCT = 85;
/**
* C++ template union.
*/
static final int C_TEMPLATE_UNION_DECLARATION = 86;
/**
* C++ template union.
*/
static final int C_TEMPLATE_UNION = 87;
/**
* C++ template function declaration.
*/
static final int C_TEMPLATE_FUNCTION_DECLARATION = 88;
/**
* C++ template function.
*/
static final int C_TEMPLATE_FUNCTION = 89;
/**
* C++ template method.
*/
static final int C_TEMPLATE_METHOD_DECLARATION = 90;
/**
* C++ template method.
*/
static final int C_TEMPLATE_METHOD = 91;
/**
* C++ template variable.
*/
static final int C_TEMPLATE_VARIABLE = 92;
/**
* An unknown ICElement. Mainly used to determine what elements are not yet implemented.
* i.e. the new DOM Parser supports open declaration on labels, while the old parser did not
*/
static final int C_UNKNOWN_DECLARATION = 93;
/**
* Assembly label.
*
* @since 5.0
*/
static final int ASM_LABEL= 94;
/**
* Modifier indicating a class constructor
* @deprecated use {@link IMethodDeclaration#isConstructor()}
*/
@Deprecated
static final int C_CLASS_CTOR = 0x100;
/**
* Modifier indicating a class destructor
* @deprecated use {@link IMethodDeclaration#isDestructor()}
*/
@Deprecated
static final int C_CLASS_DTOR = 0x200;
/**
* Modifier indicating a static storage attribute
* @deprecated use {@link IDeclaration#isStatic()}
*/
@Deprecated
static final int C_STORAGE_STATIC = 0x400;
/**
* Modifier indicating an extern storage attribute
* @deprecated not used anymore
*/
@Deprecated
static final int C_STORAGE_EXTERN = 0x800;
/**
* Modifier indicating a private class
* @deprecated use {@link IMember#getVisibility()}
*/
@Deprecated
static final int CPP_PRIVATE = 0x1000;
/**
* Modifier indicating a public class
* @deprecated use {@link IMember#getVisibility()}
*/
@Deprecated
static final int CPP_PUBLIC = 0x2000;
/**
* Modifier indicating a protected class
* @deprecated use {@link IMember#getVisibility()}
*/
@Deprecated
static final int CPP_PROTECTED = 0x4000;
/**
* Modifier indicating a friend class
* @deprecated use {@link IMethodDeclaration#isFriend()}
*/
@Deprecated
static final int CPP_FRIEND = 0x8000;
/**
* Returns whether this C element exists in the model.
*
* @return <code>true</code> if this element exists in the C model
*/
boolean exists();
/**
* Returns the first ancestor of this C element that has the given type.
* Returns <code>null</code> if no such an ancestor can be found.
* This is a handle-only method.
*
* @param ancestorType the given type
* @return the first ancestor of this C element that has the given type, null if no such an ancestor can be found
* @since 2.0
*/
ICElement getAncestor(int ancestorType);
/**
* Returns the name of this element.
*
* @return the element name
*/
String getElementName();
/**
* Returns this element's kind encoded as an integer.
* This is a handle-only method.
*
* @return the kind of element; one of the constants declared in
* <code>ICElement</code>
* @see ICElement
*/
int getElementType();
/**
* Returns the C model.
*
* @return the C model
*/
ICModel getCModel();
/**
* Returns the C project this element is contained in,
* or <code>null</code> if this element is not contained in any C project
*
* @return the containing C project, or <code>null</code> if this element is
* not contained in a C project
*/
ICProject getCProject();
/**
* Returns the element directly containing this element,
* or <code>null</code> if this element has no parent.
*
* @return the parent element, or <code>null</code> if this element has no parent
*/
ICElement getParent();
/**
* Returns the path to the innermost resource enclosing this element.
* If this element is not included in an external archive,
* the path returned is the full, absolute path to the underlying resource,
* relative to the workbench.
* If this element is included in an external archive,
* the path returned is the absolute path to the archive in the file system.
* This is a handle-only method.
*
*/
IPath getPath();
/**
* Returns an absolute URI corresponding to the innermost file enclosing this element.
*
* @since 5.0
* @return the URI corresponding to the location
*/
URI getLocationURI();
/**
* Returns the underlying resource that contains
* this element, or <code>null</code> if this element is not contained
* in a resource.
*
* @return the underlying resource, or <code>null</code> if none
*/
IResource getUnderlyingResource();
/**
* Returns the Corresponding resource for
* this element, or <code>null</code> if this element does not have
* a corresponding resource.
*
* @return the corresponding resource, or <code>null</code> if none
*/
IResource getResource();
/**
* Returns whether this C element is read-only. An element is read-only
* if its structure cannot be modified by the C model.
*
* @return <code>true</code> if this element is read-only
*/
boolean isReadOnly();
/**
* Returns whether the structure of this element is known. For example, for a
* translation unit that could not be parsed, <code>false</code> is returned.
* If the structure of an element is unknown, navigations will return reasonable
* defaults. For example, <code>getChildren</code> will return an empty collection.
* <p>
* Note: This does not imply anything about consistency with the
* underlying resource/buffer contents.
* </p>
*
* @return <code>true</code> if the structure of this element is known
* @exception CModelException if this element does not exist or if an
* exception occurs while accessing its corresponding resource
*/
boolean isStructureKnown() throws CModelException;
/**
* Accept a visitor and walk the ICElement tree with it.
*
* @param visitor
* @throws CModelException
*/
void accept(ICElementVisitor visitor) throws CoreException;
/**
* Returns a string representation of this element handle. The format of the
* string is not specified; however, the identifier is stable across
* workspace sessions, and can be used to recreate this handle via the
* <code>CoreModel.create(String)</code> method.
* <p>
* Some element types, like binaries, do not support handle identifiers and
* return <code>null</code>.
* </p>
*
* @return the string handle identifier, or <code>null</code> if the
* element type is not supported
* @see CoreModel#create(java.lang.String)
*
* @since 5.0
*/
String getHandleIdentifier();
}

View file

@ -1,60 +1,61 @@
/*******************************************************************************
* Copyright (c) 2001, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Rational Software - initial implementation
*******************************************************************************/
package org.eclipse.cdt.internal.core.model;
import org.eclipse.core.resources.IResourceStatus;
import org.eclipse.core.resources.IWorkspaceRunnable;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.cdt.core.model.ICModelStatus;
import org.eclipse.cdt.core.model.CModelException;
/**
* An operation created as a result of a call to JavaCore.run(IWorkspaceRunnable, IProgressMonitor)
* that encapsulates a user defined IWorkspaceRunnable.
*/
public class BatchOperation extends CModelOperation {
protected IWorkspaceRunnable runnable;
public BatchOperation(IWorkspaceRunnable runnable) {
this.runnable = runnable;
}
/* (non-Javadoc)
* @see org.eclipse.jdt.internal.core.JavaModelOperation#executeOperation()
*/
@Override
protected void executeOperation() throws CModelException {
try {
this.runnable.run(fMonitor);
} catch (CoreException ce) {
if (ce instanceof CModelException) {
throw (CModelException)ce;
}
if (ce.getStatus().getCode() == IResourceStatus.OPERATION_FAILED) {
Throwable e= ce.getStatus().getException();
if (e instanceof CModelException) {
throw (CModelException) e;
}
}
throw new CModelException(ce);
}
}
/* (non-Javadoc)
* @see org.eclipse.jdt.internal.core.JavaModelOperation#verify()
*/
@Override
protected ICModelStatus verify() {
// cannot verify user defined operation
return CModelStatus.VERIFIED_OK;
}
}
/*******************************************************************************
* Copyright (c) 2001, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Rational Software - initial implementation
*******************************************************************************/
package org.eclipse.cdt.internal.core.model;
import org.eclipse.core.resources.IResourceStatus;
import org.eclipse.core.resources.IWorkspaceRunnable;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.cdt.core.model.ICModelStatus;
import org.eclipse.cdt.core.model.CModelException;
/**
* An operation created as a result of a call to JavaCore.run(IWorkspaceRunnable, IProgressMonitor)
* that encapsulates a user defined IWorkspaceRunnable.
*/
public class BatchOperation extends CModelOperation {
protected IWorkspaceRunnable runnable;
public BatchOperation(IWorkspaceRunnable runnable) {
this.runnable = runnable;
}
/* (non-Javadoc)
* @see org.eclipse.jdt.internal.core.JavaModelOperation#executeOperation()
*/
@Override
protected void executeOperation() throws CModelException {
try {
this.runnable.run(fMonitor);
} catch (CoreException ce) {
if (ce instanceof CModelException) {
throw (CModelException)ce;
}
if (ce.getStatus().getCode() == IResourceStatus.OPERATION_FAILED) {
Throwable e= ce.getStatus().getException();
if (e instanceof CModelException) {
throw (CModelException) e;
}
}
throw new CModelException(ce);
}
}
/* (non-Javadoc)
* @see org.eclipse.jdt.internal.core.JavaModelOperation#verify()
*/
@Override
protected ICModelStatus verify() {
// cannot verify user defined operation
return CModelStatus.VERIFIED_OK;
}
}

View file

@ -296,13 +296,13 @@ public class TranslationUnit extends Openable implements ITranslationUnit {
public INamespace[] getNamespaces() throws CModelException {
ICElement[] celements = getChildren();
ArrayList<ICElement> aList = new ArrayList<ICElement>();
ArrayList<ICElement> elementList = new ArrayList<ICElement>();
for (ICElement celement : celements) {
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) {
@ -343,7 +343,7 @@ public class TranslationUnit extends Openable implements ITranslationUnit {
}
public void copy(ICElement container, ICElement sibling, String rename, boolean force,
IProgressMonitor monitor) throws CModelException {
IProgressMonitor monitor) throws CModelException {
getSourceManipulationInfo().copy(container, sibling, rename, force, monitor);
}
@ -352,12 +352,11 @@ public class TranslationUnit extends Openable implements ITranslationUnit {
}
public void move(ICElement container, ICElement sibling, String rename, boolean force,
IProgressMonitor monitor) throws CModelException {
IProgressMonitor monitor) throws CModelException {
getSourceManipulationInfo().move(container, sibling, rename, force, monitor);
}
public void rename(String name, boolean force, IProgressMonitor monitor)
throws CModelException {
public void rename(String name, boolean force, IProgressMonitor monitor) throws CModelException {
getSourceManipulationInfo().rename(name, force, monitor);
}
@ -418,7 +417,8 @@ public class TranslationUnit extends Openable implements ITranslationUnit {
}
@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;
// generate structure
@ -460,7 +460,7 @@ public class TranslationUnit extends Openable implements ITranslationUnit {
return getWorkingCopy(monitor, null);
}
public IWorkingCopy getWorkingCopy(IProgressMonitor monitor, IBufferFactory factory) throws CModelException{
public IWorkingCopy getWorkingCopy(IProgressMonitor monitor, IBufferFactory factory) throws CModelException {
WorkingCopy workingCopy;
IFile file= getFile();
if (file != null) {
@ -482,7 +482,8 @@ public class TranslationUnit extends Openable implements ITranslationUnit {
}
@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 {
super.openParent(childInfo, newElements, pm);
} catch (CModelException e) {
@ -503,7 +504,8 @@ public class TranslationUnit extends Openable implements ITranslationUnit {
makeConsistent(forced, monitor);
}
protected IASTTranslationUnit makeConsistent(boolean computeAST, IProgressMonitor monitor) throws CModelException {
protected IASTTranslationUnit makeConsistent(boolean computeAST, IProgressMonitor monitor)
throws CModelException {
if (!computeAST && isConsistent()) {
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.
// This has been fixed (bug 273471).
// 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);
} else {
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;
}
@ -794,7 +798,8 @@ public class TranslationUnit extends Openable implements ITranslationUnit {
} else {
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;
@ -811,7 +816,8 @@ public class TranslationUnit extends Openable implements ITranslationUnit {
}
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) {
ibcf.setSupportFillGapFromContextToHeader(true);
}
@ -885,7 +891,8 @@ public class TranslationUnit extends Openable implements ITranslationUnit {
fLanguageOfContext= language;
if (language != null) {
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) {
final IASTTranslationUnit ast = result.getTranslationUnit();
if (ast != null) {