1 17 18 package org.netbeans.lib.uihandler; 19 20 import java.util.logging.LogRecord ; 21 import java.util.logging.XMLFormatter ; 22 23 27 public enum InputGesture { 28 KEYBOARD, MENU, TOOLBAR; 29 30 31 private static final XMLFormatter F = new XMLFormatter (); 32 33 37 public static InputGesture valueOf(LogRecord rec) { 38 if ("UI_ACTION_BUTTON_PRESS".equals(rec.getMessage())) { 39 String fullMsg = F.format(rec); 40 if (fullMsg.indexOf("Actions$Menu") >= 0) { 41 return MENU; 42 } 43 if (fullMsg.indexOf("Actions$Toolbar") >= 0) { 44 return TOOLBAR; 45 } 46 } 47 if ("UI_ACTION_KEY_PRESS".equals(rec.getMessage())) { 48 return KEYBOARD; 49 } 50 return null; 51 } 52 } 53 | Popular Tags |