예제 #1
0
 @Override
 public void dispose() {
   assertCanChange();
   LOG.trace("Disposing the module " + this);
   myFileSystem.removeListener(this);
   for (ModuleFacetBase f : myFacets) {
     f.dispose();
   }
   myFacets.clear();
   for (ModelRoot m : mySModelRoots) {
     ((ModelRootBase) m).dispose();
   }
   mySModelRoots.clear();
   super.dispose();
 }
예제 #2
0
  public void rename(@NotNull String newName) {
    SModuleReference oldRef = getModuleReference();
    renameModels(getModuleName(), newName, true);

    save(); // see MPS-18743, need to save before setting descriptor

    ModuleDescriptor descriptor = getModuleDescriptor();
    if (myDescriptorFile != null) {
      // fixme AP: this looks awful -- I agree; the right way is to have IFile something immutable
      // fixme or just work in <code>WatchedRoots</code> by IFile (not by String) and listen for
      // rename
      myFileSystem.removeListener(this);
      myDescriptorFile.rename(newName + "." + FileUtil.getExtension(myDescriptorFile.getName()));
      myFileSystem.addListener(this);
    }

    if (descriptor != null) {
      descriptor.setNamespace(newName);
      setModuleDescriptor(descriptor);
    }

    fireModuleRenamed(oldRef);
  }