|
What this is
This file is included in the DevDaily.com
"Java Source Code
Warehouse" project. The intent of this project is to help you "Learn
Java by Example" TM.
Other links
The source code
/*
* Sun Public License Notice
*
* The contents of this file are subject to the Sun Public License
* Version 1.0 (the "License"). You may not use this file except in
* compliance with the License. A copy of the License is available at
* http://www.sun.com/
*
* The Original Code is NetBeans. The Initial Developer of the Original
* Code is Sun Microsystems, Inc. Portions Copyright 1997-2003 Sun
* Microsystems, Inc. All Rights Reserved.
*/
package org.netbeans.modules.javahelp;
import java.awt.*;
import java.awt.event.AWTEventListener;
import java.awt.event.WindowEvent;
import java.io.ObjectStreamException;
import java.lang.ref.Reference;
import java.lang.ref.SoftReference;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.*;
import java.util.List;
import javax.swing.*;
import javax.help.HelpSet;
import javax.help.HelpSetException;
import javax.help.JHelp;
import org.openide.ErrorManager;
import org.openide.util.*;
import org.openide.windows.CloneableTopComponent;
import org.openide.windows.WindowManager;
// [PENDING] should event dispatch thread be used thruout?
/** Help implementation using the JavaHelp 1.x system.
* @author Jesse Glick, Richard Gregor
*/
public final class JavaHelp extends AbstractHelp implements AWTEventListener {
/** Make a JavaHelp implementation of the Help.Impl interface.
*Or, use {@link #getDefaultJavaHelp}.
*/
public JavaHelp() {
Installer.err.log("JavaHelp created");
Toolkit.getDefaultToolkit().addAWTEventListener(this, AWTEvent.WINDOW_EVENT_MASK);
}
void deactivate() {
Toolkit.getDefaultToolkit().removeAWTEventListener(this);
}
// [PENDING] hold help sets weakly? softly? try to conserve memory...
/** The master help set.
*/
private HelpSet master = null;
/** map from help sets to (soft refs to) components showing them */
private Map availableJHelps = new HashMap(); // Map>
/** viewer (may be invisible) showing help normally; null until first used; if invisible, is empty */
private JFrame frameViewer = null;
/** viewer showing help parented to current modal dialog; initially null */
private JDialog dialogViewer = null;
/** whether user explicitly closed dialog viewer.
* true - frame viewer was initially open, then reparented to dialog viewer,
* then user closes main dialog and we ought to reparent to frame viewer
* false - frame viewer not initially open anyway, or it was but the user
* explicitly closed it as a dialog viewer, we should leave it closed
*/
private boolean reparentToFrameLater = false;
/** the modal dialog(s) currently in effect */
private Stack currentModalDialogs = new Stack(); // Stack
|