improved PHP parser
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpdt / core / IType.java
index 1a69299..264c13c 100644 (file)
@@ -1,16 +1,20 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2001, 2002 International Business Machines Corp. and others.
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials 
- * are made available under the terms of the Common Public License v0.5 
+ * are made available under the terms of the Common Public License v1.0
  * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v05.html
+ * http://www.eclipse.org/legal/cpl-v10.html
  * 
  * Contributors:
  *     IBM Corporation - initial API and implementation
- ******************************************************************************/
+ *******************************************************************************/
 package net.sourceforge.phpdt.core;
 
 import org.eclipse.core.runtime.IProgressMonitor;
+import net.sourceforge.phpdt.core.ITypeHierarchy;
+import net.sourceforge.phpdt.core.JavaModelException;
+import net.sourceforge.phpdt.core.WorkingCopyOwner;
+
 
 /**
  * Represents either a source type in a compilation unit (either a top-level
@@ -53,16 +57,16 @@ public interface IType extends IMember, IParent {
         * @param requestor the completion requestor
         * @since 2.0
         */
-       void codeComplete(
-               char[] snippet,
-               int insertion,
-               int position,
-               char[][] localVariableTypeNames,
-               char[][] localVariableNames,
-               int[] localVariableModifiers,
-               boolean isStatic,
-               ICompletionRequestor requestor)
-               throws JavaModelException;
+//     void codeComplete(
+//             char[] snippet,
+//             int insertion,
+//             int position,
+//             char[][] localVariableTypeNames,
+//             char[][] localVariableNames,
+//             int[] localVariableModifiers,
+//             boolean isStatic,
+//             ICompletionRequestor requestor)
+//             throws JavaModelException;
 
        /**
         * Creates and returns a field in this type with the
@@ -94,8 +98,8 @@ public interface IType extends IMember, IParent {
         * </ul>
         * @return a field in this type with the given contents
         */
-       IField createField(String contents, IJavaElement sibling, boolean force, IProgressMonitor monitor)
-               throws JavaModelException;
+//     IField createField(String contents, IJavaElement sibling, boolean force, IProgressMonitor monitor)
+//             throws JavaModelException;
                
        /**
         * Creates and returns a static initializer in this type with the
@@ -119,8 +123,8 @@ public interface IType extends IMember, IParent {
         * </ul>
         * @return a static initializer in this type with the given contents
         */
-       IInitializer createInitializer(String contents, IJavaElement sibling, IProgressMonitor monitor)
-               throws JavaModelException;
+//     IInitializer createInitializer(String contents, IJavaElement sibling, IProgressMonitor monitor)
+//             throws JavaModelException;
                
        /**
         * Creates and returns a method or constructor in this type with the
@@ -153,8 +157,8 @@ public interface IType extends IMember, IParent {
         * </ul>
         * @return a method or constructor in this type with the given contents
         */
-       IMethod createMethod(String contents, IJavaElement sibling, boolean force, IProgressMonitor monitor)
-               throws JavaModelException;
+//     IMethod createMethod(String contents, IJavaElement sibling, boolean force, IProgressMonitor monitor)
+//             throws JavaModelException;
                
        /**
         * Creates and returns a type in this type with the
@@ -186,8 +190,8 @@ public interface IType extends IMember, IParent {
         * </ul>
         * @return a type in this type with the given contents
         */
-       IType createType(String contents, IJavaElement sibling, boolean force, IProgressMonitor monitor)
-               throws JavaModelException;
+//     IType createType(String contents, IJavaElement sibling, boolean force, IProgressMonitor monitor)
+//             throws JavaModelException;
                
        /** 
         * Finds the methods in this type that correspond to
@@ -280,13 +284,13 @@ public interface IType extends IMember, IParent {
        /**
         * Returns the initializer with the specified position relative to
         * the order they are defined in the source.
-        * Numbering starts at 1 (i.e. the first occurrence is occurrence 1, not occurrence 0).
+        * Numbering starts at 1 (thus the first occurrence is occurrence 1, not occurrence 0).
         * This is a handle-only method.  The initializer may or may not be present.
         * 
         * @param occurrenceCount the specified position
         * @return the initializer with the specified position relative to the order they are defined in the source
         */
-       IInitializer getInitializer(int occurrenceCount);
+//     IInitializer getInitializer(int occurrenceCount);
        
        /**
         * Returns the initializers declared by this type.
@@ -298,7 +302,7 @@ public interface IType extends IMember, IParent {
         *              exception occurs while accessing its corresponding resource.
         * @return the initializers declared by this type
         */
-       IInitializer[] getInitializers() throws JavaModelException;
+//     IInitializer[] getInitializers() throws JavaModelException;
        
        /**
         * Returns the method with the specified name and parameter types
@@ -333,7 +337,7 @@ public interface IType extends IMember, IParent {
         * 
         * @return the package fragment in which this element is defined
         */
-       //IPackageFragment getPackageFragment();
+       IPackageFragment getPackageFragment();
        
        /**
         * Returns the name of this type's superclass, or <code>null</code>
@@ -354,7 +358,7 @@ public interface IType extends IMember, IParent {
         * For classes, this gives the interfaces that this class implements.
         * For interfaces, this gives the interfaces that this interface extends.
         * An empty collection is returned if this type does not implement or
-        * extend any interfaces. For source types, simples name are returned,
+        * extend any interfaces. For source types, simple names are returned,
         * for binary types, qualified names are returned.
         *
         * @exception JavaModelException if this element does not exist or if an
@@ -473,7 +477,27 @@ public interface IType extends IMember, IParent {
         * @since 2.0
         */
        boolean isMember() throws JavaModelException;
-
+       /**
+        * Loads a previously saved ITypeHierarchy from an input stream. A type hierarchy can
+        * be stored using ITypeHierachy#store(OutputStream).
+        * 
+        * Only hierarchies originally created by the following methods can be load:
+        * <ul>
+        * <li>IType#newSupertypeHierarchy(IProgressMonitor)</li>
+        * <li>IType#newTypeHierarchy(IJavaProject, IProgressMonitor)</li>
+        * <li>IType#newTypeHierarchy(IProgressMonitor)</li>
+        * </u>
+        * 
+        * @param input stream where hierarchy will be read
+        * @param monitor the given progress monitor
+        * @return the stored hierarchy
+        * @exception JavaModelException if the hierarchy could not be restored, reasons include:
+        *      - type is not the focus of the hierarchy or 
+        *              - unable to read the input stream (wrong format, IOException during reading, ...)
+        * @see ITypeHierarchy#store(OutputStream, IProgressMonitor)
+        * @since 2.1
+        */
+//     ITypeHierarchy loadTypeHierachy(InputStream input, IProgressMonitor monitor) throws JavaModelException;
        /**
         * Creates and returns a type hierarchy for this type containing
         * this type and all of its supertypes.
@@ -483,7 +507,7 @@ public interface IType extends IMember, IParent {
         * @param monitor the given progress monitor
         * @return a type hierarchy for this type containing this type and all of its supertypes
         */
-       //ITypeHierarchy newSupertypeHierarchy(IProgressMonitor monitor) throws JavaModelException;
+//     ITypeHierarchy newSupertypeHierarchy(IProgressMonitor monitor) throws JavaModelException;
        
        /**
         * Creates and returns a type hierarchy for this type containing
@@ -503,7 +527,7 @@ public interface IType extends IMember, IParent {
         */
 //     ITypeHierarchy newSupertypeHierarchy(IWorkingCopy[] workingCopies, IProgressMonitor monitor)
 //             throws JavaModelException;
-//             
+               
        /**
         * Creates and returns a type hierarchy for this type containing
         * this type, all of its supertypes, and all its subtypes in the workspace.
@@ -533,7 +557,27 @@ public interface IType extends IMember, IParent {
         *              exception occurs while accessing its corresponding resource.
         * @since 2.0
         */
-       // ITypeHierarchy newTypeHierarchy(IWorkingCopy[] workingCopies, IProgressMonitor monitor) throws JavaModelException;
+//     ITypeHierarchy newTypeHierarchy(IWorkingCopy[] workingCopies, IProgressMonitor monitor) throws JavaModelException;
+       /**
+        * Creates and returns a type hierarchy for this type containing
+        * this type, all of its supertypes, and all its subtypes in the workspace, 
+        * considering types in the working copies with the given owner. 
+        * In other words, the owner's working copies will take 
+        * precedence over their original compilation units in the workspace.
+        * <p>
+        * Note that if a working copy is empty, it will be as if the original compilation
+        * unit had been deleted.
+        * <p>
+        *
+        * @param owner the owner of working copies that take precedence over their original compilation units
+        * @param monitor the given progress monitor
+        * @return a type hierarchy for this type containing
+        * this type, all of its supertypes, and all its subtypes in the workspace
+        * @exception JavaModelException if this element does not exist or if an
+        *              exception occurs while accessing its corresponding resource.
+        * @since 3.0
+        */
+//     ITypeHierarchy newTypeHierarchy(WorkingCopyOwner owner, IProgressMonitor monitor) throws JavaModelException;
        
        /**
         * Creates and returns a type hierarchy for this type containing
@@ -565,5 +609,5 @@ public interface IType extends IMember, IParent {
         * @exception JavaModelException if code resolve could not be performed. 
         * @return the resolved type names or <code>null</code> if unable to find any matching type
         */
-       String[][] resolveType(String typeName) throws JavaModelException;
+//     String[][] resolveType(String typeName) throws JavaModelException;
 }