comparison dwtx/core/commands/IHandler.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 46a6e0e6ccd4
comparison
equal deleted inserted replaced
2:a012107a911c 3:6518c18a01f7
1 /*******************************************************************************
2 * Copyright (c) 2004, 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 * Port to the D programming language:
11 * Frank Benoit <benoit@tionex.de>
12 *******************************************************************************/
13 module dwtx.core.commands.IHandler;
14
15 import dwtx.core.commands.IHandlerListener;
16 import dwtx.core.commands.ExecutionEvent;
17
18
19 /**
20 * A handler is the pluggable piece of a command that handles execution. Each
21 * command can have zero or more handlers associated with it (in general), of
22 * which only one will be active at any given moment in time. When the command
23 * is asked to execute, it will simply pass that request on to its active
24 * handler, if any.
25 *
26 * @see AbstractHandler
27 * @since 3.1
28 */
29 public interface IHandler {
30
31 /**
32 * Registers an instance of <code>IHandlerListener</code> to listen for
33 * changes to properties of this instance.
34 *
35 * @param handlerListener
36 * the instance to register. Must not be <code>null</code>. If
37 * an attempt is made to register an instance which is already
38 * registered with this instance, no operation is performed.
39 */
40 void addHandlerListener(IHandlerListener handlerListener);
41
42 /**
43 * Disposes of this handler. This method is run once when the object is no
44 * longer referenced. This can be used as an opportunity to unhook listeners
45 * from other objects.
46 */
47 public void dispose();
48
49 /**
50 * Executes with the map of parameter values by name.
51 *
52 * @param event
53 * An event containing all the information about the current
54 * state of the application; must not be <code>null</code>.
55 * @return the result of the execution. Reserved for future use, must be
56 * <code>null</code>.
57 * @throws ExecutionException
58 * if an exception occurred during execution.
59 */
60 Object execute(ExecutionEvent event);
61
62 /**
63 * Returns whether this handler is capable of executing at this moment in
64 * time.
65 *
66 * @return <code>true</code> if the command is enabled; <code>false</code>
67 * otherwise.
68 */
69 public bool isEnabled();
70
71 /**
72 * Returns whether this handler is really capable of handling delegation. In
73 * the case of a handler that is a composition of other handlers, this reply
74 * is intended to indicate whether the handler is truly capable of receiving
75 * delegated responsibilities at this time.
76 *
77 * @return <code>true</code> if the handler is handled; <code>false</code>
78 * otherwise.
79 */
80 public bool isHandled();
81
82 /**
83 * Unregisters an instance of <code>IHandlerListener</code> listening for
84 * changes to properties of this instance.
85 *
86 * @param handlerListener
87 * the instance to unregister. Must not be <code>null</code>.
88 * If an attempt is made to unregister an instance which is not
89 * already registered with this instance, no operation is
90 * performed.
91 */
92 void removeHandlerListener(IHandlerListener handlerListener);
93 }