org-netbeans-modules-applemenu

16:39:48.964 INFO  jd.cli.Main - Decompiling org-netbeans-modules-applemenu.jar
package org.netbeans.modules.applemenu;

class ApplePopupFactory$1 {}

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

import java.awt.Color;
import java.awt.Component;
import java.awt.Container;
import java.awt.Point;
import javax.swing.JWindow;

class ApplePopupFactory$HWPopup
  extends ApplePopupFactory.OurPopup
{
  private JWindow window = null;
  
  public ApplePopupFactory$HWPopup(Component paramComponent1, Component paramComponent2, int paramInt1, int paramInt2)
  {
    super(paramComponent1, paramComponent2, paramInt1, paramInt2);
  }
  
  public boolean isShowing()
  {
    return (window != null) && (window.isShowing());
  }
  
  void dispose()
  {
    if (window != null)
    {
      ApplePopupFactory.access$100(window);
      window = null;
    }
    super.dispose();
  }
  
  protected void prepareResources()
  {
    window = ApplePopupFactory.access$200();
    window.getContentPane().add(contents);
    window.setLocation(new Point(x, y));
    window.pack();
    window.setBackground(new Color(255, 255, 255, 0));
  }
  
  protected void doShow()
  {
    window.setVisible(true);
  }
  
  protected void doHide()
  {
    if (window != null)
    {
      window.setVisible(false);
      window.getContentPane().remove(contents);
      
      dispose();
    }
  }
}

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

import java.awt.peer.ComponentPeer;
import java.lang.reflect.Method;
import javax.swing.JWindow;
import org.openide.ErrorManager;

final class ApplePopupFactory$HackedJWindow
  extends JWindow
{
  private String title = "none";
  
  public void addNotify()
  {
    super.addNotify();
    hackTitle();
    hackNativeWindow();
  }
  
  private void hackTitle()
  {
    if (!ApplePopupFactory.access$300()) {
      try
      {
        ComponentPeer localComponentPeer = getPeer();
        if (localComponentPeer != null)
        {
          Method localMethod = localComponentPeer.getClass().getDeclaredMethod("setTitle", new Class[] { String.class });
          
          localMethod.setAccessible(true);
          title = ("hw popup" + ApplePopupFactory.access$408());
          localMethod.invoke(localComponentPeer, new Object[] { title });
        }
      }
      catch (Exception localException)
      {
        warn(localException);
      }
    }
  }
  
  private void hackNativeWindow()
  {
    if (!ApplePopupFactory.access$300()) {
      try
      {
        Class localClass = Class.forName("com.apple.cocoa.application.NSApplication");
        
        Method localMethod1 = localClass.getDeclaredMethod("sharedApplication", new Class[0]);
        Object localObject1 = localMethod1.invoke(null, new Object[0]);
        
        localMethod1 = localObject1.getClass().getMethod("windows", new Class[0]);
        Object localObject2 = localMethod1.invoke(localObject1, new Object[0]);
        
        localMethod1 = localObject2.getClass().getMethod("count", new Class[0]);
        int i = ((Integer)localMethod1.invoke(localObject2, new Object[0])).intValue();
        
        Object[] arrayOfObject = new Object[i];
        localMethod1 = localObject2.getClass().getMethod("getObjects", new Class[] { Object[].class });
        
        localMethod1.invoke(localObject2, new Object[] { arrayOfObject });
        if (arrayOfObject.length > 0)
        {
          localClass = arrayOfObject[0].getClass();
          Method localMethod2 = localClass.getMethod("title", new Class[0]);
          Method localMethod3 = localClass.getMethod("setHasShadow", new Class[] { Boolean.TYPE });
          for (int j = 0; j < arrayOfObject.length; j++)
          {
            String str = (String)localMethod2.invoke(arrayOfObject[j], new Object[0]);
            if (title.equals(str)) {
              localMethod3.invoke(arrayOfObject[j], new Object[] { Boolean.FALSE });
            }
          }
        }
      }
      catch (Exception localException)
      {
        warn(localException);
      }
    }
  }
  
  private void warn(Exception paramException)
  {
    ApplePopupFactory.access$302(true);
    if (!ApplePopupFactory.access$500())
    {
      ApplePopupFactory.access$502(true);
      ErrorManager.getDefault().log(1, "Cannot turn off popup drop shadow, reverting to standard swing popup factory");
      
      ErrorManager.getDefault().notify(1, paramException);
      paramException.printStackTrace();
    }
  }
}

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

import java.awt.Component;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.Point;
import java.awt.Rectangle;
import javax.swing.JComponent;
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JWindow;
import javax.swing.SwingUtilities;

class ApplePopupFactory$LWPopup
  extends ApplePopupFactory.OurPopup
{
  public ApplePopupFactory$LWPopup(Component paramComponent1, Component paramComponent2, int paramInt1, int paramInt2)
  {
    super(paramComponent1, paramComponent2, paramInt1, paramInt2);
  }
  
  private Rectangle bounds = null;
  
  protected void prepareResources()
  {
    JComponent localJComponent1 = (JComponent)owner;
    Container localContainer = localJComponent1.getTopLevelAncestor();
    JComponent localJComponent2 = null;
    if ((localContainer instanceof JFrame)) {
      localJComponent2 = (JComponent)((JFrame)localContainer).getGlassPane();
    } else if ((localContainer instanceof JDialog)) {
      localJComponent2 = (JComponent)((JDialog)localContainer).getGlassPane();
    } else if ((localContainer instanceof JWindow)) {
      localJComponent2 = (JComponent)((JWindow)localContainer).getGlassPane();
    }
    if (localContainer == null) {
      throw new IllegalArgumentException("Not a JFrame/JWindow/JDialog: " + owner);
    }
    Point localPoint = new Point(x, y);
    SwingUtilities.convertPointFromScreen(localPoint, localJComponent2);
    if (localJComponent2.getLayout() != null) {
      localJComponent2.setLayout(null);
    }
    localJComponent2.setVisible(true);
    contents.setVisible(false);
    Dimension localDimension = contents.getPreferredSize();
    localJComponent2.add(contents);
    bounds = new Rectangle(x, y, width, height);
    contents.setBounds(x, y, width, height);
  }
  
  protected void doShow()
  {
    contents.setVisible(true);
  }
  
  public boolean isShowing()
  {
    return (contents != null) && (contents.isShowing());
  }
  
  protected void doHide()
  {
    Container localContainer = contents.getParent();
    if (localContainer != null)
    {
      contents.getParent().remove(contents);
      localContainer.repaint(bounds.x, bounds.y, bounds.width, bounds.height);
    }
    contents.setVisible(true);
  }
}

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

import javax.swing.Popup;

final class ApplePopupFactory$NullPopup
  extends Popup
{
  public void show() {}
  
  public void hide() {}
}

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

import java.awt.Component;
import javax.swing.Popup;

abstract class ApplePopupFactory$OurPopup
  extends Popup
{
  protected Component owner = null;
  protected Component contents = null;
  protected int x = -1;
  protected int y = -1;
  
  public ApplePopupFactory$OurPopup(Component paramComponent1, Component paramComponent2, int paramInt1, int paramInt2)
  {
    configure(paramComponent1, paramComponent2, paramInt1, paramInt2);
  }
  
  final void configure(Component paramComponent1, Component paramComponent2, int paramInt1, int paramInt2)
  {
    owner = paramComponent1;
    contents = paramComponent2;
    x = paramInt1;
    y = paramInt2;
  }
  
  protected abstract void prepareResources();
  
  protected abstract void doShow();
  
  public abstract boolean isShowing();
  
  protected abstract void doHide();
  
  public final void show()
  {
    prepareResources();
    doShow();
  }
  
  public final void hide()
  {
    doHide();
  }
  
  void dispose()
  {
    owner = null;
    contents = null;
    x = -1;
    y = -1;
  }
  
  private boolean canReuse = false;
  
  public final void clear()
  {
    canReuse = true;
    dispose();
  }
  
  boolean isInUse()
  {
    return canReuse;
  }
}

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

import java.awt.Color;
import java.awt.Component;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.peer.ComponentPeer;
import java.lang.ref.Reference;
import java.lang.ref.SoftReference;
import java.lang.reflect.Method;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
import javax.swing.JComponent;
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JWindow;
import javax.swing.Popup;
import javax.swing.PopupFactory;
import javax.swing.SwingUtilities;
import org.openide.ErrorManager;

public class ApplePopupFactory
  extends PopupFactory
{
  private static final boolean APPLE_HEAVYWEIGHT = Boolean.getBoolean("nb.explorer.hw.completions");
  private static final boolean APPLE_COCOA_HACK = (APPLE_HEAVYWEIGHT) && (Boolean.getBoolean("nb.explorer.hw.cocoahack"));
  private static Set<Reference<JWindow>> windowPool = new HashSet();
  
  public Popup getPopup(Component paramComponent1, Component paramComponent2, int paramInt1, int paramInt2)
    throws IllegalArgumentException
  {
    assert ((paramComponent1 instanceof JComponent));
    Dimension localDimension = paramComponent2.getPreferredSize();
    Container localContainer = ((JComponent)paramComponent1).getTopLevelAncestor();
    if (localContainer == null) {
      throw new IllegalArgumentException("Not onscreen: " + paramComponent1);
    }
    Point localPoint = new Point(paramInt1, paramInt2);
    SwingUtilities.convertPointFromScreen(localPoint, localContainer);
    Rectangle localRectangle = new Rectangle(x, y, width, height);
    if (localContainer.getBounds().contains(localRectangle)) {
      return new LWPopup(paramComponent1, paramComponent2, paramInt1, paramInt2);
    }
    return APPLE_HEAVYWEIGHT ? new HWPopup(paramComponent1, paramComponent2, paramInt1, paramInt2) : new NullPopup(null);
  }
  
  private static final class NullPopup
    extends Popup
  {
    public void show() {}
    
    public void hide() {}
  }
  
  private static abstract class OurPopup
    extends Popup
  {
    protected Component owner = null;
    protected Component contents = null;
    protected int x = -1;
    protected int y = -1;
    
    public OurPopup(Component paramComponent1, Component paramComponent2, int paramInt1, int paramInt2)
    {
      configure(paramComponent1, paramComponent2, paramInt1, paramInt2);
    }
    
    final void configure(Component paramComponent1, Component paramComponent2, int paramInt1, int paramInt2)
    {
      owner = paramComponent1;
      contents = paramComponent2;
      x = paramInt1;
      y = paramInt2;
    }
    
    protected abstract void prepareResources();
    
    protected abstract void doShow();
    
    public abstract boolean isShowing();
    
    protected abstract void doHide();
    
    public final void show()
    {
      prepareResources();
      doShow();
    }
    
    public final void hide()
    {
      doHide();
    }
    
    void dispose()
    {
      owner = null;
      contents = null;
      x = -1;
      y = -1;
    }
    
    private boolean canReuse = false;
    
    public final void clear()
    {
      canReuse = true;
      dispose();
    }
    
    boolean isInUse()
    {
      return canReuse;
    }
  }
  
  private static class LWPopup
    extends ApplePopupFactory.OurPopup
  {
    public LWPopup(Component paramComponent1, Component paramComponent2, int paramInt1, int paramInt2)
    {
      super(paramComponent2, paramInt1, paramInt2);
    }
    
    private Rectangle bounds = null;
    
    protected void prepareResources()
    {
      JComponent localJComponent1 = (JComponent)owner;
      Container localContainer = localJComponent1.getTopLevelAncestor();
      JComponent localJComponent2 = null;
      if ((localContainer instanceof JFrame)) {
        localJComponent2 = (JComponent)((JFrame)localContainer).getGlassPane();
      } else if ((localContainer instanceof JDialog)) {
        localJComponent2 = (JComponent)((JDialog)localContainer).getGlassPane();
      } else if ((localContainer instanceof JWindow)) {
        localJComponent2 = (JComponent)((JWindow)localContainer).getGlassPane();
      }
      if (localContainer == null) {
        throw new IllegalArgumentException("Not a JFrame/JWindow/JDialog: " + owner);
      }
      Point localPoint = new Point(x, y);
      SwingUtilities.convertPointFromScreen(localPoint, localJComponent2);
      if (localJComponent2.getLayout() != null) {
        localJComponent2.setLayout(null);
      }
      localJComponent2.setVisible(true);
      contents.setVisible(false);
      Dimension localDimension = contents.getPreferredSize();
      localJComponent2.add(contents);
      bounds = new Rectangle(x, y, width, height);
      contents.setBounds(x, y, width, height);
    }
    
    protected void doShow()
    {
      contents.setVisible(true);
    }
    
    public boolean isShowing()
    {
      return (contents != null) && (contents.isShowing());
    }
    
    protected void doHide()
    {
      Container localContainer = contents.getParent();
      if (localContainer != null)
      {
        contents.getParent().remove(contents);
        localContainer.repaint(bounds.x, bounds.y, bounds.width, bounds.height);
      }
      contents.setVisible(true);
    }
  }
  
  private static class HWPopup
    extends ApplePopupFactory.OurPopup
  {
    private JWindow window = null;
    
    public HWPopup(Component paramComponent1, Component paramComponent2, int paramInt1, int paramInt2)
    {
      super(paramComponent2, paramInt1, paramInt2);
    }
    
    public boolean isShowing()
    {
      return (window != null) && (window.isShowing());
    }
    
    void dispose()
    {
      if (window != null)
      {
        ApplePopupFactory.checkInWindow(window);
        window = null;
      }
      super.dispose();
    }
    
    protected void prepareResources()
    {
      window = ApplePopupFactory.access$200();
      window.getContentPane().add(contents);
      window.setLocation(new Point(x, y));
      window.pack();
      window.setBackground(new Color(255, 255, 255, 0));
    }
    
    protected void doShow()
    {
      window.setVisible(true);
    }
    
    protected void doHide()
    {
      if (window != null)
      {
        window.setVisible(false);
        window.getContentPane().remove(contents);
        
        dispose();
      }
    }
  }
  
  private static JWindow checkOutWindow()
  {
    if ((windowPool != null) && 
      (!windowPool.isEmpty())) {
      for (localObject = windowPool.iterator(); ((Iterator)localObject).hasNext();)
      {
        Reference localReference = (Reference)((Iterator)localObject).next();
        JWindow localJWindow = (JWindow)localReference.get();
        ((Iterator)localObject).remove();
        if (localJWindow != null)
        {
          assert (!localJWindow.isShowing());
          localJWindow.setBounds(0, 0, 1, 1);
          localJWindow.getContentPane().removeAll();
          localJWindow.setBackground(new Color(255, 255, 255, 0));
          return localJWindow;
        }
      }
    }
    Object localObject = APPLE_COCOA_HACK ? new HackedJWindow() : new JWindow();
    
    ((JWindow)localObject).setBackground(new Color(255, 255, 255, 0));
    return (JWindow)localObject;
  }
  
  private static void checkInWindow(JWindow paramJWindow)
  {
    if (!APPLE_COCOA_HACK) {
      paramJWindow.dispose();
    }
    windowPool.add(new SoftReference(paramJWindow));
  }
  
  private static int ct = 0;
  private static boolean hackBroken = false;
  private static boolean warned = false;
  
  static boolean broken()
  {
    return hackBroken;
  }
  
  private static final class HackedJWindow
    extends JWindow
  {
    private String title = "none";
    
    public void addNotify()
    {
      super.addNotify();
      hackTitle();
      hackNativeWindow();
    }
    
    private void hackTitle()
    {
      if (!ApplePopupFactory.hackBroken) {
        try
        {
          ComponentPeer localComponentPeer = getPeer();
          if (localComponentPeer != null)
          {
            Method localMethod = localComponentPeer.getClass().getDeclaredMethod("setTitle", new Class[] { String.class });
            
            localMethod.setAccessible(true);
            title = ("hw popup" + ApplePopupFactory.access$408());
            localMethod.invoke(localComponentPeer, new Object[] { title });
          }
        }
        catch (Exception localException)
        {
          warn(localException);
        }
      }
    }
    
    private void hackNativeWindow()
    {
      if (!ApplePopupFactory.hackBroken) {
        try
        {
          Class localClass = Class.forName("com.apple.cocoa.application.NSApplication");
          
          Method localMethod1 = localClass.getDeclaredMethod("sharedApplication", new Class[0]);
          Object localObject1 = localMethod1.invoke(null, new Object[0]);
          
          localMethod1 = localObject1.getClass().getMethod("windows", new Class[0]);
          Object localObject2 = localMethod1.invoke(localObject1, new Object[0]);
          
          localMethod1 = localObject2.getClass().getMethod("count", new Class[0]);
          int i = ((Integer)localMethod1.invoke(localObject2, new Object[0])).intValue();
          
          Object[] arrayOfObject = new Object[i];
          localMethod1 = localObject2.getClass().getMethod("getObjects", new Class[] { Object[].class });
          
          localMethod1.invoke(localObject2, new Object[] { arrayOfObject });
          if (arrayOfObject.length > 0)
          {
            localClass = arrayOfObject[0].getClass();
            Method localMethod2 = localClass.getMethod("title", new Class[0]);
            Method localMethod3 = localClass.getMethod("setHasShadow", new Class[] { Boolean.TYPE });
            for (int j = 0; j < arrayOfObject.length; j++)
            {
              String str = (String)localMethod2.invoke(arrayOfObject[j], new Object[0]);
              if (title.equals(str)) {
                localMethod3.invoke(arrayOfObject[j], new Object[] { Boolean.FALSE });
              }
            }
          }
        }
        catch (Exception localException)
        {
          warn(localException);
        }
      }
    }
    
    private void warn(Exception paramException)
    {
      ApplePopupFactory.access$302(true);
      if (!ApplePopupFactory.warned)
      {
        ApplePopupFactory.access$502(true);
        ErrorManager.getDefault().log(1, "Cannot turn off popup drop shadow, reverting to standard swing popup factory");
        
        ErrorManager.getDefault().notify(1, paramException);
        paramException.printStackTrace();
      }
    }
  }
}

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

import java.awt.AWTEvent;
import java.awt.event.AWTEventListener;
import java.awt.event.FocusEvent;
import java.awt.event.InputEvent;
import java.awt.event.MouseEvent;
import java.lang.ref.Reference;
import java.lang.ref.WeakReference;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import javax.swing.text.Caret;
import javax.swing.text.JTextComponent;

public class CtrlClickHack
  implements AWTEventListener
{
  private Reference<JTextComponent> lastFocusedTextComponent = null;
  
  public void eventDispatched(AWTEvent paramAWTEvent)
  {
    if ((!(paramAWTEvent instanceof MouseEvent)) && (!(paramAWTEvent instanceof FocusEvent))) {
      return;
    }
    Object localObject2;
    Object localObject3;
    if ((paramAWTEvent instanceof FocusEvent))
    {
      localObject1 = (FocusEvent)paramAWTEvent;
      if (((FocusEvent)localObject1).getID() == 1004)
      {
        if ((((FocusEvent)localObject1).getOppositeComponent() instanceof JTextComponent))
        {
          localObject2 = (JTextComponent)((FocusEvent)localObject1).getOppositeComponent();
          if (null != localObject2)
          {
            localObject3 = ((JTextComponent)localObject2).getCaret();
            if (null != localObject3) {
              ((Caret)localObject3).setVisible(false);
            }
          }
        }
        else
        {
          localObject2 = lastFocusedTextComponent == null ? null : (JTextComponent)lastFocusedTextComponent.get();
          if (null != localObject2)
          {
            localObject3 = ((JTextComponent)localObject2).getCaret();
            if (null != localObject3) {
              ((Caret)localObject3).setVisible(false);
            }
          }
        }
        if ((((FocusEvent)localObject1).getComponent() instanceof JTextComponent))
        {
          localObject2 = (JTextComponent)((FocusEvent)localObject1).getComponent();
          lastFocusedTextComponent = new WeakReference(localObject2);
          if (null != localObject2)
          {
            localObject3 = ((JTextComponent)localObject2).getCaret();
            if (null != localObject3) {
              ((Caret)localObject3).setVisible(true);
            }
          }
        }
      }
      return;
    }
    Object localObject1 = (MouseEvent)paramAWTEvent;
    if (((MouseEvent)localObject1).getModifiers() != 18) {
      return;
    }
    try
    {
      localObject2 = InputEvent.class.getDeclaredField("modifiers");
      localObject3 = MouseEvent.class.getDeclaredField("button");
      Method localMethod = MouseEvent.class.getDeclaredMethod("setNewModifiers", new Class[0]);
      ((Field)localObject2).setAccessible(true);
      ((Field)localObject2).setInt(localObject1, 4);
      ((Field)localObject3).setAccessible(true);
      ((Field)localObject3).setInt(localObject1, 3);
      localMethod.setAccessible(true);
      localMethod.invoke(localObject1, new Object[0]);
    }
    catch (Exception localException)
    {
      localException.printStackTrace();
    }
  }
}

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

import java.awt.Font;
import java.lang.ref.Reference;
import java.lang.ref.ReferenceQueue;
import java.lang.reflect.Field;

class FontReferenceQueue
  extends ReferenceQueue
{
  public Reference poll()
  {
    Reference localReference;
    for (;;)
    {
      localReference = super.poll();
      if (localReference == null) {
        break;
      }
      Object localObject = localReference.get();
      if (!(localObject instanceof Font)) {
        break;
      }
    }
    return localReference;
  }
  
  public Reference remove(long paramLong)
    throws IllegalArgumentException, InterruptedException
  {
    Reference localReference;
    for (;;)
    {
      localReference = super.remove(paramLong);
      if (localReference == null) {
        break;
      }
      Object localObject = localReference.get();
      if (!(localObject instanceof Font)) {
        break;
      }
    }
    return localReference;
  }
  
  static void install()
  {
    try
    {
      Class localClass = Class.forName("java.lang.ref.Finalizer");
      Field localField = localClass.getDeclaredField("queue");
      localField.setAccessible(true);
      localField.set(null, new FontReferenceQueue());
    }
    catch (NoClassDefFoundError localNoClassDefFoundError) {}catch (ClassNotFoundException localClassNotFoundException) {}catch (Exception localException) {}
  }
}

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

import java.awt.Toolkit;
import java.lang.reflect.Method;
import org.openide.modules.ModuleInstall;

public class Install
  extends ModuleInstall
{
  private CtrlClickHack listener;
  
  public void restored()
  {
    listener = new CtrlClickHack();
    Toolkit.getDefaultToolkit().addAWTEventListener(listener, 20L);
    if (System.getProperty("mrj.version") != null)
    {
      try
      {
        Class localClass = Class.forName("org.netbeans.modules.applemenu.NbApplicationAdapter");
        Method localMethod = localClass.getDeclaredMethod("install", new Class[0]);
        localMethod.invoke(localClass, new Object[0]);
      }
      catch (NoClassDefFoundError localNoClassDefFoundError) {}catch (ClassNotFoundException localClassNotFoundException) {}catch (Exception localException) {}
      String str = "apple.laf.useScreenMenuBar";
      if (System.getProperty(str) == null) {
        System.setProperty(str, "true");
      }
    }
  }
  
  public void uninstalled()
  {
    if (listener != null)
    {
      Toolkit.getDefaultToolkit().removeAWTEventListener(listener);
      listener = null;
    }
    if (System.getProperty("mrj.version") != null) {
      try
      {
        Class localClass = Class.forName("org.netbeans.modules.applemenu.NbApplicationAdapter");
        Method localMethod = localClass.getDeclaredMethod("uninstall", new Class[0]);
        localMethod.invoke(localClass, new Object[0]);
      }
      catch (NoClassDefFoundError localNoClassDefFoundError) {}catch (ClassNotFoundException localClassNotFoundException) {}catch (Exception localException) {}
    }
  }
}

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

import java.awt.Frame;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import org.openide.windows.WindowManager;

public final class MinimizeWindowAction
  implements ActionListener
{
  public void actionPerformed(ActionEvent paramActionEvent)
  {
    WindowManager.getDefault().getMainWindow().setExtendedState(1);
  }
}

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

import com.apple.eawt.Application;
import com.apple.eawt.ApplicationEvent;
import com.apple.eawt.ApplicationListener;
import java.awt.event.ActionEvent;
import java.beans.Beans;
import java.io.File;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.Action;
import org.openide.ErrorManager;
import org.openide.cookies.EditCookie;
import org.openide.cookies.InstanceCookie;
import org.openide.cookies.OpenCookie;
import org.openide.cookies.ViewCookie;
import org.openide.filesystems.FileObject;
import org.openide.filesystems.FileUtil;
import org.openide.loaders.DataObject;
import org.openide.loaders.DataObjectNotFoundException;
import org.openide.util.Lookup;

class NbApplicationAdapter
  implements ApplicationListener
{
  private static final String OPTIONS_ACTION = "Actions/Window/org-netbeans-modules-options-OptionsWindowAction.instance";
  private static final String ABOUT_ACTION = "Actions/Help/org-netbeans-core-actions-AboutAction.instance";
  private static final String EXIT_ACTION = "Actions/System/org-netbeans-core-actions-SystemExit.instance";
  private static ApplicationListener al = null;
  
  static void install()
  {
    boolean bool = Beans.isDesignTime();
    try
    {
      Beans.setDesignTime(false);
      
      al = new NbApplicationAdapter();
      Application.getApplication().addApplicationListener(al);
      Application.getApplication().setEnabledAboutMenu(true);
      Application.getApplication().setEnabledPreferencesMenu(true);
    }
    finally
    {
      Beans.setDesignTime(bool);
    }
  }
  
  static void uninstall()
  {
    if (al != null)
    {
      Application.getApplication().removeApplicationListener(al);
      al = null;
    }
  }
  
  public void handleAbout(ApplicationEvent paramApplicationEvent)
  {
    paramApplicationEvent.setHandled(performAction("Actions/Help/org-netbeans-core-actions-AboutAction.instance"));
  }
  
  public void handleOpenApplication(ApplicationEvent paramApplicationEvent) {}
  
  public void handleOpenFile(ApplicationEvent paramApplicationEvent)
  {
    boolean bool = false;
    String str = paramApplicationEvent.getFilename();
    File localFile = new File(str);
    if ((localFile.exists()) && (!localFile.isDirectory()))
    {
      FileObject localFileObject = FileUtil.toFileObject(localFile);
      if (localFileObject != null) {
        try
        {
          DataObject localDataObject = DataObject.find(localFileObject);
          OpenCookie localOpenCookie = (OpenCookie)localDataObject.getLookup().lookup(OpenCookie.class);
          if ((bool = localOpenCookie != null ? 1 : 0) != 0)
          {
            localOpenCookie.open();
          }
          else
          {
            EditCookie localEditCookie = (EditCookie)localDataObject.getLookup().lookup(EditCookie.class);
            if ((bool = localEditCookie != null ? 1 : 0) != 0)
            {
              localEditCookie.edit();
            }
            else
            {
              ViewCookie localViewCookie = (ViewCookie)localDataObject.getLookup().lookup(ViewCookie.class);
              if ((bool = localViewCookie != null ? 1 : 0) != 0) {
                localViewCookie.view();
              }
            }
          }
        }
        catch (DataObjectNotFoundException localDataObjectNotFoundException)
        {
          Logger.getLogger(NbApplicationAdapter.class.getName()).log(Level.INFO, str, localDataObjectNotFoundException);
        }
      }
    }
    paramApplicationEvent.setHandled(bool);
  }
  
  public void handlePreferences(ApplicationEvent paramApplicationEvent)
  {
    paramApplicationEvent.setHandled(performAction("Actions/Window/org-netbeans-modules-options-OptionsWindowAction.instance"));
  }
  
  public void handlePrintFile(ApplicationEvent paramApplicationEvent) {}
  
  public void handleQuit(ApplicationEvent paramApplicationEvent)
  {
    paramApplicationEvent.setHandled(!performAction("Actions/System/org-netbeans-core-actions-SystemExit.instance"));
  }
  
  public void handleReOpenApplication(ApplicationEvent paramApplicationEvent) {}
  
  private boolean performAction(String paramString)
  {
    return performAction(paramString, null);
  }
  
  private boolean performAction(String paramString1, String paramString2)
  {
    Action localAction = findAction(paramString1);
    if (localAction == null) {
      return false;
    }
    if (paramString2 == null) {
      paramString2 = "foo";
    }
    ActionEvent localActionEvent = new ActionEvent(this, 1001, paramString2);
    try
    {
      localAction.actionPerformed(localActionEvent);
      return true;
    }
    catch (Exception localException)
    {
      ErrorManager.getDefault().notify(16, localException);
    }
    return false;
  }
  
  private Action findAction(String paramString)
  {
    FileObject localFileObject = FileUtil.getConfigFile(paramString);
    if ((localFileObject != null) && (localFileObject.isValid())) {
      try
      {
        DataObject localDataObject = DataObject.find(localFileObject);
        InstanceCookie localInstanceCookie = (InstanceCookie)localDataObject.getCookie(InstanceCookie.class);
        if (localInstanceCookie != null)
        {
          Object localObject = localInstanceCookie.instanceCreate();
          if ((localObject instanceof Action)) {
            return (Action)localObject;
          }
        }
      }
      catch (Exception localException)
      {
        ErrorManager.getDefault().notify(16, localException);
        return null;
      }
    }
    return null;
  }
}

/* Location:
 * Qualified Name:     org.netbeans.modules.applemenu.NbApplicationAdapter
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
1

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