1 19 package org.openharmonise.him.actions.help; 20 21 import java.awt.Dimension ; 22 import java.awt.event.ActionEvent ; 23 import java.awt.event.InputEvent ; 24 import java.awt.event.KeyEvent ; 25 import java.net.URL ; 26 27 import javax.help.HelpBroker; 28 import javax.help.HelpSet; 29 import javax.help.CSH; 30 import javax.swing.Icon ; 31 import javax.swing.JMenuItem ; 32 import javax.swing.KeyStroke ; 33 34 import org.openharmonise.him.actions.*; 35 import org.openharmonise.vfs.*; 36 import org.openharmonise.vfs.gui.*; 37 38 39 47 public class ActionKeyboardShortcuts 48 extends AbstractHIMAction 49 implements HIMAction { 50 51 54 public ActionKeyboardShortcuts() { 55 super(); 56 } 57 58 61 public ActionKeyboardShortcuts(VirtualFile vfFile) { 62 super(vfFile); 63 } 64 65 68 public void actionPerformed(ActionEvent arg0) { 69 71 } 72 73 76 public JMenuItem getMenuItem() { 77 HelpBroker hb = null; 78 try { 79 String helpHS = "Harmonise Information Manager.hs"; 80 ClassLoader cl = ActionHelp.class.getClassLoader(); 81 URL hsURL = HelpSet.findHelpSet(cl, helpHS); 82 HelpSet hs = new HelpSet(null, hsURL); 83 hs.setHomeID("Keyboard_Shortcuts"); 84 hb = hs.createHelpBroker(); 85 hb.setSize(new Dimension (740,495)); 86 } catch (Exception ee) { 87 88 } 89 90 JMenuItem menuItem = super.getMenuItem(); 91 menuItem.setAccelerator( KeyStroke.getKeyStroke(this.getAcceleratorKeycode(), this.getAcceleratorMask()) ); 92 try { 93 menuItem.addActionListener(new CSH.DisplayHelpFromSource( hb )); 94 } catch(NullPointerException npe) { 95 npe.printStackTrace(System.out); 96 } 97 return menuItem; 98 } 99 100 103 public String getDescription() { 104 return "Displays a list of all the keyboard shortcuts"; 105 } 106 107 110 public String getText() { 111 return "Keyboard shortcuts"; 112 } 113 114 117 public String getToolTip() { 118 return this.getDescription(); 119 } 120 121 124 public Icon getIcon() { 125 return IconManager.getInstance().getIcon("16-blank.gif"); 126 } 127 128 131 public int getAcceleratorKeycode() { 132 return KeyEvent.VK_K; 133 } 134 135 138 public String getMnemonic() { 139 return "K"; 140 } 141 142 145 public int getAcceleratorMask() { 146 return InputEvent.CTRL_MASK; 147 } 148 149 } 150 | Popular Tags |