*******************************************************************************/
package net.sourceforge.phpdt.internal.core;
+import java.util.ArrayList;
+
+import net.sourceforge.phpdt.core.ICompilationUnit;
import net.sourceforge.phpdt.core.IJavaElement;
import net.sourceforge.phpdt.core.IJavaModel;
+import net.sourceforge.phpdt.core.IJavaModelStatusConstants;
+import net.sourceforge.phpdt.core.IJavaProject;
import net.sourceforge.phpdt.core.IOpenable;
import net.sourceforge.phpdt.core.JavaModelException;
/**
* @see IJavaElement
*/
-// public boolean exists() {
-//
-// try {
-// getElementInfo();
-// return true;
-// } catch (JavaModelException e) {
-// }
-// return false;
-// }
+ public boolean exists() {
+
+ try {
+ getElementInfo();
+ return true;
+ } catch (JavaModelException e) {
+ }
+ return false;
+ }
/**
* Returns the <code>IDOMNode</code> that corresponds to this <code>JavaElement</code>
/**
* @see IParent
*/
-// public IJavaElement[] getChildren() throws JavaModelException {
-// return ((JavaElementInfo)getElementInfo()).getChildren();
-// }
+ public IJavaElement[] getChildren() throws JavaModelException {
+ return ((JavaElementInfo)getElementInfo()).getChildren();
+ }
/**
* Returns a collection of (immediate) children of this node of the
* specified type.
*
* @param type - one of constants defined by IJavaLanguageElementTypes
*/
-// public ArrayList getChildrenOfType(int type) throws JavaModelException {
-// IJavaElement[] children = getChildren();
-// int size = children.length;
-// ArrayList list = new ArrayList(size);
-// for (int i = 0; i < size; ++i) {
-// JavaElement elt = (JavaElement)children[i];
-// if (elt.getElementType() == type) {
-// list.add(elt);
-// }
-// }
-// return list;
-// }
+ public ArrayList getChildrenOfType(int type) throws JavaModelException {
+ IJavaElement[] children = getChildren();
+ int size = children.length;
+ ArrayList list = new ArrayList(size);
+ for (int i = 0; i < size; ++i) {
+ JavaElement elt = (JavaElement)children[i];
+ if (elt.getElementType() == type) {
+ list.add(elt);
+ }
+ }
+ return list;
+ }
/**
* @see IMember
*/
// public IClassFile getClassFile() {
// return null;
// }
-// /**
-// * @see IMember
-// */
-// public ICompilationUnit getCompilationUnit() {
-// return null;
-// }
+ /**
+ * @see IMember
+ */
+ public ICompilationUnit getCompilationUnit() {
+ return null;
+ }
/**
* Returns the info for this handle.
* If this element is not already open, it and all of its parents are opened.
* NOTE: BinaryType infos are NJOT rooted under JavaElementInfo.
* @exception JavaModelException if the element is not present or not accessible
*/
-// public Object getElementInfo() throws JavaModelException {
-//
-// // workaround to ensure parent project resolved classpath is available to avoid triggering initializers
-// // while the JavaModelManager lock is acquired (can cause deadlocks in clients)
+ public Object getElementInfo() throws JavaModelException {
+return null;
+ // workaround to ensure parent project resolved classpath is available to avoid triggering initializers
+ // while the JavaModelManager lock is acquired (can cause deadlocks in clients)
// IJavaProject project = getJavaProject();
// if (project != null && !project.isOpen()) {
// // TODO: need to revisit, since deadlock could still occur if perProjectInfo is removed concurrent before entering the lock
// }
// return info;
// }
-// }
+ }
/**
* @see IAdaptable
*/
} while ((current = current.getParent()) != null);
return null;
}
-//
-// /**
-// * @see IJavaElement
-// */
-// public IJavaProject getJavaProject() {
-// IJavaElement current = this;
-// do {
-// if (current instanceof IJavaProject) return (IJavaProject) current;
-// } while ((current = current.getParent()) != null);
-// return null;
-// }
+
+ /**
+ * @see IJavaElement
+ */
+ public IJavaProject getJavaProject() {
+ IJavaElement current = this;
+ do {
+ if (current instanceof IJavaProject) return (IJavaProject) current;
+ } while ((current = current.getParent()) != null);
+ return null;
+ }
/**
* Returns the occurrence count of the handle.
*/
// public boolean isStructureKnown() throws JavaModelException {
// return ((JavaElementInfo)getElementInfo()).isStructureKnown();
// }
-// /**
-// * Creates and returns and not present exception for this element.
-// */
-// protected JavaModelException newNotPresentException() {
-// return new JavaModelException(new JavaModelStatus(IJavaModelStatusConstants.ELEMENT_DOES_NOT_EXIST, this));
-// }
+ /**
+ * Creates and returns and not present exception for this element.
+ */
+ protected JavaModelException newNotPresentException() {
+ return new JavaModelException(new JavaModelStatus(IJavaModelStatusConstants.ELEMENT_DOES_NOT_EXIST, this));
+ }
// /**
// * Opens this element and all parents that are not already open.
// *
// /**
// * Returns a copy of this element rooted at the given project.
// */
-// public abstract IJavaElement rootedAt(IJavaProject project);
+ public abstract IJavaElement rootedAt(IJavaProject project);
// /**
// * Runs a Java Model Operation
// */