import net.sourceforge.phpdt.core.IPackageFragment;
import net.sourceforge.phpdt.core.IPackageFragmentRoot;
import net.sourceforge.phpdt.core.JavaModelException;
+import net.sourceforge.phpdt.core.WorkingCopyOwner;
+import net.sourceforge.phpdt.internal.core.util.MementoTokenizer;
import net.sourceforge.phpdt.internal.core.util.Util;
import net.sourceforge.phpdt.internal.ui.util.PHPFileUtil;
if (extension != null) {
if (extension.equalsIgnoreCase(extType)) {
IJavaElement childElement;
-// if (kind == IPackageFragmentRoot.K_SOURCE && Util.isValidCompilationUnitName(child.getName())) {
+// if (kind == IPackageFragmentRoot.K_SOURCE && ProjectPrefUtil.isValidCompilationUnitName(child.getName())) {
// childElement = new CompilationUnit(this, child.getName(), DefaultWorkingCopyOwner.PRIMARY);
// vChildren.add(childElement);
-// } else if (Util.isValidClassFileName(child.getName())) {
+// } else if (ProjectPrefUtil.isValidClassFileName(child.getName())) {
// childElement = getClassFile(child.getName());
// vChildren.add(childElement);
// }
// for (int i = 0, max = members.length; i < max; i++) {
// IResource child = members[i];
// if (child.getType() != IResource.FOLDER
-// && !Util.isExcluded(child, exclusionPatterns)) {
+// && !ProjectPrefUtil.isExcluded(child, exclusionPatterns)) {
// String extension = child.getProjectRelativePath().getFileExtension();
// if (extension != null) {
// if (extension.equalsIgnoreCase(extType)) {
// IJavaElement childElement;
-//// if (kind == IPackageFragmentRoot.K_SOURCE && Util.isValidCompilationUnitName(child.getName())) {
+//// if (kind == IPackageFragmentRoot.K_SOURCE && ProjectPrefUtil.isValidCompilationUnitName(child.getName())) {
//// childElement = getCompilationUnit(child.getName());
//// vChildren.add(childElement);
-//// } else if (Util.isValidClassFileName(child.getName())) {
+//// } else if (ProjectPrefUtil.isValidClassFileName(child.getName())) {
//// childElement = getClassFile(child.getName());
//// vChildren.add(childElement);
//// }
*/
//public void copy(IJavaElement container, IJavaElement sibling, String rename, boolean force, IProgressMonitor monitor) throws JavaModelException {
// if (container == null) {
-// throw new IllegalArgumentException(Util.bind("operation.nullContainer")); //$NON-NLS-1$
+// throw new IllegalArgumentException(ProjectPrefUtil.bind("operation.nullContainer")); //$NON-NLS-1$
// }
// IJavaElement[] elements= new IJavaElement[] {this};
// IJavaElement[] containers= new IJavaElement[] {container};
//}
/**
* @see IPackageFragment#getCompilationUnit(String)
- * @exception IllegalArgumentExcpetion if the name does not end with ".java"
+ * @exception IllegalArgumentExcpetion if the name does not end with a php file extension
*/
public ICompilationUnit getCompilationUnit(String cuName) {
if (! PHPFileUtil.isValidPHPUnitName(cuName)) {
public int getElementType() {
return PACKAGE_FRAGMENT;
}
+/*
+ * @see JavaElement
+ */
+public IJavaElement getHandleFromMemento(String token, MementoTokenizer memento, WorkingCopyOwner owner) {
+ switch (token.charAt(0)) {
+ case JEM_COUNT:
+ return getHandleUpdatingCountFromMemento(memento, owner);
+// case JEM_CLASSFILE:
+// String classFileName = memento.nextToken();
+// JavaElement classFile = (JavaElement)getClassFile(classFileName);
+// return classFile.getHandleFromMemento(memento, owner);
+ case JEM_COMPILATIONUNIT:
+ String cuName = memento.nextToken();
+ JavaElement cu = new CompilationUnit(this, cuName, owner);
+ return cu.getHandleFromMemento(memento, owner);
+ }
+ return null;
+}
/**
* @see JavaElement#getHandleMementoDelimiter()
*/
*/
//public void move(IJavaElement container, IJavaElement sibling, String rename, boolean force, IProgressMonitor monitor) throws JavaModelException {
// if (container == null) {
-// throw new IllegalArgumentException(Util.bind("operation.nullContainer")); //$NON-NLS-1$
+// throw new IllegalArgumentException(ProjectPrefUtil.bind("operation.nullContainer")); //$NON-NLS-1$
// }
// IJavaElement[] elements= new IJavaElement[] {this};
// IJavaElement[] containers= new IJavaElement[] {container};
*/
//public void rename(String name, boolean force, IProgressMonitor monitor) throws JavaModelException {
// if (name == null) {
-// throw new IllegalArgumentException(Util.bind("element.nullName")); //$NON-NLS-1$
+// throw new IllegalArgumentException(ProjectPrefUtil.bind("element.nullName")); //$NON-NLS-1$
// }
// IJavaElement[] elements= new IJavaElement[] {this};
// IJavaElement[] dests= new IJavaElement[] {this.getParent()};