private void change(FileEvent fe) {
   synchronized (saveActions) {
     for (AtomicAction a : saveActions) {
       if (fe.firedFrom(a)) {
         return;
       }
     }
   }
   String path;
   FileObject f = fe.getFile();
   synchronized (modifiedMetadataPaths) {
     if (f.equals(resolveFileObject(PROJECT_XML_PATH))) {
       if (modifiedMetadataPaths.contains(PROJECT_XML_PATH)) {
         // #68872: don't do anything if the given file has non-saved changes:
         return;
       }
       path = PROJECT_XML_PATH;
       projectXmlValid = false;
     } else if (f.equals(resolveFileObject(PRIVATE_XML_PATH))) {
       if (modifiedMetadataPaths.contains(PRIVATE_XML_PATH)) {
         // #68872: don't do anything if the given file has non-saved changes:
         return;
       }
       path = PRIVATE_XML_PATH;
       privateXmlValid = false;
     } else {
       LOG.log(
           Level.WARNING,
           "#184132: unexpected file change in {0}; possibly deleted project?",
           f);
       return;
     }
   }
   fireExternalChange(path);
 }
Ejemplo n.º 2
0
 public void fileFolderCreated(FileEvent fe) {
   FileObject fo = fe.getFile();
   if (FileUtil.isParentOf(root, fo) && isVisible(root, fo)) {
     cleanEmptyKeys(fo);
     //            add( fo, false);
     findNonExcludedPackages(fo);
     refreshKeys();
   }
 }
 @Override
 public void fileDeleted(FileEvent fe) {
   String path = fe.getFile().getPath();
   try {
     pref.node(path).removeNode();
   } catch (BackingStoreException ex) {
     Exceptions.printStackTrace(ex);
   }
 }
Ejemplo n.º 4
0
 public void fileDataCreated(FileEvent fe) {
   FileObject fo = fe.getFile();
   if (FileUtil.isParentOf(root, fo) && isVisible(root, fo)) {
     FileObject parent = fo.getParent();
     if (!VisibilityQuery.getDefault().isVisible(parent)) {
       return; // Adding file into ignored directory
     }
     PackageNode n = get(parent);
     if (n == null && !contains(parent)) {
       add(parent, false);
       refreshKeys();
     } else if (n != null) {
       n.updateChildren();
     }
   }
 }
Ejemplo n.º 5
0
  public void fileDeleted(FileEvent fe) {
    FileObject fo = fe.getFile();
    if (FileUtil.isParentOf(root, fo) && isVisible(root, fo)) {
      if (fo.isFolder() || get(fo) != null) {
        removeSubTree(fo);
        // Now add the parent if necessary
        FileObject parent = fo.getParent();
        if ((FileUtil.isParentOf(root, parent) || root.equals(parent))
            && get(parent) == null
            && parent.isValid()) {
          // Candidate for adding
          if (!toBeRemoved(parent)) {
            add(parent, true);
          }
        }
        refreshKeysAsync();
      } else {
        FileObject parent = fo.getParent();
        final PackageNode n = get(parent);
        if (n != null) {
          // #61027: workaround to a deadlock when the package is being changed from non-leaf to
          // leaf:
          boolean leaf = n.isLeaf();
          DataFolder df = n.getDataFolder();
          boolean empty = n.isEmpty(df);

          if (leaf != empty) {
            SwingUtilities.invokeLater(
                new Runnable() {
                  public void run() {
                    n.updateChildren();
                  }
                });
          } else {
            n.updateChildren();
          }
        }
        // If the parent folder only contains folders remove it
        if (toBeRemoved(parent)) {
          remove(parent);
          refreshKeysAsync();
        }
      }
    }
  }
 @Override
 public void fileChanged(FileEvent fe) {
   String path = fe.getFile().getPath();
   pref.node(path);
 }
 @Override
 public void fileFolderCreated(FileEvent fe) {
   String path = fe.getFile().getPath();
   pref.node(path);
 }