Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[platform-ui-dev] TextEditorActions and selection/position-dependent actions?

I've got a TextEditorAction that I want to be both selection-
and position-activated, i.e. so that it's enabled at some
textual positions but not others.

So, I've marked it as selection-dependent; i.e., I called
AbstractTextEditor.markAsSelectionDependentAction(myAction).

I've found that changing the cursor position doesn't always
result in calling an action's IUpdate.update(), so my action
doesn't always get the chance to enable/disable itself.

Specifically, if the selection is empty, cursor motion via the
arrow keys or mouse pointer does NOT call update().

If the selection is NON-empty, cursor motion via the arrow keys
or mouse DOES call update() (presumably since the selection goes
from non-empty to empty).

One could argue that this is all a red herring since I can work
around the problem by not attempting to enable/disable my action,
but rather make it a no-op if the position is not one it should
handle.

On the other hand, I think that an empty selection is still a
selection (zero length but at a specific document offset), so
moving the cursor from one spot to another changes the selection,
but clearly AbstractTextEditor disagrees with me. :-)

Thoughts?


--------------------------------
Dr. Robert M. Fuhrer                         rfuhrer@xxxxxxxxxxxxxx
Programming Technologies           IBM T. J. Watson Research Center



Back to the top