org-netbeans-modules-favorites

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

class Actions$1 {}

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

import java.beans.PropertyVetoException;
import org.openide.explorer.ExplorerManager;
import org.openide.nodes.Node;

final class Actions$Add$1
  implements Runnable
{
  Actions$Add$1(Tab paramTab, Node[] paramArrayOfNode) {}
  
  public void run()
  {
    try
    {
      val$projectsTab.getExplorerManager().setExploredContextAndSelection(val$toSelect[0], val$toSelect);
    }
    catch (PropertyVetoException localPropertyVetoException) {}
  }
}

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

import java.beans.PropertyVetoException;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.ResourceBundle;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.Action;
import javax.swing.JFileChooser;
import javax.swing.SwingUtilities;
import org.netbeans.modules.favorites.api.Favorites;
import org.openide.DialogDisplayer;
import org.openide.NotifyDescriptor;
import org.openide.explorer.ExplorerManager;
import org.openide.filesystems.FileObject;
import org.openide.filesystems.FileStateInvalidException;
import org.openide.filesystems.FileSystem;
import org.openide.filesystems.FileUtil;
import org.openide.filesystems.URLMapper;
import org.openide.loaders.DataFolder;
import org.openide.loaders.DataObject;
import org.openide.loaders.DataObjectNotFoundException;
import org.openide.loaders.DataShadow;
import org.openide.nodes.Children;
import org.openide.nodes.Node;
import org.openide.util.HelpCtx;
import org.openide.util.NbBundle;
import org.openide.util.actions.NodeAction;
import org.openide.windows.WindowManager;

public class Actions$Add
  extends NodeAction
{
  static final long serialVersionUID = -6471281373153172312L;
  private static final Add ADD = new Add();
  
  public static Action getDefault()
  {
    return ADD;
  }
  
  private Actions$Add()
  {
    putValue("noIconInMenu", Boolean.TRUE);
  }
  
  public boolean enable(Node[] paramArrayOfNode)
  {
    if ((paramArrayOfNode == null) || (paramArrayOfNode.length == 0)) {
      return false;
    }
    if ((paramArrayOfNode.length == 1) && ((paramArrayOfNode[0] instanceof FavoritesNode))) {
      return true;
    }
    for (int i = 0; i < paramArrayOfNode.length; i++)
    {
      DataObject localDataObject = (DataObject)paramArrayOfNode[i].getCookie(DataObject.class);
      if (!isAllowed(localDataObject)) {
        return false;
      }
    }
    return true;
  }
  
  public String getName()
  {
    return NbBundle.getMessage(Actions.class, "ACT_Add");
  }
  
  public HelpCtx getHelpCtx()
  {
    return new HelpCtx(Add.class);
  }
  
  protected void performAction(Node[] paramArrayOfNode)
  {
    try
    {
      Object localObject2;
      Object localObject1;
      if ((paramArrayOfNode.length == 1) && ((paramArrayOfNode[0] instanceof FavoritesNode)))
      {
        localObject2 = chooseFileObject();
        if (localObject2 == null) {
          return;
        }
        localObject1 = Collections.singletonList(DataObject.find((FileObject)localObject2));
      }
      else
      {
        localObject1 = new ArrayList();
        for (Object localObject3 : paramArrayOfNode)
        {
          DataObject localDataObject = (DataObject)((Node)localObject3).getCookie(DataObject.class);
          if (localDataObject != null) {
            ((List)localObject1).add(localDataObject);
          }
        }
      }
      addToFavorites((List)localObject1);
    }
    catch (DataObjectNotFoundException localDataObjectNotFoundException)
    {
      Actions.access$000().log(Level.WARNING, null, localDataObjectNotFoundException);
    }
  }
  
  private static FileObject chooseFileObject()
  {
    FileObject localFileObject = null;
    File localFile1 = null;
    JFileChooser localJFileChooser = new JFileChooser();
    localJFileChooser.setFileSelectionMode(2);
    localJFileChooser.setDialogTitle(NbBundle.getBundle(Actions.class).getString("CTL_DialogTitle"));
    localJFileChooser.setApproveButtonText(NbBundle.getBundle(Actions.class).getString("CTL_ApproveButtonText"));
    if (Actions.access$100() != null) {
      localJFileChooser.setCurrentDirectory(Actions.access$100());
    }
    int i = localJFileChooser.showOpenDialog(WindowManager.getDefault().getMainWindow());
    if (i == 0)
    {
      localFile1 = localJFileChooser.getSelectedFile();
      File localFile2 = FileUtil.normalizeFile(localFile1);
      if ((!localFile2.exists()) && 
        (localFile2.getParentFile() != null) && (localFile2.getParentFile().exists()) && 
        (localFile2.getName().equals(localFile2.getParentFile().getName()))) {
        localFile2 = localFile2.getParentFile();
      }
      if (!new File(localFile2, "").exists())
      {
        String str1 = NbBundle.getMessage(Actions.class, "ERR_FileDoesNotExist", localFile2.getPath());
        String str2 = NbBundle.getMessage(Actions.class, "ERR_FileDoesNotExistDlgTitle");
        DialogDisplayer.getDefault().notify(new NotifyDescriptor(str1, str2, -1, 1, new Object[] { NotifyDescriptor.CLOSED_OPTION }, NotifyDescriptor.OK_OPTION));
      }
      else
      {
        localFileObject = FileUtil.toFileObject(localFile2);
        assert (localFileObject != null);
      }
    }
    Actions.access$102(localJFileChooser.getCurrentDirectory());
    return localFileObject;
  }
  
  public static void selectAfterAddition(DataObject paramDataObject)
  {
    Tab localTab = Tab.findDefault();
    localTab.open();
    localTab.requestActive();
    if (paramDataObject != null)
    {
      Node[] arrayOfNode1 = localTab.getExplorerManager().getRootContext().getChildren().getNodes(true);
      final Node[] arrayOfNode2 = new Node[1];
      int i = 0;
      for (int j = 0; j < arrayOfNode1.length; j++) {
        if (paramDataObject.getName().equals(arrayOfNode1[j].getName()))
        {
          arrayOfNode2[0] = arrayOfNode1[j];
          i = 1;
          break;
        }
      }
      if (i != 0) {
        SwingUtilities.invokeLater(new Runnable()
        {
          public void run()
          {
            try
            {
              val$projectsTab.getExplorerManager().setExploredContextAndSelection(arrayOfNode2[0], arrayOfNode2);
            }
            catch (PropertyVetoException localPropertyVetoException) {}
          }
        });
      }
    }
  }
  
  static DataObject createShadows(DataFolder paramDataFolder, List<DataObject> paramList1, List<DataObject> paramList2)
  {
    DataShadow localDataShadow = null;
    for (DataObject localDataObject : paramList1) {
      try
      {
        if (localDataShadow == null)
        {
          localDataShadow = localDataObject.createShadow(paramDataFolder);
          paramList2.add(localDataShadow);
        }
        else
        {
          paramList2.add(localDataObject.createShadow(paramDataFolder));
        }
      }
      catch (IOException localIOException)
      {
        Actions.access$000().log(Level.WARNING, null, localIOException);
      }
    }
    return localDataShadow;
  }
  
  public static void reorderAfterAddition(DataFolder paramDataFolder, DataObject[] paramArrayOfDataObject, List<? extends DataObject> paramList)
  {
    ArrayList localArrayList = new ArrayList();
    if (paramList.size() > 0)
    {
      DataObject localDataObject = null;
      for (int i = 0; i < paramArrayOfDataObject.length; i++)
      {
        FileObject localFileObject = paramArrayOfDataObject[i].getPrimaryFile();
        if ("Favorites/Root.instance".equals(localFileObject.getPath())) {
          localDataObject = paramArrayOfDataObject[i];
        }
      }
      if (localDataObject != null)
      {
        for (i = 0; i < paramArrayOfDataObject.length; i++) {
          if (!localDataObject.equals(paramArrayOfDataObject[i])) {
            localArrayList.add(paramArrayOfDataObject[i]);
          }
        }
        localArrayList.addAll(paramList);
        localArrayList.add(localDataObject);
      }
      else
      {
        for (i = 0; i < paramArrayOfDataObject.length; i++) {
          localArrayList.add(paramArrayOfDataObject[i]);
        }
        localArrayList.addAll(paramList);
      }
      DataObject[] arrayOfDataObject = (DataObject[])localArrayList.toArray(new DataObject[localArrayList.size()]);
      try
      {
        paramDataFolder.setOrder(arrayOfDataObject);
      }
      catch (IOException localIOException)
      {
        Actions.access$000().log(Level.WARNING, null, localIOException);
      }
    }
  }
  
  protected boolean asynchronous()
  {
    return false;
  }
  
  static void addToFavorites(List<DataObject> paramList)
  {
    DataFolder localDataFolder = FavoritesNode.getFolder();
    DataObject[] arrayOfDataObject = localDataFolder.getChildren();
    ArrayList localArrayList = new ArrayList();
    DataObject localDataObject = createShadows(localDataFolder, paramList, localArrayList);
    
    reorderAfterAddition(localDataFolder, arrayOfDataObject, localArrayList);
    selectAfterAddition(localDataObject);
  }
  
  static boolean isAllowed(DataObject paramDataObject)
  {
    if (paramDataObject == null) {
      return false;
    }
    FileObject localFileObject = paramDataObject.getPrimaryFile();
    if (localFileObject != null)
    {
      if (URLMapper.findURL(localFileObject, 1) == null) {
        return false;
      }
      if (Favorites.getDefault().isInFavorites(localFileObject)) {
        return false;
      }
      File localFile = FileUtil.toFile(localFileObject);
      if ((localFile != null) && 
        (localFile.getParent() == null)) {
        return false;
      }
    }
    try
    {
      if (paramDataObject.getPrimaryFile().getFileSystem().isDefault()) {
        return false;
      }
    }
    catch (FileStateInvalidException localFileStateInvalidException)
    {
      return false;
    }
    return true;
  }
}

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

import javax.swing.Action;
import org.openide.util.NbBundle;

public class Actions$AddOnFavoritesNode
  extends Actions.Add
{
  static final long serialVersionUID = -6471284573153172312L;
  
  public Actions$AddOnFavoritesNode()
  {
    super(null);
  }
  
  private static final AddOnFavoritesNode ADD_ON_FAVORITES_NODE = new AddOnFavoritesNode();
  
  public static Action getDefault()
  {
    return ADD_ON_FAVORITES_NODE;
  }
  
  public String getName()
  {
    return NbBundle.getMessage(Actions.class, "ACT_AddOnFavoritesNode");
  }
}

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

import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.Action;
import org.openide.loaders.DataObject;
import org.openide.nodes.Node;
import org.openide.util.HelpCtx;
import org.openide.util.NbBundle;
import org.openide.util.actions.NodeAction;

class Actions$Remove
  extends NodeAction
{
  static final long serialVersionUID = -6471281373153172312L;
  private static final Remove REMOVE = new Remove();
  
  public static Action getDefault()
  {
    return REMOVE;
  }
  
  public boolean enable(Node[] paramArrayOfNode)
  {
    if ((paramArrayOfNode == null) || (paramArrayOfNode.length == 0)) {
      return false;
    }
    for (int i = 0; i < paramArrayOfNode.length; i++)
    {
      DataObject localDataObject = (DataObject)paramArrayOfNode[i].getCookie(DataObject.class);
      if ((localDataObject == null) || (localDataObject.getFolder() != FavoritesNode.getFolder())) {
        return false;
      }
    }
    return true;
  }
  
  public String getName()
  {
    return NbBundle.getMessage(Actions.class, "ACT_Remove");
  }
  
  public HelpCtx getHelpCtx()
  {
    return new HelpCtx(Remove.class);
  }
  
  protected void performAction(Node[] paramArrayOfNode)
  {
    for (int i = 0; i < paramArrayOfNode.length; i++)
    {
      DataObject localDataObject = (DataObject)paramArrayOfNode[i].getCookie(DataObject.class);
      if ((localDataObject != null) && (localDataObject.getFolder() == FavoritesNode.getFolder())) {
        try
        {
          localDataObject.delete();
        }
        catch (IOException localIOException)
        {
          Actions.access$000().log(Level.WARNING, null, localIOException);
        }
      }
    }
  }
  
  protected boolean asynchronous()
  {
    return false;
  }
}

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

import javax.swing.Action;
import javax.swing.JMenuItem;
import org.openide.loaders.DataObject;
import org.openide.nodes.Node;
import org.openide.util.HelpCtx;
import org.openide.util.NbBundle;
import org.openide.util.actions.NodeAction;

class Actions$Select
  extends NodeAction
{
  private static final Select SELECT = new Select();
  
  public static Action getDefault()
  {
    return SELECT;
  }
  
  private Actions$Select()
  {
    putValue("noIconInMenu", Boolean.TRUE);
  }
  
  protected void performAction(Node[] paramArrayOfNode)
  {
    Tab localTab = Tab.findDefault();
    localTab.open();
    localTab.requestActive();
    localTab.doSelectNode((DataObject)paramArrayOfNode[0].getCookie(DataObject.class));
  }
  
  protected boolean enable(Node[] paramArrayOfNode)
  {
    if (paramArrayOfNode.length != 1) {
      return false;
    }
    DataObject localDataObject = (DataObject)paramArrayOfNode[0].getCookie(DataObject.class);
    if (localDataObject == null) {
      return false;
    }
    return true;
  }
  
  public String getName()
  {
    return NbBundle.getMessage(Select.class, "ACT_Select_Main_Menu");
  }
  
  public JMenuItem getPopupPresenter()
  {
    JMenuItem localJMenuItem = super.getPopupPresenter();
    localJMenuItem.setText(NbBundle.getMessage(Select.class, "ACT_Select"));
    return localJMenuItem;
  }
  
  protected String iconResource()
  {
    return "org/netbeans/modules/favorites/resources/actionView.png";
  }
  
  public HelpCtx getHelpCtx()
  {
    return null;
  }
  
  protected boolean asynchronous()
  {
    return false;
  }
}

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

import java.awt.Image;
import java.awt.event.ActionEvent;
import javax.swing.AbstractAction;
import javax.swing.Action;
import javax.swing.ImageIcon;
import org.openide.util.HelpCtx;
import org.openide.util.HelpCtx.Provider;
import org.openide.util.ImageUtilities;
import org.openide.util.NbBundle;
import org.openide.windows.TopComponent;

class Actions$View
  extends AbstractAction
  implements HelpCtx.Provider
{
  private static final View VIEW = new View();
  
  public Actions$View()
  {
    putValue("Name", NbBundle.getMessage(Actions.class, "ACT_View"));
    
    Image localImage = ImageUtilities.loadImage("org/netbeans/modules/favorites/resources/actionView.png");
    putValue("SmallIcon", localImage != null ? new ImageIcon(localImage) : null);
  }
  
  public static Action getDefault()
  {
    return VIEW;
  }
  
  public void actionPerformed(ActionEvent paramActionEvent)
  {
    Tab localTab = Tab.findDefault();
    localTab.open();
    localTab.requestActive();
  }
  
  public HelpCtx getHelpCtx()
  {
    return new HelpCtx(View.class);
  }
}

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

import java.awt.Image;
import java.awt.event.ActionEvent;
import java.beans.PropertyVetoException;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.ResourceBundle;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.AbstractAction;
import javax.swing.Action;
import javax.swing.ImageIcon;
import javax.swing.JFileChooser;
import javax.swing.JMenuItem;
import javax.swing.SwingUtilities;
import org.netbeans.modules.favorites.api.Favorites;
import org.openide.DialogDisplayer;
import org.openide.NotifyDescriptor;
import org.openide.explorer.ExplorerManager;
import org.openide.filesystems.FileObject;
import org.openide.filesystems.FileStateInvalidException;
import org.openide.filesystems.FileSystem;
import org.openide.filesystems.FileUtil;
import org.openide.filesystems.URLMapper;
import org.openide.loaders.DataFolder;
import org.openide.loaders.DataObject;
import org.openide.loaders.DataObjectNotFoundException;
import org.openide.loaders.DataShadow;
import org.openide.nodes.Children;
import org.openide.nodes.Node;
import org.openide.util.HelpCtx;
import org.openide.util.HelpCtx.Provider;
import org.openide.util.ImageUtilities;
import org.openide.util.NbBundle;
import org.openide.util.actions.NodeAction;
import org.openide.windows.TopComponent;
import org.openide.windows.WindowManager;

public final class Actions
{
  private static File currentDir = null;
  private static final Logger LOG = Logger.getLogger(Actions.class.getName());
  
  public static Action view()
  {
    return View.getDefault();
  }
  
  public static Action add()
  {
    return Add.getDefault();
  }
  
  public static Action addOnFavoritesNode()
  {
    return AddOnFavoritesNode.getDefault();
  }
  
  public static Action remove()
  {
    return Remove.getDefault();
  }
  
  public static Action select()
  {
    return Select.getDefault();
  }
  
  private static class View
    extends AbstractAction
    implements HelpCtx.Provider
  {
    private static final View VIEW = new View();
    
    public View()
    {
      putValue("Name", NbBundle.getMessage(Actions.class, "ACT_View"));
      
      Image localImage = ImageUtilities.loadImage("org/netbeans/modules/favorites/resources/actionView.png");
      putValue("SmallIcon", localImage != null ? new ImageIcon(localImage) : null);
    }
    
    public static Action getDefault()
    {
      return VIEW;
    }
    
    public void actionPerformed(ActionEvent paramActionEvent)
    {
      Tab localTab = Tab.findDefault();
      localTab.open();
      localTab.requestActive();
    }
    
    public HelpCtx getHelpCtx()
    {
      return new HelpCtx(View.class);
    }
  }
  
  private static class Select
    extends NodeAction
  {
    private static final Select SELECT = new Select();
    
    public static Action getDefault()
    {
      return SELECT;
    }
    
    private Select()
    {
      putValue("noIconInMenu", Boolean.TRUE);
    }
    
    protected void performAction(Node[] paramArrayOfNode)
    {
      Tab localTab = Tab.findDefault();
      localTab.open();
      localTab.requestActive();
      localTab.doSelectNode((DataObject)paramArrayOfNode[0].getCookie(DataObject.class));
    }
    
    protected boolean enable(Node[] paramArrayOfNode)
    {
      if (paramArrayOfNode.length != 1) {
        return false;
      }
      DataObject localDataObject = (DataObject)paramArrayOfNode[0].getCookie(DataObject.class);
      if (localDataObject == null) {
        return false;
      }
      return true;
    }
    
    public String getName()
    {
      return NbBundle.getMessage(Select.class, "ACT_Select_Main_Menu");
    }
    
    public JMenuItem getPopupPresenter()
    {
      JMenuItem localJMenuItem = super.getPopupPresenter();
      localJMenuItem.setText(NbBundle.getMessage(Select.class, "ACT_Select"));
      return localJMenuItem;
    }
    
    protected String iconResource()
    {
      return "org/netbeans/modules/favorites/resources/actionView.png";
    }
    
    public HelpCtx getHelpCtx()
    {
      return null;
    }
    
    protected boolean asynchronous()
    {
      return false;
    }
  }
  
  private static class Remove
    extends NodeAction
  {
    static final long serialVersionUID = -6471281373153172312L;
    private static final Remove REMOVE = new Remove();
    
    public static Action getDefault()
    {
      return REMOVE;
    }
    
    public boolean enable(Node[] paramArrayOfNode)
    {
      if ((paramArrayOfNode == null) || (paramArrayOfNode.length == 0)) {
        return false;
      }
      for (int i = 0; i < paramArrayOfNode.length; i++)
      {
        DataObject localDataObject = (DataObject)paramArrayOfNode[i].getCookie(DataObject.class);
        if ((localDataObject == null) || (localDataObject.getFolder() != FavoritesNode.getFolder())) {
          return false;
        }
      }
      return true;
    }
    
    public String getName()
    {
      return NbBundle.getMessage(Actions.class, "ACT_Remove");
    }
    
    public HelpCtx getHelpCtx()
    {
      return new HelpCtx(Remove.class);
    }
    
    protected void performAction(Node[] paramArrayOfNode)
    {
      for (int i = 0; i < paramArrayOfNode.length; i++)
      {
        DataObject localDataObject = (DataObject)paramArrayOfNode[i].getCookie(DataObject.class);
        if ((localDataObject != null) && (localDataObject.getFolder() == FavoritesNode.getFolder())) {
          try
          {
            localDataObject.delete();
          }
          catch (IOException localIOException)
          {
            Actions.LOG.log(Level.WARNING, null, localIOException);
          }
        }
      }
    }
    
    protected boolean asynchronous()
    {
      return false;
    }
  }
  
  public static class Add
    extends NodeAction
  {
    static final long serialVersionUID = -6471281373153172312L;
    private static final Add ADD = new Add();
    
    public static Action getDefault()
    {
      return ADD;
    }
    
    private Add()
    {
      putValue("noIconInMenu", Boolean.TRUE);
    }
    
    public boolean enable(Node[] paramArrayOfNode)
    {
      if ((paramArrayOfNode == null) || (paramArrayOfNode.length == 0)) {
        return false;
      }
      if ((paramArrayOfNode.length == 1) && ((paramArrayOfNode[0] instanceof FavoritesNode))) {
        return true;
      }
      for (int i = 0; i < paramArrayOfNode.length; i++)
      {
        DataObject localDataObject = (DataObject)paramArrayOfNode[i].getCookie(DataObject.class);
        if (!isAllowed(localDataObject)) {
          return false;
        }
      }
      return true;
    }
    
    public String getName()
    {
      return NbBundle.getMessage(Actions.class, "ACT_Add");
    }
    
    public HelpCtx getHelpCtx()
    {
      return new HelpCtx(Add.class);
    }
    
    protected void performAction(Node[] paramArrayOfNode)
    {
      try
      {
        Object localObject2;
        Object localObject1;
        if ((paramArrayOfNode.length == 1) && ((paramArrayOfNode[0] instanceof FavoritesNode)))
        {
          localObject2 = chooseFileObject();
          if (localObject2 == null) {
            return;
          }
          localObject1 = Collections.singletonList(DataObject.find((FileObject)localObject2));
        }
        else
        {
          localObject1 = new ArrayList();
          for (Object localObject3 : paramArrayOfNode)
          {
            DataObject localDataObject = (DataObject)((Node)localObject3).getCookie(DataObject.class);
            if (localDataObject != null) {
              ((List)localObject1).add(localDataObject);
            }
          }
        }
        addToFavorites((List)localObject1);
      }
      catch (DataObjectNotFoundException localDataObjectNotFoundException)
      {
        Actions.LOG.log(Level.WARNING, null, localDataObjectNotFoundException);
      }
    }
    
    private static FileObject chooseFileObject()
    {
      FileObject localFileObject = null;
      File localFile1 = null;
      JFileChooser localJFileChooser = new JFileChooser();
      localJFileChooser.setFileSelectionMode(2);
      localJFileChooser.setDialogTitle(NbBundle.getBundle(Actions.class).getString("CTL_DialogTitle"));
      localJFileChooser.setApproveButtonText(NbBundle.getBundle(Actions.class).getString("CTL_ApproveButtonText"));
      if (Actions.currentDir != null) {
        localJFileChooser.setCurrentDirectory(Actions.currentDir);
      }
      int i = localJFileChooser.showOpenDialog(WindowManager.getDefault().getMainWindow());
      if (i == 0)
      {
        localFile1 = localJFileChooser.getSelectedFile();
        File localFile2 = FileUtil.normalizeFile(localFile1);
        if ((!localFile2.exists()) && 
          (localFile2.getParentFile() != null) && (localFile2.getParentFile().exists()) && 
          (localFile2.getName().equals(localFile2.getParentFile().getName()))) {
          localFile2 = localFile2.getParentFile();
        }
        if (!new File(localFile2, "").exists())
        {
          String str1 = NbBundle.getMessage(Actions.class, "ERR_FileDoesNotExist", localFile2.getPath());
          String str2 = NbBundle.getMessage(Actions.class, "ERR_FileDoesNotExistDlgTitle");
          DialogDisplayer.getDefault().notify(new NotifyDescriptor(str1, str2, -1, 1, new Object[] { NotifyDescriptor.CLOSED_OPTION }, NotifyDescriptor.OK_OPTION));
        }
        else
        {
          localFileObject = FileUtil.toFileObject(localFile2);
          assert (localFileObject != null);
        }
      }
      Actions.access$102(localJFileChooser.getCurrentDirectory());
      return localFileObject;
    }
    
    public static void selectAfterAddition(DataObject paramDataObject)
    {
      Tab localTab = Tab.findDefault();
      localTab.open();
      localTab.requestActive();
      if (paramDataObject != null)
      {
        Node[] arrayOfNode1 = localTab.getExplorerManager().getRootContext().getChildren().getNodes(true);
        final Node[] arrayOfNode2 = new Node[1];
        int i = 0;
        for (int j = 0; j < arrayOfNode1.length; j++) {
          if (paramDataObject.getName().equals(arrayOfNode1[j].getName()))
          {
            arrayOfNode2[0] = arrayOfNode1[j];
            i = 1;
            break;
          }
        }
        if (i != 0) {
          SwingUtilities.invokeLater(new Runnable()
          {
            public void run()
            {
              try
              {
                val$projectsTab.getExplorerManager().setExploredContextAndSelection(arrayOfNode2[0], arrayOfNode2);
              }
              catch (PropertyVetoException localPropertyVetoException) {}
            }
          });
        }
      }
    }
    
    static DataObject createShadows(DataFolder paramDataFolder, List<DataObject> paramList1, List<DataObject> paramList2)
    {
      DataShadow localDataShadow = null;
      for (DataObject localDataObject : paramList1) {
        try
        {
          if (localDataShadow == null)
          {
            localDataShadow = localDataObject.createShadow(paramDataFolder);
            paramList2.add(localDataShadow);
          }
          else
          {
            paramList2.add(localDataObject.createShadow(paramDataFolder));
          }
        }
        catch (IOException localIOException)
        {
          Actions.LOG.log(Level.WARNING, null, localIOException);
        }
      }
      return localDataShadow;
    }
    
    public static void reorderAfterAddition(DataFolder paramDataFolder, DataObject[] paramArrayOfDataObject, List<? extends DataObject> paramList)
    {
      ArrayList localArrayList = new ArrayList();
      if (paramList.size() > 0)
      {
        DataObject localDataObject = null;
        for (int i = 0; i < paramArrayOfDataObject.length; i++)
        {
          FileObject localFileObject = paramArrayOfDataObject[i].getPrimaryFile();
          if ("Favorites/Root.instance".equals(localFileObject.getPath())) {
            localDataObject = paramArrayOfDataObject[i];
          }
        }
        if (localDataObject != null)
        {
          for (i = 0; i < paramArrayOfDataObject.length; i++) {
            if (!localDataObject.equals(paramArrayOfDataObject[i])) {
              localArrayList.add(paramArrayOfDataObject[i]);
            }
          }
          localArrayList.addAll(paramList);
          localArrayList.add(localDataObject);
        }
        else
        {
          for (i = 0; i < paramArrayOfDataObject.length; i++) {
            localArrayList.add(paramArrayOfDataObject[i]);
          }
          localArrayList.addAll(paramList);
        }
        DataObject[] arrayOfDataObject = (DataObject[])localArrayList.toArray(new DataObject[localArrayList.size()]);
        try
        {
          paramDataFolder.setOrder(arrayOfDataObject);
        }
        catch (IOException localIOException)
        {
          Actions.LOG.log(Level.WARNING, null, localIOException);
        }
      }
    }
    
    protected boolean asynchronous()
    {
      return false;
    }
    
    static void addToFavorites(List<DataObject> paramList)
    {
      DataFolder localDataFolder = FavoritesNode.getFolder();
      DataObject[] arrayOfDataObject = localDataFolder.getChildren();
      ArrayList localArrayList = new ArrayList();
      DataObject localDataObject = createShadows(localDataFolder, paramList, localArrayList);
      
      reorderAfterAddition(localDataFolder, arrayOfDataObject, localArrayList);
      selectAfterAddition(localDataObject);
    }
    
    static boolean isAllowed(DataObject paramDataObject)
    {
      if (paramDataObject == null) {
        return false;
      }
      FileObject localFileObject = paramDataObject.getPrimaryFile();
      if (localFileObject != null)
      {
        if (URLMapper.findURL(localFileObject, 1) == null) {
          return false;
        }
        if (Favorites.getDefault().isInFavorites(localFileObject)) {
          return false;
        }
        File localFile = FileUtil.toFile(localFileObject);
        if ((localFile != null) && 
          (localFile.getParent() == null)) {
          return false;
        }
      }
      try
      {
        if (paramDataObject.getPrimaryFile().getFileSystem().isDefault()) {
          return false;
        }
      }
      catch (FileStateInvalidException localFileStateInvalidException)
      {
        return false;
      }
      return true;
    }
  }
  
  public static class AddOnFavoritesNode
    extends Actions.Add
  {
    static final long serialVersionUID = -6471284573153172312L;
    
    public AddOnFavoritesNode()
    {
      super();
    }
    
    private static final AddOnFavoritesNode ADD_ON_FAVORITES_NODE = new AddOnFavoritesNode();
    
    public static Action getDefault()
    {
      return ADD_ON_FAVORITES_NODE;
    }
    
    public String getName()
    {
      return NbBundle.getMessage(Actions.class, "ACT_AddOnFavoritesNode");
    }
  }
}

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

class FavoritesNode$1 {}

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

import org.netbeans.api.queries.VisibilityQuery;
import org.openide.loaders.DataFolder;
import org.openide.loaders.DataObject;
import org.openide.nodes.Children;
import org.openide.nodes.FilterNode;
import org.openide.nodes.FilterNode.Children;
import org.openide.nodes.Node;
import org.openide.util.Lookup;

class FavoritesNode$Chldrn
  extends FilterNode.Children
{
  private boolean hideHidden;
  
  public FavoritesNode$Chldrn(Node paramNode, boolean paramBoolean)
  {
    super(paramNode);
    hideHidden = paramBoolean;
  }
  
  protected Node[] createNodes(Node paramNode)
  {
    Object localObject = FilterNode.Children.LEAF;
    DataObject localDataObject = (DataObject)paramNode.getLookup().lookup(DataObject.class);
    if ((hideHidden) && 
      (localDataObject != null) && (!VisibilityQuery.getDefault().isVisible(localDataObject.getPrimaryFile()))) {
      return null;
    }
    DataFolder localDataFolder = (DataFolder)paramNode.getLookup().lookup(DataFolder.class);
    if (localDataFolder != null) {
      localObject = new Chldrn(new FilterNode(paramNode, localDataFolder.createNodeChildren(new FavoritesNode.VisQ())), true);
    } else if (paramNode.isLeaf()) {
      localObject = Children.LEAF;
    } else {
      localObject = new Chldrn(paramNode, true);
    }
    return new Node[] { new FavoritesNode.ProjectFilterNode(paramNode, (Children)localObject) };
  }
}

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

import java.awt.datatransfer.Transferable;
import java.io.IOException;
import java.util.Arrays;
import org.openide.loaders.DataObject;
import org.openide.util.datatransfer.PasteType;

class FavoritesNode$FavoritesPasteType
  extends PasteType
{
  private final DataObject[] dos;
  
  private FavoritesNode$FavoritesPasteType(DataObject[] paramArrayOfDataObject)
  {
    dos = paramArrayOfDataObject;
  }
  
  public Transferable paste()
    throws IOException
  {
    Actions.Add.addToFavorites(Arrays.asList(dos));
    return null;
  }
}

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

import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import javax.swing.Action;
import org.openide.actions.CopyAction;
import org.openide.actions.CutAction;
import org.openide.actions.DeleteAction;
import org.openide.filesystems.FileObject;
import org.openide.filesystems.FileUtil;
import org.openide.loaders.DataFolder;
import org.openide.loaders.DataObject;
import org.openide.loaders.DataShadow;
import org.openide.nodes.Children;
import org.openide.nodes.FilterNode;
import org.openide.nodes.Node;
import org.openide.util.Exceptions;
import org.openide.util.NbBundle;

class FavoritesNode$ProjectFilterNode
  extends FilterNode
{
  public FavoritesNode$ProjectFilterNode(Node paramNode, Children paramChildren)
  {
    super(paramNode, paramChildren);
  }
  
  public void setName(String paramString)
  {
    DataFolder localDataFolder = FavoritesNode.getFolder();
    DataObject[] arrayOfDataObject = localDataFolder.getChildren();
    super.setName(paramString);
    try
    {
      localDataFolder.setOrder(arrayOfDataObject);
    }
    catch (IOException localIOException)
    {
      Exceptions.printStackTrace(localIOException);
    }
  }
  
  public String getDisplayName()
  {
    if (FavoritesNode.getNode().equals(getParentNode()))
    {
      DataShadow localDataShadow = (DataShadow)getCookie(DataShadow.class);
      if (localDataShadow != null)
      {
        String str1 = localDataShadow.getName();
        String str2 = FileUtil.getFileDisplayName(localDataShadow.getOriginal().getPrimaryFile());
        return NbBundle.getMessage(FavoritesNode.class, "CTL_DisplayNameTemplate", str1, str2);
      }
      return super.getDisplayName();
    }
    return super.getDisplayName();
  }
  
  public String getHtmlDisplayName()
  {
    if (FavoritesNode.getNode().equals(getParentNode()))
    {
      DataShadow localDataShadow = (DataShadow)getCookie(DataShadow.class);
      if (localDataShadow != null)
      {
        String str1 = localDataShadow.getName();
        String str2 = FileUtil.getFileDisplayName(localDataShadow.getOriginal().getPrimaryFile());
        return NbBundle.getMessage(FavoritesNode.class, "CTL_DisplayNameTemplateHtml", str1, str2);
      }
      return super.getDisplayName();
    }
    return getOriginal().getHtmlDisplayName();
  }
  
  protected Node getOriginal()
  {
    return super.getOriginal();
  }
  
  public boolean canDestroy()
  {
    boolean bool = super.canDestroy();
    DataShadow localDataShadow = (DataShadow)getCookie(DataShadow.class);
    if ((bool) && (isDeleteOriginal(localDataShadow))) {
      bool = localDataShadow.getOriginal().isDeleteAllowed();
    }
    return bool;
  }
  
  public void destroy()
    throws IOException
  {
    if (canDestroy())
    {
      DataShadow localDataShadow = (DataShadow)getCookie(DataShadow.class);
      Object localObject = isDeleteOriginal(localDataShadow) ? localDataShadow.getOriginal() : null;
      
      super.destroy();
      if (localObject != null) {
        ((DataObject)localObject).delete();
      }
    }
  }
  
  private boolean isDeleteOriginal(DataShadow paramDataShadow)
  {
    return false;
  }
  
  public Action[] getActions(boolean paramBoolean)
  {
    Action[] arrayOfAction = super.getActions(paramBoolean);
    
    int i = 0;
    DataObject localDataObject = (DataObject)getCookie(DataObject.class);
    Object localObject;
    if (localDataObject != null)
    {
      localObject = localDataObject.getPrimaryFile();
      if (localObject != null)
      {
        File localFile = FileUtil.toFile((FileObject)localObject);
        if ((localFile != null) && 
          (localFile.getParent() == null)) {
          i = 1;
        }
      }
    }
    if (i != 0) {
      return createActionsForRoot(arrayOfAction);
    }
    if (FavoritesNode.getNode().equals(getParentNode()))
    {
      localObject = (DataShadow)getCookie(DataShadow.class);
      if (localObject != null)
      {
        if (((DataShadow)localObject).getOriginal().getPrimaryFile().isFolder()) {
          return createActionsForFavoriteFolder(arrayOfAction);
        }
        return createActionsForFavoriteFile(arrayOfAction);
      }
    }
    else
    {
      localObject = (DataObject)getCookie(DataObject.class);
      if (localObject != null)
      {
        if (((DataObject)localObject).getPrimaryFile().isFolder()) {
          return createActionsForFolder(arrayOfAction);
        }
        return createActionsForFile(arrayOfAction);
      }
    }
    return arrayOfAction;
  }
  
  private Action[] createActionsForRoot(Action[] paramArrayOfAction)
  {
    return paramArrayOfAction;
  }
  
  private Action[] createActionsForFavoriteFolder(Action[] paramArrayOfAction)
  {
    int i = 0;
    ArrayList localArrayList = new ArrayList();
    for (int j = 0; j < paramArrayOfAction.length; j++)
    {
      if ((i == 0) && (((paramArrayOfAction[j] instanceof CopyAction)) || ((paramArrayOfAction[j] instanceof CutAction))))
      {
        i = 1;
        localArrayList.add(Actions.remove());
        localArrayList.add(null);
      }
      if (!(paramArrayOfAction[j] instanceof DeleteAction)) {
        localArrayList.add(paramArrayOfAction[j]);
      }
    }
    if (i == 0)
    {
      i = 1;
      localArrayList.add(null);
      localArrayList.add(Actions.remove());
    }
    return (Action[])localArrayList.toArray(new Action[localArrayList.size()]);
  }
  
  private Action[] createActionsForFavoriteFile(Action[] paramArrayOfAction)
  {
    int i = 0;
    ArrayList localArrayList = new ArrayList();
    for (int j = 0; j < paramArrayOfAction.length; j++)
    {
      if ((i == 0) && (((paramArrayOfAction[j] instanceof CopyAction)) || ((paramArrayOfAction[j] instanceof CutAction))))
      {
        i = 1;
        localArrayList.add(Actions.remove());
        localArrayList.add(null);
      }
      if (!(paramArrayOfAction[j] instanceof DeleteAction)) {
    
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