Package org.eclipse.cdt.core.model

# Interface IOpenable

All Superinterfaces:
  `IBufferChangedListener`

All Known Subinterfaces:
  `IArchive`, `IArchiveContainer`, `IBinary`, `IBinaryContainer`, `ICContainer`, `ICModel`, `ICProject`, `ISourceRoot`, `ITranslationUnit`, `IWorkingCopy`

public interface IOpenable extends IBufferChangedListener
An openable is an element that can be opened, saved, and closed. An openable might or might not have an associated buffer.

Restriction:
  This interface is not intended to be implemented by clients.
Restriction:
  This interface is not intended to be extended by clients.

## Method Summary

Modifier and Type
Method
Description
`void`
`close()`
Closes this element and its buffer (if any).
`IBuffer`
`getBuffer()`
Returns the buffer opened for this element, or `null` if this element does not have a buffer.
`boolean`
`hasUnsavedChanges()`
returns true if the associated buffer has some unsaved changes
`boolean`
`isConsistent()`
Returns whether the element is consistent with its underlying resource or buffer.
`boolean`
`isOpen()`
Returns whether this CFile is open.
`void`
`makeConsistent(org.eclipse.core.runtime.IProgressMonitor progress)`
Makes this element consistent with its underlying resource or buffer by updating the element's structure and properties as necessary.
`void`
`makeConsistent(org.eclipse.core.runtime.IProgressMonitor progress, boolean forced)`
`void`
`open(org.eclipse.core.runtime.IProgressMonitor progress)`
Opens this element and all parent elements that are not already open.
`void`
`save(org.eclipse.core.runtime.IProgressMonitor progress, boolean force)`
Saves any changes in this element's buffer to its underlying resource via a workspace resource operation.

### Methods inherited from interface org.eclipse.cdt.core.model.IBufferChangedListener

`bufferChanged`

## Method Details

### close

void close() throws CModelException
Closes this element and its buffer (if any).

Throws:
  `CModelException`

### getBuffer

IBuffer getBuffer() throws CModelException
Returns the buffer opened for this element, or `null` if this element does not have a buffer.

Throws:
  `CModelException`

### hasUnsavedChanges

boolean hasUnsavedChanges() throws CModelException
returns true if the associated buffer has some unsaved changes

Throws:
  `CModelException`

### isConsistent

boolean isConsistent() throws CModelException
Returns whether the element is consistent with its underlying resource or buffer. The element is consistent when opened, and is consistent if the underlying resource or buffer has not been modified since it was last consistent.

Throws:
  `CModelException`

### isOpen

boolean isOpen()
Returns whether this CFile is open.

### makeConsistent

void makeConsistent(org.eclipse.core.runtime.IProgressMonitor progress) throws CModelException
Makes this element consistent with its underlying resource or buffer by updating the element's structure and properties as necessary.

Throws:
  `CModelException`

### makeConsistent

void makeConsistent(org.eclipse.core.runtime.IProgressMonitor progress, boolean forced) throws CModelException

Throws:
  `CModelException`

### open

void open(org.eclipse.core.runtime.IProgressMonitor progress) throws CModelException
Opens this element and all parent elements that are not already open. For translation units, a buffer is opened on the contents of the underlying resource.

Throws:
  `CModelException`

### save

void save(org.eclipse.core.runtime.IProgressMonitor progress, boolean force) throws CModelException
Saves any changes in this element's buffer to its underlying resource via a workspace resource operation.

The `force` parameter controls how this method deals with cases where the workbench is not completely in sync with the local file system.

Throws:
  `CModelException`