KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > internal > debug > ui > classpath > AbstractClasspathEntry


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.debug.ui.classpath;
12
13 import java.util.ArrayList JavaDoc;
14 import java.util.List JavaDoc;
15
16
17 public abstract class AbstractClasspathEntry implements IClasspathEntry {
18
19     protected List JavaDoc childEntries = new ArrayList JavaDoc();
20     protected IClasspathEntry parent = null;
21
22     /* (non-Javadoc)
23      * @see org.eclipse.ant.internal.ui.preferences.IClasspathEntry#moveChild(int)
24      */

25     public void moveChild(boolean up, IClasspathEntry child) {
26         int index= childEntries.indexOf(child);
27         int direction= 1;
28         if (up) {
29             direction= -1;
30         }
31         Object JavaDoc moved= childEntries.get(index+direction);
32         childEntries.set(index + direction, child);
33         childEntries.set(index, moved);
34     }
35
36     /* (non-Javadoc)
37      * @see org.eclipse.ant.internal.ui.preferences.IClasspathEntry#getEntries()
38      */

39     public IClasspathEntry[] getEntries() {
40         return (IClasspathEntry[])childEntries.toArray(new IClasspathEntry[childEntries.size()]);
41     }
42
43     /* (non-Javadoc)
44      * @see org.eclipse.jdt.debug.ui.launchConfigurations.IClasspathEntry#hasEntries()
45      */

46     public boolean hasEntries() {
47         return !childEntries.isEmpty();
48     }
49
50     /* (non-Javadoc)
51      * @see org.eclipse.jdt.debug.ui.launchConfigurations.IClasspathEntry#getParent()
52      */

53     public IClasspathEntry getParent() {
54         return parent;
55     }
56     
57     /**
58      * @param parent The parent to set.
59      */

60     public void setParent(IClasspathEntry parent) {
61         this.parent = parent;
62     }
63 }
64
Popular Tags