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.*;
022: import java.awt.event.*;
023: import java.net.*;
024:
025: import javax.help.*;
026: import javax.swing.*;
027:
028: import org.openharmonise.him.actions.*;
029: import org.openharmonise.vfs.*;
030: import org.openharmonise.vfs.gui.*;
031:
032: /**
033: * Action to open the main help dialog.
034: *
035: * @author Matthew Large
036: * @version $Revision: 1.1 $
037: *
038: */
039: public class ActionHelp extends AbstractHIMAction implements HIMAction {
040:
041: /**
042: *
043: */
044: public ActionHelp() {
045: super ();
046: }
047:
048: /**
049: * @param vfFile
050: */
051: public ActionHelp(VirtualFile vfFile) {
052: super (vfFile);
053: }
054:
055: /* (non-Javadoc)
056: * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
057: */
058: public void actionPerformed(ActionEvent arg0) {
059:
060: }
061:
062: /* (non-Javadoc)
063: * @see com.simulacramedia.contentmanager.actions.CMAction#getMenuItem()
064: */
065: public JMenuItem getMenuItem() {
066: HelpBroker hb = null;
067: try {
068: String helpHS = "Harmonise Information Manager.hs";
069: ClassLoader cl = ActionHelp.class.getClassLoader();
070: URL hsURL = HelpSet.findHelpSet(cl, helpHS);
071: HelpSet hs = new HelpSet(null, hsURL);
072: hb = hs.createHelpBroker();
073: hb.setSize(new Dimension(740, 495));
074: } catch (Exception ee) {
075:
076: }
077:
078: JMenuItem menuItem = super .getMenuItem();
079: menuItem.setAccelerator(KeyStroke.getKeyStroke(this
080: .getAcceleratorKeycode(), this .getAcceleratorMask()));
081: try {
082: menuItem
083: .addActionListener(new CSH.DisplayHelpFromSource(hb));
084: } catch (NullPointerException npe) {
085: npe.printStackTrace(System.out);
086: }
087: return menuItem;
088: }
089:
090: /* (non-Javadoc)
091: * @see com.simulacramedia.contentmanager.actions.CMAction#getDescription()
092: */
093: public String getDescription() {
094: return "Displays the help system";
095: }
096:
097: /* (non-Javadoc)
098: * @see com.simulacramedia.contentmanager.actions.CMAction#getText()
099: */
100: public String getText() {
101: return "Help";
102: }
103:
104: /* (non-Javadoc)
105: * @see com.simulacramedia.contentmanager.actions.CMAction#getToolTip()
106: */
107: public String getToolTip() {
108: return this .getDescription();
109: }
110:
111: /* (non-Javadoc)
112: * @see com.simulacramedia.contentmanager.actions.CMAction#getIcon()
113: */
114: public Icon getIcon() {
115: return IconManager.getInstance().getIcon("16-command-help.gif");
116: }
117:
118: /* (non-Javadoc)
119: * @see com.simulacramedia.contentmanager.actions.CMAction#getAcceleratorKeycode()
120: */
121: public int getAcceleratorKeycode() {
122: return KeyEvent.VK_F1;
123: }
124:
125: /* (non-Javadoc)
126: * @see com.simulacramedia.contentmanager.actions.CMAction#getMnemonic()
127: */
128: public String getMnemonic() {
129: return "H";
130: }
131:
132: /* (non-Javadoc)
133: * @see com.simulacramedia.contentmanager.actions.CMAction#getAcceleratorMask()
134: */
135: public int getAcceleratorMask() {
136: return 0;
137: }
138:
139: }
|