01: /*******************************************************************************
02: * Copyright (c) 2003, 2006 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: *******************************************************************************/package org.eclipse.ui.internal.progress;
11:
12: /**
13: * SubTaskInfo is the class that displays a subtask in the
14: * tree.
15: */
16: class SubTaskInfo extends JobTreeElement {
17:
18: protected String taskName;
19:
20: JobInfo jobInfo;
21:
22: /**
23: * Create a new instance of the receiver.
24: * @param parentJob
25: * @param name
26: */
27: SubTaskInfo(JobInfo parentJob, String name) {
28: taskName = name;
29: jobInfo = parentJob;
30: }
31:
32: /* (non-Javadoc)
33: * @see org.eclipse.ui.internal.progress.JobTreeElement#getChildren()
34: */
35: Object[] getChildren() {
36: return ProgressManagerUtil.EMPTY_OBJECT_ARRAY;
37: }
38:
39: /* (non-Javadoc)
40: * @see org.eclipse.ui.internal.progress.JobTreeElement#getDisplayString()
41: */
42: String getDisplayString() {
43: if (taskName == null) {
44: return ProgressMessages.SubTaskInfo_UndefinedTaskName;
45: }
46: return taskName;
47: }
48:
49: /* (non-Javadoc)
50: * @see org.eclipse.ui.internal.progress.JobTreeElement#hasChildren()
51: */
52: boolean hasChildren() {
53: return false;
54: }
55:
56: /**
57: * Set the taskName of the receiver.
58: * @param taskName
59: */
60: void setTaskName(String name) {
61: this .taskName = name;
62: }
63:
64: /**
65: * Returns the taskName of the receiver.
66: */
67: String getTaskName() {
68: return taskName;
69: }
70:
71: /* (non-Javadoc)
72: * @see org.eclipse.ui.internal.progress.JobTreeElement#getParent()
73: */
74: Object getParent() {
75: return jobInfo;
76: }
77:
78: /* (non-Javadoc)
79: * @see org.eclipse.ui.internal.progress.JobTreeElement#isJobInfo()
80: */
81: boolean isJobInfo() {
82: return false;
83: }
84:
85: /* (non-Javadoc)
86: * @see org.eclipse.ui.internal.progress.JobTreeElement#isActive()
87: */
88: boolean isActive() {
89: return jobInfo.isActive();
90: }
91: }
|