org-openide-actions

16:40:24.574 INFO  jd.cli.Main - Decompiling org-openide-actions.jar
package org.netbeans.modules.openide.actions;

import java.awt.event.ActionEvent;
import javax.swing.Action;
import org.openide.actions.ActionManager;
import org.openide.util.actions.ActionInvoker;

public class ActionsBridgeImpl
  extends ActionInvoker
{
  protected void invokeAction(Action paramAction, ActionEvent paramActionEvent)
  {
    ActionManager.getDefault().invokeAction(paramAction, paramActionEvent);
  }
}

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

class ActionManager$1 {}

/* Location:
 * Qualified Name:     org.openide.actions.ActionManager.1
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.openide.actions;

import org.openide.util.actions.SystemAction;

final class ActionManager$Trivial
  extends ActionManager
{
  public SystemAction[] getContextActions()
  {
    return new SystemAction[0];
  }
}

/* Location:
 * Qualified Name:     org.openide.actions.ActionManager.Trivial
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.openide.actions;

import java.awt.event.ActionEvent;
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import javax.swing.Action;
import org.openide.util.Lookup;
import org.openide.util.actions.SystemAction;

public abstract class ActionManager
{
  public static final String PROP_CONTEXT_ACTIONS = "contextActions";
  private PropertyChangeSupport supp;
  
  public ActionManager()
  {
    supp = null;
  }
  
  public static ActionManager getDefault()
  {
    Object localObject = (ActionManager)Lookup.getDefault().lookup(ActionManager.class);
    if (localObject == null) {
      localObject = new Trivial(null);
    }
    return (ActionManager)localObject;
  }
  
  public abstract SystemAction[] getContextActions();
  
  @Deprecated
  public void invokeAction(Action paramAction, ActionEvent paramActionEvent)
  {
    paramAction.actionPerformed(paramActionEvent);
  }
  
  public final void addPropertyChangeListener(PropertyChangeListener paramPropertyChangeListener)
  {
    if (supp == null) {
      supp = new PropertyChangeSupport(this);
    }
    supp.addPropertyChangeListener(paramPropertyChangeListener);
  }
  
  public final void removePropertyChangeListener(PropertyChangeListener paramPropertyChangeListener)
  {
    if (supp != null) {
      supp.removePropertyChangeListener(paramPropertyChangeListener);
    }
  }
  
  protected final void firePropertyChange(String paramString, Object paramObject1, Object paramObject2)
  {
    if (supp != null) {
      supp.firePropertyChange(paramString, paramObject1, paramObject2);
    }
  }
  
  private static final class Trivial
    extends ActionManager
  {
    public SystemAction[] getContextActions()
    {
      return new SystemAction[0];
    }
  }
}

/* Location:
 * Qualified Name:     org.openide.actions.ActionManager
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.openide.actions;

import org.openide.util.HelpCtx;
import org.openide.util.NbBundle;
import org.openide.util.actions.CallbackSystemAction;

public class CloneViewAction
  extends CallbackSystemAction
{
  public Object getActionMapKey()
  {
    return "cloneWindow";
  }
  
  public String getName()
  {
    return NbBundle.getMessage(CloneViewAction.class, "CloneView");
  }
  
  public HelpCtx getHelpCtx()
  {
    return new HelpCtx(CloneViewAction.class);
  }
  
  protected String iconResource()
  {
    return "org/openide/resources/actions/clone.gif";
  }
  
  protected boolean asynchronous()
  {
    return false;
  }
}

/* Location:
 * Qualified Name:     org.openide.actions.CloneViewAction
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.openide.actions;

import org.openide.util.HelpCtx;
import org.openide.util.NbBundle;
import org.openide.util.actions.CallbackSystemAction;

public class CloseViewAction
  extends CallbackSystemAction
{
  public Object getActionMapKey()
  {
    return "closeWindow";
  }
  
  public HelpCtx getHelpCtx()
  {
    return new HelpCtx(CloseViewAction.class);
  }
  
  public String getName()
  {
    return NbBundle.getMessage(CloseViewAction.class, "CloseView");
  }
  
  protected boolean asynchronous()
  {
    return false;
  }
}

/* Location:
 * Qualified Name:     org.openide.actions.CloseViewAction
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.openide.actions;

import org.openide.util.HelpCtx;
import org.openide.util.NbBundle;
import org.openide.util.actions.CallbackSystemAction;

public class CopyAction
  extends CallbackSystemAction
{
  protected void initialize()
  {
    super.initialize();
  }
  
  public Object getActionMapKey()
  {
    return "copy-to-clipboard";
  }
  
  public String getName()
  {
    return NbBundle.getMessage(CopyAction.class, "Copy");
  }
  
  public HelpCtx getHelpCtx()
  {
    return new HelpCtx(CopyAction.class);
  }
  
  protected String iconResource()
  {
    return "org/openide/resources/actions/copy.gif";
  }
  
  protected boolean asynchronous()
  {
    return false;
  }
}

/* Location:
 * Qualified Name:     org.openide.actions.CopyAction
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.openide.actions;

import org.openide.nodes.Node;
import org.openide.nodes.NodeOperation;
import org.openide.util.HelpCtx;
import org.openide.util.NbBundle;
import org.openide.util.actions.NodeAction;

public class CustomizeAction
  extends NodeAction
{
  protected void performAction(Node[] paramArrayOfNode)
  {
    NodeOperation.getDefault().customize(paramArrayOfNode[0]);
  }
  
  protected boolean asynchronous()
  {
    return false;
  }
  
  protected boolean enable(Node[] paramArrayOfNode)
  {
    if ((paramArrayOfNode == null) || (paramArrayOfNode.length != 1)) {
      return false;
    }
    return paramArrayOfNode[0].hasCustomizer();
  }
  
  public String getName()
  {
    return NbBundle.getMessage(CustomizeAction.class, "Customize");
  }
  
  public HelpCtx getHelpCtx()
  {
    return new HelpCtx(CustomizeAction.class);
  }
}

/* Location:
 * Qualified Name:     org.openide.actions.CustomizeAction
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.openide.actions;

import org.openide.util.HelpCtx;
import org.openide.util.NbBundle;
import org.openide.util.actions.CallbackSystemAction;

public class CutAction
  extends CallbackSystemAction
{
  protected void initialize()
  {
    super.initialize();
  }
  
  public Object getActionMapKey()
  {
    return "cut-to-clipboard";
  }
  
  public String getName()
  {
    return NbBundle.getMessage(CutAction.class, "Cut");
  }
  
  public HelpCtx getHelpCtx()
  {
    return new HelpCtx(CutAction.class);
  }
  
  protected String iconResource()
  {
    return "org/openide/resources/actions/cut.gif";
  }
  
  protected boolean asynchronous()
  {
    return false;
  }
}

/* Location:
 * Qualified Name:     org.openide.actions.CutAction
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.openide.actions;

import org.openide.util.HelpCtx;
import org.openide.util.NbBundle;
import org.openide.util.actions.CallbackSystemAction;

public class DeleteAction
  extends CallbackSystemAction
{
  public DeleteAction()
  {
    putValue("noIconInMenu", Boolean.TRUE);
  }
  
  protected void initialize()
  {
    super.initialize();
  }
  
  public Object getActionMapKey()
  {
    return "delete";
  }
  
  public String getName()
  {
    return NbBundle.getMessage(DeleteAction.class, "Delete");
  }
  
  public HelpCtx getHelpCtx()
  {
    return new HelpCtx(DeleteAction.class);
  }
  
  protected String iconResource()
  {
    return "org/openide/resources/actions/delete.gif";
  }
  
  protected boolean asynchronous()
  {
    return true;
  }
}

/* Location:
 * Qualified Name:     org.openide.actions.DeleteAction
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.openide.actions;

import java.util.ResourceBundle;
import org.openide.cookies.EditCookie;
import org.openide.nodes.Node;
import org.openide.util.HelpCtx;
import org.openide.util.NbBundle;
import org.openide.util.actions.CookieAction;

public class EditAction
  extends CookieAction
{
  protected boolean surviveFocusChange()
  {
    return false;
  }
  
  public String getName()
  {
    return NbBundle.getBundle(EditAction.class).getString("Edit");
  }
  
  public HelpCtx getHelpCtx()
  {
    return new HelpCtx(EditAction.class);
  }
  
  protected int mode()
  {
    return 4;
  }
  
  protected Class[] cookieClasses()
  {
    return new Class[] { EditCookie.class };
  }
  
  protected void performAction(Node[] paramArrayOfNode)
  {
    for (int i = 0; i < paramArrayOfNode.length; i++)
    {
      EditCookie localEditCookie = (EditCookie)paramArrayOfNode[i].getCookie(EditCookie.class);
      if (localEditCookie != null) {
        localEditCookie.edit();
      }
    }
  }
  
  protected boolean asynchronous()
  {
    return false;
  }
}

/* Location:
 * Qualified Name:     org.openide.actions.EditAction
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.openide.actions;

import org.openide.util.HelpCtx;
import org.openide.util.NbBundle;
import org.openide.util.actions.CallbackSystemAction;

public class FindAction
  extends CallbackSystemAction
{
  public String getName()
  {
    return NbBundle.getMessage(FindAction.class, "Find");
  }
  
  public HelpCtx getHelpCtx()
  {
    return new HelpCtx(FindAction.class);
  }
  
  protected String iconResource()
  {
    return null;
  }
  
  protected boolean asynchronous()
  {
    return false;
  }
}

/* Location:
 * Qualified Name:     org.openide.actions.FindAction
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.openide.actions;

final class GarbageCollectAction$1
  implements Runnable
{
  public void run()
  {
    System.gc();
    System.runFinalization();
    System.gc();
  }
}

/* Location:
 * Qualified Name:     org.openide.actions.GarbageCollectAction.1
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.openide.actions;

import java.awt.Container;
import java.awt.Dimension;
import javax.swing.JComponent;

final class GarbageCollectAction$HeapViewWrapper
  extends JComponent
{
  public GarbageCollectAction$HeapViewWrapper()
  {
    add(new HeapView());
    setLayout(null);
  }
  
  public boolean isOpaque()
  {
    return false;
  }
  
  public Dimension getMinimumSize()
  {
    return calcPreferredSize();
  }
  
  public Dimension getPreferredSize()
  {
    return calcPreferredSize();
  }
  
  public Dimension getMaximumSize()
  {
    Dimension localDimension = calcPreferredSize();
    Container localContainer = getParent();
    if ((localContainer != null) && (localContainer.getHeight() > 0)) {
      height = localContainer.getHeight();
    }
    return localDimension;
  }
  
  public Dimension calcPreferredSize()
  {
    Dimension localDimension = getHeapView().heapViewPreferredSize();
    height += 1;
    width += 6;
    return localDimension;
  }
  
  public void layout()
  {
    int i = getWidth();
    int j = getHeight();
    HeapView localHeapView = getHeapView();
    localHeapView.setBounds(4, 2, i - 6, j - 4);
  }
  
  private HeapView getHeapView()
  {
    return (HeapView)getComponent(0);
  }
}

/* Location:
 * Qualified Name:     org.openide.actions.GarbageCollectAction.HeapViewWrapper
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.openide.actions;

import java.awt.Component;
import java.awt.Container;
import java.awt.Dimension;
import java.util.ResourceBundle;
import javax.swing.JComponent;
import org.openide.util.HelpCtx;
import org.openide.util.NbBundle;
import org.openide.util.RequestProcessor;
import org.openide.util.actions.CallableSystemAction;

public class GarbageCollectAction
  extends CallableSystemAction
{
  private static RequestProcessor RP;
  
  public String getName()
  {
    return NbBundle.getBundle(GarbageCollectAction.class).getString("CTL_GarbageCollect");
  }
  
  public HelpCtx getHelpCtx()
  {
    return new HelpCtx(GarbageCollectAction.class);
  }
  
  public void performAction() {}
  
  private static void gc()
  {
    if (RP == null) {
      RP = new RequestProcessor("GarbageCollectAction");
    }
    RP.post(new Runnable()
    {
      public void run()
      {
        System.gc();
        System.runFinalization();
        System.gc();
      }
    });
  }
  
  protected boolean asynchronous()
  {
    return false;
  }
  
  public Component getToolbarPresenter()
  {
    return new HeapViewWrapper();
  }
  
  private static final class HeapViewWrapper
    extends JComponent
  {
    public HeapViewWrapper()
    {
      add(new HeapView());
      setLayout(null);
    }
    
    public boolean isOpaque()
    {
      return false;
    }
    
    public Dimension getMinimumSize()
    {
      return calcPreferredSize();
    }
    
    public Dimension getPreferredSize()
    {
      return calcPreferredSize();
    }
    
    public Dimension getMaximumSize()
    {
      Dimension localDimension = calcPreferredSize();
      Container localContainer = getParent();
      if ((localContainer != null) && (localContainer.getHeight() > 0)) {
        height = localContainer.getHeight();
      }
      return localDimension;
    }
    
    public Dimension calcPreferredSize()
    {
      Dimension localDimension = getHeapView().heapViewPreferredSize();
      height += 1;
      width += 6;
      return localDimension;
    }
    
    public void layout()
    {
      int i = getWidth();
      int j = getHeight();
      HeapView localHeapView = getHeapView();
      localHeapView.setBounds(4, 2, i - 6, j - 4);
    }
    
    private HeapView getHeapView()
    {
      return (HeapView)getComponent(0);
    }
  }
}

/* Location:
 * Qualified Name:     org.openide.actions.GarbageCollectAction
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.openide.actions;

import org.openide.util.HelpCtx;
import org.openide.util.NbBundle;
import org.openide.util.actions.CallbackSystemAction;

public class GotoAction
  extends CallbackSystemAction
{
  public GotoAction()
  {
    putProperty("noIconInMenu", Boolean.TRUE);
  }
  
  public String getName()
  {
    return NbBundle.getMessage(GotoAction.class, "Goto");
  }
  
  public HelpCtx getHelpCtx()
  {
    return new HelpCtx(GotoAction.class);
  }
  
  protected boolean asynchronous()
  {
    return false;
  }
}

/* Location:
 * Qualified Name:     org.openide.actions.GotoAction
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.openide.actions;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JCheckBoxMenuItem;

class HeapView$1
  implements ActionListener
{
  HeapView$1(HeapView paramHeapView) {}
  
  public void actionPerformed(ActionEvent paramActionEvent)
  {
    this$0.setShowText(((JCheckBoxMenuItem)paramActionEvent.getSource()).isSelected());
  }
}

/* Location:
 * Qualified Name:     org.openide.actions.HeapView.1
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.openide.actions;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JCheckBoxMenuItem;

class HeapView$2
  implements ActionListener
{
  HeapView$2(HeapView paramHeapView) {}
  
  public void actionPerformed(ActionEvent paramActionEvent)
  {
    this$0.setShowDropShadow(((JCheckBoxMenuItem)paramActionEvent.getSource()).isSelected());
  }
}

/* Location:
 * Qualified Name:     org.openide.actions.HeapView.2
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.openide.actions;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JCheckBoxMenuItem;

class HeapView$3
  implements ActionListener
{
  HeapView$3(HeapView paramHeapView) {}
  
  public void actionPerformed(ActionEvent paramActionEvent)
  {
    int i = ((JCheckBoxMenuItem)paramActionEvent.getSource()).isSelected() ? 1 : 0;
    
    this$0.setTickStyle(i);
  }
}

/* Location:
 * Qualified Name:     org.openide.actions.HeapView.3
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.openide.actions;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

final class HeapView$ActionHandler
  implements ActionListener
{
  private HeapView$ActionHandler(HeapView paramHeapView) {}
  
  public void actionPerformed(ActionEvent paramActionEvent)
  {
    HeapView.access$100(this$0);
  }
}

/* Location:
 * Qualified Name:     org.openide.actions.HeapView.ActionHandler
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.openide.actions;

import java.awt.Graphics2D;
import java.awt.event.ActionEvent;
import java.awt.image.BufferedImage;
import javax.swing.Timer;

final class HeapView$HeapGrowTimer
  extends Timer
{
  private final long startTime;
  private float percent;
  BufferedImage image;
  
  HeapView$HeapGrowTimer(HeapView paramHeapView)
  {
    super(30, null);
    setRepeats(true);
    startTime = System.currentTimeMillis();
    percent = 0.0F;
    int i = paramHeapView.getWidth() - 2;
    int j = paramHeapView.getHeight() - 4;
    image = new BufferedImage(i, j, 2);
    Graphics2D localGraphics2D = image.createGraphics();
    HeapView.access$200(paramHeapView, localGraphics2D, i, j);
    localGraphics2D.dispose();
  }
  
  public float getPercent()
  {
    return percent;
  }
  
  protected void fireActionPerformed(ActionEvent paramActionEvent)
  {
    long l1 = System.currentTimeMillis();
    long l2 = Math.max(0L, l1 - startTime);
    if (l2 > 1000L)
    {
      HeapView.access$300(this$0);
    }
    else
    {
      percent = ((float)l2 / 1000.0F);
      this$0.repaint();
    }
  }
}

/* Location:
 * Qualified Name:     org.openide.actions.HeapView.HeapGrowTimer
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.openide.actions;

import java.awt.AlphaComposite;
import java.awt.Color;
import java.awt.Composite;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.FontMetrics;
import java.awt.GradientPaint;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseEvent;
import java.awt.image.BufferedImage;
import java.awt.image.ConvolveOp;
import java.awt.image.Kernel;
import java.text.MessageFormat;
import java.util.prefs.Preferences;
import javax.swing.JCheckBoxMenuItem;
import javax.swing.JComponent;
import javax.swing.JLabel;
import javax.swing.JPopupMenu;
import javax.swing.SwingUtilities;
import javax.swing.Timer;
import org.openide.util.NbBundle;
import org.openide.util.NbPreferences;

class HeapView
  extends JComponent
{
  private static final boolean AUTOMATIC_REFRESH = System.getProperty("org.netbeans.log.startup") == null;
  private static final int STYLE_DEFAULT = 0;
  private static final int STYLE_OVERLAY = 1;
  private static final int TICK = 1500;
  private static final int HEAP_GROW_ANIMATE_TIME = 1000;
  private static final int BORDER_W = 2;
  private static final int BORDER_H = 4;
  private static final Color[] GRID_COLORS = { new Color(14933967), new Color(15197395), new Color(14342086), new Color(14671051), new Color(13881279), new Color(14144451), new Color(13552314), new Color(13683900) };
  private static final Color BORDER1_COLOR = new Color(10920597);
  private static final Color BORDER2_COLOR = new Color(12631213);
  private static final Color MIN_TICK_COLOR = new Color(13096621);
  private static final Color MAX_TICK_COLOR = new Color(6380815);
  private static final Color TEXT_BLUR_COLOR = Color.WHITE;
  private static final Color TEXT_COLOR = Color.WHITE;
  private static final Color BACKGROUND1_COLOR = new Color(13683900);
  private static final Color BACKGROUND2_COLOR = new Color(15394775);
  private static final int KERNEL_SIZE = 3;
  private static final float BLUR_FACTOR = 0.1F;
  private static final int SHIFT_X = 0;
  private static final int SHIFT_Y = 1;
  private final ConvolveOp blur;
  private final MessageFormat format;
  private boolean showDropShadow;
  private int tickStyle;
  private boolean showText;
  private float[] graph;
  private int graphIndex;
  private boolean graphFilled;
  private long lastTotal;
  private Timer updateTimer;
  private Image bgImage;
  private int cachedWidth;
  private int cachedHeight;
  private BufferedImage textImage;
  private BufferedImage dropShadowImage;
  private HeapGrowTimer heapGrowTimer;
  private int maxTextWidth;
  private String heapSizeText;
  private Image tickGradientImage;
  private BufferedImage gridOverlayImage;
  private static final String TICK_STYLE = "tickStyle";
  private static final String SHOW_TEXT = "showText";
  private static final String DROP_SHADOW = "dropShadow";
  private boolean containsMouse;
  private boolean cachedBorderVaild;
  
  public HeapView()
  {
    int i = 3;int j = 3;
    float f = 0.1F;
    float[] arrayOfFloat = new float[i * j];
    for (int k = 0; k < arrayOfFloat.length; k++) {
      arrayOfFloat[k] = f;
    }
    blur = new ConvolveOp(new Kernel(i, j, arrayOfFloat));
    format = new MessageFormat("{0,choice,0#{0,number,0.0}|999<{0,number,0}}/{1,choice,0#{1,number,0.0}|999<{1,number,0}}MB");
    heapSizeText = "";
    
    enableEvents(16L);
    setToolTipText(NbBundle.getMessage(GarbageCollectAction.class, "CTL_GC"));
    updateUI();
  }
  
  public boolean isOpaque()
  {
    return true;
  }
  
  public void updateUI()
  {
    Font localFont = new JLabel().getFont();
    localFont = new Font(localFont.getName(), 1, localFont.getSize());
    setFont(localFont);
    revalidate();
    repaint();
  }
  
  public void setTickStyle(int paramInt)
  {
    prefs().putInt("tickStyle", paramInt);
    repaint();
  }
  
  public int getTickStyle()
  {
    return prefs().getInt("tickStyle", 1);
  }
  
  public void setShowText(boolean paramBoolean)
  {
    prefs().putBoolean("showText", paramBoolean);
    repaint();
  }
  
  public boolean getShowText()
  {
    return prefs().getBoolean("showText", true);
  }
  
  public void setShowDropShadow(boolean paramBoolean)
  {
    prefs().putBoolean("dropShadow", paramBoolean);
    repaint();
  }
  
  public boolean getShowDropShadow()
  {
    return prefs().getBoolean("dropShadow", true);
  }
  
  public void setFont(Font paramFont)
  {
    super.setFont(paramFont);
    updateTextWidth();
  }
  
  Dimension heapViewPreferredSize()
  {
    Dimension localDimension = new Dimension(maxTextWidth + 8, getFontMetrics(getFont()).getHeight() + 8);
    
    return localDimension;
  }
  
  private Preferences prefs()
  {
    return NbPreferences.forModule(HeapView.class);
  }
  
  private void updateTextWidth()
  {
    String str = format.format(new Object[] { new Float(999.9F), new Float(999.9F) });
    
    maxTextWidth = (getFontMetrics(getFont()).stringWidth(str) + 4);
  }
  
  protected void processMouseEvent(MouseEvent paramMouseEvent)
  {
    super.processMouseEvent(paramMouseEvent);
    if (!paramMouseEvent.isConsumed()) {
      if (paramMouseEvent.isPopupTrigger())
      {
        showPopup(paramMouseEvent.getX(), paramMouseEvent.getY());
      }
      else if (paramMouseEvent.getID() == 504)
      {
        containsMouse = true;
        cachedBorderVaild = false;
        repaint();
      }
      else if (paramMouseEvent.getID() == 505)
      {
        containsMouse = false;
        cachedBorderVaild = false;
        repaint();
      }
    }
    if ((paramMouseEvent.getID() == 500) && (SwingUtilities.isLeftMouseButton(paramMouseEvent)) && (paramMouseEvent.getClickCount() == 1)) {
      ((GarbageCollectAction)GarbageCollectAction.get(GarbageCollectAction.class)).performAction();
    }
  }
  
  private void showPopup(int paramInt1, int paramInt2)
  {
    JPopupMenu localJPopupMenu = new JPopupMenu();
    JCheckBoxMenuItem localJCheckBoxMenuItem = new JCheckBoxMenuItem(NbBundle.getMessage(HeapView.class, "LBL_ShowText"));
    localJCheckBoxMenuItem.setSelected(getShowText());
    localJCheckBoxMenuItem.addActionListener(new ActionListener()
    {
      public void actionPerformed(ActionEvent paramAnonymousActionEvent)
      {
        setShowText(((JCheckBoxMenuItem)paramAnonymousActionEvent.getSource()).isSelected());
      }
    });
    localJPopupMenu.add(localJCheckBoxMenuItem);
    localJCheckBoxMenuItem = new JCheckBoxMenuItem(NbBundle.getMessage(HeapView.class, "LBL_DropShadow"));
    localJCheckBoxMenuItem.setSelected(getShowDropShadow());
    localJCheckBoxMenuItem.addActionListener(new ActionListener()
    {
      public void actionPerformed(ActionEvent paramAnonymousActionEvent)
      {
        setShowDropShadow(((JCheckBoxMenuItem)paramAnonymousActionEvent.getSource()).isSelected());
      }
    });
    localJPopupMenu.add(localJCheckBoxMenuItem);
    localJCheckBoxMenuItem = new JCheckBoxMenuItem(NbBundle.getMessage(HeapView.class, "LBL_OverlayGrid"));
    localJCheckBoxMenuItem.setSelected(getTickStyle() == 1);
    localJCheckBoxMenuItem.addActionListener(new ActionListener()
    {
      public void actionPerformed(ActionEvent paramAnonymousActionEvent)
      {
        int i = ((JCheckBoxMenuItem)paramAnonymousActionEvent.getSource()).isSelected() ? 1 : 0;
        
        setTickStyle(i);
      }
    });
    localJPopupMenu.add(localJCheckBoxMenuItem);
    localJPopupMenu.show(this, paramInt1, paramInt2);
  }
  
  private int getGraphStartIndex()
  {
    if (graphFilled) {
      return graphIndex;
    }
    return 0;
  }
  
  protected void paintComponent(Graphics paramGraphics)
  {
    Graphics2D localGraphics2D = (Graphics2D)paramGraphics;
    int i = getWidth();
    int j = getHeight();
    if ((i - 2 > 0) && (j - 4 > 0))
    {
      startTimerIfNecessary();
      updateCacheIfNecessary(i, j);
      paintCachedBackground(localGraphics2D, i, j);
      paramGraphics.translate(1, 2);
      if (containsMouse) {
        paramGraphics.clipRect(1, 0, i - 4, j - 4);
      } else {
        paramGraphics.clipRect(0, 0, i - 2, j - 4);
      }
      int k = i - 2;
      int m = j - 4;
      if (heapGrowTimer != null)
      {
        Composite localComposite = ((Graphics2D)paramGraphics).getComposite();
        float f = 1.0F - heapGrowTimer.getPercent();
        ((Graphics2D)paramGraphics).setComposite(AlphaComposite.getInstance(3, f));
        paramGraphics.drawImage(heapGrowTimer.image, 0, 0, null);
        ((Graphics2D)paramGraphics).setComposite(localComposite);
      }
      paintTicks(localGraphics2D, k, m);
      if (getTickStyle() == 1) {
        localGraphics2D.drawImage(getGridOverlayImage(), 0, 0, null);
      }
      if (getShowText()) {
        if (getShowDropShadow())
        {
          paintDropShadowText(paramGraphics, k, m);
        }
        else
        {
          paramGraphics.setColor(Color.WHITE);
          paintText(paramGraphics, k, m);
        }
      }
      paramGraphics.translate(-1, -2);
    }
    else
    {
      stopTimerIfNecessary();
      
      paramGraphics.setColor(getBackground());
      paramGraphics.fillRect(0, 0, i, j);
    }
  }
  
  private void paintTicks(Graphics2D paramGraphics2D, int paramInt1, int paramInt2)
  {
    if ((graphIndex > 0) || (graphFilled))
    {
      int i = getGraphStartIndex();
      int j = 0;
      if (!graphFilled) {
        j = paramInt1 - graphIndex;
      }
      float f = graph[i];
      i = (i + 1) % graph.length;
      while (i != graphIndex)
      {
        f = Math.min(f, graph[i]);
        i = (i + 1) % graph.length;
      }
      int k = (int)(f * paramInt2);
      if (k > 0) {
        paramGraphics2D.drawImage(tickGradientImage, j, paramInt2 - k, paramInt1, paramInt2, j, paramInt2 - k, paramInt1, paramInt2, null);
      }
      i = getGraphStartIndex();
      do
      {
        int m = (int)(graph[i] * paramInt2);
        if (m > k) {
          paramGraphics2D.drawImage(tickGradientImage, j, paramInt2 - m, j + 1, paramInt2 - k, j, paramInt2 - m, j + 1, paramInt2 - k, null);
        }
        i = (i + 1) % graph.length;
        j++;
      } while (i != graphIndex);
    }
  }
  
  private void paintText(Graphics paramGraphics, int paramInt1, int paramInt2)
  {
    paramGraphics.setFont(getFont());
    String str = getHeapSizeText();
    FontMetrics localFontMetrics = paramGraphics.getFontMetrics();
    int i = localFontMetrics.stringWidth(str);
    paramGraphics.drawString(str, (paramInt1 - maxTextWidth) / 2 + (maxTextWidth - i), paramInt2 / 2 + localFontMetrics.getAscent() / 2);
  }
  
  private void paintDropShadowText(Graphics paramGraphics, int paramInt1, int paramInt2)
  {
    if (textImage == null)
    {
      textImage = new BufferedImage(paramInt1, paramInt2, 2);
      dropShadowImage = new BufferedImage(paramInt1, paramInt2, 2);
    }
    Graphics2D localGraphics2D1 = textImage.createGraphics();
    localGraphics2D1.setComposite(AlphaComposite.Clear);
    localGraphics2D1.fillRect(0, 0, paramInt1, paramInt2);
    localGraphics2D1.setComposite(AlphaComposite.SrcOver);
    localGraphics2D1.setColor(TEXT_BLUR_COLOR);
    paintText(localGraphics2D1, paramInt1, paramInt2);
    localGraphics2D1.dispose();
    
    Graphics2D localGraphics2D2 = dropShadowImage.createGraphics();
    localGraphics2D2.setComposite(AlphaComposite.Clear);
    localGraphics2D2.fillRect(0, 0, paramInt1, paramInt2);
    localGraphics2D2.setComposite(AlphaComposite.SrcOver);
    localGraphics2D2.drawImage(textImage, blur, 0, 1);
    localGraphics2D2.setColor(TEXT_COLOR);
    localGraphics2D2.setFont(getFont());
    
    paintText(localGraphics2D2, paramInt1, paramInt2);
    localGraphics2D2.dispose();
    
    paramGraphics.drawImage(dropShadowImage, 0, 0, null);
  }
  
  private String getHeapSizeText()
  {
    return heapSizeText;
  }
  
  private void paintGridOverlay(Graphics2D paramGraphics2D, int paramInt1, int paramInt2)
  {
    int i = GRID_COLORS.length / 2;
    int j = (paramInt2 - i - 1) / i;
    int k = 13683900;
    int m = 15394775;
    paramGraphics2D.setPaint(new GradientPaint(0.0F, 0.0F, new Color(k >> 16 & 0xFF, k >> 8 & 0xFF, k & 0xFF, 48), 0.0F, paramInt2, new Color(m >> 16 & 0xFF, m >> 8 & 0xFF, m & 0xFF, 64)));
    for (int n = 0; n < paramInt1; n += j + 1) {
      paramGraphics2D.fillRect(n, 0, 1, paramInt2);
    }
    for (n = paramInt2 - j - 1; n >= 0; n -= j + 1) {
      paramGraphics2D.fillRect(0, n, paramInt1, 1);
    }
  }
  
  private void paintCachedBackground(Graphics2D paramGraphics2D, int paramInt1, int paramInt2)
  {
    if (bgImage != null) {
      paramGraphics2D.drawImage(bgImage, 0, 0, null);
    }
  }
  
  private void paintBackgroundTiles(Graphics2D paramGraphics2D, int paramInt1, int paramInt2)
  {
    paramGraphics2D.translate(1, 2);
    paramInt1 -= 2;
    paramInt2 -= 4;
    int i = GRID_COLORS.length / 2;
    int j = (paramInt2 - i - 1) / i;
    for (int k = 0; k < i; k++)
    {
      int m = k;
      int n = paramInt2 - j * (k + 1) - k;
      int i1 = 1;
      paramGraphics2D.setPaint(new GradientPaint(0.0F, n, GRID_COLORS[(m * 2)], 0.0F, n + j - 1, GRID_COLORS[(m * 2 + 1)]));
      while (i1 < paramInt1)
      {
        int i2 = Math.min(paramInt1, i1 + j);
        paramGraphics2D.fillRect(i1, n, i2 - i1, j);
        i1 = i2 + 1;
      }
      n += j + 1;
    }
    paramGraphics2D.translate(-1, -2);
  }
  
  private void paintBackground(Graphics2D paramGraphics2D, int paramInt1, int paramInt2)
  {
    paramGraphics2D.setPaint(new GradientPaint(0.0F, 0.0F, BACKGROUND1_COLOR, 0.0F, paramInt2, BACKGROUND2_COLOR));
    
    paramGraphics2D.fillRect(0, 0, paramInt1, paramInt2);
  }
  
  private void paintBorder(Graphics paramGraphics, int paramInt1, int paramInt2)
  {
    if (containsMouse)
    {
      paramGraphics.setColor(Color.WHITE);
      paramGraphics.drawRect(0, 0, paramInt1 - 1, paramInt2 - 1);
      paramGraphics.drawRect(1, 1, paramInt1 - 3, paramInt2 - 3);
    }
    else
    {
      paramGraphics.setColor(BORDER1_COLOR);
      paramGraphics.drawRect(0, 0, paramInt1 - 1, paramInt2 - 2);
      paramGraphics.setColor(BORDER2_COLOR);
      paramGraphics.fillRect(1, 1, paramInt1 - 2, 1);
      paramGraphics.setColor(Color.WHITE);
      paramGraphics.fillRect(0, paramInt2 - 1, paramInt1, 1);
    }
  }
  
  private void updateCacheIfNecessary(int paramInt1, int paramInt2)
  {
    if ((cachedWidth != paramInt1) || (cachedHeight != paramInt2) || (!cachedBorderVaild))
    {
      cachedWidth = paramInt1;
      cachedHeight = paramInt2;
      cachedBorderVaild = true;
      updateCache(paramInt1, paramInt2);
    }
  }
  
  private Image getGridOverlayImage()
  {
    if (gridOverlayImage == null)
    {
      gridOverlayImage = new BufferedImage(getInnerWidth(), getInnerHeight(), 2);
      
      Graphics2D localGraphics2D = gridOverlayImage.createGraphics();
      paintGridOverlay(localGraphics2D, getInnerWidth(), getInnerHeight());
      localGraphics2D.dispose();
    }
    return gridOverlayImage;
  }
  
  private void updateCache(int paramInt1, int paramInt2)
  {
    disposeImages();
    textImage = new BufferedImage(paramInt1, paramInt2, 2);
    dropShadowImage = new BufferedImage(paramInt1, paramInt2, 2);
    bgImage = createImage(paramInt1, paramInt2);
    Graphics2D localGraphics2D = (Graphics2D)bgImage.getGraphics();
    paintBackground(localGraphics2D, paramInt1, paramInt2);
    paintBackgroundTiles(localGraphics2D, paramInt1, paramInt2);
    paintBorder(localGraphics2D, paramInt1, paramInt2);
    localGraphics2D.dispose();
    paramInt1 -= 2;
    paramInt2 -= 4;
    if ((graph == null) || (graph.length != paramInt1))
    {
      graph = new float[paramInt1];
      graphFilled = false;
      graphIndex = 0;
    }
    GradientPaint localGradientPaint = new GradientPaint(0.0F, paramInt2, MIN_TICK_COLOR, paramInt1, 0.0F, MAX_TICK_COLOR);
    
    tickGradientImage = createImage(paramInt1, paramInt2);
    localGraphics2D = (Graphics2D)tickGradientImage.getGraphics();
    localGraphics2D.setPaint(localGradientPaint);
    localGraphics2D.fillRect(0, 0, paramInt1, paramInt2);
    localGraphics2D.dispose();
    if (gridOverlayImage != null)
    {
      gridOverlayImage.flush();
      gridOverlayImage = null;
    }
  }
  
  public void removeNotify()
  {
    super.removeNotify();
    stopTimerIfNecessary();
  }
  
  private void startTimerIfNecessary()
  {
    if (!AUTOMATIC_REFRESH) {
      return;
    }
    if (updateTimer == null)
    {
      updateTimer = new Timer(1500, new ActionHandler(null));
      updateTimer.setRepeats(true);
      updateTimer.start();
    }
  }
  
  private void stopTimerIfNecessary()
  {
    if (updateTimer != null)
    {
      graph = null;
      graphFilled = false;
      updateTimer.stop();
      updateTimer = null;
      lastTotal = 0L;
      disposeImages();
      cachedHeight = (cachedHeight = -1);
      if (heapGrowTimer != null)
      {
        heapGrowTimer.stop();
        heapGrowTimer = null;
      }
    }
  }
  
  private void disposeImages()
  {
    if (bgImage != null)
    {
      bgImage.flush();
      bgImage = null;
    }
    if (textImage != null)
    {
      textImage.flush();
      textImage = null;
    }
    if (dropShadowImage != null)
    {
      dropShadowImage.flush();
      dropShadowImage = null;
    }
    if (tickGradientImage != null)
    {
      tickGradientImage.flush();
      tickGradientImage = null;
    }
    if (gridOverlayImage != null)
    {
      gridOverlayImage.flush();
      gridOverlayImage = null;
    }
  }
  
  private void update()
  {
    if (!isShowing())
    {
      stopTimerIfNecessary();
      return;
    }
    Runtime localRuntime = Runtime.getRuntime();
    long l1 = localRuntime.totalMemory();
    if (l1 != lastTotal)
    {
      if (lastTotal != 0L)
      {
        startHeapAnimate();
        
        int i = getGraphStartIndex();
        do
        {
          graph[i] = ((float)(graph[i] * lastTotal / l1));
          
          i = (i + 1) % graph.length;
        } while (i != graphIndex);
      }
      lastTotal = l1;
    }
    if (heapGrowTimer == null)
    {
      long l2 = l1 - localRuntime.freeMemory();
      graph[graphIndex] = ((float)(l2 / l1));
      graphIndex = ((graphIndex + 1) % graph.length);
      if (graphIndex == 0) {
        graphFilled = true;
      }
      heapSizeText = format.format(new Object[] { new Double(l2 / 1024.0D / 1024.0D), new Double(l1 / 1024.0D / 1024.0D) });
    }
    repaint();
  }
  
  private void startHeapAnimate()
  {
    if (heapGrowTimer == null)
    {
      heapGrowTimer = new HeapGrowTimer();
      heapGrowTimer.start();
    }
  }
  
  private void stopHeapAnimate()
  {
    if (heapGrowTimer != null)
    {
      heapGrowTimer.stop();
      heapGrowTimer = null;
    }
  }
  
  private int getInnerWidth()
  {
    return getWidth() - 2;
  }
  
  private int getInnerHeight()
  {
    return getHeight() - 4;
  }
  
  private final class ActionHandler
    implements ActionListener
  {
    private ActionHandler() {}
    
    public void actionPerformed(ActionEvent paramActionEvent)
    {
      HeapView.this.update();
    }
  }
  
  private final class HeapGrowTimer
    extends Timer
  {
    private final long startTime;
    private float percent;
    BufferedImage image;
    
    HeapGrowTimer()
    {
      super(null);
      setRepeats(true);
      startTime = System.currentTimeMillis();
      percent = 0.0F;
      int i = getWidth() - 2;
      int j = getHeight() - 4;
      image = new BufferedImage(i, j, 2);
      Graphics2D localGraphics2D = image.createGraphics();
      HeapView.this.paintTicks(localGraphics2D, i, j);
      localGraphics2D.dispose();
    }
    
    public float getPercent()
    {
      return percent;
    }
    
    protected void fireActionPerformed(ActionEvent paramActionEvent)
    {
      long l1 = System.currentTimeMillis();
      long l2 = Math.max(0L, l1 - startTime);
      if (l2 > 1000L)
      {
        HeapView.this.stopHeapAnimate();
      }
      else
      {
        percent = ((float)l2 / 1000.0F);
        repaint();
      }
    }
  }
}

/* Location:
 * Qualified Name:     org.openide.actions.HeapView
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.openide.actions;

import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import org.openide.nodes.Index;
import org.openide.nodes.Node;

final class MoveDownAction$OrderingListener
  implements ChangeListener
{
  MoveDownAction$OrderingListener(MoveDownAction paramMoveDownAction) {}
  
  public void stateChanged(ChangeEvent paramChangeEvent)
  {
    Node[] arrayOfNode = this$0.getActivatedNodes();
    Index localIndex = MoveDownAction.access$000(this$0, arrayOfNode);
    if (localIndex == null)
    {
      this$0.setEnabled(false);
    }
    else
    {
      int i = localIndex.indexOf(arrayOfNode[0]);
      this$0.setEnabled((i >= 0) && (i < localIndex.getNodesCount() - 1));
    }
  }
}

/* Location:
 * Qualified Name:     org.openide.actions.MoveDownAction.OrderingListener
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.openide.actions;

import java.lang.ref.Reference;
import java.lang.ref.WeakReference;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import org.openide.nodes.Index;
import org.openide.nodes.Node;
import org.openide.util.HelpCtx;
import org.openide.util.NbBundle;
import org.openide.util.actions.NodeAction;

public final class MoveDownAction
  extends NodeAction
{
  private static final String PROP_ORDER_LISTENER = "sellistener";
  private Reference<Index> curIndexCookie;
  
  protected void initialize()
  {
    super.initialize();
    
    OrderingListener localOrderingListener = n
1 2 3 4 5

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