org-netbeans-modules-javahelp

16:39:57.645 INFO  jd.cli.Main - Decompiling org-netbeans-modules-javahelp.jar
package javax.help;

import java.util.Hashtable;
import java.util.Locale;

@Deprecated
public class ModifiedSearchView
  extends SearchView
{
  public ModifiedSearchView(HelpSet paramHelpSet, String paramString1, String paramString2, Hashtable paramHashtable)
  {
    super(paramHelpSet, paramString1, paramString2, paramHelpSet.getLocale(), paramHashtable);
  }
  
  public ModifiedSearchView(HelpSet paramHelpSet, String paramString1, String paramString2, Locale paramLocale, Hashtable paramHashtable)
  {
    super(paramHelpSet, paramString1, paramString2, paramLocale, paramHashtable);
  }
}

/* Location:
 * Qualified Name:     javax.help.ModifiedSearchView
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.api.javahelp;

import javax.swing.event.ChangeListener;
import org.openide.util.HelpCtx;

public abstract class Help
{
  public abstract Boolean isValidID(String paramString, boolean paramBoolean);
  
  public void showHelp(HelpCtx paramHelpCtx)
  {
    showHelp(paramHelpCtx, true);
  }
  
  public abstract void showHelp(HelpCtx paramHelpCtx, boolean paramBoolean);
  
  public abstract void addChangeListener(ChangeListener paramChangeListener);
  
  public abstract void removeChangeListener(ChangeListener paramChangeListener);
}

/* Location:
 * Qualified Name:     org.netbeans.api.javahelp.Help
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.modules.javahelp;

import org.openide.util.LookupEvent;
import org.openide.util.LookupListener;

class AbstractHelp$1
  implements LookupListener
{
  AbstractHelp$1(AbstractHelp paramAbstractHelp) {}
  
  public void resultChanged(LookupEvent paramLookupEvent)
  {
    this$0.helpSetsChanged();
  }
}

/* Location:
 * Qualified Name:     org.netbeans.modules.javahelp.AbstractHelp.1
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.modules.javahelp;

class AbstractHelp$2
  implements Runnable
{
  AbstractHelp$2(AbstractHelp paramAbstractHelp) {}
  
  public void run()
  {
    AbstractHelp.access$000(this$0);
  }
}

/* Location:
 * Qualified Name:     org.netbeans.modules.javahelp.AbstractHelp.2
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.modules.javahelp;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.help.HelpSet;
import javax.swing.SwingUtilities;
import javax.swing.event.ChangeListener;
import org.netbeans.api.javahelp.Help;
import org.openide.util.ChangeSupport;
import org.openide.util.Lookup;
import org.openide.util.Lookup.Result;
import org.openide.util.LookupEvent;
import org.openide.util.LookupListener;

public abstract class AbstractHelp
  extends Help
  implements HelpConstants
{
  private Lookup.Result<HelpSet> helpsets = null;
  
  protected final Collection<? extends HelpSet> getHelpSets()
  {
    if (helpsets == null)
    {
      Installer.log.fine("searching for instances of HelpSet...");
      helpsets = Lookup.getDefault().lookupResult(HelpSet.class);
      helpsets.addLookupListener(new LookupListener()
      {
        public void resultChanged(LookupEvent paramAnonymousLookupEvent)
        {
          helpSetsChanged();
        }
      });
      fireChangeEvent();
    }
    Collection localCollection = helpsets.allInstances();
    if (Installer.log.isLoggable(Level.FINE))
    {
      ArrayList localArrayList = new ArrayList(Math.min(1, localCollection.size()));
      for (HelpSet localHelpSet : localCollection) {
        localArrayList.add(localHelpSet.getTitle());
      }
      Installer.log.fine("listing helpsets: " + localArrayList);
    }
    return localCollection;
  }
  
  protected final boolean helpSetsReady()
  {
    return helpsets != null;
  }
  
  protected final boolean shouldMerge(HelpSet paramHelpSet)
  {
    Boolean localBoolean = (Boolean)paramHelpSet.getKeyData("OpenIDE", "mergeIntoMaster");
    return (localBoolean == null) || (localBoolean.booleanValue());
  }
  
  protected void helpSetsChanged()
  {
    Installer.log.fine("helpSetsChanged");
    fireChangeEvent();
  }
  
  public final void addChangeListener(ChangeListener paramChangeListener)
  {
    cs.addChangeListener(paramChangeListener);
  }
  
  public final void removeChangeListener(ChangeListener paramChangeListener)
  {
    cs.removeChangeListener(paramChangeListener);
  }
  
  private final ChangeSupport cs = new ChangeSupport(this);
  
  private final void fireChangeEvent()
  {
    if (!SwingUtilities.isEventDispatchThread())
    {
      SwingUtilities.invokeLater(new Runnable()
      {
        public void run()
        {
          AbstractHelp.this.fireChangeEvent();
        }
      });
      return;
    }
    Installer.log.fine("Help.stateChanged");
    cs.fireChange();
  }
}

/* Location:
 * Qualified Name:     org.netbeans.modules.javahelp.AbstractHelp
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.modules.javahelp;

import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;

class BrowserDisplayer$1
  implements MouseListener
{
  BrowserDisplayer$1(BrowserDisplayer paramBrowserDisplayer) {}
  
  public void mouseClicked(MouseEvent paramMouseEvent)
  {
    this$0.setToolTipText(null);
    if (Utils.isMouseRightClick(paramMouseEvent)) {
      Utils.showPopupMenu(paramMouseEvent, BrowserDisplayer.access$000(this$0), this$0);
    }
  }
  
  public void mouseEntered(MouseEvent paramMouseEvent)
  {
    this$0.setCursor(BrowserDisplayer.access$100());
    this$0.setToolTipText(this$0.getContent());
  }
  
  public void mouseExited(MouseEvent paramMouseEvent)
  {
    this$0.setCursor(BrowserDisplayer.access$200(this$0));
    this$0.setToolTipText(null);
  }
  
  public void mousePressed(MouseEvent paramMouseEvent) {}
  
  public void mouseReleased(MouseEvent paramMouseEvent) {}
}

/* Location:
 * Qualified Name:     org.netbeans.modules.javahelp.BrowserDisplayer.1
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.modules.javahelp;

import com.sun.java.help.impl.ViewAwareComponent;
import java.awt.Color;
import java.awt.Cursor;
import java.awt.Font;
import java.awt.FontMetrics;
import java.awt.Insets;
import java.awt.Toolkit;
import java.awt.datatransfer.Clipboard;
import java.awt.datatransfer.Transferable;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.net.MalformedURLException;
import java.net.URL;
import javax.accessibility.AccessibleContext;
import javax.swing.JButton;
import javax.swing.JPopupMenu;
import javax.swing.UIManager;
import javax.swing.border.EmptyBorder;
import javax.swing.text.AttributeSet;
import javax.swing.text.SimpleAttributeSet;
import javax.swing.text.StyleConstants;
import javax.swing.text.View;
import javax.swing.text.html.HTMLDocument;
import javax.swing.text.html.StyleSheet;
import org.openide.awt.HtmlBrowser.URLDisplayer;
import org.openide.util.NbBundle;

public class BrowserDisplayer
  extends JButton
  implements ActionListener, ViewAwareComponent, CopyLinkLocationAction.LinkOwner
{
  private View myView;
  private SimpleAttributeSet textAttribs;
  private HTMLDocument doc;
  private URL base;
  private static final Cursor handCursor = Cursor.getPredefinedCursor(12);
  private Cursor origCursor;
  private JPopupMenu popupMenu;
  
  public BrowserDisplayer()
  {
    setMargin(new Insets(0, 0, 0, 0));
    createLinkLabel();
    addActionListener(this);
    origCursor = getCursor();
    getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(BrowserDisplayer.class, "ACSD_Label"));
    
    popupMenu = HyperlinkEventProcessor.getPopupMenu(new CopyLinkLocationAction(this));
    
    addMouseListener(new MouseListener()
    {
      public void mouseClicked(MouseEvent paramAnonymousMouseEvent)
      {
        setToolTipText(null);
        if (Utils.isMouseRightClick(paramAnonymousMouseEvent)) {
          Utils.showPopupMenu(paramAnonymousMouseEvent, popupMenu, BrowserDisplayer.this);
        }
      }
      
      public void mouseEntered(MouseEvent paramAnonymousMouseEvent)
      {
        setCursor(BrowserDisplayer.handCursor);
        setToolTipText(getContent());
      }
      
      public void mouseExited(MouseEvent paramAnonymousMouseEvent)
      {
        setCursor(origCursor);
        setToolTipText(null);
      }
      
      public void mousePressed(MouseEvent paramAnonymousMouseEvent) {}
      
      public void mouseReleased(MouseEvent paramAnonymousMouseEvent) {}
    });
  }
  
  public void setViewData(View paramView)
  {
    myView = paramView;
    doc = ((HTMLDocument)myView.getDocument());
    base = doc.getBase();
    
    Font localFont = getFont();
    textAttribs = new SimpleAttributeSet();
    textAttribs.removeAttribute(StyleConstants.FontSize);
    textAttribs.removeAttribute(StyleConstants.Bold);
    textAttribs.removeAttribute(StyleConstants.Italic);
    textAttribs.addAttribute(StyleConstants.FontFamily, localFont.getName());
    
    textAttribs.addAttribute(StyleConstants.FontSize, new Integer(localFont.getSize()));
    
    textAttribs.addAttribute(StyleConstants.Bold, Boolean.valueOf(localFont.isBold()));
    
    textAttribs.addAttribute(StyleConstants.Italic, Boolean.valueOf(localFont.isItalic()));
  }
  
  private String content = "";
  
  public void setContent(String paramString)
  {
    content = paramString;
  }
  
  public String getContent()
  {
    return content;
  }
  
  private void createLinkLabel()
  {
    setBorder(new EmptyBorder(1, 1, 1, 1));
    setBorderPainted(false);
    setFocusPainted(false);
    setAlignmentY(getPreferredAlignmentY());
    setContentAreaFilled(false);
    setHorizontalAlignment(2);
    setBackground(UIManager.getColor("EditorPane.background"));
    if ((textAttribs != null) && (textAttribs.isDefined(StyleConstants.Foreground))) {
      setForeground((Color)textAttribs.getAttribute(StyleConstants.Foreground));
    } else {
      setForeground(Color.blue);
    }
    invalidate();
  }
  
  private float getPreferredAlignmentY()
  {
    Font localFont = getFont();
    FontMetrics localFontMetrics = getToolkit().getFontMetrics(localFont);
    float f1 = localFontMetrics.getHeight();
    float f2 = localFontMetrics.getDescent();
    return (f1 - f2) / f1;
  }
  
  public void setTextFontFamily(String paramString)
  {
    textAttribs.removeAttribute(StyleConstants.FontFamily);
    textAttribs.addAttribute(StyleConstants.FontFamily, paramString);
    setFont(getAttributeSetFont(textAttribs));
    Font localFont = getFont();
  }
  
  public String getTextFontFamily()
  {
    return StyleConstants.getFontFamily(textAttribs);
  }
  
  public void setTextFontSize(String paramString)
  {
    StyleSheet localStyleSheet = doc.getStyleSheet();
    int i;
    try
    {
      if (paramString.equals("xx-small"))
      {
        i = (int)localStyleSheet.getPointSize(0);
      }
      else if (paramString.equals("x-small"))
      {
        i = (int)localStyleSheet.getPointSize(1);
      }
      else if (paramString.equals("small"))
      {
        i = (int)localStyleSheet.getPointSize(2);
      }
      else if (paramString.equals("medium"))
      {
        i = (int)localStyleSheet.getPointSize(3);
      }
      else if (paramString.equals("large"))
      {
        i = (int)localStyleSheet.getPointSize(4);
      }
      else if (paramString.equals("x-large"))
      {
        i = (int)localStyleSheet.getPointSize(5);
      }
      else if (paramString.equals("xx-large"))
      {
        i = (int)localStyleSheet.getPointSize(6);
      }
      else if (paramString.equals("bigger"))
      {
        i = (int)localStyleSheet.getPointSize("+1");
      }
      else if (paramString.equals("smaller"))
      {
        i = (int)localStyleSheet.getPointSize("-1");
      }
      else if (paramString.endsWith("pt"))
      {
        String str = paramString.substring(0, paramString.length() - 2);
        i = Integer.parseInt(str);
      }
      else
      {
        i = (int)localStyleSheet.getPointSize(paramString);
      }
    }
    catch (NumberFormatException localNumberFormatException)
    {
      return;
    }
    if (i == 0) {
      return;
    }
    textAttribs.removeAttribute(StyleConstants.FontSize);
    textAttribs.addAttribute(StyleConstants.FontSize, new Integer(i));
    
    setFont(getAttributeSetFont(textAttribs));
    Font localFont = getFont();
  }
  
  public String getTextFontSize()
  {
    return Integer.toString(StyleConstants.getFontSize(textAttribs));
  }
  
  public void setTextFontWeight(String paramString)
  {
    boolean bool = false;
    if ("bold".equals(paramString)) {
      bool = true;
    } else {
      bool = false;
    }
    textAttribs.removeAttribute(StyleConstants.Bold);
    textAttribs.addAttribute(StyleConstants.Bold, Boolean.valueOf(bool));
    setFont(getAttributeSetFont(textAttribs));
    Font localFont = getFont();
  }
  
  public String getTextFontWeight()
  {
    if (StyleConstants.isBold(textAttribs)) {
      return "bold";
    }
    return "plain";
  }
  
  public void setTextFontStyle(String paramString)
  {
    boolean bool = false;
    if ("italic".equals(paramString)) {
      bool = true;
    } else {
      bool = false;
    }
    textAttribs.removeAttribute(StyleConstants.Italic);
    textAttribs.addAttribute(StyleConstants.Italic, Boolean.valueOf(bool));
    setFont(getAttributeSetFont(textAttribs));
    Font localFont = getFont();
  }
  
  public String getTextFontStyle()
  {
    if (StyleConstants.isItalic(textAttribs)) {
      return "italic";
    }
    return "plain";
  }
  
  public void setTextColor(String paramString)
  {
    Color localColor = null;
    if ("black".equals(paramString)) {
      localColor = Color.black;
    } else if ("blue".equals(paramString)) {
      localColor = Color.blue;
    } else if ("cyan".equals(paramString)) {
      localColor = Color.cyan;
    } else if ("darkGray".equals(paramString)) {
      localColor = Color.darkGray;
    } else if ("gray".equals(paramString)) {
      localColor = Color.gray;
    } else if ("green".equals(paramString)) {
      localColor = Color.green;
    } else if ("lightGray".equals(paramString)) {
      localColor = Color.lightGray;
    } else if ("magenta".equals(paramString)) {
      localColor = Color.magenta;
    } else if ("orange".equals(paramString)) {
      localColor = Color.orange;
    } else if ("pink".equals(paramString)) {
      localColor = Color.pink;
    } else if ("red".equals(paramString)) {
      localColor = Color.red;
    } else if ("white".equals(paramString)) {
      localColor = Color.white;
    } else if ("yellow".equals(paramString)) {
      localColor = Color.yellow;
    }
    if (localColor == null) {
      return;
    }
    textAttribs.removeAttribute(StyleConstants.Foreground);
    textAttribs.addAttribute(StyleConstants.Foreground, localColor);
    setForeground(localColor);
  }
  
  public String getTextColor()
  {
    Color localColor = getForeground();
    return localColor.toString();
  }
  
  private Font getAttributeSetFont(AttributeSet paramAttributeSet)
  {
    int i = 0;
    if (StyleConstants.isBold(paramAttributeSet)) {
      i |= 0x1;
    }
    if (StyleConstants.isItalic(paramAttributeSet)) {
      i |= 0x2;
    }
    String str = StyleConstants.getFontFamily(paramAttributeSet);
    int j = StyleConstants.getFontSize(paramAttributeSet);
    if ((StyleConstants.isSuperscript(paramAttributeSet)) || (StyleConstants.isSubscript(paramAttributeSet))) {
      j -= 2;
    }
    return doc.getStyleSheet().getFont(str, i, j);
  }
  
  public void actionPerformed(ActionEvent paramActionEvent)
  {
    URL localURL;
    try
    {
      localURL = new URL(content);
    }
    catch (MalformedURLException localMalformedURLException)
    {
      return;
    }
    HtmlBrowser.URLDisplayer.getDefault().showURL(localURL);
  }
  
  public String getURLExternalForm()
  {
    return getContent();
  }
  
  public Clipboard getClipboard()
  {
    return getToolkit().getSystemClipboard();
  }
  
  public void lostOwnership(Clipboard paramClipboard, Transferable paramTransferable) {}
}

/* Location:
 * Qualified Name:     org.netbeans.modules.javahelp.BrowserDisplayer
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.modules.javahelp;

import java.beans.PropertyDescriptor;
import java.beans.SimpleBeanInfo;

public class BrowserDisplayerBeanInfo
  extends SimpleBeanInfo
{
  public PropertyDescriptor[] getPropertyDescriptors()
  {
    PropertyDescriptor[] arrayOfPropertyDescriptor = new PropertyDescriptor[7];
    try
    {
      arrayOfPropertyDescriptor[0] = new PropertyDescriptor("content", BrowserDisplayer.class);
      arrayOfPropertyDescriptor[1] = new PropertyDescriptor("text", BrowserDisplayer.class);
      arrayOfPropertyDescriptor[2] = new PropertyDescriptor("textFontFamily", BrowserDisplayer.class);
      arrayOfPropertyDescriptor[3] = new PropertyDescriptor("textFontSize", BrowserDisplayer.class);
      arrayOfPropertyDescriptor[4] = new PropertyDescriptor("textFontWeight", BrowserDisplayer.class);
      arrayOfPropertyDescriptor[5] = new PropertyDescriptor("textFontStyle", BrowserDisplayer.class);
      arrayOfPropertyDescriptor[6] = new PropertyDescriptor("textColor", BrowserDisplayer.class);
      return arrayOfPropertyDescriptor;
    }
    catch (Exception localException) {}
    return null;
  }
}

/* Location:
 * Qualified Name:     org.netbeans.modules.javahelp.BrowserDisplayerBeanInfo
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.modules.javahelp;

import java.awt.datatransfer.Clipboard;
import java.awt.datatransfer.ClipboardOwner;

public abstract interface CopyLinkLocationAction$LinkOwner
  extends ClipboardOwner
{
  public abstract String getURLExternalForm();
  
  public abstract Clipboard getClipboard();
}

/* Location:
 * Qualified Name:     org.netbeans.modules.javahelp.CopyLinkLocationAction.LinkOwner
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.modules.javahelp;

import java.awt.datatransfer.Clipboard;
import java.awt.datatransfer.ClipboardOwner;
import java.awt.datatransfer.StringSelection;
import java.awt.event.ActionEvent;
import javax.swing.AbstractAction;
import org.openide.util.NbBundle;

public class CopyLinkLocationAction
  extends AbstractAction
{
  private static final String LBL_CopyLinkLocationAction = NbBundle.getMessage(HyperlinkEventProcessor.class, "LBL_CopyLinkLocationAction");
  private LinkOwner linkOwner;
  
  public CopyLinkLocationAction(LinkOwner paramLinkOwner)
  {
    super(LBL_CopyLinkLocationAction);
    
    linkOwner = paramLinkOwner;
  }
  
  public void actionPerformed(ActionEvent paramActionEvent)
  {
    textToSystemClipboard(linkOwner.getURLExternalForm());
  }
  
  private void textToSystemClipboard(String paramString)
  {
    StringSelection localStringSelection = new StringSelection(paramString);
    Clipboard localClipboard = linkOwner.getClipboard();
    localClipboard.setContents(localStringSelection, linkOwner);
  }
  
  public static abstract interface LinkOwner
    extends ClipboardOwner
  {
    public abstract String getURLExternalForm();
    
    public abstract Clipboard getClipboard();
  }
}

/* Location:
 * Qualified Name:     org.netbeans.modules.javahelp.CopyLinkLocationAction
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.modules.javahelp;

import javax.swing.MenuElement;
import javax.swing.MenuSelectionManager;

class HelpAction$1
  implements Runnable
{
  HelpAction$1(HelpAction paramHelpAction, MenuElement[] paramArrayOfMenuElement) {}
  
  public void run()
  {
    MenuElement[] arrayOfMenuElement = MenuSelectionManager.defaultManager().getSelectedPath();
    if (arrayOfMenuElement.length != val$path.length) {
      return;
    }
    for (int i = 0; i < arrayOfMenuElement.length; i++) {
      if (arrayOfMenuElement[i] != val$path[i]) {
        return;
      }
    }
    MenuSelectionManager.defaultManager().clearSelectedPath();
  }
}

/* Location:
 * Qualified Name:     org.netbeans.modules.javahelp.HelpAction.1
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.modules.javahelp;

import java.awt.AWTEvent;
import java.awt.GraphicsEnvironment;
import java.awt.Toolkit;
import java.awt.Window;
import java.awt.event.AWTEventListener;
import java.awt.event.WindowEvent;
import java.lang.ref.WeakReference;

class HelpAction$WindowActivatedDetector
  implements AWTEventListener
{
  private static WeakReference<Window> currentWindowRef;
  private static WindowActivatedDetector detector = null;
  
  static synchronized void install()
  {
    if ((detector == null) && (!GraphicsEnvironment.isHeadless()))
    {
      detector = new WindowActivatedDetector();
      Toolkit.getDefaultToolkit().addAWTEventListener(detector, 64L);
    }
  }
  
  static synchronized void uninstall()
  {
    if (detector != null)
    {
      Toolkit.getDefaultToolkit().removeAWTEventListener(detector);
      detector = null;
    }
  }
  
  static synchronized Window getCurrentActivatedWindow()
  {
    if (currentWindowRef != null) {
      return (Window)currentWindowRef.get();
    }
    return null;
  }
  
  private static synchronized void setCurrentActivatedWindow(Window paramWindow)
  {
    currentWindowRef = new WeakReference(paramWindow);
  }
  
  public void eventDispatched(AWTEvent paramAWTEvent)
  {
    if (paramAWTEvent.getID() != 205) {
      return;
    }
    setCurrentActivatedWindow(((WindowEvent)paramAWTEvent).getWindow());
  }
}

/* Location:
 * Qualified Name:     org.netbeans.modules.javahelp.HelpAction.WindowActivatedDetector
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.modules.javahelp;

import java.awt.AWTEvent;
import java.awt.Component;
import java.awt.GraphicsEnvironment;
import java.awt.Toolkit;
import java.awt.Window;
import java.awt.event.AWTEventListener;
import java.awt.event.ActionEvent;
import java.awt.event.WindowEvent;
import java.lang.ref.WeakReference;
import java.util.logging.Logger;
import javax.swing.MenuElement;
import javax.swing.MenuSelectionManager;
import javax.swing.SwingUtilities;
import javax.swing.plaf.basic.ComboPopup;
import org.netbeans.api.javahelp.Help;
import org.openide.awt.StatusDisplayer;
import org.openide.util.HelpCtx;
import org.openide.util.Lookup;
import org.openide.util.NbBundle;
import org.openide.util.actions.SystemAction;

public class HelpAction
  extends SystemAction
{
  private static final long serialVersionUID = 4658008202517094416L;
  
  public String getName()
  {
    return NbBundle.getMessage(HelpAction.class, "LBL_HelpAction");
  }
  
  public HelpCtx getHelpCtx()
  {
    return HelpCtx.DEFAULT_HELP;
  }
  
  protected String iconResource()
  {
    return "org/netbeans/modules/javahelp/resources/show-help.gif";
  }
  
  protected void initialize()
  {
    super.initialize();
    Installer.log.fine("HelpAction.initialize");
    
    putProperty("OpenIDE-Transmodal-Action", Boolean.TRUE);
  }
  
  static class WindowActivatedDetector
    implements AWTEventListener
  {
    private static WeakReference<Window> currentWindowRef;
    private static WindowActivatedDetector detector = null;
    
    static synchronized void install()
    {
      if ((detector == null) && (!GraphicsEnvironment.isHeadless()))
      {
        detector = new WindowActivatedDetector();
        Toolkit.getDefaultToolkit().addAWTEventListener(detector, 64L);
      }
    }
    
    static synchronized void uninstall()
    {
      if (detector != null)
      {
        Toolkit.getDefaultToolkit().removeAWTEventListener(detector);
        detector = null;
      }
    }
    
    static synchronized Window getCurrentActivatedWindow()
    {
      if (currentWindowRef != null) {
        return (Window)currentWindowRef.get();
      }
      return null;
    }
    
    private static synchronized void setCurrentActivatedWindow(Window paramWindow)
    {
      currentWindowRef = new WeakReference(paramWindow);
    }
    
    public void eventDispatched(AWTEvent paramAWTEvent)
    {
      if (paramAWTEvent.getID() != 205) {
        return;
      }
      setCurrentActivatedWindow(((WindowEvent)paramAWTEvent).getWindow());
    }
  }
  
  private static HelpCtx findHelpCtx()
  {
    Window localWindow = WindowActivatedDetector.getCurrentActivatedWindow();
    Component localComponent = localWindow != null ? SwingUtilities.findFocusOwner(localWindow) : null;
    HelpCtx localHelpCtx = localComponent == null ? HelpCtx.DEFAULT_HELP : HelpCtx.findHelp(localComponent);
    
    Installer.log.fine("HelpCtx " + localHelpCtx + " from " + localComponent);
    return localHelpCtx;
  }
  
  public void actionPerformed(ActionEvent paramActionEvent)
  {
    Help localHelp = (Help)Lookup.getDefault().lookup(Help.class);
    if (localHelp == null)
    {
      Toolkit.getDefaultToolkit().beep();
      return;
    }
    final MenuElement[] arrayOfMenuElement = MenuSelectionManager.defaultManager().getSelectedPath();
    HelpCtx localHelpCtx;
    if ((arrayOfMenuElement != null) && (arrayOfMenuElement.length > 0) && (!(arrayOfMenuElement[0].getComponent() instanceof ComboPopup)))
    {
      localHelpCtx = HelpCtx.findHelp(arrayOfMenuElement[(arrayOfMenuElement.length - 1)].getComponent());
      
      SwingUtilities.invokeLater(new Runnable()
      {
        public void run()
        {
          MenuElement[] arrayOfMenuElement = MenuSelectionManager.defaultManager().getSelectedPath();
          if (arrayOfMenuElement.length != arrayOfMenuElement.length) {
            return;
          }
          for (int i = 0; i < arrayOfMenuElement.length; i++) {
            if (arrayOfMenuElement[i] != arrayOfMenuElement[i]) {
              return;
            }
          }
          MenuSelectionManager.defaultManager().clearSelectedPath();
        }
      });
    }
    else
    {
      localHelpCtx = findHelpCtx();
    }
    StatusDisplayer.getDefault().setStatusText(NbBundle.getMessage(HelpAction.class, "CTL_OpeningHelp"));
    localHelp.showHelp(localHelpCtx);
  }
}

/* Location:
 * Qualified Name:     org.netbeans.modules.javahelp.HelpAction
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.modules.javahelp;

public abstract interface HelpConstants
{
  public static final String PUBLIC_ID_HELPSET = "-//Sun Microsystems Inc.//DTD JavaHelp HelpSet Version 1.0//EN";
  public static final String PUBLIC_ID_HELPSETREF = "-//NetBeans//DTD JavaHelp Help Set Reference 1.0//EN";
  public static final String PUBLIC_URL_HELPSETREF = "http://www.netbeans.org/dtds/helpsetref-1_0.dtd";
  public static final String PUBLIC_ID_HELPCTX = "-//NetBeans//DTD Help Context 1.0//EN";
  public static final String PUBLIC_URL_HELPCTX = "http://www.netbeans.org/dtds/helpcontext-1_0.dtd";
  public static final String HELPSET_MERGE_CONTEXT = "OpenIDE";
  public static final String HELPSET_MERGE_ATTR = "mergeIntoMaster";
  public static final String MASTER_ID = "org.netbeans.api.javahelp.MASTER_ID";
}

/* Location:
 * Qualified Name:     org.netbeans.modules.javahelp.HelpConstants
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.modules.javahelp;

import java.io.ByteArrayInputStream;
import org.xml.sax.EntityResolver;
import org.xml.sax.InputSource;

class HelpCtxProcessor$1
  implements EntityResolver
{
  HelpCtxProcessor$1(HelpCtxProcessor paramHelpCtxProcessor) {}
  
  public InputSource resolveEntity(String paramString1, String paramString2)
  {
    return new InputSource(new ByteArrayInputStream(new byte[0]));
  }
}

/* Location:
 * Qualified Name:     org.netbeans.modules.javahelp.HelpCtxProcessor.1
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.modules.javahelp;

import org.xml.sax.AttributeList;
import org.xml.sax.HandlerBase;
import org.xml.sax.SAXException;

class HelpCtxProcessor$2
  extends HandlerBase
{
  HelpCtxProcessor$2(HelpCtxProcessor paramHelpCtxProcessor) {}
  
  public void startElement(String paramString, AttributeList paramAttributeList)
    throws SAXException
  {
    if ("helpctx".equals(paramString))
    {
      String str1 = paramAttributeList.getValue("id");
      String str2 = paramAttributeList.getValue("showmaster");
      if ((str1 != null) && (!"".equals(str1))) {
        HelpCtxProcessor.access$002(this$0, new HelpCtxProcessor.ShortcutAction(HelpCtxProcessor.access$100(this$0), str1, Boolean.valueOf(str2).booleanValue()));
      }
    }
  }
}

/* Location:
 * Qualified Name:     org.netbeans.modules.javahelp.HelpCtxProcessor.2
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.modules.javahelp;

import java.awt.Image;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.beans.PropertyChangeEvent;
import java.util.logging.Logger;
import javax.swing.AbstractAction;
import javax.swing.ImageIcon;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import org.netbeans.api.javahelp.Help;
import org.openide.loaders.XMLDataObject;
import org.openide.nodes.Node;
import org.openide.nodes.NodeEvent;
import org.openide.nodes.NodeListener;
import org.openide.nodes.NodeMemberEvent;
import org.openide.nodes.NodeOp;
import org.openide.nodes.NodeReorderEvent;
import org.openide.util.HelpCtx;
import org.openide.util.HelpCtx.Provider;
import org.openide.util.WeakListeners;

final class HelpCtxProcessor$ShortcutAction
  extends AbstractAction
  implements HelpCtx.Provider, NodeListener, ChangeListener
{
  private final XMLDataObject obj;
  private String helpID;
  private boolean showmaster;
  
  public HelpCtxProcessor$ShortcutAction(XMLDataObject paramXMLDataObject, String paramString, boolean paramBoolean)
  {
    obj = paramXMLDataObject;
    helpID = paramString;
    showmaster = paramBoolean;
    putValue("noIconInMenu", Boolean.TRUE);
    Installer.log.fine("new ShortcutAction: " + paramXMLDataObject + " " + paramString + " showmaster=" + paramBoolean);
    updateText();
    updateIcon();
    updateEnabled();
    if (paramXMLDataObject.isValid())
    {
      localObject = paramXMLDataObject.getNodeDelegate();
      ((Node)localObject).addNodeListener(NodeOp.weakNodeListener(this, localObject));
    }
    Object localObject = HelpCtxProcessor.access$200();
    if (localObject != null) {
      ((Help)localObject).addChangeListener(WeakListeners.change(this, localObject));
    }
  }
  
  public void actionPerformed(ActionEvent paramActionEvent)
  {
    Help localHelp = HelpCtxProcessor.access$200();
    if (localHelp != null)
    {
      Installer.log.fine("ShortcutAction.actionPerformed: " + helpID + " showmaster=" + showmaster);
      localHelp.showHelp(new HelpCtx(helpID), showmaster);
    }
    else
    {
      Toolkit.getDefaultToolkit().beep();
    }
  }
  
  public HelpCtx getHelpCtx()
  {
    return new HelpCtx("ide.welcome");
  }
  
  public void stateChanged(ChangeEvent paramChangeEvent)
  {
    updateEnabled();
  }
  
  public void propertyChange(PropertyChangeEvent paramPropertyChangeEvent)
  {
    String str = paramPropertyChangeEvent.getPropertyName();
    if (!obj.isValid()) {
      return;
    }
    if ((str == null) || (str.equals("name")) || (str.equals("displayName"))) {
      updateText();
    }
    if ((str == null) || (str.equals("icon"))) {
      updateIcon();
    }
  }
  
  private void updateText()
  {
    String str;
    if (obj.isValid()) {
      str = obj.getNodeDelegate().getDisplayName();
    } else {
      str = "dead";
    }
    putValue("Name", str);
  }
  
  private void updateIcon()
  {
    if (obj.isValid())
    {
      Image localImage = obj.getNodeDelegate().getIcon(1);
      if (localImage != null) {
        putValue("SmallIcon", new ImageIcon(localImage));
      }
    }
  }
  
  private void updateEnabled()
  {
    Help localHelp = HelpCtxProcessor.access$200();
    Boolean localBoolean = localHelp == null ? Boolean.FALSE : localHelp.isValidID(helpID, false);
    if (localBoolean != null) {
      setEnabled(localBoolean.booleanValue());
    }
    Installer.log.fine("enabled: xml=" + obj.getPrimaryFile() + " id=" + helpID + " enabled=" + localBoolean);
  }
  
  public void nodeDestroyed(NodeEvent paramNodeEvent)
  {
    setEnabled(false);
    updateText();
  }
  
  public void childrenAdded(NodeMemberEvent paramNodeMemberEvent) {}
  
  public void childrenRemoved(NodeMemberEvent paramNodeMemberEvent) {}
  
  public void childrenReordered(NodeReorderEvent paramNodeReorderEvent) {}
}

/* Location:
 * Qualified Name:     org.netbeans.modules.javahelp.HelpCtxProcessor.ShortcutAction
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.modules.javahelp;

import java.awt.Image;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.beans.PropertyChangeEvent;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.util.logging.Logger;
import javax.swing.AbstractAction;
import javax.swing.Action;
import javax.swing.ImageIcon;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import org.netbeans.api.javahelp.Help;
import org.openide.cookies.InstanceCookie.Of;
import org.openide.filesystems.FileObject;
import org.openide.loaders.XMLDataObject;
import org.openide.loaders.XMLDataObject.Processor;
import org.openide.nodes.Node;
import org.openide.nodes.NodeEvent;
import org.openide.nodes.NodeListener;
import org.openide.nodes.NodeMemberEvent;
import org.openide.nodes.NodeOp;
import org.openide.nodes.NodeReorderEvent;
import org.openide.util.HelpCtx;
import org.openide.util.HelpCtx.Provider;
import org.openide.util.Lookup;
import org.openide.util.WeakListeners;
import org.xml.sax.AttributeList;
import org.xml.sax.EntityResolver;
import org.xml.sax.HandlerBase;
import org.xml.sax.InputSource;
import org.xml.sax.Parser;
import org.xml.sax.SAXException;

public final class HelpCtxProcessor
  implements XMLDataObject.Processor, InstanceCookie.Of
{
  private XMLDataObject xml;
  private Action p;
  
  private static Help findHelp()
  {
    return (Help)Lookup.getDefault().lookup(Help.class);
  }
  
  public void attachTo(XMLDataObject paramXMLDataObject)
  {
    xml = paramXMLDataObject;
    Installer.log.fine("processing help context ref: " + paramXMLDataObject.getPrimaryFile());
  }
  
  public Class instanceClass()
    throws IOException, ClassNotFoundException
  {
    return ShortcutAction.class;
  }
  
  public String instanceName()
  {
    return "org.netbeans.modules.javahelp.HelpCtxProcessor$ShortcutAction";
  }
  
  public boolean instanceOf(Class paramClass)
  {
    return paramClass == Action.class;
  }
  
  public Object instanceCreate()
    throws IOException, ClassNotFoundException
  {
    if (p != null) {
      return p;
    }
    Installer.log.fine("creating help context presenter from " + xml.getPrimaryFile());
    
    EntityResolver local1 = new EntityResolver()
    {
      public InputSource resolveEntity(String paramAnonymousString1, String paramAnonymousString2)
      {
        return new InputSource(new ByteArrayInputStream(new byte[0]));
      }
    };
    HandlerBase local2 = new HandlerBase()
    {
      public void startElement(String paramAnonymousString, AttributeList paramAnonymousAttributeList)
        throws SAXException
      {
        if ("helpctx".equals(paramAnonymousString))
        {
          String str1 = paramAnonymousAttributeList.getValue("id");
          String str2 = paramAnonymousAttributeList.getValue("showmaster");
          if ((str1 != null) && (!"".equals(str1))) {
            p = new HelpCtxProcessor.ShortcutAction(xml, str1, Boolean.valueOf(str2).booleanValue());
          }
        }
      }
    };
    Parser localParser = XMLDataObject.createParser();
    localParser.setEntityResolver(local1);
    localParser.setDocumentHandler(local2);
    try
    {
      localParser.parse(new InputSource(xml.getPrimaryFile().getInputStream()));
    }
    catch (SAXException localSAXException)
    {
      throw ((IOException)new IOException(localSAXException.toString()).initCause(localSAXException));
    }
    if (p == null) {
      throw new IOException("No <helpctx> element in " + xml.getPrimaryFile());
    }
    return p;
  }
  
  private static final class ShortcutAction
    extends AbstractAction
    implements HelpCtx.Provider, NodeListener, ChangeListener
  {
    private final XMLDataObject obj;
    private String helpID;
    private boolean showmaster;
    
    public ShortcutAction(XMLDataObject paramXMLDataObject, String paramString, boolean paramBoolean)
    {
      obj = paramXMLDataObject;
      helpID = paramString;
      showmaster = paramBoolean;
      putValue("noIconInMenu", Boolean.TRUE);
      Installer.log.fine("new ShortcutAction: " + paramXMLDataObject + " " + paramString + " showmaster=" + paramBoolean);
      updateText();
      updateIcon();
      updateEnabled();
      if (paramXMLDataObject.isValid())
      {
        localObject = paramXMLDataObject.getNodeDelegate();
        ((Node)localObject).addNodeListener(NodeOp.weakNodeListener(this, localObject));
      }
      Object localObject = HelpCtxProcessor.access$200();
      if (localObject != null) {
        ((Help)localObject).addChangeListener(WeakListeners.change(this, localObject));
      }
    }
    
    public void actionPerformed(ActionEvent paramActionEvent)
    {
      Help localHelp = HelpCtxProcessor.access$200();
      if (localHelp != null)
      {
        Installer.log.fine("ShortcutAction.actionPerformed: " + helpID + " showmaster=" + showmaster);
        localHelp.showHelp(new HelpCtx(helpID), showmaster);
      }
      else
      {
        Toolkit.getDefaultToolkit().beep();
      }
    }
    
    public HelpCtx getHelpCtx()
    {
      return new HelpCtx("ide.welcome");
    }
    
    public void stateChanged(ChangeEvent paramChangeEvent)
    {
      updateEnabled();
    }
    
    public void propertyChange(PropertyChangeEvent paramPropertyChangeEvent)
    {
      String str = paramPropertyChangeEvent.getPropertyName();
      if (!obj.isValid()) {
        return;
      }
      if ((str == null) || (str.equals("name")) || (str.equals("displayName"))) {
        updateText();
      }
      if ((str == null) || (str.equals("icon"))) {
        updateIcon();
      }
    }
    
    private void updateText()
    {
      String str;
      if (obj.isValid()) {
        str = obj.getNodeDelegate().getDisplayName();
      } else {
        str = "dead";
      }
      putValue("Name", str);
    }
    
    private void updateIcon()
    {
      if (obj.isValid())
      {
        Image localImage = obj.getNodeDelegate().getIcon(1);
        if (localImage != null) {
          putValue("SmallIcon", new ImageIcon(localImage));
        }
      }
    }
    
    private void updateEnabled()
    {
      Help localHelp = HelpCtxProcessor.access$200();
      Boolean localBoolean = localHelp == null ? Boolean.FALSE : localHelp.isValidID(helpID, false);
      if (localBoolean != null) {
        setEnabled(localBoolean.booleanValue());
      }
      Installer.log.fine("enabled: xml=" + obj.getPrimaryFile() + " id=" + helpID + " enabled=" + localBoolean);
    }
    
    public void nodeDestroyed(NodeEvent paramNodeEvent)
    {
      setEnabled(false);
      updateText();
    }
    
    public void childrenAdded(NodeMemberEvent paramNodeMemberEvent) {}
    
    public void childrenRemoved(NodeMemberEvent paramNodeMemberEvent) {}
    
    public void childrenReordered(NodeReorderEvent paramNodeReorderEvent) {}
  }
}

/* Location:
 * Qualified Name:     org.netbeans.mod
1 2 3

Further reading...

For more information on Java 1.5 Tiger, you may find Java 1.5 Tiger, A developer's Notebook by D. Flanagan and B. McLaughlin from O'Reilly of interest.

New!JAR listings


Copyright 2006-2017. Infinite Loop Ltd