KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > internal > launching > environments > Analyzer


1 /*******************************************************************************
2  * Copyright (c) 2005, 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.launching.environments;
12
13 import org.eclipse.core.runtime.CoreException;
14 import org.eclipse.core.runtime.IConfigurationElement;
15 import org.eclipse.core.runtime.IProgressMonitor;
16 import org.eclipse.jdt.launching.IVMInstall;
17 import org.eclipse.jdt.launching.environments.CompatibleEnvironment;
18 import org.eclipse.jdt.launching.environments.IExecutionEnvironmentAnalyzerDelegate;
19
20 /**
21  * Contributed analyzer.
22  *
23  * @since 3.2
24  *
25  */

26 class Analyzer implements IExecutionEnvironmentAnalyzerDelegate {
27     
28     private IConfigurationElement fElement;
29     
30     private IExecutionEnvironmentAnalyzerDelegate fDelegate;
31     
32     Analyzer(IConfigurationElement element) {
33         fElement = element;
34     }
35
36     /* (non-Javadoc)
37      * @see org.eclipse.jdt.launching.environments.IExecutionEnvironmentAnalyzer#analyze(org.eclipse.jdt.launching.IVMInstall, org.eclipse.core.runtime.IProgressMonitor)
38      */

39     public CompatibleEnvironment[] analyze(IVMInstall vm, 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() throws CoreException {
50         if (fDelegate == null) {
51             fDelegate = (IExecutionEnvironmentAnalyzerDelegate) fElement.createExecutableExtension("class"); //$NON-NLS-1$
52
}
53         return fDelegate;
54     }
55
56     /**
57      * Returns the id of this delegate
58      * @return id
59      */

60     public String JavaDoc getId() {
61         return fElement.getAttribute("id"); //$NON-NLS-1$
62
}
63
64 }
65
Popular Tags