Package jetbrains.mps.extapi.persistence
Class FileBasedModelRoot
- java.lang.Object
 - 
- jetbrains.mps.extapi.persistence.ModelRootBase
 - 
- jetbrains.mps.extapi.persistence.FileBasedModelRoot
 
 
 
- 
- All Implemented Interfaces:
 FileListener,FileSystemListener,ModelRoot
- Direct Known Subclasses:
 DefaultModelRoot,JavaClassStubsModelRoot
public abstract class FileBasedModelRoot extends ModelRootBase implements FileSystemListener
FileBasedModelRootcontains severalSourceRootwhich contain models. The source roots might be marked with aSourceRootKindwhich determine how do we treat the model files/folders we discover under those source roots.The class is in the state of migration from
Stringsource roots to the interfaceSourceRootthat is why it is such a mess.Paths represented by string either must have a clear contract (absolute, relative) or (better) replaced with some
Pathentities. AP 
- 
- 
Field Summary
Fields Modifier and Type Field Description static StringCONTENT_PATHThis is a private model root persistence notation, ought to be concealed from the general publicstatic StringEXCLUDEDDeprecated.useSourceRootKinds.EXCLUDEDinsteadstatic StringLOCATIONstatic StringSOURCE_ROOTSDeprecated.useSourceRootKinds.SOURCESinstead 
- 
Constructor Summary
Constructors Modifier Constructor Description protectedFileBasedModelRoot()protectedFileBasedModelRoot(String[] supportedFileKinds)Deprecated.useFileBasedModelRoot()instead and define your owngetSupportedFileKinds1() 
- 
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidaddFile(String kind, String filePath)Deprecated.useaddSourceRoot(SourceRootKind, SourceRoot)insteadvoidaddSourceRoot(SourceRootKind kind, SourceRoot root)voidattach()booleancontainsFile(String kind, String file)Deprecated.voiddeleteFile(String kind, String file)Deprecated.useremoveSourceRoot(SourceRoot)insteadvoiddispose()booleanequals(Object o)IFilegetContentDirectory()StringgetContentRoot()Deprecated.usegetContentDirectory()insteadCollection<String>getFiles(String kind)Deprecated.usegetSourceRoots(SourceRootKind)insteadFileSystemgetFileSystem()IFilegetFileToListen()StringgetPresentation()A textual representation of the model root TODO what is the difference with theObject.toString()?? TODO very ambiguous in API: is it to be used in UI? somewhere else? TODO one needs to clarify or replace it with a prosy #getNameList<SourceRoot>getSourceRoots(SourceRootKind kind)Collection<String>getSupportedFileKinds()Deprecated.Stringis not the best choice.List<SourceRootKind>getSupportedFileKinds1()To become abstract in the 3.5inthashCode()voidload(Memento memento)Allows the model root to read its previously saved configuration informationstatic Stringrelativize(String fullPath, String contentHomePath)static Stringrelativize(String fullPath, IFile contentHome)SourceRootKindremoveSourceRoot(SourceRoot root)voidsave(Memento memento)Gives the model root the opportunity to persist into the supplied memento whatever configuration information may be needed to restore the models in the future.voidsetContentDirectory(IFile contentDir)voidsetContentRoot(String path)Deprecated.usesetContentDirectory(IFile)insteadvoidupdate(ProgressMonitor monitor, FileSystemEvent event)listener gets here all the events- 
Methods inherited from class jetbrains.mps.extapi.persistence.ModelRootBase
assertCanChange, assertCanRead, canCreateModels, getModels, getModule, getRepository, isRegistered, loadModels, registerModel, setModule, toString, update 
- 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait 
- 
Methods inherited from interface jetbrains.mps.vfs.refresh.FileListener
listeningPreferences 
- 
Methods inherited from interface jetbrains.mps.vfs.refresh.FileSystemListener
getListenerDependencies 
- 
Methods inherited from interface org.jetbrains.mps.openapi.persistence.ModelRoot
canCreateModel, createModel, getModel, getType 
 - 
 
 - 
 
- 
- 
Field Detail
- 
SOURCE_ROOTS
@Deprecated public static final String SOURCE_ROOTS
Deprecated.useSourceRootKinds.SOURCESinstead- See Also:
 - Constant Field Values
 
 
- 
EXCLUDED
@Deprecated public static final String EXCLUDED
Deprecated.useSourceRootKinds.EXCLUDEDinstead- See Also:
 - Constant Field Values
 
 
- 
CONTENT_PATH
public static final String CONTENT_PATH
This is a private model root persistence notation, ought to be concealed from the general public- See Also:
 - Constant Field Values
 
 
- 
LOCATION
public static final String LOCATION
- See Also:
 - Constant Field Values
 
 
 - 
 
- 
Constructor Detail
- 
FileBasedModelRoot
protected FileBasedModelRoot()
 
- 
FileBasedModelRoot
@Deprecated protected FileBasedModelRoot(String[] supportedFileKinds)
Deprecated.useFileBasedModelRoot()instead and define your owngetSupportedFileKinds1() 
 - 
 
- 
Method Detail
- 
getContentRoot
@Deprecated @Nullable public final String getContentRoot()
Deprecated.usegetContentDirectory()instead 
- 
setContentRoot
@Deprecated public final void setContentRoot(@NotNull String path)
Deprecated.usesetContentDirectory(IFile)instead 
- 
getFileSystem
@NotNull public final FileSystem getFileSystem()
 
- 
getSupportedFileKinds1
@NotNull public List<SourceRootKind> getSupportedFileKinds1()
To become abstract in the 3.5 
- 
getSourceRoots
@NotNull public final List<SourceRoot> getSourceRoots(@NotNull SourceRootKind kind)
- Returns:
 SourceRoots of the specified kind They might contain relative paths (unlike the legacy counterpart method!!). FBModelRoot is going to store relative path, all we need is some api to provide relative path instances. Now we do not have such abstraction sinceIFileis effectively absolute (just since the idea'sVirtualFileis absolute as well).AP
 
- 
addSourceRoot
public final void addSourceRoot(@NotNull SourceRootKind kind, @NotNull SourceRoot root)
 
- 
removeSourceRoot
@Nullable public final SourceRootKind removeSourceRoot(@NotNull SourceRoot root)
- Returns:
 - the 
FileKindof the removedSourceRootif it was successfully removed. 
 
- 
getSupportedFileKinds
@Deprecated public final Collection<String> getSupportedFileKinds()
Deprecated.Stringis not the best choice. Consider usinggetSupportedFileKinds1()- See Also:
 SourcePaths
 
- 
getFiles
@NotNull @Deprecated public final Collection<String> getFiles(@NotNull String kind)
Deprecated.usegetSourceRoots(SourceRootKind)instead 
- 
containsFile
@Deprecated public final boolean containsFile(String kind, String file)
Deprecated. 
- 
addFile
@Deprecated public final void addFile(String kind, String filePath)
Deprecated.useaddSourceRoot(SourceRootKind, SourceRoot)instead 
- 
deleteFile
@Deprecated public final void deleteFile(String kind, String file)
Deprecated.useremoveSourceRoot(SourceRoot)instead 
- 
getPresentation
public final String getPresentation()
Description copied from interface:ModelRootA textual representation of the model root TODO what is the difference with theObject.toString()?? TODO very ambiguous in API: is it to be used in UI? somewhere else? TODO one needs to clarify or replace it with a prosy #getName- Specified by:
 getPresentationin interfaceModelRoot
 
- 
save
public void save(@NotNull Memento memento)
Description copied from interface:ModelRootGives the model root the opportunity to persist into the supplied memento whatever configuration information may be needed to restore the models in the future. 
- 
load
public void load(@NotNull Memento memento)
Description copied from interface:ModelRootAllows the model root to read its previously saved configuration information 
- 
attach
public void attach()
- Overrides:
 attachin classModelRootBase
 
- 
dispose
public void dispose()
- Overrides:
 disposein classModelRootBase
 
- 
getFileToListen
public final IFile getFileToListen()
- Specified by:
 getFileToListenin interfaceFileSystemListener
 
- 
update
public void update(ProgressMonitor monitor, @NotNull FileSystemEvent event)
Description copied from interface:FileListenerlistener gets here all the events- Specified by:
 updatein interfaceFileListener
 
- 
relativize
@NotNull public static String relativize(@NotNull String fullPath, @NotNull IFile contentHome)
 
 - 
 
 -