org-openide-compat

16:40:27.343 INFO  jd.cli.Main - Decompiling org-openide-compat.jar
package org.openide.explorer;

class ExplorerActions$ActionStateUpdater$1
  implements Runnable
{
  private final ExplorerActions.ActionStateUpdater this$1;
  
  ExplorerActions$ActionStateUpdater$1(ExplorerActions.ActionStateUpdater paramActionStateUpdater, ExplorerManager paramExplorerManager) {}
  
  public void run()
  {
    ExplorerActions.access$700(ExplorerActions.ActionStateUpdater.access$600(this$1), val$em.getSelectedNodes());
  }
}

/* Location:
 * Qualified Name:     org.openide.explorer.ExplorerActions.ActionStateUpdater.1
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.openide.explorer;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import javax.swing.Timer;
import org.openide.util.Mutex;
import org.openide.util.datatransfer.ClipboardEvent;
import org.openide.util.datatransfer.ClipboardListener;

class ExplorerActions$ActionStateUpdater
  implements PropertyChangeListener, ClipboardListener, ActionListener
{
  private final Timer timer;
  private boolean planned;
  private final ExplorerActions this$0;
  
  ExplorerActions$ActionStateUpdater(ExplorerActions paramExplorerActions)
  {
    timer = new ExplorerActions.FixIssue29405Timer(150, this);
    timer.setCoalesce(true);
    timer.setRepeats(false);
  }
  
  public synchronized void propertyChange(PropertyChangeEvent paramPropertyChangeEvent)
  {
    timer.restart();
    planned = true;
  }
  
  public void clipboardChanged(ClipboardEvent paramClipboardEvent)
  {
    final ExplorerManager localExplorerManager = ExplorerActions.access$100(this$0);
    if ((!paramClipboardEvent.isConsumed()) && (localExplorerManager != null)) {
      Mutex.EVENT.writeAccess(new Runnable()
      {
        public void run()
        {
          ExplorerActions.access$700(this$0, localExplorerManager.getSelectedNodes());
        }
      });
    }
  }
  
  public void actionPerformed(ActionEvent paramActionEvent)
  {
    ExplorerActions.access$800(this$0);
    synchronized (this)
    {
      timer.stop();
      planned = false;
    }
  }
  
  public void update()
  {
    boolean bool;
    synchronized (this)
    {
      bool = planned;
      planned = false;
    }
    if (bool)
    {
      timer.stop();
      ExplorerActions.access$800(this$0);
    }
  }
}

/* Location:
 * Qualified Name:     org.openide.explorer.ExplorerActions.ActionStateUpdater
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.openide.explorer;

import java.awt.datatransfer.Clipboard;
import java.awt.datatransfer.StringSelection;
import java.awt.datatransfer.Transferable;
import java.awt.event.ActionEvent;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.AbstractAction;
import org.openide.nodes.Node;
import org.openide.util.actions.ActionPerformer;
import org.openide.util.actions.SystemAction;
import org.openide.util.datatransfer.ExTransferable.Multi;

class ExplorerActions$CopyCutActionPerformer
  extends AbstractAction
  implements ActionPerformer
{
  private boolean copyCut;
  private final ExplorerActions this$0;
  
  public ExplorerActions$CopyCutActionPerformer(ExplorerActions paramExplorerActions, boolean paramBoolean)
  {
    copyCut = paramBoolean;
  }
  
  public boolean isEnabled()
  {
    ExplorerActions.access$000(this$0);
    
    return super.isEnabled();
  }
  
  public void performAction(SystemAction paramSystemAction)
  {
    Object localObject1 = null;
    Node[] arrayOfNode = ExplorerActions.access$100(this$0).getSelectedNodes();
    Object localObject2;
    if (arrayOfNode.length != 1)
    {
      localObject2 = new Transferable[arrayOfNode.length];
      for (int i = 0; i < arrayOfNode.length; i++) {
        if ((localObject2[i] = getTransferableOwner(arrayOfNode[i])) == null) {
          return;
        }
      }
      localObject1 = new ExTransferable.Multi((Transferable[])localObject2);
    }
    else
    {
      localObject1 = getTransferableOwner(arrayOfNode[0]);
    }
    if (localObject1 != null)
    {
      localObject2 = ExplorerActions.access$200();
      
      ((Clipboard)localObject2).setContents((Transferable)localObject1, new StringSelection(""));
    }
  }
  
  private Transferable getTransferableOwner(Node paramNode)
  {
    try
    {
      return copyCut ? paramNode.clipboardCopy() : paramNode.clipboardCut();
    }
    catch (IOException localIOException)
    {
      Logger.getLogger((ExplorerActions.class$org$openide$explorer$ExplorerActions == null ? (ExplorerActions.class$org$openide$explorer$ExplorerActions = ExplorerActions.class$("org.openide.explorer.ExplorerActions")) : ExplorerActions.class$org$openide$explorer$ExplorerActions).getName()).log(Level.WARNING, null, localIOException);
    }
    return null;
  }
  
  public void actionPerformed(ActionEvent paramActionEvent)
  {
    performAction(null);
  }
}

/* Location:
 * Qualified Name:     org.openide.explorer.ExplorerActions.CopyCutActionPerformer
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.openide.explorer;

import java.io.IOException;
import org.openide.filesystems.FileSystem.AtomicAction;
import org.openide.nodes.Node;
import org.openide.util.Exceptions;

class ExplorerActions$DeleteActionPerformer$1
  implements FileSystem.AtomicAction
{
  private final ExplorerActions.DeleteActionPerformer this$1;
  
  ExplorerActions$DeleteActionPerformer$1(ExplorerActions.DeleteActionPerformer paramDeleteActionPerformer, Node[] paramArrayOfNode) {}
  
  public void run()
    throws IOException
  {
    for (int i = 0; i < val$sel.length; i++) {
      try
      {
        val$sel[i].destroy();
      }
      catch (IOException localIOException)
      {
        Exceptions.printStackTrace(localIOException);
      }
    }
  }
}

/* Location:
 * Qualified Name:     org.openide.explorer.ExplorerActions.DeleteActionPerformer.1
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.openide.explorer;

import org.openide.actions.DeleteAction;

class ExplorerActions$DeleteActionPerformer$1Run
  implements Runnable
{
  private final ExplorerActions.DeleteActionPerformer this$1;
  
  ExplorerActions$DeleteActionPerformer$1Run(ExplorerActions.DeleteActionPerformer paramDeleteActionPerformer) {}
  
  public void run()
  {
    if (ExplorerActions.access$400(ExplorerActions.DeleteActionPerformer.access$300(this$1))) {
      ExplorerActions.access$500().setActionPerformer(null);
    } else {
      this$1.setEnabled(false);
    }
  }
}

/* Location:
 * Qualified Name:     org.openide.explorer.ExplorerActions.DeleteActionPerformer.1Run
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.openide.explorer;

import java.awt.event.ActionEvent;
import java.beans.PropertyVetoException;
import java.io.IOException;
import javax.swing.AbstractAction;
import org.openide.DialogDisplayer;
import org.openide.NotifyDescriptor;
import org.openide.NotifyDescriptor.Confirmation;
import org.openide.actions.DeleteAction;
import org.openide.filesystems.FileSystem.AtomicAction;
import org.openide.filesystems.FileUtil;
import org.openide.nodes.Node;
import org.openide.util.Exceptions;
import org.openide.util.Mutex;
import org.openide.util.NbBundle;
import org.openide.util.actions.ActionPerformer;
import org.openide.util.actions.SystemAction;

class ExplorerActions$DeleteActionPerformer
  extends AbstractAction
  implements ActionPerformer
{
  private final ExplorerActions this$0;
  
  ExplorerActions$DeleteActionPerformer(ExplorerActions paramExplorerActions) {}
  
  public boolean isEnabled()
  {
    ExplorerActions.access$000(this$0);
    
    return super.isEnabled();
  }
  
  public void performAction(SystemAction paramSystemAction)
  {
    Node[] arrayOfNode = ExplorerActions.access$100(this$0).getSelectedNodes();
    if ((arrayOfNode == null) || (arrayOfNode.length == 0)) {
      return;
    }
    if ((!this$0.isConfirmDelete()) || (doConfirm(arrayOfNode)))
    {
      try
      {
        if (ExplorerActions.access$100(this$0) != null) {
          ExplorerActions.access$100(this$0).setSelectedNodes(new Node[0]);
        }
      }
      catch (PropertyVetoException localPropertyVetoException) {}
      doDestroy(arrayOfNode);
      
      Mutex.EVENT.readAccess(new Runnable()
      {
        public void run()
        {
          if (ExplorerActions.access$400(this$0)) {
            ExplorerActions.access$500().setActionPerformer(null);
          } else {
            setEnabled(false);
          }
        }
      });
    }
  }
  
  private boolean doConfirm(Node[] paramArrayOfNode)
  {
    int i = 1;
    for (int j = 0; j < paramArrayOfNode.length; j++) {
      if (!Boolean.TRUE.equals(paramArrayOfNode[j].getValue("customDelete")))
      {
        i = 0;
        
        break;
      }
    }
    if (i != 0) {
      return true;
    }
    String str1;
    String str2;
    if (paramArrayOfNode.length == 1)
    {
      str1 = NbBundle.getMessage(ExplorerActions.class$org$openide$explorer$ExplorerActions == null ? (ExplorerActions.class$org$openide$explorer$ExplorerActions = ExplorerActions.class$("org.openide.explorer.ExplorerActions")) : ExplorerActions.class$org$openide$explorer$ExplorerActions, "MSG_ConfirmDeleteObject", paramArrayOfNode[0].getDisplayName());
      
      str2 = NbBundle.getMessage(ExplorerActions.class$org$openide$explorer$ExplorerActions == null ? (ExplorerActions.class$org$openide$explorer$ExplorerActions = ExplorerActions.class$("org.openide.explorer.ExplorerActions")) : ExplorerActions.class$org$openide$explorer$ExplorerActions, "MSG_ConfirmDeleteObjectTitle");
    }
    else
    {
      str1 = NbBundle.getMessage(ExplorerActions.class$org$openide$explorer$ExplorerActions == null ? (ExplorerActions.class$org$openide$explorer$ExplorerActions = ExplorerActions.class$("org.openide.explorer.ExplorerActions")) : ExplorerActions.class$org$openide$explorer$ExplorerActions, "MSG_ConfirmDeleteObjects", new Integer(paramArrayOfNode.length));
      
      str2 = NbBundle.getMessage(ExplorerActions.class$org$openide$explorer$ExplorerActions == null ? (ExplorerActions.class$org$openide$explorer$ExplorerActions = ExplorerActions.class$("org.openide.explorer.ExplorerActions")) : ExplorerActions.class$org$openide$explorer$ExplorerActions, "MSG_ConfirmDeleteObjectsTitle");
    }
    NotifyDescriptor.Confirmation localConfirmation = new NotifyDescriptor.Confirmation(str1, str2, 0);
    
    return NotifyDescriptor.YES_OPTION.equals(DialogDisplayer.getDefault().notify(localConfirmation));
  }
  
  private void doDestroy(final Node[] paramArrayOfNode)
  {
    try
    {
      FileUtil.runAtomicAction(new FileSystem.AtomicAction()
      {
        public void run()
          throws IOException
        {
          for (int i = 0; i < paramArrayOfNode.length; i++) {
            try
            {
              paramArrayOfNode[i].destroy();
            }
            catch (IOException localIOException)
            {
              Exceptions.printStackTrace(localIOException);
            }
          }
        }
      });
    }
    catch (IOException localIOException)
    {
      throw ((IllegalStateException)new IllegalStateException(localIOException.toString()).initCause(localIOException));
    }
  }
  
  public void actionPerformed(ActionEvent paramActionEvent)
  {
    performAction(null);
  }
}

/* Location:
 * Qualified Name:     org.openide.explorer.ExplorerActions.DeleteActionPerformer
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.openide.explorer;

import java.awt.event.ActionListener;
import javax.swing.Timer;

class ExplorerActions$FixIssue29405Timer
  extends Timer
{
  private boolean running;
  
  public ExplorerActions$FixIssue29405Timer(int paramInt, ActionListener paramActionListener)
  {
    super(paramInt, paramActionListener);
  }
  
  public void restart()
  {
    super.restart();
    running = true;
  }
  
  public void stop()
  {
    running = false;
    super.stop();
  }
  
  public boolean isRunning()
  {
    return running;
  }
}

/* Location:
 * Qualified Name:     org.openide.explorer.ExplorerActions.FixIssue29405Timer
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.openide.explorer;

import java.awt.datatransfer.Transferable;
import java.io.IOException;
import org.openide.util.datatransfer.ExTransferable.Multi;
import org.openide.util.datatransfer.PasteType;

class ExplorerActions$MultiPasteType
  extends PasteType
{
  Transferable[] t;
  PasteType[] p;
  
  ExplorerActions$MultiPasteType(Transferable[] paramArrayOfTransferable, PasteType[] paramArrayOfPasteType)
  {
    t = paramArrayOfTransferable;
    p = paramArrayOfPasteType;
  }
  
  public Transferable paste()
    throws IOException
  {
    int i = p.length;
    Transferable[] arrayOfTransferable = new Transferable[i];
    for (int j = 0; j < i; j++)
    {
      Transferable localTransferable = p[j].paste();
      if (localTransferable != null) {
        arrayOfTransferable[j] = localTransferable;
      } else {
        arrayOfTransferable[j] = t[j];
      }
    }
    return new ExTransferable.Multi(arrayOfTransferable);
  }
}

/* Location:
 * Qualified Name:     org.openide.explorer.ExplorerActions.MultiPasteType
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.openide.explorer;

import java.awt.event.ActionEvent;
import java.util.Arrays;
import javax.swing.AbstractAction;
import org.openide.util.datatransfer.PasteType;

class ExplorerActions$OwnPaste
  extends AbstractAction
{
  private PasteType[] pasteTypes = new PasteType[0];
  private final ExplorerActions this$0;
  
  ExplorerActions$OwnPaste(ExplorerActions paramExplorerActions) {}
  
  public boolean isEnabled()
  {
    ExplorerActions.access$000(this$0);
    
    return super.isEnabled();
  }
  
  public void setPasteTypes(PasteType[] paramArrayOfPasteType)
  {
    synchronized (this)
    {
      pasteTypes = paramArrayOfPasteType;
    }
    setEnabled(paramArrayOfPasteType != null);
  }
  
  public void actionPerformed(ActionEvent paramActionEvent)
  {
    if (pasteTypes == null) {
      throw new IllegalStateException("Should not be invoked at all. Paste types: null");
    }
    throw new IllegalStateException("Should not be invoked at all. Paste types: " + Arrays.asList(pasteTypes));
  }
  
  public Object getValue(String paramString)
  {
    ExplorerActions.access$000(this$0);
    if ("delegates".equals(paramString)) {
      return pasteTypes;
    }
    return super.getValue(paramString);
  }
}

/* Location:
 * Qualified Name:     org.openide.explorer.ExplorerActions.OwnPaste
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.openide.explorer;

import java.awt.Toolkit;
import java.awt.datatransfer.Clipboard;
import java.awt.datatransfer.StringSelection;
import java.awt.datatransfer.Transferable;
import java.awt.datatransfer.UnsupportedFlavorException;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.beans.PropertyVetoException;
import java.io.IOException;
import java.util.Arrays;
import java.util.HashMap;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.AbstractAction;
import javax.swing.Action;
import javax.swing.Timer;
import org.openide.DialogDisplayer;
import org.openide.NotifyDescriptor;
import org.openide.NotifyDescriptor.Confirmation;
import org.openide.actions.CopyAction;
import org.openide.actions.CutAction;
import org.openide.actions.DeleteAction;
import org.openide.actions.PasteAction;
import org.openide.filesystems.FileSystem.AtomicAction;
import org.openide.filesystems.FileUtil;
import org.openide.nodes.Node;
import org.openide.util.Exceptions;
import org.openide.util.Lookup;
import org.openide.util.Mutex;
import org.openide.util.NbBundle;
import org.openide.util.WeakListeners;
import org.openide.util.actions.ActionPerformer;
import org.openide.util.actions.SystemAction;
import org.openide.util.datatransfer.ClipboardEvent;
import org.openide.util.datatransfer.ClipboardListener;
import org.openide.util.datatransfer.ExClipboard;
import org.openide.util.datatransfer.ExTransferable;
import org.openide.util.datatransfer.ExTransferable.Multi;
import org.openide.util.datatransfer.MultiTransferObject;
import org.openide.util.datatransfer.PasteType;

/**
 * @deprecated
 */
public class ExplorerActions
{
  private static CopyAction copy = null;
  private static CutAction cut = null;
  private static DeleteAction delete = null;
  private static PasteAction paste = null;
  private final CopyCutActionPerformer copyActionPerformer = new CopyCutActionPerformer(true);
  private final CopyCutActionPerformer cutActionPerformer = new CopyCutActionPerformer(false);
  private final DeleteActionPerformer deleteActionPerformer = new DeleteActionPerformer();
  private final OwnPaste pasteActionPerformer = new OwnPaste();
  private ActionStateUpdater actionStateUpdater;
  private ExplorerManager manager;
  private Boolean confirmDelete;
  private boolean attachPerformers;
  
  public ExplorerActions()
  {
    this(true);
  }
  
  ExplorerActions(boolean paramBoolean)
  {
    attachPerformers = paramBoolean;
  }
  
  final Action copyAction()
  {
    return copyActionPerformer;
  }
  
  final Action cutAction()
  {
    return cutActionPerformer;
  }
  
  final Action deleteAction()
  {
    return deleteActionPerformer;
  }
  
  final Action pasteAction()
  {
    return pasteActionPerformer;
  }
  
  public synchronized void attach(ExplorerManager paramExplorerManager)
  {
    if (manager != null) {
      detach();
    }
    manager = paramExplorerManager;
    
    ExplorerPanel.associateActions(this, paramExplorerManager);
    
    actionStateUpdater = new ActionStateUpdater();
    manager.addPropertyChangeListener(WeakListeners.propertyChange(actionStateUpdater, manager));
    
    Clipboard localClipboard = getClipboard();
    if ((localClipboard instanceof ExClipboard))
    {
      ExClipboard localExClipboard = (ExClipboard)localClipboard;
      localExClipboard.addClipboardListener((ClipboardListener)WeakListeners.create(ClipboardListener.class, actionStateUpdater, localExClipboard));
    }
    updateActions();
  }
  
  public synchronized void detach()
  {
    if (manager == null) {
      return;
    }
    actionStateUpdater = null;
    
    stopActions();
    
    manager = null;
  }
  
  /**
   * @deprecated
   */
  ExplorerManager getAttachedManager()
  {
    return manager;
  }
  
  public final void setConfirmDelete(boolean paramBoolean)
  {
    confirmDelete = Boolean.valueOf(paramBoolean);
  }
  
  public final boolean isConfirmDelete()
  {
    return confirmDelete == null ? ExplorerPanel.isConfirmDelete() : confirmDelete.booleanValue();
  }
  
  private void stopActions()
  {
    if (copyActionPerformer != null) {
      if (attachPerformers)
      {
        if ((copy.getActionPerformer() instanceof CopyCutActionPerformer)) {
          copy.setActionPerformer(null);
        }
        if ((cut.getActionPerformer() instanceof CopyCutActionPerformer)) {
          cut.setActionPerformer(null);
        }
        paste.setPasteTypes(null);
        if ((delete.getActionPerformer() instanceof DeleteActionPerformer)) {
          delete.setActionPerformer(null);
        }
      }
      else
      {
        copyActionPerformer.setEnabled(false);
        cutActionPerformer.setEnabled(false);
        deleteActionPerformer.setEnabled(false);
        pasteActionPerformer.setEnabled(false);
      }
    }
  }
  
  private void updateActions()
  {
    if (manager == null) {
      return;
    }
    Node[] arrayOfNode = manager.getSelectedNodes();
    if (copy == null)
    {
      copy = (CopyAction)CopyAction.findObject(CopyAction.class, true);
      cut = (CutAction)CutAction.findObject(CutAction.class, true);
      paste = (PasteAction)PasteAction.findObject(PasteAction.class, true);
      delete = (DeleteAction)DeleteAction.findObject(DeleteAction.class, true);
    }
    int j = arrayOfNode != null ? arrayOfNode.length : 0;
    if (j > 0)
    {
      int k = 0;
      if (j > 1)
      {
        HashMap localHashMap = new HashMap(101);
        for (i = 0; i < j; i++) {
          if (!checkParents(arrayOfNode[i], localHashMap))
          {
            k = 1;
            
            break;
          }
        }
      }
      for (int i = 0; i < j; i++) {
        if ((k != 0) || (!arrayOfNode[i].canCopy()))
        {
          if (attachPerformers)
          {
            copy.setActionPerformer(null); break;
          }
          copyActionPerformer.setEnabled(false);
          
          break;
        }
      }
      if (i == j) {
        if (attachPerformers) {
          copy.setActionPerformer(copyActionPerformer);
        } else {
          copyActionPerformer.setEnabled(true);
        }
      }
      for (i = 0; i < j; i++) {
        if ((k != 0) || (!arrayOfNode[i].canCut()))
        {
          if (attachPerformers)
          {
            cut.setActionPerformer(null); break;
          }
          cutActionPerformer.setEnabled(false);
          
          break;
        }
      }
      if (i == j) {
        if (attachPerformers) {
          cut.setActionPerformer(cutActionPerformer);
        } else {
          cutActionPerformer.setEnabled(true);
        }
      }
      for (i = 0; i < j; i++) {
        if ((k != 0) || (!arrayOfNode[i].canDestroy()))
        {
          if (attachPerformers)
          {
            delete.setActionPerformer(null); break;
          }
          deleteActionPerformer.setEnabled(false);
          
          break;
        }
      }
      if (i == j) {
        if (attachPerformers) {
          delete.setActionPerformer(deleteActionPerformer);
        } else {
          deleteActionPerformer.setEnabled(true);
        }
      }
    }
    else if (attachPerformers)
    {
      copy.setActionPerformer(null);
      cut.setActionPerformer(null);
      delete.setActionPerformer(null);
    }
    else
    {
      copyActionPerformer.setEnabled(false);
      cutActionPerformer.setEnabled(false);
      deleteActionPerformer.setEnabled(false);
    }
    updatePasteAction(arrayOfNode);
  }
  
  private boolean checkParents(Node paramNode, HashMap paramHashMap)
  {
    if (paramHashMap.get(paramNode) != null) {
      return false;
    }
    paramHashMap.put(paramNode, this);
    do
    {
      paramNode = paramNode.getParentNode();
      if (paramNode == null) {
        return true;
      }
    } while (paramHashMap.put(paramNode, paramNode) != this);
    return false;
  }
  
  private void updatePasteAction(Node[] paramArrayOfNode)
  {
    ExplorerManager localExplorerManager = manager;
    if (localExplorerManager == null)
    {
      if (attachPerformers) {
        paste.setPasteTypes(null);
      } else {
        pasteActionPerformer.setPasteTypes(null);
      }
      return;
    }
    if ((paramArrayOfNode != null) && (paramArrayOfNode.length > 1))
    {
      if (attachPerformers) {
        paste.setPasteTypes(null);
      } else {
        pasteActionPerformer.setPasteTypes(null);
      }
      return;
    }
    Node localNode = localExplorerManager.getExploredContext();
    Node[] arrayOfNode = localExplorerManager.getSelectedNodes();
    if ((arrayOfNode != null) && (arrayOfNode.length == 1)) {
      localNode = arrayOfNode[0];
    }
    if (localNode != null)
    {
      Transferable localTransferable = getClipboard().getContents(this);
      updatePasteTypes(localTransferable, localNode);
    }
  }
  
  private void updatePasteTypes(Transferable paramTransferable, Node paramNode)
  {
    if (paramTransferable != null)
    {
      PasteType[] arrayOfPasteType1 = paramNode == null ? new PasteType[0] : paramNode.getPasteTypes(paramTransferable);
      if (arrayOfPasteType1.length != 0)
      {
        if (attachPerformers) {
          paste.setPasteTypes(arrayOfPasteType1);
        } else {
          pasteActionPerformer.setPasteTypes(arrayOfPasteType1);
        }
        return;
      }
      boolean bool = false;
      try
      {
        bool = paramTransferable.isDataFlavorSupported(ExTransferable.multiFlavor);
      }
      catch (Exception localException) {}
      if (bool) {
        try
        {
          MultiTransferObject localMultiTransferObject = (MultiTransferObject)paramTransferable.getTransferData(ExTransferable.multiFlavor);
          int i = localMultiTransferObject.getCount();
          int j = 1;
          Transferable[] arrayOfTransferable = new Transferable[i];
          PasteType[] arrayOfPasteType2 = new PasteType[i];
          for (int k = 0; k < i; k++)
          {
            arrayOfTransferable[k] = localMultiTransferObject.getTransferableAt(k);
            arrayOfPasteType1 = paramNode == null ? new PasteType[0] : paramNode.getPasteTypes(arrayOfTransferable[k]);
            if (arrayOfPasteType1.length == 0)
            {
              j = 0;
              
              break;
            }
            arrayOfPasteType2[k] = arrayOfPasteType1[0];
          }
          if (j != 0)
          {
            PasteType[] arrayOfPasteType3 = { new MultiPasteType(arrayOfTransferable, arrayOfPasteType2) };
            if (attachPerformers) {
              paste.setPasteTypes(arrayOfPasteType3);
            } else {
              pasteActionPerformer.setPasteTypes(arrayOfPasteType3);
            }
            return;
          }
        }
        catch (UnsupportedFlavorException localUnsupportedFlavorException) {}catch (IOException localIOException) {}
      }
    }
    if (attachPerformers)
    {
      if (paste != null) {
        paste.setPasteTypes(null);
      }
    }
    else {
      pasteActionPerformer.setPasteTypes(null);
    }
  }
  
  private static Clipboard getClipboard()
  {
    Clipboard localClipboard = (Clipboard)Lookup.getDefault().lookup(Clipboard.class);
    if (localClipboard == null) {
      localClipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
    }
    return localClipboard;
  }
  
  private void updateActionsState()
  {
    ActionStateUpdater localActionStateUpdater;
    synchronized (this)
    {
      localActionStateUpdater = actionStateUpdater;
    }
    if (localActionStateUpdater != null) {
      localActionStateUpdater.update();
    }
  }
  
  private static class MultiPasteType
    extends PasteType
  {
    Transferable[] t;
    PasteType[] p;
    
    MultiPasteType(Transferable[] paramArrayOfTransferable, PasteType[] paramArrayOfPasteType)
    {
      t = paramArrayOfTransferable;
      p = paramArrayOfPasteType;
    }
    
    public Transferable paste()
      throws IOException
    {
      int i = p.length;
      Transferable[] arrayOfTransferable = new Transferable[i];
      for (int j = 0; j < i; j++)
      {
        Transferable localTransferable = p[j].paste();
        if (localTransferable != null) {
          arrayOfTransferable[j] = localTransferable;
        } else {
          arrayOfTransferable[j] = t[j];
        }
      }
      return new ExTransferable.Multi(arrayOfTransferable);
    }
  }
  
  private class OwnPaste
    extends AbstractAction
  {
    private PasteType[] pasteTypes = new PasteType[0];
    
    OwnPaste() {}
    
    public boolean isEnabled()
    {
      ExplorerActions.this.updateActionsState();
      
      return super.isEnabled();
    }
    
    public void setPasteTypes(PasteType[] paramArrayOfPasteType)
    {
      synchronized (this)
      {
        pasteTypes = paramArrayOfPasteType;
      }
      setEnabled(paramArrayOfPasteType != null);
    }
    
    public void actionPerformed(ActionEvent paramActionEvent)
    {
      if (pasteTypes == null) {
        throw new IllegalStateException("Should not be invoked at all. Paste types: null");
      }
      throw new IllegalStateException("Should not be invoked at all. Paste types: " + Arrays.asList(pasteTypes));
    }
    
    public Object getValue(String paramString)
    {
      ExplorerActions.this.updateActionsState();
      if ("delegates".equals(paramString)) {
        return pasteTypes;
      }
      return super.getValue(paramString);
    }
  }
  
  private class CopyCutActionPerformer
    extends AbstractAction
    implements ActionPerformer
  {
    private boolean copyCut;
    
    public CopyCutActionPerformer(boolean paramBoolean)
    {
      copyCut = paramBoolean;
    }
    
    public boolean isEnabled()
    {
      ExplorerActions.this.updateActionsState();
      
      return super.isEnabled();
    }
    
    public void performAction(SystemAction paramSystemAction)
    {
      Object localObject1 = null;
      Node[] arrayOfNode = manager.getSelectedNodes();
      Object localObject2;
      if (arrayOfNode.length != 1)
      {
        localObject2 = new Transferable[arrayOfNode.length];
        for (int i = 0; i < arrayOfNode.length; i++) {
          if ((localObject2[i] = getTransferableOwner(arrayOfNode[i])) == null) {
            return;
          }
        }
        localObject1 = new ExTransferable.Multi((Transferable[])localObject2);
      }
      else
      {
        localObject1 = getTransferableOwner(arrayOfNode[0]);
      }
      if (localObject1 != null)
      {
        localObject2 = ExplorerActions.access$200();
        
        ((Clipboard)localObject2).setContents((Transferable)localObject1, new StringSelection(""));
      }
    }
    
    private Transferable getTransferableOwner(Node paramNode)
    {
      try
      {
        return copyCut ? paramNode.clipboardCopy() : paramNode.clipboardCut();
      }
      catch (IOException localIOException)
      {
        Logger.getLogger(ExplorerActions.class.getName()).log(Level.WARNING, null, localIOException);
      }
      return null;
    }
    
    public void actionPerformed(ActionEvent paramActionEvent)
    {
      performAction(null);
    }
  }
  
  private class DeleteActionPerformer
    extends AbstractAction
    implements ActionPerformer
  {
    DeleteActionPerformer() {}
    
    public boolean isEnabled()
    {
      ExplorerActions.this.updateActionsState();
      
      return super.isEnabled();
    }
    
    public void performAction(SystemAction paramSystemAction)
    {
      Node[] arrayOfNode = manager.getSelectedNodes();
      if ((arrayOfNode == null) || (arrayOfNode.length == 0)) {
        return;
      }
      if ((!isConfirmDelete()) || (doConfirm(arrayOfNode)))
      {
        try
        {
          if (manager != null) {
            manager.setSelectedNodes(new Node[0]);
          }
        }
        catch (PropertyVetoException localPropertyVetoException) {}
        doDestroy(arrayOfNode);
        
        Mutex.EVENT.readAccess(new Runnable()
        {
          public void run()
          {
            if (attachPerformers) {
              ExplorerActions.delete.setActionPerformer(null);
            } else {
              setEnabled(false);
            }
          }
        });
      }
    }
    
    private boolean doConfirm(Node[] paramArrayOfNode)
    {
      int i = 1;
      for (int j = 0; j < paramArrayOfNode.length; j++) {
        if (!Boolean.TRUE.equals(paramArrayOfNode[j].getValue("customDelete")))
        {
          i = 0;
          
          break;
        }
      }
      if (i != 0) {
        return true;
      }
      String str1;
      String str2;
      if (paramArrayOfNode.length == 1)
      {
        str1 = NbBundle.getMessage(ExplorerActions.class, "MSG_ConfirmDeleteObject", paramArrayOfNode[0].getDisplayName());
        
        str2 = NbBundle.getMessage(ExplorerActions.class, "MSG_ConfirmDeleteObjectTitle");
      }
      else
      {
        str1 = NbBundle.getMessage(ExplorerActions.class, "MSG_ConfirmDeleteObjects", new Integer(paramArrayOfNode.length));
        
        str2 = NbBundle.getMessage(ExplorerActions.class, "MSG_ConfirmDeleteObjectsTitle");
      }
      NotifyDescriptor.Confirmation localConfirmation = new NotifyDescriptor.Confirmation(str1, str2, 0);
      
      return NotifyDescriptor.YES_OPTION.equals(DialogDisplayer.getDefault().notify(localConfirmation));
    }
    
    private void doDestroy(final Node[] paramArrayOfNode)
    {
      try
      {
        FileUtil.runAtomicAction(new FileSystem.AtomicAction()
        {
          public void run()
            throws IOException
          {
            for (int i = 0; i < paramArrayOfNode.length; i++) {
              try
              {
                paramArrayOfNode[i].destroy();
              }
              catch (IOException localIOException)
              {
                Exceptions.printStackTrace(localIOException);
              }
            }
          }
        });
      }
      catch (IOException localIOException)
      {
        throw ((IllegalStateException)new IllegalStateException(localIOException.toString()).initCause(localIOException));
      }
    }
    
    public void actionPerformed(ActionEvent paramActionEvent)
    {
      performAction(null);
    }
  }
  
  private class ActionStateUpdater
    implements PropertyChangeListener, ClipboardListener, ActionListener
  {
    private final Timer timer;
    private boolean planned;
    
    ActionStateUpdater()
    {
      timer = new ExplorerActions.FixIssue29405Timer(150, this);
      timer.setCoalesce(true);
      timer.setRepeats(false);
    }
    
    public synchronized void propertyChange(PropertyChangeEvent paramPropertyChangeEvent)
    {
      timer.restart();
      planned = true;
    }
    
    public void clipboardChanged(ClipboardEvent paramClipboardEvent)
    {
      final ExplorerManager localExplorerManager = manager;
      if ((!paramClipboardEvent.isConsumed()) && (localExplorerManager != null)) {
        Mutex.EVENT.writeAccess(new Runnable()
        {
          public void run()
          {
            ExplorerActions.this.updatePasteAction(localExplorerManager.getSelectedNodes());
          }
        });
      }
    }
    
    public void actionPerformed(ActionEvent paramActionEvent)
    {
      ExplorerActions.this.updateActions();
      synchronized (this)
      {
        timer.stop();
        planned = false;
      }
    }
    
    public void update()
    {
      boolean bool;
      synchronized (this)
      {
        bool = planned;
        planned = false;
      }
      if (bool)
      {
        timer.stop();
        ExplorerActions.this.updateActions();
      }
    }
  }
  
  private static class FixIssue29405Timer
    extends Timer
  {
    private boolean running;
    
    public FixIssue29405Timer(int paramInt, ActionListener paramActionListener)
    {
      super(paramActionListener);
    }
    
    public void restart()
    {
      super.restart();
      running = true;
    }
    
    public void stop()
    {
      running = false;
      super.stop();
    }
    
    public boolean isRunning()
    {
      return running;
    }
  }
}

/* Location:
 * Qualified Name:     org.openide.explorer.ExplorerActions
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.openide.explorer;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.Timer;
import org.openide.nodes.Node;

class ExplorerPanel$DelayedSetter
  implements ActionListener
{
  private Node[] nodes;
  private Timer timer;
  private boolean firstChange = true;
  private final ExplorerPanel this$0;
  
  ExplorerPanel$DelayedSetter(ExplorerPanel paramExplorerPanel) {}
  
  public void scheduleActivatedNodes(Node[] paramArrayOfNode)
  {
    synchronized (this)
    {
      nodes = paramArrayOfNode;
      if (timer == null)
      {
        timer = new Timer(70, this);
        timer.setCoalesce(true);
        timer.setRepeats(false);
      }
      if (timer.isRunning())
      {
        if (timer.getInitialDelay() < 350) {
          timer.setInitialDelay(timer.getInitialDelay() * 2);
        }
        firstChange = false;
      }
      else
      {
        this$0.setActivatedNodes(paramArrayOfNode);
        firstChange = true;
      }
      timer.restart();
    }
  }
  
  public void actionPerformed(ActionEvent paramActionEvent)
  {
    synchronized (this)
    {
      synchronized (this)
      {
        timer.stop();
      }
    }
    if (!firstChange) {
      this$0.setActivatedNodes(nodes);
    }
  }
}

/* Location:
 * Qualified Name:     org.openide.explorer.ExplorerPanel.DelayedSetter
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.openide.explorer;

import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;

final class ExplorerPanel$PropL
  implements PropertyChangeListener
{
  private final ExplorerPanel this$0;
  
  ExplorerPanel$PropL(ExplorerPanel paramExplorerPanel) {}
  
  public void propertyChange(PropertyChangeEvent paramPropertyChangeEvent)
  {
    if (paramPropertyChangeEvent.getSource() != ExplorerPanel.access$000(this$0)) {
      return;
    }
    if ("selectedNodes".equals(paramPropertyChangeEvent.getPropertyName()))
    {
      if (ExplorerPanel.access$100(this$0)) {
        ExplorerPanel.access$200(this$0, ExplorerPanel.access$000(this$0).getSelectedNodes());
      } else {
        this$0.setActivatedNodes(ExplorerPanel.access$000(this$0).getSelectedNodes());
      }
      return;
    }
    if ("exploredContext".equals(paramPropertyChangeEvent.getPropertyName()))
    {
      this$0.updateTitle();
      
      return;
    }
  }
}

/* Location:
 * Qualified Name:     org.openide.explorer.ExplorerPanel.PropL
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.openide.explorer;

import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
import java.lang.ref.Reference;
import java.lang.ref.WeakReference;
import java.text.MessageFormat;
import java.util.WeakHashMap;
import java.util.prefs.Preferences;
import javax.swing.ActionMap;
import javax.swing.Timer;
import org.openide.nodes.Node;
import org.openide.util.HelpCtx;
import org.openide.util.NbBundle;
import org.openide.util.NbPreferences;
import org.openide.util.WeakListeners;
import org.openide.util.io.NbMarshalledObject;
import org.openide.util.io.SafeException;
import org.openide.windows.TopComponent;
import org.openide.windows.WindowManager;
import org.openide.windows.Workspace;

/**
 * @deprecated
 */
public class ExplorerPanel
  extends TopComponent
  implements ExplorerManager.Provider
{
  static final long serialVersionUID = 5522528786650751459L;
  private static MessageFormat formatExplorerTitle;
  private static final int INIT_DELAY = 70;
  private static final int MAX_DELAY = 350;
  private static Boolean scheduleAcivatedNodes;
  private static WeakHashMap panels = new WeakHashMap();
  private ExplorerManager manager;
  private final transient PropertyChangeListener managerListener = new PropL();
  private ExplorerActions actions;
  private transient DelayedSetter delayedSetter;
  
  public ExplorerPanel(ExplorerManager paramExplorerManager)
  {
    this(paramExplorerManager, null);
  }
  
  public ExplorerPanel()
  {
    this(null, null);
  }
  
  ExplorerPanel(ExplorerManager paramExplorerManager, boolean paramBoolean)
  {
    this(paramExplorerManager, Boolean.valueOf(paramBoolean));
  }
  
  private ExplorerPanel(ExplorerManager paramExplorerManager, Boolean paramBoolean)
  {
    if (paramExplorerManager == null) {
      paramExplorerManager = new ExplorerManager();
    }
    manager = paramExplorerManager;
    panels.put(paramExplorerManager, new WeakReference(this));
    
    setLayout(new BorderLayout());
    initActionMap
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