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