Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 351265 - SWT: Numberkeystrokes support only Keypad
Summary: SWT: Numberkeystrokes support only Keypad
Status: CLOSED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Scout (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows Vista
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-07-06 02:34 EDT by Nathan Burgherr CLA
Modified: 2021-08-19 11:33 EDT (History)
3 users (show)

See Also:
zimmermann: indigo+
zimmermann: juno+


Attachments
Patch for projects ui.swt and testing.client (26.63 KB, patch)
2011-07-15 08:15 EDT, Claudio Guglielmo CLA
no flags Details | Diff
Patch for projects ui.swt and testing.client (26.58 KB, patch)
2011-07-15 08:21 EDT, Claudio Guglielmo CLA
zimmermann: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Nathan Burgherr CLA 2011-07-06 02:34:31 EDT
Build Identifier: 

If you register a keystroke with a number, it listens only to the numbers on the keypad but not to those over the alphabetical keys.

Solution hint:
In the SwtUtility class in getKeyStrokes there is a special Case for the CR. It registers the normal CR and the one on the keypad. The same is needed for the numbers.

public static ISwtKeyStroke[] getKeyStrokes(IKeyStroke stroke, ISwtEnvironment environment) {
    ArrayList<ISwtKeyStroke> swtKeyStrokes = new ArrayList<ISwtKeyStroke>();
    int keycode = getSwtKeyCode(stroke);
    int stateMask = getSwtStateMask(stroke);
    // in case of enter register keypad enter as well
    if (keycode == SWT.CR) {
      swtKeyStrokes.add(new SwtScoutKeyStroke(stroke, SWT.CR, stateMask, environment));
      swtKeyStrokes.add(new SwtScoutKeyStroke(stroke, SWT.KEYPAD_CR, stateMask, environment));
    }
    else {
      swtKeyStrokes.add(new SwtScoutKeyStroke(stroke, keycode, stateMask, environment));
    }
    return swtKeyStrokes.toArray(new ISwtKeyStroke[swtKeyStrokes.size()]);
  }


Reproducible: Always

Steps to Reproduce:
1. Register a number key as keystroke somewhere in the application
    @Order(50.0)
    public class FiveKeyStroke extends AbstractKeyStroke {

      @Override
      protected String getConfiguredKeyStroke() {
        return "5";
      }

      @Override
      protected void execAction() throws ProcessingException {
        System.out.println("5 pressed");
      }
    }
2. Start application an try to get into execAction throug hitting 5 over the alphapetical keys
Comment 1 Claudio Guglielmo CLA 2011-07-15 08:15:22 EDT
Created attachment 199738 [details]
Patch for projects ui.swt and testing.client
Comment 2 Claudio Guglielmo CLA 2011-07-15 08:21:29 EDT
Created attachment 199740 [details]
Patch for projects ui.swt and testing.client
Comment 3 Andreas Hoegger CLA 2011-07-15 17:09:01 EDT
Patch applied for Indigo SP1 and trunk.
Thank you Claudio.
Comment 4 Wayne Beaton CLA 2011-09-20 07:39:52 EDT
The patch, if applied to the code base, must be flagged iplog+ so that it appears in the log.
Comment 5 Matthias Zimmermann CLA 2011-10-10 12:51:40 EDT
shipped with scout 3.7.1
Comment 6 Matthias Zimmermann CLA 2011-10-11 11:44:51 EDT
removed iplog flag from ticket and added iplog flag to attachment