KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > ant > internal > ui > views > elements > TargetNode


1 /*******************************************************************************
2  * Copyright (c) 2000, 2004 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Common Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/cpl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.ant.internal.ui.views.elements;
12
13 import java.util.ArrayList JavaDoc;
14 import java.util.List JavaDoc;
15
16
17 /**
18  * Representation of an ant target
19  */

20 public class TargetNode extends AntNode {
21     private List JavaDoc dependencies= new ArrayList JavaDoc();
22     private boolean isErrorNode= false;
23     
24     /**
25      * Creates a new target node with the given name, and description
26      *
27      * @param name the new node's name
28      * @param description the target description or <code>null</code> if the
29      * target has no description
30      */

31     public TargetNode(String JavaDoc name, String JavaDoc description) {
32         super(name);
33         setDescription(description);
34     }
35     
36     /**
37      * Adds the given dependency to the list of this target's dependencies
38      *
39      * @param dependency the dependency to add
40      */

41     public void addDependency(String JavaDoc dependency) {
42         dependencies.add(dependency);
43     }
44
45     /**
46      * Returns the dependency node containing the names of the targets on which
47      * this target depends
48      *
49      * @return DependencyNode the node containing the names of this target's
50      * dependencies
51      */

52     public String JavaDoc[] getDependencies() {
53         return (String JavaDoc[]) dependencies.toArray(new String JavaDoc[dependencies.size()]);
54     }
55     
56     /**
57      * Returns the ProjectNode containing this target. This method is equivalent
58      * to calling getParent() and casting the result to a ProjectNode.
59      *
60      * @return ProjectNode the project containing this target
61      */

62     public ProjectNode getProject() {
63         return (ProjectNode) getParent();
64     }
65     
66     /**
67      * Sets this target's error node state
68      *
69      * @param isErrorNode whether or not an error occurred while parsing this node
70      */

71     public void setIsErrorNode(boolean isErrorNode) {
72         this.isErrorNode= isErrorNode;
73     }
74
75     /**
76      * Returns whether an error occurred while parsing this Ant node
77      *
78      * @return whether an error occurred while parsing this Ant node
79      */

80     public boolean isErrorNode() {
81         return isErrorNode;
82     }
83 }
84
Popular Tags