2 * Copyright (C) 2008 The Android Open Source Project
4 * Licensed under the Eclipse Public License, Version 1.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.eclipse.org/org/documents/epl-v10.php
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 package com.android.ide.eclipse.mock;
19 import org.eclipse.core.resources.IProject;
20 import org.eclipse.core.resources.IResource;
21 import org.eclipse.core.runtime.IPath;
22 import org.eclipse.core.runtime.IProgressMonitor;
23 import org.eclipse.core.runtime.jobs.ISchedulingRule;
24 import org.eclipse.jdt.core.IBuffer;
25 import org.eclipse.jdt.core.IClasspathEntry;
26 import org.eclipse.jdt.core.IJavaElement;
27 import org.eclipse.jdt.core.IJavaModel;
28 import org.eclipse.jdt.core.IJavaProject;
29 import org.eclipse.jdt.core.IOpenable;
30 import org.eclipse.jdt.core.IPackageFragment;
31 import org.eclipse.jdt.core.IPackageFragmentRoot;
32 import org.eclipse.jdt.core.IRegion;
33 import org.eclipse.jdt.core.IType;
34 import org.eclipse.jdt.core.ITypeHierarchy;
35 import org.eclipse.jdt.core.JavaCore;
36 import org.eclipse.jdt.core.JavaModelException;
37 import org.eclipse.jdt.core.WorkingCopyOwner;
38 import org.eclipse.jdt.core.eval.IEvaluationContext;
40 import sun.reflect.generics.reflectiveObjects.NotImplementedException;
44 public class JavaProjectMock implements IJavaProject {
46 private IProject mProject;
48 private IClasspathEntry[] mEntries;
49 private IPath mOutputLocation;
50 private String mCompilerCompliance = "1.4"; //$NON-NLS-1
51 private String mCompilerSource = "1.4"; //$NON-NLS-1
52 private String mCompilerTarget = "1.4"; //$NON-NLS-1
54 public JavaProjectMock(IClasspathEntry[] entries, IPath outputLocation) {
56 mOutputLocation = outputLocation;
59 public IProject getProject() {
60 if (mProject == null) {
61 mProject = new ProjectMock();
68 public void setRawClasspath(IClasspathEntry[] entries, IProgressMonitor monitor)
69 throws JavaModelException {
73 public void setRawClasspath(IClasspathEntry[] entries, IPath outputLocation,
74 IProgressMonitor monitor) throws JavaModelException {
76 mOutputLocation = outputLocation;
79 public IClasspathEntry[] getRawClasspath() throws JavaModelException {
83 public IPath getOutputLocation() throws JavaModelException {
84 return mOutputLocation;
87 public String getOption(String optionName, boolean inheritJavaCoreOptions) {
88 if (optionName.equals(JavaCore.COMPILER_COMPLIANCE)) {
89 return mCompilerCompliance;
90 } else if (optionName.equals(JavaCore.COMPILER_SOURCE)) {
91 return mCompilerSource;
92 } else if (optionName.equals(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM)) {
93 return mCompilerTarget;
99 public void setOption(String optionName, String optionValue) {
100 if (optionName.equals(JavaCore.COMPILER_COMPLIANCE)) {
101 mCompilerCompliance = optionValue;
102 } else if (optionName.equals(JavaCore.COMPILER_SOURCE)) {
103 mCompilerSource = optionValue;
104 } else if (optionName.equals(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM)) {
105 mCompilerTarget = optionValue;
107 throw new NotImplementedException();
112 // -------- UNIMPLEMENTED METHODS ----------------
114 public IClasspathEntry decodeClasspathEntry(String encodedEntry) {
115 throw new NotImplementedException();
118 public String encodeClasspathEntry(IClasspathEntry classpathEntry) {
119 throw new NotImplementedException();
122 public IJavaElement findElement(IPath path) throws JavaModelException {
123 throw new NotImplementedException();
126 public IJavaElement findElement(IPath path, WorkingCopyOwner owner) throws JavaModelException {
127 throw new NotImplementedException();
130 public IPackageFragment findPackageFragment(IPath path) throws JavaModelException {
131 throw new NotImplementedException();
134 public IPackageFragmentRoot findPackageFragmentRoot(IPath path) throws JavaModelException {
135 throw new NotImplementedException();
138 public IPackageFragmentRoot[] findPackageFragmentRoots(IClasspathEntry entry) {
139 throw new NotImplementedException();
142 public IType findType(String fullyQualifiedName) throws JavaModelException {
143 throw new NotImplementedException();
146 public IType findType(String fullyQualifiedName, IProgressMonitor progressMonitor)
147 throws JavaModelException {
148 throw new NotImplementedException();
151 public IType findType(String fullyQualifiedName, WorkingCopyOwner owner)
152 throws JavaModelException {
153 throw new NotImplementedException();
156 public IType findType(String packageName, String typeQualifiedName) throws JavaModelException {
157 throw new NotImplementedException();
160 public IType findType(String fullyQualifiedName, WorkingCopyOwner owner,
161 IProgressMonitor progressMonitor) throws JavaModelException {
162 throw new NotImplementedException();
165 public IType findType(String packageName, String typeQualifiedName,
166 IProgressMonitor progressMonitor) throws JavaModelException {
167 throw new NotImplementedException();
170 public IType findType(String packageName, String typeQualifiedName, WorkingCopyOwner owner)
171 throws JavaModelException {
172 throw new NotImplementedException();
175 public IType findType(String packageName, String typeQualifiedName, WorkingCopyOwner owner,
176 IProgressMonitor progressMonitor) throws JavaModelException {
177 throw new NotImplementedException();
180 public IPackageFragmentRoot[] getAllPackageFragmentRoots() throws JavaModelException {
181 throw new NotImplementedException();
184 public Object[] getNonJavaResources() throws JavaModelException {
185 throw new NotImplementedException();
188 @SuppressWarnings("unchecked")
189 public Map getOptions(boolean inheritJavaCoreOptions) {
190 throw new NotImplementedException();
193 public IPackageFragmentRoot getPackageFragmentRoot(String jarPath) {
194 throw new NotImplementedException();
197 public IPackageFragmentRoot getPackageFragmentRoot(IResource resource) {
198 throw new NotImplementedException();
201 public IPackageFragmentRoot[] getPackageFragmentRoots() throws JavaModelException {
202 throw new NotImplementedException();
205 public IPackageFragmentRoot[] getPackageFragmentRoots(IClasspathEntry entry) {
206 throw new NotImplementedException();
209 public IPackageFragment[] getPackageFragments() throws JavaModelException {
210 throw new NotImplementedException();
213 public String[] getRequiredProjectNames() throws JavaModelException {
214 throw new NotImplementedException();
217 public IClasspathEntry[] getResolvedClasspath(boolean ignoreUnresolvedEntry)
218 throws JavaModelException {
219 throw new NotImplementedException();
222 public boolean hasBuildState() {
223 throw new NotImplementedException();
226 public boolean hasClasspathCycle(IClasspathEntry[] entries) {
227 throw new NotImplementedException();
230 public boolean isOnClasspath(IJavaElement element) {
231 throw new NotImplementedException();
234 public boolean isOnClasspath(IResource resource) {
235 throw new NotImplementedException();
238 public IEvaluationContext newEvaluationContext() {
239 throw new NotImplementedException();
242 public ITypeHierarchy newTypeHierarchy(IRegion region, IProgressMonitor monitor)
243 throws JavaModelException {
244 throw new NotImplementedException();
247 public ITypeHierarchy newTypeHierarchy(IRegion region, WorkingCopyOwner owner,
248 IProgressMonitor monitor) throws JavaModelException {
249 throw new NotImplementedException();
252 public ITypeHierarchy newTypeHierarchy(IType type, IRegion region, IProgressMonitor monitor)
253 throws JavaModelException {
254 throw new NotImplementedException();
257 public ITypeHierarchy newTypeHierarchy(IType type, IRegion region, WorkingCopyOwner owner,
258 IProgressMonitor monitor) throws JavaModelException {
259 throw new NotImplementedException();
262 public IPath readOutputLocation() {
263 throw new NotImplementedException();
266 public IClasspathEntry[] readRawClasspath() {
267 throw new NotImplementedException();
270 @SuppressWarnings("unchecked")
271 public void setOptions(Map newOptions) {
272 throw new NotImplementedException();
275 public void setOutputLocation(IPath path, IProgressMonitor monitor) throws JavaModelException {
276 throw new NotImplementedException();
279 public void setRawClasspath(IClasspathEntry[] entries, boolean canModifyResources,
280 IProgressMonitor monitor) throws JavaModelException {
281 throw new NotImplementedException();
284 public void setRawClasspath(IClasspathEntry[] entries, IPath outputLocation,
285 boolean canModifyResources, IProgressMonitor monitor) throws JavaModelException {
286 throw new NotImplementedException();
289 public IJavaElement[] getChildren() throws JavaModelException {
290 throw new NotImplementedException();
293 public boolean hasChildren() throws JavaModelException {
294 throw new NotImplementedException();
297 public boolean exists() {
298 throw new NotImplementedException();
301 public IJavaElement getAncestor(int ancestorType) {
302 throw new NotImplementedException();
305 public String getAttachedJavadoc(IProgressMonitor monitor) throws JavaModelException {
306 throw new NotImplementedException();
309 public IResource getCorrespondingResource() throws JavaModelException {
310 throw new NotImplementedException();
313 public String getElementName() {
314 throw new NotImplementedException();
317 public int getElementType() {
318 throw new NotImplementedException();
321 public String getHandleIdentifier() {
322 throw new NotImplementedException();
325 public IJavaModel getJavaModel() {
326 throw new NotImplementedException();
329 public IJavaProject getJavaProject() {
330 throw new NotImplementedException();
333 public IOpenable getOpenable() {
334 throw new NotImplementedException();
337 public IJavaElement getParent() {
338 throw new NotImplementedException();
341 public IPath getPath() {
342 throw new NotImplementedException();
345 public IJavaElement getPrimaryElement() {
346 throw new NotImplementedException();
349 public IResource getResource() {
350 throw new NotImplementedException();
353 public ISchedulingRule getSchedulingRule() {
354 throw new NotImplementedException();
357 public IResource getUnderlyingResource() throws JavaModelException {
358 throw new NotImplementedException();
361 public boolean isReadOnly() {
362 throw new NotImplementedException();
365 public boolean isStructureKnown() throws JavaModelException {
366 throw new NotImplementedException();
369 @SuppressWarnings("unchecked")
370 public Object getAdapter(Class adapter) {
371 throw new NotImplementedException();
374 public void close() throws JavaModelException {
375 throw new NotImplementedException();
378 public String findRecommendedLineSeparator() throws JavaModelException {
379 throw new NotImplementedException();
382 public IBuffer getBuffer() throws JavaModelException {
383 throw new NotImplementedException();
386 public boolean hasUnsavedChanges() throws JavaModelException {
387 throw new NotImplementedException();
390 public boolean isConsistent() throws JavaModelException {
391 throw new NotImplementedException();
394 public boolean isOpen() {
395 throw new NotImplementedException();
398 public void makeConsistent(IProgressMonitor progress) throws JavaModelException {
399 throw new NotImplementedException();
402 public void open(IProgressMonitor progress) throws JavaModelException {
403 throw new NotImplementedException();
406 public void save(IProgressMonitor progress, boolean force) throws JavaModelException {
407 throw new NotImplementedException();
410 public IJavaElement findElement(String bindingKey, WorkingCopyOwner owner)
411 throws JavaModelException {
412 throw new NotImplementedException();