001: /*
002: * The contents of this file are subject to the
003: * Mozilla Public License Version 1.1 (the "License");
004: * you may not use this file except in compliance with the License.
005: * You may obtain a copy of the License at http://www.mozilla.org/MPL/
006: *
007: * Software distributed under the License is distributed on an "AS IS"
008: * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.
009: * See the License for the specific language governing rights and
010: * limitations under the License.
011: *
012: * The Initial Developer of the Original Code is Simulacra Media Ltd.
013: * Portions created by Simulacra Media Ltd are Copyright (C) Simulacra Media Ltd, 2004.
014: *
015: * All Rights Reserved.
016: *
017: * Contributor(s):
018: */
019: package org.openharmonise.him.actions.help;
020:
021: import java.awt.Dimension;
022: import java.awt.event.ActionEvent;
023: import java.awt.event.InputEvent;
024: import java.awt.event.KeyEvent;
025: import java.net.URL;
026:
027: import javax.help.HelpBroker;
028: import javax.help.HelpSet;
029: import javax.help.CSH;
030: import javax.swing.Icon;
031: import javax.swing.JMenuItem;
032: import javax.swing.KeyStroke;
033:
034: import org.openharmonise.him.actions.*;
035: import org.openharmonise.vfs.*;
036: import org.openharmonise.vfs.gui.*;
037:
038: /**
039: * Action to open the main help dialog with the keyboard shortcuts
040: * selected.
041: *
042: * @author Matthew Large
043: * @version $Revision: 1.1 $
044: *
045: */
046: public class ActionKeyboardShortcuts extends AbstractHIMAction
047: implements HIMAction {
048:
049: /**
050: *
051: */
052: public ActionKeyboardShortcuts() {
053: super ();
054: }
055:
056: /**
057: * @param vfFile
058: */
059: public ActionKeyboardShortcuts(VirtualFile vfFile) {
060: super (vfFile);
061: }
062:
063: /* (non-Javadoc)
064: * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
065: */
066: public void actionPerformed(ActionEvent arg0) {
067: // TODO Auto-generated method stub
068:
069: }
070:
071: /* (non-Javadoc)
072: * @see com.simulacramedia.contentmanager.actions.CMAction#getMenuItem()
073: */
074: public JMenuItem getMenuItem() {
075: HelpBroker hb = null;
076: try {
077: String helpHS = "Harmonise Information Manager.hs";
078: ClassLoader cl = ActionHelp.class.getClassLoader();
079: URL hsURL = HelpSet.findHelpSet(cl, helpHS);
080: HelpSet hs = new HelpSet(null, hsURL);
081: hs.setHomeID("Keyboard_Shortcuts");
082: hb = hs.createHelpBroker();
083: hb.setSize(new Dimension(740, 495));
084: } catch (Exception ee) {
085:
086: }
087:
088: JMenuItem menuItem = super .getMenuItem();
089: menuItem.setAccelerator(KeyStroke.getKeyStroke(this
090: .getAcceleratorKeycode(), this .getAcceleratorMask()));
091: try {
092: menuItem
093: .addActionListener(new CSH.DisplayHelpFromSource(hb));
094: } catch (NullPointerException npe) {
095: npe.printStackTrace(System.out);
096: }
097: return menuItem;
098: }
099:
100: /* (non-Javadoc)
101: * @see com.simulacramedia.contentmanager.actions.CMAction#getDescription()
102: */
103: public String getDescription() {
104: return "Displays a list of all the keyboard shortcuts";
105: }
106:
107: /* (non-Javadoc)
108: * @see com.simulacramedia.contentmanager.actions.CMAction#getText()
109: */
110: public String getText() {
111: return "Keyboard shortcuts";
112: }
113:
114: /* (non-Javadoc)
115: * @see com.simulacramedia.contentmanager.actions.CMAction#getToolTip()
116: */
117: public String getToolTip() {
118: return this .getDescription();
119: }
120:
121: /* (non-Javadoc)
122: * @see com.simulacramedia.contentmanager.actions.CMAction#getIcon()
123: */
124: public Icon getIcon() {
125: return IconManager.getInstance().getIcon("16-blank.gif");
126: }
127:
128: /* (non-Javadoc)
129: * @see com.simulacramedia.contentmanager.actions.CMAction#getAcceleratorKeycode()
130: */
131: public int getAcceleratorKeycode() {
132: return KeyEvent.VK_K;
133: }
134:
135: /* (non-Javadoc)
136: * @see com.simulacramedia.contentmanager.actions.CMAction#getMnemonic()
137: */
138: public String getMnemonic() {
139: return "K";
140: }
141:
142: /* (non-Javadoc)
143: * @see com.simulacramedia.contentmanager.actions.CMAction#getAcceleratorMask()
144: */
145: public int getAcceleratorMask() {
146: return InputEvent.CTRL_MASK;
147: }
148:
149: }
|