Class CL_ContextActionSupport

java.lang.Object
org.jjazz.cl_editor.api.CL_ContextActionSupport
All Implemented Interfaces:
ClsChangeListener

public class CL_ContextActionSupport extends Object implements ClsChangeListener
A helper class to write CL_Editor context aware actions.

Listen to ChordLeadSheetItem, SelectedBar, ChordLeadSheet presence in the lookup. Listen to the "present" ChordLeadSheet property changes. Fire the corresponding events to listeners.

  • Constructor Details

    • CL_ContextActionSupport

      public CL_ContextActionSupport(org.openide.util.Lookup context)
  • Method Details

    • getInstance

      public static CL_ContextActionSupport getInstance(org.openide.util.Lookup context)
      If context == Utilities.actionsGlobalContext() return a shared instance. Otherwise return a new specific object.
      Parameters:
      context -
      Returns:
    • getContext

      public final org.openide.util.Lookup getContext()
      Returns:
      the Lookup context
    • getSelection

      public final CL_SelectionUtilities getSelection()
      Returns:
      The latest selection.
    • addListener

      public void addListener(CL_ContextActionListener l)
    • removeListener

      public void removeListener(CL_ContextActionListener l)
    • authorizeChange

      public void authorizeChange(ClsChangeEvent e) throws UnsupportedEditException
      Description copied from interface: ClsChangeListener
      Some change events might need to be authorized by all listeners before being processed by chordLeadSheetChanged().
      Specified by:
      authorizeChange in interface ClsChangeListener
      Parameters:
      e - The change to authorize.
      Throws:
      UnsupportedEditException - Listener shall throw this exception if change is not acceptable. Exception message might be shown to user to explain the problem.
    • chordLeadSheetChanged

      public void chordLeadSheetChanged(ClsChangeEvent event)
      Description copied from interface: ClsChangeListener
      Process the change.

      Note that this method might be called outside of the EDT.

      Specified by:
      chordLeadSheetChanged in interface ClsChangeListener