Interface ICModel
- All Superinterfaces:
org.eclipse.core.runtime.IAdaptable
,IBufferChangedListener
,ICElement
,IOpenable
,IParent
ICProject
s.
This interface provides methods for performing copy, move, rename, and delete operations on multiple C elements.
- See Also:
- Restriction:
- This interface is not intended to be implemented by clients.
- Restriction:
- This interface is not intended to be extended by clients.
-
Field Summary
Fields inherited from interface org.eclipse.cdt.core.model.ICElement
ASM_LABEL, C_ARCHIVE, C_BINARY, C_CCONTAINER, C_CLASS, C_CLASS_CTOR, C_CLASS_DECLARATION, C_CLASS_DTOR, C_ENUMERATION, C_ENUMERATOR, C_FIELD, C_FUNCTION, C_FUNCTION_DECLARATION, C_INCLUDE, C_MACRO, C_METHOD, C_METHOD_DECLARATION, C_MODEL, C_NAMESPACE, C_PRAGMA, C_PROJECT, C_STORAGE_EXTERN, C_STORAGE_STATIC, C_STRUCT, C_STRUCT_DECLARATION, C_TEMPLATE_CLASS, C_TEMPLATE_CLASS_DECLARATION, C_TEMPLATE_FUNCTION, C_TEMPLATE_FUNCTION_DECLARATION, C_TEMPLATE_METHOD, C_TEMPLATE_METHOD_DECLARATION, C_TEMPLATE_STRUCT, C_TEMPLATE_STRUCT_DECLARATION, C_TEMPLATE_UNION, C_TEMPLATE_UNION_DECLARATION, C_TEMPLATE_VARIABLE, C_TYPEDEF, C_UNION, C_UNION_DECLARATION, C_UNIT, C_UNKNOWN_DECLARATION, C_USING, C_VARIABLE, C_VARIABLE_DECLARATION, C_VARIABLE_LOCAL, C_VCONTAINER, CPP_FRIEND, CPP_PRIVATE, CPP_PROTECTED, CPP_PUBLIC, EMPTY_ARRAY
-
Method Summary
Modifier and TypeMethodDescriptionvoid
copy
(ICElement[] elements, ICElement[] containers, ICElement[] siblings, String[] renamings, boolean replace, org.eclipse.core.runtime.IProgressMonitor monitor) Copies the given elements to the specified container(s).void
Deletes the given elements, forcing the operation if necessary and specified.getCProject
(String name) Returns the C project with the given name.Returns the C projects.Object[]
Returns an array of non-C resources (i.e.org.eclipse.core.resources.IWorkspace
Returns the workspace associated with this C model.void
move
(ICElement[] elements, ICElement[] containers, ICElement[] siblings, String[] renamings, boolean replace, org.eclipse.core.runtime.IProgressMonitor monitor) Moves the given elements to the specified container(s).void
rename
(ICElement[] elements, ICElement[] destinations, String[] names, boolean replace, org.eclipse.core.runtime.IProgressMonitor monitor) Renames the given elements as specified.Methods inherited from interface org.eclipse.core.runtime.IAdaptable
getAdapter
Methods inherited from interface org.eclipse.cdt.core.model.IBufferChangedListener
bufferChanged
Methods inherited from interface org.eclipse.cdt.core.model.ICElement
accept, exists, getAncestor, getCModel, getCProject, getElementName, getElementType, getHandleIdentifier, getLocationURI, getParent, getPath, getResource, getUnderlyingResource, isReadOnly, isStructureKnown
Methods inherited from interface org.eclipse.cdt.core.model.IOpenable
close, getBuffer, hasUnsavedChanges, isConsistent, isOpen, makeConsistent, makeConsistent, open, save
Methods inherited from interface org.eclipse.cdt.core.model.IParent
getChildren, getChildrenOfType, hasChildren
-
Method Details
-
copy
void copy(ICElement[] elements, ICElement[] containers, ICElement[] siblings, String[] renamings, boolean replace, org.eclipse.core.runtime.IProgressMonitor monitor) throws CModelException Copies the given elements to the specified container(s). If one container is specified, all elements are copied to that container. If more than one container is specified, the number of elements and containers must match, and each element is copied to its associated container.Optionally, each copy can positioned before a sibling element. If
null
is specified for a given sibling, the copy is inserted as the last child of its associated container.Optionally, each copy can be renamed. If
null
is specified for the new name, the copy is not renamed.Optionally, any existing child in the destination container with the same name can be replaced by specifying
true
for force. Otherwise an exception is thrown in the event that a name collision occurs.- Parameters:
elements
- the elements to copycontainers
- the container, or list of containerssiblings
- the list of sibling elements, any of which may benull
, ornull
renamings
- the list of new names, any of which may benull
, ornull
replace
-true
if any existing child in a target container with the target name should be replaced, andfalse
to throw an exception in the event of a name collisionmonitor
- a progress monitor- Throws:
CModelException
- if an element could not be copied. Reasons include:- A specified element, container, or sibling does not exist (ELEMENT_DOES_NOT_EXIST)
- A
CoreException
occurred while updating an underlying resource - A container is of an incompatible type (
INVALID_DESTINATION
) - A sibling is not a child of it associated container (
INVALID_SIBLING
) - A new name is invalid (
INVALID_NAME
) - A child in its associated container already exists with the same
name and
replace
has been specified asfalse
(NAME_COLLISION
) - A container or element is read-only (
READ_ONLY
)
-
delete
void delete(ICElement[] elements, boolean force, org.eclipse.core.runtime.IProgressMonitor monitor) throws CModelException Deletes the given elements, forcing the operation if necessary and specified.- Parameters:
elements
- the elements to deleteforce
- a flag controlling whether underlying resources that are not in sync with the local file system will be toleratedmonitor
- a progress monitor- Throws:
CModelException
- if an element could not be deleted. Reasons include:- A specified element does not exist (ELEMENT_DOES_NOT_EXIST)
- A
CoreException
occurred while updating an underlying resource - An element is read-only (
READ_ONLY
)
-
move
void move(ICElement[] elements, ICElement[] containers, ICElement[] siblings, String[] renamings, boolean replace, org.eclipse.core.runtime.IProgressMonitor monitor) throws CModelException Moves the given elements to the specified container(s). If one container is specified, all elements are moved to that container. If more than one container is specified, the number of elements and containers must match, and each element is moved to its associated container.Optionally, each element can positioned before a sibling element. If
null
is specified for sibling, the element is inserted as the last child of its associated container.Optionally, each element can be renamed. If
null
is specified for the new name, the element is not renamed.Optionally, any existing child in the destination container with the same name can be replaced by specifying
true
for force. Otherwise an exception is thrown in the event that a name collision occurs.- Parameters:
elements
- the elements to movecontainers
- the container, or list of containerssiblings
- the list of siblings element any of which may benull
; ornull
renamings
- the list of new names any of which may benull
; ornull
replace
-true
if any existing child in a target container with the target name should be replaced, andfalse
to throw an exception in the event of a name collisionmonitor
- a progress monitor- Throws:
CModelException
- if an element could not be moved. Reasons include:- A specified element, container, or sibling does not exist (ELEMENT_DOES_NOT_EXIST)
- A
CoreException
occurred while updating an underlying resource - A container is of an incompatible type (
INVALID_DESTINATION
) - A sibling is not a child of it associated container (
INVALID_SIBLING
) - A new name is invalid (
INVALID_NAME
) - A child in its associated container already exists with the same
name and
replace
has been specified asfalse
(NAME_COLLISION
) - A container or element is read-only (
READ_ONLY
)
IllegalArgumentException
- any element or container isnull
-
rename
void rename(ICElement[] elements, ICElement[] destinations, String[] names, boolean replace, org.eclipse.core.runtime.IProgressMonitor monitor) throws CModelException Renames the given elements as specified. If one container is specified, all elements are renamed within that container. If more than one container is specified, the number of elements and containers must match, and each element is renamed within its associated container.- Parameters:
elements
- the elements to renamedestinations
- the container, or list of containersnames
- the list of new namesreplace
-true
if an existing child in a target container with the target name should be replaced, andfalse
to throw an exception in the event of a name collisionmonitor
- a progress monitor- Throws:
CModelException
- if an element could not be renamed. Reasons include:- A specified element does not exist (ELEMENT_DOES_NOT_EXIST)
- A
CoreException
occurred while updating an underlying resource - A new name is invalid (
INVALID_NAME
) - A child already exists with the same name and
replace
has been specified asfalse
(NAME_COLLISION
) - An element is read-only (
READ_ONLY
)
-
getCProject
Returns the C project with the given name. This is a handle-only method. The project may or may not exist.- Parameters:
name
- of the project
-
getCProjects
Returns the C projects.- Throws:
CModelException
-
getNonCResources
Returns an array of non-C resources (i.e. non-C projects) in the workspace.Non-C projects include all projects that are closed (even if they have the C nature).
- Returns:
- an array of non-C projects contained in the workspace.
- Throws:
CModelException
- if this element does not exist or if an exception occurs while accessing its corresponding resource- Since:
- 2.1
-
getWorkspace
org.eclipse.core.resources.IWorkspace getWorkspace()Returns the workspace associated with this C model.
-