01: /*******************************************************************************
02: * Copyright (c) 2005, 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.launching.environments;
11:
12: import org.eclipse.core.runtime.CoreException;
13: import org.eclipse.core.runtime.IConfigurationElement;
14: import org.eclipse.core.runtime.IProgressMonitor;
15: import org.eclipse.jdt.launching.IVMInstall;
16: import org.eclipse.jdt.launching.environments.CompatibleEnvironment;
17: import org.eclipse.jdt.launching.environments.IExecutionEnvironmentAnalyzerDelegate;
18:
19: /**
20: * Contributed analyzer.
21: *
22: * @since 3.2
23: *
24: */
25: class Analyzer implements IExecutionEnvironmentAnalyzerDelegate {
26:
27: private IConfigurationElement fElement;
28:
29: private IExecutionEnvironmentAnalyzerDelegate fDelegate;
30:
31: Analyzer(IConfigurationElement element) {
32: fElement = element;
33: }
34:
35: /* (non-Javadoc)
36: * @see org.eclipse.jdt.launching.environments.IExecutionEnvironmentAnalyzer#analyze(org.eclipse.jdt.launching.IVMInstall, org.eclipse.core.runtime.IProgressMonitor)
37: */
38: public CompatibleEnvironment[] analyze(IVMInstall vm,
39: IProgressMonitor monitor) throws CoreException {
40: return getDelegate().analyze(vm, monitor);
41: }
42:
43: /**
44: * Instantiates and returns the contributed analyzer.
45: *
46: * @return analyzer
47: * @throws CoreException
48: */
49: private IExecutionEnvironmentAnalyzerDelegate getDelegate()
50: throws CoreException {
51: if (fDelegate == null) {
52: fDelegate = (IExecutionEnvironmentAnalyzerDelegate) fElement
53: .createExecutableExtension("class"); //$NON-NLS-1$
54: }
55: return fDelegate;
56: }
57:
58: /**
59: * Returns the id of this delegate
60: * @return id
61: */
62: public String getId() {
63: return fElement.getAttribute("id"); //$NON-NLS-1$
64: }
65:
66: }
|