Menu

#14 "Next/Previous Event" menus are not context-sensitive

closed-fixed
karthik
5
2007-03-05
2007-02-07
No

When the last event of a line is selected the "Next Event" menu item is still enabled. It should be grayed. Same for "Previous Event" when the first event of a lines selected.

Discussion

  • Mahesh DC

    Mahesh DC - 2007-02-22
    • assigned_to: nobody --> karthik_s_udupa
     
  • karthik

    karthik - 2007-03-02
     
  • karthik

    karthik - 2007-03-02

    Logged In: YES
    user_id=1596868
    Originator: NO

    Am attaching a patch which will fix this bug. I have done the following changes:

    The NextAction & PreviousAction classes will observe the ZoomModel class. When a user creates a baseline that will be notified to these classes through zoom model. Then these two classes will update the status of the Next/Previous action menu option(i.e. enable/disable the menu obtion based on the base line time).

    File Added: bug- 1654076v3.diff

     
  • karthik

    karthik - 2007-03-02

    Logged In: YES
    user_id=1596868
    Originator: NO

    Am attaching a patch which will fix this bug. I have done the following changes:

    The NextAction & PreviousAction classes will observe the ZoomModel class. When a user creates a baseline that will be notified to these classes through zoom model. Then these two classes will update the status of the Next/Previous action menu option(i.e. enable/disable the menu obtion based on the base line time).

    File Added: bug- 1654076v3.diff

     
  • karthik

    karthik - 2007-03-02
     
  • Philippe Coucaud

    Logged In: YES
    user_id=1706683
    Originator: YES

    Hi Karthik,

    some remarks about the patch:

    1) in NextAction.updateModel() please call super.updateModel(...) instead of explicitly setting the tracemodel/zoommodel attributes again. Same for PreviousAction.

    2) NextAction/PreviousAction are created once in TraceEditorActionBars() and then shared by all editors. Thus I don't understand why you need a static field to store this unique instance. Removing this static field and calling setEnabled(...) directly should work ...

    3) you always add observers on the zoommodel, but never remove them. To do that you probably need to remember the previous zoomModel, remove the observer on this one and add the new observer on the new zoommodel. As I don't think it is the responsability of those actions to store such a state, I think you may consider moving the code that handle the enablement (updateActionState()) in TraceEditorActionBars.setActiveEditor(). Here you can add a local observer to the zoommodel that will enable/disable the action according to the new state and you also have the dispose() method available to remove the observer from the last active model.

     
  • karthik

    karthik - 2007-03-05
     
  • karthik

    karthik - 2007-03-05

    Logged In: YES
    user_id=1596868
    Originator: NO

    I am submitting a new patch for this bug which incorporates Mr. Philippe Coucaud's comments.
    File Added: bug- 1654076v4.diff

     
  • Mahesh DC

    Mahesh DC - 2007-03-05

    Logged In: YES
    user_id=1577725
    Originator: NO

    I have verified the patch and it fixes the problem as well as the review comments.

    The code is updated in CVS.

     
  • Mahesh DC

    Mahesh DC - 2007-03-05
    • status: open --> closed-fixed
     

Log in to post a comment.