KickJava   Java API By Example, From Geeks To Geeks.

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


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 package org.eclipse.jdt.internal.launching;
12
13 import java.util.ArrayList JavaDoc;
14 import java.util.List JavaDoc;
15
16 import org.eclipse.core.runtime.CoreException;
17 import org.eclipse.debug.core.ILaunchConfiguration;
18 import org.eclipse.jdt.core.IClasspathEntry;
19 import org.eclipse.jdt.core.IJavaProject;
20 import org.eclipse.jdt.launching.*;
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  * Default resolver for a contributed classpath entry
28  */

29 public class DefaultEntryResolver implements IRuntimeClasspathEntryResolver {
30     /* (non-Javadoc)
31      * @see org.eclipse.jdt.launching.IRuntimeClasspathEntryResolver#resolveRuntimeClasspathEntry(org.eclipse.jdt.launching.IRuntimeClasspathEntry, org.eclipse.debug.core.ILaunchConfiguration)
32      */

33     public IRuntimeClasspathEntry[] resolveRuntimeClasspathEntry(IRuntimeClasspathEntry entry, ILaunchConfiguration configuration) throws CoreException {
34         IRuntimeClasspathEntry2 entry2 = (IRuntimeClasspathEntry2)entry;
35         IRuntimeClasspathEntry[] entries = entry2.getRuntimeClasspathEntries(configuration);
36         List JavaDoc resolved = new ArrayList JavaDoc();
37         for (int i = 0; i < entries.length; i++) {
38             IRuntimeClasspathEntry[] temp = JavaRuntime.resolveRuntimeClasspathEntry(entries[i], configuration);
39             for (int j = 0; j < temp.length; j++) {
40                 resolved.add(temp[j]);
41             }
42         }
43         return (IRuntimeClasspathEntry[]) resolved.toArray(new IRuntimeClasspathEntry[resolved.size()]);
44     }
45     /* (non-Javadoc)
46      * @see org.eclipse.jdt.launching.IRuntimeClasspathEntryResolver#resolveRuntimeClasspathEntry(org.eclipse.jdt.launching.IRuntimeClasspathEntry, org.eclipse.jdt.core.IJavaProject)
47      */

48     public IRuntimeClasspathEntry[] resolveRuntimeClasspathEntry(IRuntimeClasspathEntry entry, IJavaProject project) throws CoreException {
49         IRuntimeClasspathEntry2 entry2 = (IRuntimeClasspathEntry2)entry;
50         IRuntimeClasspathEntry[] entries = entry2.getRuntimeClasspathEntries(null);
51         List JavaDoc resolved = new ArrayList JavaDoc();
52         for (int i = 0; i < entries.length; i++) {
53             IRuntimeClasspathEntry[] temp = JavaRuntime.resolveRuntimeClasspathEntry(entries[i], project);
54             for (int j = 0; j < temp.length; j++) {
55                 resolved.add(temp[j]);
56             }
57         }
58         return (IRuntimeClasspathEntry[]) resolved.toArray(new IRuntimeClasspathEntry[resolved.size()]);
59     }
60         
61     /* (non-Javadoc)
62      * @see org.eclipse.jdt.launching.IRuntimeClasspathEntryResolver#resolveVMInstall(org.eclipse.jdt.core.IClasspathEntry)
63      */

64     public IVMInstall resolveVMInstall(IClasspathEntry entry) throws CoreException {
65         return null;
66     }
67 }
68
Popular Tags