01: /*******************************************************************************
02: * Copyright (c) 2000, 2007 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: *******************************************************************************/package org.eclipse.jdt.internal.core;
11:
12: import org.eclipse.core.resources.IResource;
13: import org.eclipse.core.resources.ResourcesPlugin;
14: import org.eclipse.jdt.core.IClasspathEntry;
15: import org.eclipse.jdt.core.IJavaElement;
16: import org.eclipse.jdt.core.JavaCore;
17: import org.eclipse.jdt.core.JavaModelException;
18:
19: public class ExternalJavaProject extends JavaProject {
20:
21: /*
22: * Note this name can be surfaced in the UI (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=128258)
23: */
24: public static final String EXTERNAL_PROJECT_NAME = " "; //$NON-NLS-1$
25:
26: public ExternalJavaProject(IClasspathEntry[] rawClasspath) {
27: super (ResourcesPlugin.getWorkspace().getRoot().getProject(
28: EXTERNAL_PROJECT_NAME), JavaModelManager
29: .getJavaModelManager().getJavaModel());
30: try {
31: getPerProjectInfo()
32: .setClasspath(
33: rawClasspath,
34: defaultOutputLocation(),
35: JavaModelStatus.VERIFIED_OK/*no .classpath format problem*/,
36: null/*no resolved claspath*/,
37: null/*no reverse map*/,
38: null/*no resolve entry map*/, null/*no resolved status*/);
39: } catch (JavaModelException e) {
40: // getPerProjectInfo() never throws JavaModelException for an ExternalJavaProject
41: }
42: }
43:
44: public boolean equals(Object o) {
45: return this == o;
46: }
47:
48: public boolean exists() {
49: // external project never exists
50: return false;
51: }
52:
53: public String getOption(String optionName,
54: boolean inheritJavaCoreOptions) {
55: if (JavaCore.COMPILER_PB_FORBIDDEN_REFERENCE.equals(optionName)
56: || JavaCore.COMPILER_PB_DISCOURAGED_REFERENCE
57: .equals(optionName))
58: return JavaCore.IGNORE;
59: return super .getOption(optionName, inheritJavaCoreOptions);
60: }
61:
62: public boolean isOnClasspath(IJavaElement element) {
63: // since project is external, no element is on classpath (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=61013#c16)
64: return false;
65: }
66:
67: public boolean isOnClasspath(IResource resource) {
68: // since project is external, no resource is on classpath (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=61013#c16)
69: return false;
70: }
71:
72: }
|