X-Git-Url: http://secure.phpeclipse.com
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/ICompilationUnit.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/ICompilationUnit.java
index 5bcfd3f..df9ee27 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/ICompilationUnit.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/ICompilationUnit.java
@@ -10,6 +10,8 @@
*******************************************************************************/
package net.sourceforge.phpdt.core;
+import org.eclipse.core.runtime.IProgressMonitor;
+
/**
@@ -27,6 +29,88 @@ package net.sourceforge.phpdt.core;
*/
public interface ICompilationUnit extends IJavaElement, ISourceReference, IParent, IOpenable, IWorkingCopy, ISourceManipulation {
//extends IJavaElement, ISourceReference, IParent, IOpenable, IWorkingCopy, ISourceManipulation, ICodeAssist {
+
+ /**
+ * Constant indicating that a reconcile operation should not return an AST.
+ * @since 3.0
+ */
+ public static final int NO_AST = 0;
+
+ /**
+ * Changes this compilation unit handle into a working copy. A new IBuffer
is
+ * created using this compilation unit handle's owner. Uses the primary owner is none was
+ * specified when this compilation unit handle was created.
+ *
+ * When switching to working copy mode, problems are reported to given
+ * IProblemRequestor
.
+ *
+ * Once in working copy mode, changes to this compilation unit or its children are done in memory.
+ * Only the new buffer is affected. Using commitWorkingCopy(boolean, IProgressMonitor)
+ * will bring the underlying resource in sync with this compilation unit.
+ *
+ * If this compilation unit was already in working copy mode, an internal counter is incremented and no
+ * other action is taken on this compilation unit. To bring this compilation unit back into the original mode
+ * (where it reflects the underlying resource), discardWorkingCopy
must be call as many
+ * times as becomeWorkingCopy
.
+ *
null
indicating
+ * that the client is not interested in problems.
+ * @param monitor a progress monitor used to report progress while opening this compilation unit
+ * or null
if no progress should be reported
+ * @throws JavaModelException if this compilation unit could not become a working copy.
+ * @see #discardWorkingCopy()
+ * @since 3.0
+ */
+ void becomeWorkingCopy(IProblemRequestor problemRequestor, IProgressMonitor monitor) throws JavaModelException;
+ /**
+ * Commits the contents of this working copy to its underlying resource.
+ *
+ * It is possible that the contents of the original resource have changed
+ * since this working copy was created, in which case there is an update conflict.
+ * The value of the force
parameter effects the resolution of
+ * such a conflict:
true
- in this case the contents of this working copy are applied to
+ * the underlying resource even though this working copy was created before
+ * a subsequent change in the resourcefalse
- in this case a JavaModelException
is thrown+ * Since 2.1, a working copy can be created on a not-yet existing compilation + * unit. In particular, such a working copy can then be committed in order to create + * the corresponding compilation unit. + *
+ * @param force a flag to handle the cases when the contents of the original resource have changed + * since this working copy was created + * @param monitor the given progress monitor + * @throws JavaModelException if this working copy could not commit. Reasons include: + *CoreException
occurred while updating an underlying resource
+ * + * This has no effect if this compilation unit was not in working copy mode. + *
+ *
+ * If becomeWorkingCopy
was called several times on this
+ * compilation unit, discardWorkingCopy
must be called as
+ * many times before it switches back to the original mode.
+ *
"java.awt.*"
)
* @return a handle onto the corresponding import declaration. The import declaration may or may not exist.
*/
-//IImportDeclaration getImport(String name) ;
+IImportDeclaration getImport(String name) ;
+/**
+ * Returns the import declarations in this compilation unit
+ * in the order in which they appear in the source. This is
+ * a convenience method - import declarations can also be
+ * accessed from a compilation unit's import container.
+ *
+ * @return the import declarations in this compilation unit
+ * @throws JavaModelException if this element does not exist or if an
+ * exception occurs while accessing its corresponding resource
+ */
+IImportDeclaration[] getImports() throws JavaModelException;
/**
* Returns the import container for this compilation unit.
* This is a handle-only method. The import container may or
@@ -157,7 +252,7 @@ IJavaElement getElementAt(int position) throws JavaModelException;
* @return a handle onto the corresponding import container. The
* import contain may or may not exist.
*/
-//IImportContainer getImportContainer();
+IImportContainer getImportContainer();
/**
* Returns the import declarations in this compilation unit
* in the order in which they appear in the source. This is
@@ -186,7 +281,20 @@ IPackageDeclaration getPackageDeclaration(String name);
* @exception JavaModelException if this element does not exist or if an
* exception occurs while accessing its corresponding resource
*/
-//IPackageDeclaration[] getPackageDeclarations() throws JavaModelException;
+IPackageDeclaration[] getPackageDeclarations() throws JavaModelException;
+/**
+ * Returns the primary compilation unit (whose owner is the primary owner)
+ * this working copy was created from, or this compilation unit if this a primary
+ * compilation unit.
+ * + * Note that the returned primary compilation unit can be in working copy mode. + *
+ * + * @return the primary compilation unit this working copy was created from, + * or this compilation unit if it is primary + * @since 3.0 + */ +ICompilationUnit getPrimary(); /** * Returns the top-level type declared in this compilation unit with the given simple type name. * The type name has to be a valid compilation unit name. @@ -196,7 +304,7 @@ IPackageDeclaration getPackageDeclaration(String name); * @return a handle onto the corresponding type. The type may or may not exist. * @see JavaConventions#validateCompilationUnitName(String name) */ -IType getType(String name); +IType getType(String name); /** * Returns the top-level types declared in this compilation unit * in the order in which they appear in the source.