Mercurial > projects > dwt-addons
comparison dwtx/core/runtime/NullProgressMonitor.d @ 3:6518c18a01f7
eclipse.core package without osgi dependencies
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Wed, 26 Mar 2008 00:57:19 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
2:a012107a911c | 3:6518c18a01f7 |
---|---|
1 /******************************************************************************* | |
2 * Copyright (c) 2000, 2006 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 * Port to the D programming language: | |
11 * Frank Benoit <benoit@tionex.de> | |
12 *******************************************************************************/ | |
13 module dwtx.core.runtime.NullProgressMonitor; | |
14 | |
15 import dwtx.core.runtime.IProgressMonitor; | |
16 | |
17 import dwt.dwthelper.utils; | |
18 | |
19 /** | |
20 * A default progress monitor implementation suitable for | |
21 * subclassing. | |
22 * <p> | |
23 * This implementation supports cancelation. The default | |
24 * implementations of the other methods do nothing. | |
25 * </p><p> | |
26 * This class can be used without OSGi running. | |
27 * </p> | |
28 */ | |
29 public class NullProgressMonitor : IProgressMonitor { | |
30 | |
31 /** | |
32 * Indicates whether cancel has been requested. | |
33 */ | |
34 private bool cancelled = false; | |
35 | |
36 /** | |
37 * Constructs a new progress monitor. | |
38 */ | |
39 public this() { | |
40 } | |
41 | |
42 /** | |
43 * This implementation does nothing. | |
44 * Subclasses may override this method to do interesting | |
45 * processing when a task begins. | |
46 * | |
47 * @see IProgressMonitor#beginTask(String, int) | |
48 */ | |
49 public void beginTask(String name, int totalWork) { | |
50 // do nothing | |
51 } | |
52 | |
53 /** | |
54 * This implementation does nothing. | |
55 * Subclasses may override this method to do interesting | |
56 * processing when a task is done. | |
57 * | |
58 * @see IProgressMonitor#done() | |
59 */ | |
60 public void done() { | |
61 // do nothing | |
62 } | |
63 | |
64 /** | |
65 * This implementation does nothing. | |
66 * Subclasses may override this method. | |
67 * | |
68 * @see IProgressMonitor#internalWorked(double) | |
69 */ | |
70 public void internalWorked(double work) { | |
71 // do nothing | |
72 } | |
73 | |
74 /** | |
75 * This implementation returns the value of the internal | |
76 * state variable set by <code>setCanceled</code>. | |
77 * Subclasses which override this method should | |
78 * override <code>setCanceled</code> as well. | |
79 * | |
80 * @see IProgressMonitor#isCanceled() | |
81 * @see IProgressMonitor#setCanceled(bool) | |
82 */ | |
83 public bool isCanceled() { | |
84 return cancelled; | |
85 } | |
86 | |
87 /** | |
88 * This implementation sets the value of an internal state variable. | |
89 * Subclasses which override this method should override | |
90 * <code>isCanceled</code> as well. | |
91 * | |
92 * @see IProgressMonitor#isCanceled() | |
93 * @see IProgressMonitor#setCanceled(bool) | |
94 */ | |
95 public void setCanceled(bool cancelled) { | |
96 this.cancelled = cancelled; | |
97 } | |
98 | |
99 /** | |
100 * This implementation does nothing. | |
101 * Subclasses may override this method to do something | |
102 * with the name of the task. | |
103 * | |
104 * @see IProgressMonitor#setTaskName(String) | |
105 */ | |
106 public void setTaskName(String name) { | |
107 // do nothing | |
108 } | |
109 | |
110 /** | |
111 * This implementation does nothing. | |
112 * Subclasses may override this method to do interesting | |
113 * processing when a subtask begins. | |
114 * | |
115 * @see IProgressMonitor#subTask(String) | |
116 */ | |
117 public void subTask(String name) { | |
118 // do nothing | |
119 } | |
120 | |
121 /** | |
122 * This implementation does nothing. | |
123 * Subclasses may override this method to do interesting | |
124 * processing when some work has been completed. | |
125 * | |
126 * @see IProgressMonitor#worked(int) | |
127 */ | |
128 public void worked(int work) { | |
129 // do nothing | |
130 } | |
131 } |