|
63 | 63 | */ |
64 | 64 | public final class ExternalActionManager { |
65 | 65 |
|
| 66 | + /** |
| 67 | + * Defines a callback mechanism for developer who wish to further control |
| 68 | + * the visibility of legacy action-based contribution items. |
| 69 | + * |
| 70 | + * @since 3.1 |
| 71 | + */ |
| 72 | + public static interface IActiveChecker { |
| 73 | + /** |
| 74 | + * Checks whether the command with the given identifier should be |
| 75 | + * considered active. This can be used in systems using some kind of |
| 76 | + * user interface filtering (e.g., activities in the Eclipse workbench). |
| 77 | + * |
| 78 | + * @param commandId |
| 79 | + * The identifier for the command; must not be |
| 80 | + * <code>null</code> |
| 81 | + * @return <code>true</code> if the command is active; |
| 82 | + * <code>false</code> otherwise. |
| 83 | + */ |
| 84 | + public boolean isActive(String commandId); |
| 85 | + } |
| 86 | + |
| 87 | + /** |
| 88 | + * A callback mechanism for some external tool to communicate extra |
| 89 | + * information to actions and action contribution items. |
| 90 | + * |
| 91 | + * @since 3.0 |
| 92 | + */ |
| 93 | + public static interface ICallback { |
| 94 | + |
| 95 | + /** |
| 96 | + * <p> |
| 97 | + * Adds a listener to the object referenced by <code>identifier</code>. |
| 98 | + * This listener will be notified if a property of the item is to be |
| 99 | + * changed. This identifier is specific to mechanism being used. In the |
| 100 | + * case of the Eclipse workbench, this is the command identifier. |
| 101 | + * </p> |
| 102 | + * <p> |
| 103 | + * A single instance of the listener may only ever be associated with |
| 104 | + * one identifier. Attempts to add the listener twice (without a removal |
| 105 | + * inbetween) has undefined behaviour. |
| 106 | + * </p> |
| 107 | + * |
| 108 | + * @param identifier |
| 109 | + * The identifier of the item to which the listener should be |
| 110 | + * attached; must not be <code>null</code>. |
| 111 | + * @param listener |
| 112 | + * The listener to be added; must not be <code>null</code>. |
| 113 | + */ |
| 114 | + public void addPropertyChangeListener(String identifier, |
| 115 | + IPropertyChangeListener listener); |
| 116 | + |
| 117 | + /** |
| 118 | + * An accessor for the accelerator associated with the item indicated by |
| 119 | + * the identifier. This identifier is specific to mechanism being used. |
| 120 | + * In the case of the Eclipse workbench, this is the command identifier. |
| 121 | + * |
| 122 | + * @param identifier |
| 123 | + * The identifier of the item from which the accelerator |
| 124 | + * should be obtained ; must not be <code>null</code>. |
| 125 | + * @return An integer representation of the accelerator. This is the |
| 126 | + * same accelerator format used by SWT. |
| 127 | + */ |
| 128 | + public Integer getAccelerator(String identifier); |
| 129 | + |
| 130 | + /** |
| 131 | + * An accessor for the accelerator text associated with the item |
| 132 | + * indicated by the identifier. This identifier is specific to mechanism |
| 133 | + * being used. In the case of the Eclipse workbench, this is the command |
| 134 | + * identifier. |
| 135 | + * |
| 136 | + * @param identifier |
| 137 | + * The identifier of the item from which the accelerator text |
| 138 | + * should be obtained ; must not be <code>null</code>. |
| 139 | + * @return A string representation of the accelerator. This is the |
| 140 | + * string representation that should be displayed to the user. |
| 141 | + */ |
| 142 | + public String getAcceleratorText(String identifier); |
| 143 | + |
| 144 | + /** |
| 145 | + * Checks to see whether the given accelerator is being used by some |
| 146 | + * other mechanism (outside of the menus controlled by JFace). This is |
| 147 | + * used to keep JFace from trying to grab accelerators away from someone |
| 148 | + * else. |
| 149 | + * |
| 150 | + * @param accelerator |
| 151 | + * The accelerator to check -- in SWT's internal accelerator |
| 152 | + * format. |
| 153 | + * @return <code>true</code> if the accelerator is already being used |
| 154 | + * and shouldn't be used again; <code>false</code> otherwise. |
| 155 | + */ |
| 156 | + public boolean isAcceleratorInUse(int accelerator); |
| 157 | + |
| 158 | + /** |
| 159 | + * Checks whether the item matching this identifier is active. This is |
| 160 | + * used to decide whether a contribution item with this identifier |
| 161 | + * should be made visible. An inactive item is not visible. |
| 162 | + * |
| 163 | + * @param identifier |
| 164 | + * The identifier of the item from which the active state |
| 165 | + * should be retrieved; must not be <code>null</code>. |
| 166 | + * @return <code>true</code> if the item is active; <code>false</code> |
| 167 | + * otherwise. |
| 168 | + */ |
| 169 | + public boolean isActive(String identifier); |
| 170 | + |
| 171 | + /** |
| 172 | + * Removes a listener from the object referenced by |
| 173 | + * <code>identifier</code>. This identifier is specific to mechanism |
| 174 | + * being used. In the case of the Eclipse workbench, this is the command |
| 175 | + * identifier. |
| 176 | + * |
| 177 | + * @param identifier |
| 178 | + * The identifier of the item to from the listener should be |
| 179 | + * removed; must not be <code>null</code>. |
| 180 | + * @param listener |
| 181 | + * The listener to be removed; must not be <code>null</code>. |
| 182 | + */ |
| 183 | + public void removePropertyChangeListener(String identifier, |
| 184 | + IPropertyChangeListener listener); |
| 185 | + } |
| 186 | + |
66 | 187 | /** |
67 | 188 | * A simple implementation of the <code>ICallback</code> mechanism that |
68 | 189 | * simply takes a <code>BindingManager</code> and a |
@@ -344,127 +465,6 @@ public final void removePropertyChangeListener(final String commandId, |
344 | 465 | } |
345 | 466 | } |
346 | 467 |
|
347 | | - /** |
348 | | - * Defines a callback mechanism for developer who wish to further control |
349 | | - * the visibility of legacy action-based contribution items. |
350 | | - * |
351 | | - * @since 3.1 |
352 | | - */ |
353 | | - public static interface IActiveChecker { |
354 | | - /** |
355 | | - * Checks whether the command with the given identifier should be |
356 | | - * considered active. This can be used in systems using some kind of |
357 | | - * user interface filtering (e.g., activities in the Eclipse workbench). |
358 | | - * |
359 | | - * @param commandId |
360 | | - * The identifier for the command; must not be |
361 | | - * <code>null</code> |
362 | | - * @return <code>true</code> if the command is active; |
363 | | - * <code>false</code> otherwise. |
364 | | - */ |
365 | | - public boolean isActive(String commandId); |
366 | | - } |
367 | | - |
368 | | - /** |
369 | | - * A callback mechanism for some external tool to communicate extra |
370 | | - * information to actions and action contribution items. |
371 | | - * |
372 | | - * @since 3.0 |
373 | | - */ |
374 | | - public static interface ICallback { |
375 | | - |
376 | | - /** |
377 | | - * <p> |
378 | | - * Adds a listener to the object referenced by <code>identifier</code>. |
379 | | - * This listener will be notified if a property of the item is to be |
380 | | - * changed. This identifier is specific to mechanism being used. In the |
381 | | - * case of the Eclipse workbench, this is the command identifier. |
382 | | - * </p> |
383 | | - * <p> |
384 | | - * A single instance of the listener may only ever be associated with |
385 | | - * one identifier. Attempts to add the listener twice (without a removal |
386 | | - * inbetween) has undefined behaviour. |
387 | | - * </p> |
388 | | - * |
389 | | - * @param identifier |
390 | | - * The identifier of the item to which the listener should be |
391 | | - * attached; must not be <code>null</code>. |
392 | | - * @param listener |
393 | | - * The listener to be added; must not be <code>null</code>. |
394 | | - */ |
395 | | - public void addPropertyChangeListener(String identifier, |
396 | | - IPropertyChangeListener listener); |
397 | | - |
398 | | - /** |
399 | | - * An accessor for the accelerator associated with the item indicated by |
400 | | - * the identifier. This identifier is specific to mechanism being used. |
401 | | - * In the case of the Eclipse workbench, this is the command identifier. |
402 | | - * |
403 | | - * @param identifier |
404 | | - * The identifier of the item from which the accelerator |
405 | | - * should be obtained ; must not be <code>null</code>. |
406 | | - * @return An integer representation of the accelerator. This is the |
407 | | - * same accelerator format used by SWT. |
408 | | - */ |
409 | | - public Integer getAccelerator(String identifier); |
410 | | - |
411 | | - /** |
412 | | - * An accessor for the accelerator text associated with the item |
413 | | - * indicated by the identifier. This identifier is specific to mechanism |
414 | | - * being used. In the case of the Eclipse workbench, this is the command |
415 | | - * identifier. |
416 | | - * |
417 | | - * @param identifier |
418 | | - * The identifier of the item from which the accelerator text |
419 | | - * should be obtained ; must not be <code>null</code>. |
420 | | - * @return A string representation of the accelerator. This is the |
421 | | - * string representation that should be displayed to the user. |
422 | | - */ |
423 | | - public String getAcceleratorText(String identifier); |
424 | | - |
425 | | - /** |
426 | | - * Checks to see whether the given accelerator is being used by some |
427 | | - * other mechanism (outside of the menus controlled by JFace). This is |
428 | | - * used to keep JFace from trying to grab accelerators away from someone |
429 | | - * else. |
430 | | - * |
431 | | - * @param accelerator |
432 | | - * The accelerator to check -- in SWT's internal accelerator |
433 | | - * format. |
434 | | - * @return <code>true</code> if the accelerator is already being used |
435 | | - * and shouldn't be used again; <code>false</code> otherwise. |
436 | | - */ |
437 | | - public boolean isAcceleratorInUse(int accelerator); |
438 | | - |
439 | | - /** |
440 | | - * Checks whether the item matching this identifier is active. This is |
441 | | - * used to decide whether a contribution item with this identifier |
442 | | - * should be made visible. An inactive item is not visible. |
443 | | - * |
444 | | - * @param identifier |
445 | | - * The identifier of the item from which the active state |
446 | | - * should be retrieved; must not be <code>null</code>. |
447 | | - * @return <code>true</code> if the item is active; <code>false</code> |
448 | | - * otherwise. |
449 | | - */ |
450 | | - public boolean isActive(String identifier); |
451 | | - |
452 | | - /** |
453 | | - * Removes a listener from the object referenced by |
454 | | - * <code>identifier</code>. This identifier is specific to mechanism |
455 | | - * being used. In the case of the Eclipse workbench, this is the command |
456 | | - * identifier. |
457 | | - * |
458 | | - * @param identifier |
459 | | - * The identifier of the item to from the listener should be |
460 | | - * removed; must not be <code>null</code>. |
461 | | - * @param listener |
462 | | - * The listener to be removed; must not be <code>null</code>. |
463 | | - */ |
464 | | - public void removePropertyChangeListener(String identifier, |
465 | | - IPropertyChangeListener listener); |
466 | | - } |
467 | | - |
468 | 468 | /** |
469 | 469 | * The singleton instance of this class. This value may be <code>null</code>-- |
470 | 470 | * if it has not yet been initialized. |
|
0 commit comments