KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > internal > launching > VariableClasspathResolver


1 /*******************************************************************************
2  * Copyright (c) 2000, 2005 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
12 package org.eclipse.jdt.internal.launching;
13
14 import org.eclipse.core.runtime.CoreException;
15 import org.eclipse.core.runtime.IPath;
16 import org.eclipse.core.runtime.Path;
17 import org.eclipse.core.variables.VariablesPlugin;
18 import org.eclipse.debug.core.ILaunchConfiguration;
19 import org.eclipse.jdt.core.IClasspathEntry;
20 import org.eclipse.jdt.core.IJavaProject;
21 import org.eclipse.jdt.launching.IRuntimeClasspathEntry;
22 import org.eclipse.jdt.launching.IRuntimeClasspathEntryResolver;
23 import org.eclipse.jdt.launching.IVMInstall;
24 import org.eclipse.jdt.launching.JavaRuntime;
25
26
27 public class VariableClasspathResolver implements IRuntimeClasspathEntryResolver {
28
29     /* (non-Javadoc)
30      * @see org.eclipse.jdt.launching.IRuntimeClasspathEntryResolver#resolveRuntimeClasspathEntry(org.eclipse.jdt.launching.IRuntimeClasspathEntry, org.eclipse.debug.core.ILaunchConfiguration)
31      */

32     public IRuntimeClasspathEntry[] resolveRuntimeClasspathEntry(IRuntimeClasspathEntry entry, ILaunchConfiguration configuration) throws CoreException {
33         return resolveRuntimeClasspathEntry(entry);
34     }
35
36     /* (non-Javadoc)
37      * @see org.eclipse.jdt.launching.IRuntimeClasspathEntryResolver#resolveRuntimeClasspathEntry(org.eclipse.jdt.launching.IRuntimeClasspathEntry, org.eclipse.jdt.core.IJavaProject)
38      */

39     public IRuntimeClasspathEntry[] resolveRuntimeClasspathEntry(IRuntimeClasspathEntry entry, IJavaProject project) throws CoreException {
40         return resolveRuntimeClasspathEntry(entry);
41     }
42
43     private IRuntimeClasspathEntry[] resolveRuntimeClasspathEntry(IRuntimeClasspathEntry entry) throws CoreException{
44         String JavaDoc variableString = ((VariableClasspathEntry)entry).getVariableString();
45         String JavaDoc strpath = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(variableString);
46         IPath path = new Path(strpath).makeAbsolute();
47         IRuntimeClasspathEntry archiveEntry = JavaRuntime.newArchiveRuntimeClasspathEntry(path);
48         return new IRuntimeClasspathEntry[] { archiveEntry };
49     }
50     
51     /* (non-Javadoc)
52      * @see org.eclipse.jdt.launching.IRuntimeClasspathEntryResolver#resolveVMInstall(org.eclipse.jdt.core.IClasspathEntry)
53      */

54     public IVMInstall resolveVMInstall(IClasspathEntry entry) throws CoreException {
55         return null;
56     }
57 }
58
Popular Tags