KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > ui > commands > ICommandManager


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
12 package org.eclipse.ui.commands;
13
14 import java.util.Map JavaDoc;
15 import java.util.Set JavaDoc;
16
17 import org.eclipse.ui.keys.KeySequence;
18
19 /**
20  * <p>
21  * An instance of <code>ICommandManager</code> can be used to obtain instances
22  * of <code>ICommand</code>, as well as manage whether or not those instances
23  * are active or inactive, enabled or disabled.
24  * </p>
25  * <p>
26  * This interface is not intended to be extended or implemented by clients.
27  * </p>
28  *
29  * @since 3.0
30  * @see org.eclipse.ui.commands.ICommand
31  * @see org.eclipse.ui.commands.ICommandManagerListener
32  * @see org.eclipse.core.commands.CommandManager
33  * @deprecated Please use the "org.eclipse.core.commands" plug-in instead.
34  */

35 public interface ICommandManager {
36
37     /**
38      * Registers an instance of <code>ICommandManagerListener</code> to listen
39      * for changes to attributes of this instance.
40      *
41      * @param commandManagerListener
42      * the instance of <code>ICommandManagerListener</code> to
43      * register. Must not be <code>null</code>. If an attempt is
44      * made to register an instance of
45      * <code>ICommandManagerListener</code> which is already
46      * registered with this instance, no operation is performed.
47      */

48     void addCommandManagerListener(
49             ICommandManagerListener commandManagerListener);
50
51     /**
52      * Returns the set of identifiers to active contexts.
53      * <p>
54      * Notification is sent to all registered listeners if this property
55      * changes.
56      * </p>
57      *
58      * @return the set of identifiers to active contexts. This set may be
59      * empty, but is guaranteed not to be <code>null</code>. If this
60      * set is not empty, it is guaranteed to only contain instances of
61      * <code>String</code>.
62      */

63     Set JavaDoc getActiveContextIds();
64
65     /**
66      * Returns the active key configuration.
67      * <p>
68      * Notification is sent to all registered listeners if this property
69      * changes.
70      * </p>
71      *
72      * @return the active key configuration identifier. This set may be empty,
73      * but it is guaranteed to not be <code>null</code>. If this set
74      * is not empty, it is guaranteed to only contains instances of
75      * <code>String</code>.
76      */

77     String JavaDoc getActiveKeyConfigurationId();
78
79     /**
80      * Returns the active locale. While this property tends to be simply the
81      * result of {@link java.util.Locale#getDefault()}, it may also be changed
82      * at runtime by different implementations of command manager.
83      * <p>
84      * Notification is sent to all registered listeners if this property
85      * changes.
86      * </p>
87      *
88      * @return the active locale. May be <code>null</code>.
89      */

90     String JavaDoc getActiveLocale();
91
92     /**
93      * Returns the active platform. While this property tends to be simply the
94      * result of {@link org.eclipse.swt.SWT#getPlatform()}, it may also be
95      * changed at runtime by different implementations of command manager.
96      * <p>
97      * Notification is sent to all registered listeners if this property
98      * changes.
99      * </p>
100      *
101      * @return the active platform. May be <code>null</code>.
102      */

103     String JavaDoc getActivePlatform();
104
105     /**
106      * Returns a handle to a category given an identifier.
107      *
108      * @param categoryId
109      * an identifier. Must not be <code>null</code>
110      * @return a handle to a category.
111      */

112     ICategory getCategory(String JavaDoc categoryId);
113
114     /**
115      * Returns a handle to a command given an identifier.
116      *
117      * @param commandId
118      * an identifier. Must not be <code>null</code>
119      * @return a handle to a command; never <code>null</code>.
120      */

121     ICommand getCommand(String JavaDoc commandId);
122
123     /**
124      * <p>
125      * Returns the set of identifiers to defined categories.
126      * </p>
127      * <p>
128      * Notification is sent to all registered listeners if this attribute
129      * changes.
130      * </p>
131      *
132      * @return the set of identifiers to defined categories. This set may be
133      * empty, but is guaranteed not to be <code>null</code>. If this
134      * set is not empty, it is guaranteed to only contain instances of
135      * <code>String</code>.
136      */

137     Set JavaDoc getDefinedCategoryIds();
138
139     /**
140      * <p>
141      * Returns the set of identifiers to defined commands.
142      * </p>
143      * <p>
144      * Notification is sent to all registered listeners if this attribute
145      * changes.
146      * </p>
147      *
148      * @return the set of identifiers to defined commands. This set may be
149      * empty, but is guaranteed not to be <code>null</code>. If this
150      * set is not empty, it is guaranteed to only contain instances of
151      * <code>String</code>.
152      */

153     Set JavaDoc getDefinedCommandIds();
154
155     /**
156      * <p>
157      * Returns the set of identifiers to defined key configurations.
158      * </p>
159      * <p>
160      * Notification is sent to all registered listeners if this attribute
161      * changes.
162      * </p>
163      *
164      * @return the set of identifiers to defined key configurations. This set
165      * may be empty, but is guaranteed not to be <code>null</code>.
166      * If this set is not empty, it is guaranteed to only contain
167      * instances of <code>String</code>.
168      */

169     Set JavaDoc getDefinedKeyConfigurationIds();
170
171     /**
172      * Returns a handle to a key configuration given an identifier.
173      *
174      * @param keyConfigurationId
175      * an identifier. Must not be <code>null</code>
176      * @return a handle to a key configuration.
177      */

178     IKeyConfiguration getKeyConfiguration(String JavaDoc keyConfigurationId);
179
180     /**
181      * Finds all of the commands which have key bindings that start with the
182      * given key sequence.
183      *
184      * @param keySequence
185      * The prefix to look for; must not be <code>null</code>.
186      * @return A map of all of the matching key sequences (
187      * <code>KeySequence</code>) to command identifiers (
188      * <code>String</code>). This map may be empty, but it is never
189      * <code>null</code>.
190      */

191     Map JavaDoc getPartialMatches(KeySequence keySequence);
192
193     /**
194      * Finds the command which has the given key sequence as one of its key
195      * bindings.
196      *
197      * @param keySequence
198      * The key binding to look for; must not be <code>null</code>.
199      * @return The command id for the matching command, if any;
200      * <code>null</code> if none.
201      */

202     String JavaDoc getPerfectMatch(KeySequence keySequence);
203
204     /**
205      * Checks to see whether there are any commands which have key bindings that
206      * start with the given key sequence.
207      *
208      * @param keySequence
209      * The prefix to look for; must not be <code>null</code>.
210      * @return <code>true</code> if at least one command has a key binding
211      * that starts with <code>keySequence</code>;<code>false</code>
212      * otherwise.
213      */

214     boolean isPartialMatch(KeySequence keySequence);
215
216     /**
217      * Checks to see if there is a command with the given key sequence as one of
218      * its key bindings.
219      *
220      * @param keySequence
221      * The key binding to look for; must not be <code>null</code>.
222      * @return <code>true</code> if a command has a matching key binding;
223      * <code>false</code> otherwise.
224      */

225     boolean isPerfectMatch(KeySequence keySequence);
226
227     /**
228      * Unregisters an instance of <code>ICommandManagerListener</code>
229      * listening for changes to attributes of this instance.
230      *
231      * @param commandManagerListener
232      * the instance of <code>ICommandManagerListener</code> to
233      * unregister. Must not be <code>null</code>. If an attempt is
234      * made to unregister an instance of
235      * <code>ICommandManagerListener</code> which is not already
236      * registered with this instance, no operation is performed.
237      */

238     void removeCommandManagerListener(
239             ICommandManagerListener commandManagerListener);
240 }
241
Popular Tags