KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > debug > internal > core > LaunchConfigurationComparator


1 /*******************************************************************************
2  * Copyright (c) 2000, 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.debug.internal.core;
12
13  
14 import java.util.Comparator JavaDoc;
15
16 import org.eclipse.core.runtime.CoreException;
17 import org.eclipse.core.runtime.IConfigurationElement;
18 import org.eclipse.debug.core.DebugPlugin;
19
20 /**
21  * Proxy to a runtime classpath entry resolver extension.
22  */

23 public class LaunchConfigurationComparator implements Comparator JavaDoc {
24
25     private IConfigurationElement fConfigurationElement;
26     
27     private Comparator JavaDoc fDelegate;
28     
29     /**
30      * Constructs a new resolver on the given configuration element
31      *
32      * @param element configuration element
33      */

34     public LaunchConfigurationComparator(IConfigurationElement element) {
35         fConfigurationElement = element;
36     }
37         
38     /**
39      * Returns the resolver delegate (and creates if required)
40      */

41     protected Comparator JavaDoc getComparator() {
42         if (fDelegate == null) {
43             try {
44                 fDelegate = (Comparator JavaDoc)fConfigurationElement.createExecutableExtension("class"); //$NON-NLS-1$
45
} catch (CoreException e) {
46                 DebugPlugin.log(e);
47             }
48         }
49         return fDelegate;
50     }
51     
52
53     /**
54      * @see Comparator#compare(Object, Object)
55      */

56     public int compare(Object JavaDoc o1, Object JavaDoc o2) {
57         return getComparator().compare(o1, o2);
58     }
59
60     /**
61      * @see Object#equals(Object)
62      */

63     public boolean equals(Object JavaDoc obj) {
64         return getComparator().equals(obj);
65     }
66
67 }
68
Popular Tags