1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
|
/*******************************************************************************
* Copyright (c) 2000, 2013 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.jface.action;
import java.text.MessageFormat;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;
import java.util.ResourceBundle;
import java.util.Set;
import org.eclipse.core.commands.Command;
import org.eclipse.core.commands.CommandEvent;
import org.eclipse.core.commands.CommandManager;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.commands.ICommandListener;
import org.eclipse.core.commands.NotEnabledException;
import org.eclipse.core.commands.ParameterizedCommand;
import org.eclipse.core.commands.common.NotDefinedException;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.ListenerList;
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.bindings.BindingManager;
import org.eclipse.jface.bindings.BindingManagerEvent;
import org.eclipse.jface.bindings.IBindingManagerListener;
import org.eclipse.jface.bindings.Trigger;
import org.eclipse.jface.bindings.TriggerSequence;
import org.eclipse.jface.bindings.keys.KeySequence;
import org.eclipse.jface.bindings.keys.KeyStroke;
import org.eclipse.jface.bindings.keys.SWTKeySupport;
import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.util.Policy;
import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.jface.util.Util;
import org.eclipse.swt.widgets.Event;
/**
* <p>
* A manager for a callback facility which is capable of querying external
* interfaces for additional information about actions and action contribution
* items. This information typically includes things like accelerators and
* textual representations.
* </p>
* <p>
* <em>It is only necessary to use this mechanism if you will be using a mix of
* actions and commands, and wish the interactions to work properly.</em>
* </p>
* <p>
* For example, in the Eclipse workbench, this mechanism is used to allow the
* command architecture to override certain values in action contribution items.
* </p>
* <p>
* This class is not intended to be called or extended by any external clients.
* </p>
*
* @since 3.0
*/
public final class ExternalActionManager {
/**
* A simple implementation of the <code>ICallback</code> mechanism that
* simply takes a <code>BindingManager</code> and a
* <code>CommandManager</code>.
* <p>
* <b>Note:</b> this class is not intended to be subclassed by clients.
* </p>
*
* @since 3.1
*/
public static class CommandCallback implements
IBindingManagerListener, IBindingManagerCallback, IExecuteCallback {
/**
* The internationalization bundle for text produced by this class.
*/
private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle
.getBundle(ExternalActionManager.class.getName());
/**
* The callback capable of responding to whether a command is active.
*/
private final IActiveChecker activeChecker;
/**
* Check the applicability of firing an execution event for an action.
*/
private final IExecuteApplicable applicabilityChecker;
/**
* The binding manager for your application. Must not be
* <code>null</code>.
*/
private final BindingManager bindingManager;
/**
* Whether a listener has been attached to the binding manager yet.
*/
private boolean bindingManagerListenerAttached = false;
/**
* The command manager for your application. Must not be
* <code>null</code>.
*/
private final CommandManager commandManager;
/**
* A set of all the command identifiers that have been logged as broken
* so far. For each of these, there will be a listener on the
* corresponding command. If the command ever becomes defined, the item
* will be removed from this set and the listener removed. This value
* may be empty, but never <code>null</code>.
*/
private final Set<String> loggedCommandIds = new HashSet<String>();
/**
* The list of listeners that have registered for property change
* notification. This is a map of command identifiers (<code>String</code>)
* to listeners (<code>IPropertyChangeListener</code> or
* <code>ListenerList</code> of <code>IPropertyChangeListener</code>).
*/
private final Map<String, Object> registeredListeners = new HashMap<String, Object>();
/**
* Constructs a new instance of <code>CommandCallback</code> with the
* workbench it should be using. All commands will be considered active.
*
* @param bindingManager
* The binding manager which will provide the callback; must
* not be <code>null</code>.
* @param commandManager
* The command manager which will provide the callback; must
* not be <code>null</code>.
*
* @since 3.1
*/
public CommandCallback(final BindingManager bindingManager,
final CommandManager commandManager) {
this(bindingManager, commandManager, new IActiveChecker() {
public boolean isActive(String commandId) {
return true;
}
}, new IExecuteApplicable() {
public boolean isApplicable(IAction action) {
return true;
}
});
}
/**
* Constructs a new instance of <code>CommandCallback</code> with the
* workbench it should be using.
*
* @param bindingManager
* The binding manager which will provide the callback; must
* not be <code>null</code>.
* @param commandManager
* The command manager which will provide the callback; must
* not be <code>null</code>.
* @param activeChecker
* The callback mechanism for checking whether a command is
* active; must not be <code>null</code>.
*
* @since 3.1
*/
public CommandCallback(final BindingManager bindingManager,
final CommandManager commandManager,
final IActiveChecker activeChecker) {
this(bindingManager, commandManager, activeChecker,
new IExecuteApplicable() {
public boolean isApplicable(IAction action) {
return true;
}
});
}
/**
* Constructs a new instance of <code>CommandCallback</code> with the
* workbench it should be using.
*
* @param bindingManager
* The binding manager which will provide the callback; must
* not be <code>null</code>.
* @param commandManager
* The command manager which will provide the callback; must
* not be <code>null</code>.
* @param activeChecker
* The callback mechanism for checking whether a command is
* active; must not be <code>null</code>.
* @param checker
* The callback to check if an IAction should fire execution
* events.
*
* @since 3.4
*/
public CommandCallback(final BindingManager bindingManager,
final CommandManager commandManager,
final IActiveChecker activeChecker,
final IExecuteApplicable checker) {
if (bindingManager == null) {
throw new NullPointerException(
"The callback needs a binding manager"); //$NON-NLS-1$
}
if (commandManager == null) {
throw new NullPointerException(
"The callback needs a command manager"); //$NON-NLS-1$
}
if (activeChecker == null) {
throw new NullPointerException(
"The callback needs an active callback"); //$NON-NLS-1$
}
if (checker == null) {
throw new NullPointerException(
"The callback needs an applicable callback"); //$NON-NLS-1$
}
this.activeChecker = activeChecker;
this.bindingManager = bindingManager;
this.commandManager = commandManager;
this.applicabilityChecker = checker;
}
/**
* @see org.eclipse.jface.action.ExternalActionManager.ICallback#addPropertyChangeListener(String,
* IPropertyChangeListener)
*/
public final void addPropertyChangeListener(final String commandId,
final IPropertyChangeListener listener) {
Object existing = registeredListeners.get(commandId);
if (existing instanceof ListenerList) {
((ListenerList) existing).add(listener);
} else if (existing != null) {
ListenerList listeners = new ListenerList(ListenerList.IDENTITY);
listeners.add(existing);
listeners.add(listener);
registeredListeners.put(commandId, listeners);
} else {
registeredListeners.put(commandId, listener);
}
if (!bindingManagerListenerAttached) {
bindingManager.addBindingManagerListener(this);
bindingManagerListenerAttached = true;
}
}
public final void bindingManagerChanged(final BindingManagerEvent event) {
if (event.isActiveBindingsChanged()) {
final Iterator<Entry<String, Object>> listenerItr = registeredListeners.entrySet()
.iterator();
while (listenerItr.hasNext()) {
final Entry<String, Object> entry = listenerItr.next();
final String commandId = entry.getKey();
final Command command = commandManager
.getCommand(commandId);
final ParameterizedCommand parameterizedCommand = new ParameterizedCommand(
command, null);
if (event.isActiveBindingsChangedFor(parameterizedCommand)) {
Object value = entry.getValue();
PropertyChangeEvent propertyChangeEvent = new PropertyChangeEvent(event
.getManager(), IAction.TEXT, null, null);
if (value instanceof ListenerList) {
Object[] listeners= ((ListenerList) value).getListeners();
for (int i = 0; i < listeners.length; i++) {
final IPropertyChangeListener listener = (IPropertyChangeListener) listeners[i];
listener.propertyChange(propertyChangeEvent);
}
} else {
final IPropertyChangeListener listener = (IPropertyChangeListener) value;
listener.propertyChange(propertyChangeEvent);
}
}
}
}
}
/**
* @see org.eclipse.jface.action.ExternalActionManager.ICallback#getAccelerator(String)
*/
public final Integer getAccelerator(final String commandId) {
final TriggerSequence triggerSequence = bindingManager
.getBestActiveBindingFor(commandId);
if (triggerSequence != null) {
final Trigger[] triggers = triggerSequence.getTriggers();
if (triggers.length == 1) {
final Trigger trigger = triggers[0];
if (trigger instanceof KeyStroke) {
final KeyStroke keyStroke = (KeyStroke) trigger;
final int accelerator = SWTKeySupport
.convertKeyStrokeToAccelerator(keyStroke);
return new Integer(accelerator);
}
}
}
return null;
}
/**
* @see org.eclipse.jface.action.ExternalActionManager.ICallback#getAcceleratorText(String)
*/
public final String getAcceleratorText(final String commandId) {
final TriggerSequence triggerSequence = bindingManager
.getBestActiveBindingFor(commandId);
if (triggerSequence == null) {
return null;
}
return triggerSequence.format();
}
/**
* Returns the active bindings for a particular command identifier.
*
* @param commandId
* The identifier of the command whose bindings are
* requested. This argument may be <code>null</code>. It
* is assumed that the command has no parameters.
* @return The array of active triggers (<code>TriggerSequence</code>)
* for a particular command identifier. This value is guaranteed
* not to be <code>null</code>, but it may be empty.
* @since 3.2
*/
public final TriggerSequence[] getActiveBindingsFor(
final String commandId) {
return bindingManager.getActiveBindingsFor(commandId);
}
/**
* @see org.eclipse.jface.action.ExternalActionManager.ICallback#isAcceleratorInUse(int)
*/
public final boolean isAcceleratorInUse(final int accelerator) {
final KeySequence keySequence = KeySequence
.getInstance(SWTKeySupport
.convertAcceleratorToKeyStroke(accelerator));
return bindingManager.isPerfectMatch(keySequence)
|| bindingManager.isPartialMatch(keySequence);
}
/**
* {@inheritDoc}
*
* Calling this method with an undefined command id will generate a log
* message.
*/
public final boolean isActive(final String commandId) {
if (commandId != null) {
final Command command = commandManager.getCommand(commandId);
if (!command.isDefined()
&& (!loggedCommandIds.contains(commandId))) {
// The command is not yet defined, so we should log this.
final String message = MessageFormat.format(Util
.translateString(RESOURCE_BUNDLE,
"undefinedCommand.WarningMessage", null), //$NON-NLS-1$
command.getId());
IStatus status = new Status(IStatus.ERROR,
"org.eclipse.jface", //$NON-NLS-1$
0, message, new Exception());
Policy.getLog().log(status);
// And remember this item so we don't log it again.
loggedCommandIds.add(commandId);
command.addCommandListener(new ICommandListener() {
/*
* (non-Javadoc)
*
* @see org.eclipse.ui.commands.ICommandListener#commandChanged(org.eclipse.ui.commands.CommandEvent)
*/
public final void commandChanged(
final CommandEvent commandEvent) {
if (command.isDefined()) {
command.removeCommandListener(this);
loggedCommandIds.remove(commandId);
}
}
});
return true;
}
return activeChecker.isActive(commandId);
}
return true;
}
/**
* @see org.eclipse.jface.action.ExternalActionManager.ICallback#removePropertyChangeListener(String,
* IPropertyChangeListener)
*/
public final void removePropertyChangeListener(final String commandId,
final IPropertyChangeListener listener) {
Object existing= registeredListeners.get(commandId);
if (existing == listener) {
registeredListeners.remove(commandId);
if (registeredListeners.isEmpty()) {
bindingManager.removeBindingManagerListener(this);
bindingManagerListenerAttached = false;
}
} else if (existing instanceof ListenerList) {
ListenerList existingList = (ListenerList) existing;
existingList.remove(listener);
if (existingList.size() == 1) {
registeredListeners.put(commandId, existingList.getListeners()[0]);
}
}
}
/**
* @since 3.4
*/
public void preExecute(IAction action, Event event) {
String actionDefinitionId = action.getActionDefinitionId();
if (actionDefinitionId==null
|| !applicabilityChecker.isApplicable(action)) {
return;
}
Command command = commandManager.getCommand(actionDefinitionId);
ExecutionEvent executionEvent = new ExecutionEvent(command,
Collections.EMPTY_MAP, event, null);
commandManager.firePreExecute(actionDefinitionId, executionEvent);
}
/**
* @since 3.4
*/
public void postExecuteSuccess(IAction action, Object returnValue) {
String actionDefinitionId = action.getActionDefinitionId();
if (actionDefinitionId==null
|| !applicabilityChecker.isApplicable(action)) {
return;
}
commandManager.firePostExecuteSuccess(actionDefinitionId, returnValue);
}
/**
* @since 3.4
*/
public void postExecuteFailure(IAction action,
ExecutionException exception) {
String actionDefinitionId = action.getActionDefinitionId();
if (actionDefinitionId==null
|| !applicabilityChecker.isApplicable(action)) {
return;
}
commandManager.firePostExecuteFailure(actionDefinitionId, exception);
}
/**
* @since 3.4
*/
public void notDefined(IAction action, NotDefinedException exception) {
String actionDefinitionId = action.getActionDefinitionId();
if (actionDefinitionId==null
|| !applicabilityChecker.isApplicable(action)) {
return;
}
commandManager.fireNotDefined(actionDefinitionId, exception);
}
/**
* @since 3.4
*/
public void notEnabled(IAction action, NotEnabledException exception) {
String actionDefinitionId = action.getActionDefinitionId();
if (actionDefinitionId==null
|| !applicabilityChecker.isApplicable(action)) {
return;
}
commandManager.fireNotEnabled(actionDefinitionId, exception);
}
}
/**
* Defines a callback mechanism for developer who wish to further control
* the visibility of legacy action-based contribution items.
*
* @since 3.1
*/
public static interface IActiveChecker {
/**
* Checks whether the command with the given identifier should be
* considered active. This can be used in systems using some kind of
* user interface filtering (e.g., activities in the Eclipse workbench).
*
* @param commandId
* The identifier for the command; must not be
* <code>null</code>
* @return <code>true</code> if the command is active;
* <code>false</code> otherwise.
*/
public boolean isActive(String commandId);
}
/**
* <p>
* A callback which communicates with the applications binding manager. This
* interface provides more information from the binding manager, which
* allows greater integration. Implementing this interface is preferred over
* {@link ExternalActionManager.ICallback}.
* </p>
* <p>
* Clients may implement this interface, but must not extend.
* </p>
*
* @since 3.2
*/
public static interface IBindingManagerCallback extends ICallback {
/**
* <p>
* Returns the active bindings for a particular command identifier.
* </p>
*
* @param commandId
* The identifier of the command whose bindings are
* requested. This argument may be <code>null</code>. It
* is assumed that the command has no parameters.
* @return The array of active triggers (<code>TriggerSequence</code>)
* for a particular command identifier. This value is guaranteed
* not to be <code>null</code>, but it may be empty.
*/
public TriggerSequence[] getActiveBindingsFor(String commandId);
}
/**
* An overridable mechanism to filter certain IActions from the execution
* bridge.
*
* @since 3.4
*/
public static interface IExecuteApplicable {
/**
* Allow the callback to filter out actions that should not fire
* execution events.
*
* @param action
* The action with an actionDefinitionId
* @return true if this action should be considered.
*/
public boolean isApplicable(IAction action);
}
/**
* <p>
* A callback for executing execution events. Allows
* <code>ActionContributionItems</code> to fire useful events.
* </p>
* <p>
* Clients must not implement this interface and must not extend.
* </p>
*
* @since 3.4
*
*/
public static interface IExecuteCallback {
/**
* Fires a <code>NotEnabledException</code> because the action was not
* enabled.
*
* @param action
* The action contribution that caused the exception,
* never <code>null</code>.
* @param exception
* The <code>NotEnabledException</code>, never <code>null</code>.
*/
public void notEnabled(IAction action, NotEnabledException exception);
/**
* Fires a <code>NotDefinedException</code> because the action was not
* defined.
*
* @param action
* The action contribution that caused the exception,
* never <code>null</code>.
* @param exception
* The <code>NotDefinedException</code>, never <code>null</code>.
*/
public void notDefined(IAction action, NotDefinedException exception);
/**
* Fires an execution event before an action is run.
*
* @param action
* The action contribution that requires an
* execution event to be fired. Cannot be <code>null</code>.
* @param e
* The SWT Event, may be <code>null</code>.
*
*/
public void preExecute(IAction action,
Event e);
/**
* Fires an execution event when the action returned a success.
*
* @param action
* The action contribution that requires an
* execution event to be fired. Cannot be <code>null</code>.
* @param returnValue
* The command's result, may be <code>null</code>.
*
*/
public void postExecuteSuccess(IAction action,
Object returnValue);
/**
* Creates an <code>ExecutionException</code> when the action returned
* a failure.
*
* @param action
* The action contribution that caused the exception,
* never <code>null</code>.
* @param exception
* The <code>ExecutionException</code>, never <code>null</code>.
*/
public void postExecuteFailure(IAction action,
ExecutionException exception);
}
/**
* A callback mechanism for some external tool to communicate extra
* information to actions and action contribution items.
*
* @since 3.0
*/
public static interface ICallback {
/**
* <p>
* Adds a listener to the object referenced by <code>identifier</code>.
* This listener will be notified if a property of the item is to be
* changed. This identifier is specific to mechanism being used. In the
* case of the Eclipse workbench, this is the command identifier.
* </p>
* <p>
* Has no effect if an identical listener has already been added for
* the <code>identifier</code>.
* </p>
*
* @param identifier
* The identifier of the item to which the listener should be
* attached; must not be <code>null</code>.
* @param listener
* The listener to be added; must not be <code>null</code>.
*/
public void addPropertyChangeListener(String identifier,
IPropertyChangeListener listener);
/**
* An accessor for the accelerator associated with the item indicated by
* the identifier. This identifier is specific to mechanism being used.
* In the case of the Eclipse workbench, this is the command identifier.
*
* @param identifier
* The identifier of the item from which the accelerator
* should be obtained ; must not be <code>null</code>.
* @return An integer representation of the accelerator. This is the
* same accelerator format used by SWT.
*/
public Integer getAccelerator(String identifier);
/**
* An accessor for the accelerator text associated with the item
* indicated by the identifier. This identifier is specific to mechanism
* being used. In the case of the Eclipse workbench, this is the command
* identifier.
*
* @param identifier
* The identifier of the item from which the accelerator text
* should be obtained ; must not be <code>null</code>.
* @return A string representation of the accelerator. This is the
* string representation that should be displayed to the user.
*/
public String getAcceleratorText(String identifier);
/**
* Checks to see whether the given accelerator is being used by some
* other mechanism (outside of the menus controlled by JFace). This is
* used to keep JFace from trying to grab accelerators away from someone
* else.
*
* @param accelerator
* The accelerator to check -- in SWT's internal accelerator
* format.
* @return <code>true</code> if the accelerator is already being used
* and shouldn't be used again; <code>false</code> otherwise.
*/
public boolean isAcceleratorInUse(int accelerator);
/**
* Checks whether the item matching this identifier is active. This is
* used to decide whether a contribution item with this identifier
* should be made visible. An inactive item is not visible.
*
* @param identifier
* The identifier of the item from which the active state
* should be retrieved; must not be <code>null</code>.
* @return <code>true</code> if the item is active; <code>false</code>
* otherwise.
*/
public boolean isActive(String identifier);
/**
* Removes a listener from the object referenced by
* <code>identifier</code>. This identifier is specific to mechanism
* being used. In the case of the Eclipse workbench, this is the command
* identifier.
*
* @param identifier
* The identifier of the item to from the listener should be
* removed; must not be <code>null</code>.
* @param listener
* The listener to be removed; must not be <code>null</code>.
*/
public void removePropertyChangeListener(String identifier,
IPropertyChangeListener listener);
}
/**
* The singleton instance of this class. This value may be <code>null</code>--
* if it has not yet been initialized.
*/
private static ExternalActionManager instance;
/**
* Retrieves the current singleton instance of this class.
*
* @return The singleton instance; this value is never <code>null</code>.
*/
public static ExternalActionManager getInstance() {
if (instance == null) {
instance = new ExternalActionManager();
}
return instance;
}
/**
* The callback mechanism to use to retrieve extra information.
*/
private ICallback callback;
/**
* Constructs a new instance of <code>ExternalActionManager</code>.
*/
private ExternalActionManager() {
// This is a singleton class. Only this class should create an instance.
}
/**
* An accessor for the current call back.
*
* @return The current callback mechanism being used. This is the callback
* that should be queried for extra information about actions and
* action contribution items. This value may be <code>null</code>
* if there is no extra information.
*/
public ICallback getCallback() {
return callback;
}
/**
* A mutator for the current call back
*
* @param callbackToUse
* The new callback mechanism to use; this value may be
* <code>null</code> if the default is acceptable (i.e., no
* extra information will provided to actions).
*/
public void setCallback(ICallback callbackToUse) {
callback = callbackToUse;
}
}
|