Summary: | [Tool] Tools need Esc key handler override | ||
---|---|---|---|
Product: | [Tools] GEF | Reporter: | Scott Barkley <scott.g.barkley> |
Component: | GEF-Legacy GEF (MVC) | Assignee: | gef-inbox <gef-inbox> |
Status: | NEW --- | QA Contact: | |
Severity: | normal | ||
Priority: | P3 | CC: | nyssen |
Version: | 3.1.1 | ||
Target Milestone: | --- | ||
Hardware: | PC | ||
OS: | Windows XP | ||
Whiteboard: |
Description
Scott Barkley
2006-09-20 10:39:31 EDT
FigureCanvas is a Control. Add a traverse listener to the control. Set doit = false. The shell will not close. See SWT snippets for more info. I don't see how behavior could be changed at FigureCanvas. But maybe some of the tools could change. Tools should already be receiving the traversal event, which could be "consumed" (doit=false) if it is ESC. Try extending DragEditPartsTracker and see if you can fix the case for MOVE. >> But maybe some of the tools could change.
Following this tip, I ended up overriding PanningSelectionTool (for the drag and drop case) and copying and adding to the internal class PaletteSelectionTool (for the creation case). These changes are a sufficient band-aid for my case, but the tools in GEF should include similar handling.
Currently, the TargetingTool -> SelectionTool -> PanningSelectionTool and TargetingTool -> SelectionTool -> PaletteSelectionTool hierarchies do not provide implementations of AbstractTool.handleKeyTraversed(TraverseEvent), so the tools are receiving the event but only doing the no-op provided by AbstractTool.
For the PanningSelectionTool case, I think it would be appropriate for PanningSelectionTool to provide an implementation that either (a) sets event.doit to false if the event represents ESC and the tool is in its initial, terminal, or (perhaps) invalid state or (b) permits the current drag tracker to have some say in the decision.
For the PaletteSelectionTool case, I think it would be appropriate for the implementation to set event.doit to false if the event represents ESC and the palette viewer's active tool is not its palette root's default entry.
|