Пример #1
0
 public void run() {
   computeKeys();
   refreshKeys();
   try {
     FileSystem fs = root.getFileSystem();
     wfcl = (FileChangeListener) WeakListeners.create(FileChangeListener.class, this, fs);
     fs.addFileChangeListener(wfcl);
   } catch (FileStateInvalidException e) {
     ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, e);
   }
   wvqcl = WeakListeners.change(this, VisibilityQuery.getDefault());
   VisibilityQuery.getDefault().addChangeListener(wvqcl);
 }
 /**
  * #25793 fix - adds project name to given ant script name if needed.
  *
  * @return ant script name annotated with project name or ant script name unchanged
  */
 private String annotateWithProjectName(String name) {
   DataObject d = getDataObject();
   if (d.getPrimaryFile().getNameExt().equals("build.xml")) { // NOI18N
     // #25793: show project name in case the script name does not suffice
     AntProjectCookie cookie = d.getCookie(AntProjectCookie.class);
     Element pel = cookie.getProjectElement();
     if (pel != null) {
       String projectName = pel.getAttribute("name"); // NOI18N
       if (!projectName.equals("")) { // NOI18N
         name =
             NbBundle.getMessage(AntProjectDataEditor.class, "LBL_editor_tab", name, projectName);
       }
     }
     if (!addedChangeListener) {
       cookie.addChangeListener(WeakListeners.change(this, cookie));
       addedChangeListener = true;
     }
   }
   return name;
 }