KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > internal > core > ExternalJavaProject


1 /*******************************************************************************
2  * Copyright (c) 2000, 2007 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.core;
12
13 import org.eclipse.core.resources.IResource;
14 import org.eclipse.core.resources.ResourcesPlugin;
15 import org.eclipse.jdt.core.IClasspathEntry;
16 import org.eclipse.jdt.core.IJavaElement;
17 import org.eclipse.jdt.core.JavaCore;
18 import org.eclipse.jdt.core.JavaModelException;
19
20 public class ExternalJavaProject extends JavaProject {
21     
22     /*
23      * Note this name can be surfaced in the UI (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=128258)
24      */

25     public static final String JavaDoc EXTERNAL_PROJECT_NAME = " "; //$NON-NLS-1$
26

27     public ExternalJavaProject(IClasspathEntry[] rawClasspath) {
28         super(ResourcesPlugin.getWorkspace().getRoot().getProject(EXTERNAL_PROJECT_NAME), JavaModelManager.getJavaModelManager().getJavaModel());
29         try {
30             getPerProjectInfo().setClasspath(rawClasspath, defaultOutputLocation(), JavaModelStatus.VERIFIED_OK/*no .classpath format problem*/, null/*no resolved claspath*/, null/*no reverse map*/, null/*no resolve entry map*/, null/*no resolved status*/);
31         } catch (JavaModelException e) {
32             // getPerProjectInfo() never throws JavaModelException for an ExternalJavaProject
33
}
34     }
35     
36     public boolean equals(Object JavaDoc o) {
37         return this == o;
38     }
39
40     public boolean exists() {
41         // external project never exists
42
return false;
43     }
44     
45     public String JavaDoc getOption(String JavaDoc optionName, boolean inheritJavaCoreOptions) {
46         if (JavaCore.COMPILER_PB_FORBIDDEN_REFERENCE.equals(optionName)
47                 || JavaCore.COMPILER_PB_DISCOURAGED_REFERENCE.equals(optionName))
48             return JavaCore.IGNORE;
49         return super.getOption(optionName, inheritJavaCoreOptions);
50     }
51     
52     public boolean isOnClasspath(IJavaElement element) {
53         // since project is external, no element is on classpath (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=61013#c16)
54
return false;
55     }
56
57     public boolean isOnClasspath(IResource resource) {
58         // since project is external, no resource is on classpath (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=61013#c16)
59
return false;
60     }
61
62 }
63
Popular Tags