KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > internal > corext > util > UnresolvableTypeInfo


1 /*******************************************************************************
2  * Copyright (c) 2000, 2006 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.jdt.internal.corext.util;
12
13 import org.eclipse.core.runtime.IPath;
14 import org.eclipse.core.runtime.Path;
15
16 import org.eclipse.core.resources.IResource;
17
18 import org.eclipse.jdt.core.IJavaElement;
19 import org.eclipse.jdt.core.search.IJavaSearchScope;
20
21 /**
22  * A type info element that represent an unresolveable type. This can happen if
23  * the search engine reports a type name that doesn't exist in the workspace.
24  */

25 public class UnresolvableTypeInfo extends TypeInfo {
26     
27     private final String JavaDoc fPath;
28     
29     public UnresolvableTypeInfo(String JavaDoc pkg, String JavaDoc name, char[][] enclosingTypes, int modifiers, String JavaDoc path) {
30         super(pkg, name, enclosingTypes, modifiers);
31         fPath= path;
32     }
33     
34     public boolean equals(Object JavaDoc obj) {
35         if (!UnresolvableTypeInfo.class.equals(obj.getClass()))
36             return false;
37         UnresolvableTypeInfo other= (UnresolvableTypeInfo)obj;
38         return doEquals(other) && fPath.equals(other.fPath);
39     }
40     
41     public int getElementType() {
42         return TypeInfo.UNRESOLVABLE_TYPE_INFO;
43     }
44     
45     public String JavaDoc getPath() {
46         return fPath;
47     }
48     
49     public IPath getPackageFragmentRootPath() {
50         return new Path(fPath);
51     }
52     
53     public String JavaDoc getPackageFragmentRootName() {
54         return fPath;
55     }
56     
57     protected IJavaElement getContainer(IJavaSearchScope scope) {
58         return null;
59     }
60     
61     public long getContainerTimestamp() {
62         return IResource.NULL_STAMP;
63     }
64     
65     public boolean isContainerDirty() {
66         return false;
67     }
68 }
69
Popular Tags