Class ProjectSpecificLocationRegister

  • All Implemented Interfaces:
    FileLocationRegister, com.nomagic.magicdraw.core.project.service.DisposableService

    @OpenApi
    public final class ProjectSpecificLocationRegister
    extends com.nomagic.magicdraw.core.project.service.AbstractProjectService
    implements FileLocationRegister
    This class is for storing file locations which depends on project. All locations stored is project specific.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.util.Map<java.lang.String,​java.io.File> fileLocations  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.io.File getFileLocation​(java.lang.String locationNameID)
      This method should be used to get file object by locationNameID.
      static ProjectSpecificLocationRegister getInstance​(Project prj)
      Method to get instance.
      private java.lang.String getProjectDirectory()
      This method is for getting project path as string.
      void setFileLocation​(java.lang.String locationNameID, java.io.File file)
      Before saving file locations file is checked if it still exist.
      • Methods inherited from class com.nomagic.magicdraw.core.project.service.AbstractProjectService

        disposeService, getInternalInstance, getKey, getReferencedProject, registerInstance
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • fileLocations

        private final java.util.Map<java.lang.String,​java.io.File> fileLocations
    • Constructor Detail

      • ProjectSpecificLocationRegister

        private ProjectSpecificLocationRegister​(Project prj)
        Constructor
        Parameters:
        prj - Project.
    • Method Detail

      • getInstance

        @OpenApi
        public static ProjectSpecificLocationRegister getInstance​(Project prj)
        Method to get instance.
        Parameters:
        prj - project type object.
        Returns:
        ProjectSpecificLocationRegister instance.
      • getFileLocation

        public java.io.File getFileLocation​(java.lang.String locationNameID)
        Description copied from interface: FileLocationRegister
        This method should be used to get file object by locationNameID.
        Specified by:
        getFileLocation in interface FileLocationRegister
        Parameters:
        locationNameID - a unique id for storing/getting file locations.
        Returns:
        File type object.
      • setFileLocation

        @OpenApi
        public void setFileLocation​(java.lang.String locationNameID,
                                    java.io.File file)
        Before saving file locations file is checked if it still exist. It is done because user may delete directory, rename it, move it... If file location does not exist anymore default(project directory) location is used.
        Specified by:
        setFileLocation in interface FileLocationRegister
        Parameters:
        locationNameID - a unique id for storing/getting file locations.
        file - type object
      • getProjectDirectory

        private java.lang.String getProjectDirectory()
        This method is for getting project path as string. IF project is team work server project it returns user documents directory.
        Returns:
        string type object.