Class CL_ContextActionSupport
- All Implemented Interfaces:
EventListener,ClsChangeListener
Listen to changes in the lookup context:
- ChordLeadSheetItem and SelectedBar presence changes are notified to the registered CL_ContextActionListeners.
- If a ChordLeadSheet is present, listen to its changes and forward the ClsChangeEvents to the registered ClsChangeListeners.
CL_ContextActionSupport instances are cached per lookup context. Only weak listeners are used: declaratively registered actions might be transient actions (e.g. ContextAwareAction instances).
-
Method Summary
Modifier and TypeMethodDescriptionvoidAdd a weak reference to the specified listener.voidAdd a weak reference to the specified listener.voidProcess the change.final ChordLeadSheetfinal org.openide.util.Lookupstatic CL_ContextActionSupportgetInstance(org.openide.util.Lookup context) Get the instance associated to the specified context.final CL_SelectionvoidRemove the specified listener.voidRemove the specified listener.
-
Method Details
-
getInstance
Get the instance associated to the specified context.- Parameters:
context-- Returns:
-
getContext
public final org.openide.util.Lookup getContext()- Returns:
- the Lookup context
-
getSelection
- Returns:
- The latest selection.
-
getActiveChordLeadSheet
- Returns:
- The ChordLeadSheet currently present in the lookup context. Can be null.
-
addWeakSelectionListener
Add a weak reference to the specified listener.Listener will be notified of selection changes (bars or chord leadsheet items), unless listener is garbage-collected.
- Parameters:
listener-
-
removeWeakSelectionListener
Remove the specified listener.- Parameters:
listener-
-
addWeakActiveClsChangeListener
Add a weak reference to the specified listener.Listener will be notified of ClsChangeEvents from the active ChordLeadSheet, i.e the one present in the lookup context (unless listener is garbage-collected).
- Parameters:
listener-
-
removeWeakActiveClsChangeListener
Remove the specified listener.- Parameters:
listener-
-
chordLeadSheetChanged
Description copied from interface:ClsChangeListenerProcess the change.Note that this method might be called outside of the EDT.
- Specified by:
chordLeadSheetChangedin interfaceClsChangeListener- Parameters:
event-- Throws:
UnsupportedEditException- If a ClsVetoableChangeEvent is not authorized by a listener.
-