001: /*
002: * $Header: /cvs/j3dfly/J3dFly/src/org/jdesktop/j3dfly/plugins/HelpSystemPlugin.java,v 1.1 2005/04/20 21:04:40 paulby Exp $
003: *
004: * Sun Public License Notice
005: *
006: * The contents of this file are subject to the Sun Public License Version
007: * 1.0 (the "License"). You may not use this file except in compliance with
008: * the License. A copy of the License is available at http://www.sun.com/
009: *
010: * The Original Code is Java 3D(tm) Fly Through.
011: * The Initial Developer of the Original Code is Paul Byrne.
012: * Portions created by Paul Byrne are Copyright (C) 2002.
013: * All Rights Reserved.
014: *
015: * Contributor(s): Paul Byrne.
016: *
017: **/
018: package org.jdesktop.j3dfly.plugins;
019:
020: import javax.media.j3d.BranchGroup;
021: import org.jdesktop.j3dfly.J3dFlyContext;
022: import org.jdesktop.j3dfly.utils.help.Help;
023: import org.jdesktop.j3dfly.utils.gui.SplashWindow;
024:
025: /**
026: *
027: * @author Paul Byrne
028: * @version $Revision: 1.1 $
029: */
030: public class HelpSystemPlugin extends J3dFlyPlugin {
031:
032: /** Creates new form J3dFlyMenu */
033: public HelpSystemPlugin() {
034: super ();
035: javax.swing.JPopupMenu.setDefaultLightWeightPopupEnabled(false);
036: initComponents();
037: menuBar.remove(helpMenu);
038: menuBar = null;
039:
040: SplashWindow.showMessage("Initialising Help");
041: Help.initialize("com/sun/j3d/demos/j3dfly/help/J3dFlyHelp");
042: }
043:
044: /**
045: * Returns the class of the plugin preference.
046: *
047: * Plugins that require more preference information should provide a
048: * subclass of PluginPrefernece that contains all the extra preference
049: * data. This class must be Serializable.
050: */
051: public Class getPluginPreferenceClass() {
052: return HelpSystemPluginPreference.class;
053: }
054:
055: public void installPlugin(PluginPreference pluginPref,
056: J3dFlyContext j3dflyContext) {
057: super .installPlugin(pluginPref, j3dflyContext);
058: if (pluginPref.isInstallInMenu())
059: j3dflyContext.getMainMenuBar().add(helpMenu);
060: if (org.jdesktop.j3dfly.utils.help.Help.isEnabled())
061: org.jdesktop.j3dfly.utils.help.Help.addHelpButton(helpMI,
062: "j3dfly.main");
063: else
064: helpMI.setEnabled(false);
065: }
066:
067: public void uninstallPlugin() {
068: super .uninstallPlugin();
069: if (pluginPref.isInstallInMenu())
070: j3dflyContext.getMainMenuBar().remove(helpMenu);
071: }
072:
073: /** This method is called from within the constructor to
074: * initialize the form.
075: * WARNING: Do NOT modify this code. The content of this method is
076: * always regenerated by the FormEditor.
077: */
078: private void initComponents() {//GEN-BEGIN:initComponents
079: menuBar = new javax.swing.JMenuBar();
080: helpMenu = new javax.swing.JMenu();
081: helpMI = new javax.swing.JMenuItem();
082: aboutMI = new javax.swing.JMenuItem();
083:
084: helpMenu.setText("Help");
085: helpMI.setText("Help...");
086: helpMenu.add(helpMI);
087: aboutMI.setText("About...");
088: helpMenu.add(aboutMI);
089: menuBar.add(helpMenu);
090:
091: }//GEN-END:initComponents
092:
093: /**
094: * Returns the control panel for this plugin, or null if there
095: * is no control panel
096: */
097: public javax.swing.JPanel getControlPanel() {
098: return null;
099: }
100:
101: /**
102: * Get the title of the plugin
103: */
104: public String getPluginTitle() {
105: return "Help";
106: }
107:
108: /**
109: * Forte thinks this class is a subclass of JFrame, it's not so add
110: * this NOP method to allow compilation in Forte
111: */
112: private void setJMenuBar(javax.swing.JMenuBar mb) {
113: }
114:
115: public static class HelpSystemPluginPreference extends
116: PluginPreference {
117: public HelpSystemPluginPreference() {
118: super ();
119: }
120:
121: public HelpSystemPluginPreference(boolean enabled,
122: boolean installed) {
123: super (enabled, installed);
124: }
125:
126: public J3dFlyPlugin instantiatePlugin() {
127: return new HelpSystemPlugin();
128: }
129:
130: /**
131: * Return a description of this plugin
132: */
133: public String getDescription() {
134: return "Application Help Infrastructure";
135: }
136:
137: /**
138: * Return the name of the Plugin for this prefernece.
139: * This is the name that will appear in the list of plugins
140: */
141: public String getName() {
142: return "Help";
143: }
144:
145: }
146:
147: /** Exit the Application */
148: // Variables declaration - do not modify//GEN-BEGIN:variables
149: private javax.swing.JMenuBar menuBar;
150: private javax.swing.JMenuItem aboutMI;
151: private javax.swing.JMenuItem helpMI;
152: private javax.swing.JMenu helpMenu;
153: // End of variables declaration//GEN-END:variables
154:
155: }
|