Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 124294

Summary: Key events on creation tool being sent to selection tool.
Product: [Tools] GEF Reporter: Ravi Ranjan <ravs53>
Component: GEF-Legacy GEF (MVC)Assignee: gef-inbox <gef-inbox>
Status: RESOLVED INVALID QA Contact:
Severity: normal    
Priority: P3    
Version: 3.1.1   
Target Milestone: ---   
Hardware: PC   
OS: Windows 2000   
Whiteboard:

Description Ravi Ranjan CLA 2006-01-18 09:49:30 EST
I have a class which extends CreationTool. Once this tool is selected and the user presses ESC the key event is sent to the SelectionTool instead of the CreationTool .
Comment 1 Randy Hudson CLA 2006-01-18 11:24:16 EST
Are you sure the tool was active? Which key event? The keyup event probably will go to the selection tool since it is loaded on keydown.
Comment 2 Ravi Ranjan CLA 2006-01-18 22:43:59 EST
I have a creation tool on the palette. Once i click on the palette and move to the editor (note: this is not DND but click on palette and click on editor) it shows the add feedback. Now if the user wants to cancel the operation he presses ESC, but this keyup event for ESC is processed by the handleKeyUp of the selection tool, which should not happen.
Comment 3 Randy Hudson CLA 2006-01-19 00:02:07 EST
OK, and what is happening on keyup that is bothering you? Usually, keyups are ignored, which keydown being the interesting event.
Comment 4 Ravi Ranjan CLA 2006-01-20 01:05:08 EST
I will detail the steps.

1. I have a class "CustomTemplateCreationLibrary extends CombinedTemplateCreationEntry".

2. This creates a tool "ElementCreationTool extends CreationTool".

3. Inside the ElementCreationTool i have the following methods overridden.

	@Override
	protected boolean handleKeyDown(KeyEvent e) {
		return super.handleKeyDown(e);
	}

	@Override
	protected void handleKeyTraversed(TraverseEvent event) {
		super.handleKeyTraversed(event);
	}

	@Override
	protected boolean handleKeyUp(KeyEvent e) {
		return super.handleKeyUp(e);
	}

4. Once select the tool in the palette and move over the graphical editor, it shows the correct add feedback.

5. Now two things happen:

a. I want to cancel the operation. So i press ESC.
  The public void keyUp(KeyEvent evt, EditPartViewer viewer) method of the AbstractTool is called. Once i start debugging through the method and i reach the following line -> handleKeyUp(evt); this should call the same method in the abstract tool or one of its overridden methods in the creation tool.

but the handleKeyUp(evt) method of the selection tool is called. Hence i am not able to cancel the selection of the tool by pressing ESC key.

This used to work before 3.0 correctly.

b. I press the space bar twice. The feedback is hidden but the tool is still selected. I am not sure whether this is a bug or expected behavior.
Comment 5 Randy Hudson CLA 2006-01-20 11:09:31 EST
The selection tool that is getting ESC is the selection tool for the palette itself, which is not your editor's active tool.

You are not getting ESC because the graphical viewer does not have focus, so the key goes to the palette (which is itself a graphical viewer). What does the logic example do in this case? Do you have a default entry defined for the palette?
Comment 6 Ravi Ranjan CLA 2006-01-23 02:17:27 EST
Okie - Resolved.