1 11 12 package org.eclipse.ui.internal.keys; 13 14 import java.util.List ; 15 16 import org.eclipse.swt.widgets.Event; 17 import org.eclipse.swt.widgets.Listener; 18 import org.eclipse.swt.widgets.Widget; 19 20 26 public class OutOfOrderListener implements Listener { 27 33 private int active = Integer.MIN_VALUE; 34 35 39 private final WorkbenchKeyboard keyboard; 40 41 50 public OutOfOrderListener(WorkbenchKeyboard workbenchKeyboard) { 51 keyboard = workbenchKeyboard; 52 } 53 54 62 public void handleEvent(Event event) { 63 final Widget widget = event.widget; 65 if ((widget != null) && (!widget.isDisposed())) { 66 widget.removeListener(event.type, this); 67 } 68 69 73 if (event.doit) { 74 List keyStrokes = WorkbenchKeyboard 75 .generatePossibleKeyStrokes(event); 76 keyboard.processKeyEvent(keyStrokes, event); 77 } 78 } 79 80 90 final boolean isActive(final int timeRegistered) { 91 return (active == timeRegistered); 92 } 93 94 104 final void setActive(final int timeRegistered) { 105 active = timeRegistered; 106 } 107 } 108 | Popular Tags |