/**
   * The constructor constructs all of the elements of this <tt>AbstractPaneItem</tt>.
   *
   * @param key the key for this <tt>AbstractPaneItem</tt> that the superclass uses to generate
   *     strings
   */
  public SharedDirPaneItem() {
    super(TITLE, LABEL);

    sharingPanel.setFileFilter(
        new FileFilter() {
          //		    private final FileManager fileManager = GuiCoreMediator.getFileManager();
          public boolean accept(File pathname) {
            return true;
            //                return fileManager.isFolderShareable(pathname, false);
          }
        });
    sharingPanel.getTree().setRootVisible(false);
    sharingPanel.getTree().setShowsRootHandles(true);

    JPanel buttonPanel = new JPanel(new BorderLayout());
    buttonPanel.setBorder(new EmptyBorder(0, 4, 0, 0));
    JPanel buttons = new JPanel(new BorderLayout());
    buttons.add(
        new JButton(new SelectSharedDirectoryAction(sharingPanel, sharingPanel)),
        BorderLayout.NORTH);
    buttons.add(Box.createVerticalStrut(4), BorderLayout.CENTER);
    buttons.add(new JButton(new RemoveSharedDirectoryAction(sharingPanel)), BorderLayout.SOUTH);
    buttonPanel.add(buttons, BorderLayout.NORTH);
    sharingPanel.addEastPanel(buttonPanel);
    add(sharingPanel);
  }
 /**
  * Defines the abstract method in <tt>AbstractPaneItem</tt>.
  *
  * <p>Sets the options for the fields in this <tt>PaneItem</tt> when the window is shown.
  */
 @SuppressWarnings("deprecation")
 @Override
 public void initOptions() {
   File[] dirs = null; // OldLibrarySettings.DIRECTORIES_TO_SHARE.getValueAsArray();
   initialFoldersToShare = new HashSet<File>(Arrays.asList(dirs));
   //		initialFoldersToExclude = GuiCoreMediator.getFileManager().getFolderNotToShare();
   sharingPanel.setRoots(dirs);
   sharingPanel.setFoldersToExclude(initialFoldersToExclude);
 }
 boolean isAlreadyGoingToBeShared(File dir) {
   if (sharingPanel.getFoldersToExclude().contains(dir)) {
     return false;
   }
   for (File folder : sharingPanel.getRootsToShare()) {
     if (FileUtils.isAncestor(folder, dir)) {
       return true;
     }
   }
   return false;
 }
 /** Adds a directory to the internal list, resetting 'dirty' only if it wasn't dirty already. */
 void addAndKeepDirtyStatus(Set<File> foldersToShare, Set<File> foldersToExclude) {
   for (File folder : foldersToShare) {
     sharingPanel.addRoot(folder);
   }
   sharingPanel.addFoldersToExclude(foldersToExclude);
 }
 public void resetDirtyState() {
   initialFoldersToShare = sharingPanel.getRootsToShare();
   initialFoldersToExclude = sharingPanel.getFoldersToExclude();
 }
 public boolean isDirty() {
   return !initialFoldersToShare.equals(sharingPanel.getRootsToShare())
       || !initialFoldersToExclude.equals(sharingPanel.getFoldersToExclude());
 }
 /** Returns the folders to exclude. */
 public Set<File> getDirectorieToExclude() {
   return sharingPanel.getFoldersToExclude();
 }
 /** Gets all folders to share. */
 public Set<File> getDirectoriesToShare() {
   return sharingPanel.getRootsToShare();
 }