Class ResourceUtils


  • public class ResourceUtils
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Constructor Description
      ResourceUtils()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String[] addElement​(java.lang.String[] elements, java.lang.String element)  
      static void addProjectNature​(org.eclipse.core.resources.IProject project, java.lang.String natureId)  
      static void addToBuildSpec​(org.eclipse.core.resources.IProject project, java.lang.String builderID)  
      static void cleanupDir​(org.eclipse.core.resources.IProject project)  
      static void cleanupDir​(org.eclipse.core.resources.IProject project, java.lang.String folderPath)  
      static void cleanupDir​(org.eclipse.core.resources.IProject project, java.lang.String folderPath, java.lang.String[] excluding)  
      static void copyFile​(org.eclipse.emf.common.util.URI sourceURI, org.eclipse.core.runtime.IPath targetPath)  
      static void createProject​(org.eclipse.core.resources.IProject project, java.lang.String nature, org.eclipse.core.runtime.IProgressMonitor monitor)  
      static void delete​(java.io.File fileOrDir, java.lang.String[] excluding)  
      static org.eclipse.core.resources.ICommand getBuildSpec​(org.eclipse.core.resources.IProjectDescription description, java.lang.String builderId)  
      static org.eclipse.core.runtime.IPath getEditorTargetResourcePath​(org.eclipse.core.resources.IProject project, State state)  
      static org.eclipse.core.runtime.IPath getEditTargetResourcePath​(org.eclipse.core.resources.IProject project, State state)  
      static org.eclipse.core.runtime.IPath getExportDestination​(org.eclipse.core.resources.IProject project)  
      static java.lang.String getFileName​(java.lang.String name)  
      static java.lang.String getModelFileExt()  
      static java.lang.String getModelFolderName()
      Returns the name of the folder within project, where the model resource is located.
      static org.eclipse.core.runtime.IPath getModelTransformationPath​(org.eclipse.core.resources.IProject project, org.eclipse.emf.common.util.URI transformationURI)  
      static org.eclipse.core.resources.IProject getProject​(java.lang.String projectName)  
      static java.lang.String getTargetFolderName()  
      static org.eclipse.core.runtime.IPath getTargetResourcePath​(org.eclipse.core.resources.IProject project, State state)  
      static org.eclipse.core.runtime.IPath getWorkspaceLocation()  
      static boolean isProjectExists​(java.lang.String projectName)  
      static java.lang.String parseProjectName​(org.eclipse.emf.common.util.URI modelURI)  
      static java.lang.String[] removeElement​(java.lang.String[] elements, java.lang.String element)  
      static void removeFromBuildSpec​(org.eclipse.core.resources.IProject project, java.lang.String builderID)  
      static void removeProjectNature​(org.eclipse.core.resources.IProject project, java.lang.String natureId)  
      static void restoreAutoBuilding​(org.eclipse.core.resources.IWorkspace workspace)  
      static void saveAutoBuilding​(org.eclipse.core.resources.IWorkspace workspace)  
      static void setAutoBuilding​(org.eclipse.core.resources.IWorkspace workspace, boolean value)  
      static void writeFile​(org.eclipse.core.runtime.IPath location, java.lang.CharSequence contents)  
      • Methods inherited from class java.lang.Object

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

      • PROJECT_DELETE_MASK

        public static java.util.List<java.lang.String> PROJECT_DELETE_MASK
      • WORKSPACE_RESOURCE_PATH

        public static final org.eclipse.core.runtime.IPath WORKSPACE_RESOURCE_PATH
    • Constructor Detail

      • ResourceUtils

        public ResourceUtils()
    • Method Detail

      • getModelTransformationPath

        public static org.eclipse.core.runtime.IPath getModelTransformationPath​(org.eclipse.core.resources.IProject project,
                                                                                org.eclipse.emf.common.util.URI transformationURI)
      • getExportDestination

        public static org.eclipse.core.runtime.IPath getExportDestination​(org.eclipse.core.resources.IProject project)
      • getTargetResourcePath

        public static org.eclipse.core.runtime.IPath getTargetResourcePath​(org.eclipse.core.resources.IProject project,
                                                                           State state)
      • getEditTargetResourcePath

        public static org.eclipse.core.runtime.IPath getEditTargetResourcePath​(org.eclipse.core.resources.IProject project,
                                                                               State state)
      • getEditorTargetResourcePath

        public static org.eclipse.core.runtime.IPath getEditorTargetResourcePath​(org.eclipse.core.resources.IProject project,
                                                                                 State state)
      • getModelFolderName

        public static java.lang.String getModelFolderName()
        Returns the name of the folder within project, where the model resource is located.
        Returns:
      • getTargetFolderName

        public static java.lang.String getTargetFolderName()
      • getModelFileExt

        public static java.lang.String getModelFileExt()
      • getFileName

        public static java.lang.String getFileName​(java.lang.String name)
      • parseProjectName

        public static java.lang.String parseProjectName​(org.eclipse.emf.common.util.URI modelURI)
      • getWorkspaceLocation

        public static org.eclipse.core.runtime.IPath getWorkspaceLocation()
      • getProject

        public static org.eclipse.core.resources.IProject getProject​(java.lang.String projectName)
      • isProjectExists

        public static boolean isProjectExists​(java.lang.String projectName)
      • addElement

        public static java.lang.String[] addElement​(java.lang.String[] elements,
                                                    java.lang.String element)
      • removeElement

        public static java.lang.String[] removeElement​(java.lang.String[] elements,
                                                       java.lang.String element)
      • addProjectNature

        public static void addProjectNature​(org.eclipse.core.resources.IProject project,
                                            java.lang.String natureId)
                                     throws org.eclipse.core.runtime.CoreException
        Throws:
        org.eclipse.core.runtime.CoreException
      • removeProjectNature

        public static void removeProjectNature​(org.eclipse.core.resources.IProject project,
                                               java.lang.String natureId)
                                        throws org.eclipse.core.runtime.CoreException
        Throws:
        org.eclipse.core.runtime.CoreException
      • getBuildSpec

        public static org.eclipse.core.resources.ICommand getBuildSpec​(org.eclipse.core.resources.IProjectDescription description,
                                                                       java.lang.String builderId)
      • addToBuildSpec

        public static void addToBuildSpec​(org.eclipse.core.resources.IProject project,
                                          java.lang.String builderID)
                                   throws org.eclipse.core.runtime.CoreException
        Throws:
        org.eclipse.core.runtime.CoreException
      • removeFromBuildSpec

        public static void removeFromBuildSpec​(org.eclipse.core.resources.IProject project,
                                               java.lang.String builderID)
                                        throws org.eclipse.core.runtime.CoreException
        Throws:
        org.eclipse.core.runtime.CoreException
      • createProject

        public static void createProject​(org.eclipse.core.resources.IProject project,
                                         java.lang.String nature,
                                         org.eclipse.core.runtime.IProgressMonitor monitor)
                                  throws org.eclipse.core.runtime.CoreException
        Throws:
        org.eclipse.core.runtime.CoreException
      • copyFile

        public static void copyFile​(org.eclipse.emf.common.util.URI sourceURI,
                                    org.eclipse.core.runtime.IPath targetPath)
                             throws org.eclipse.core.runtime.CoreException
        Throws:
        org.eclipse.core.runtime.CoreException
      • setAutoBuilding

        public static void setAutoBuilding​(org.eclipse.core.resources.IWorkspace workspace,
                                           boolean value)
                                    throws org.eclipse.core.runtime.CoreException
        Throws:
        org.eclipse.core.runtime.CoreException
      • saveAutoBuilding

        public static void saveAutoBuilding​(org.eclipse.core.resources.IWorkspace workspace)
      • restoreAutoBuilding

        public static void restoreAutoBuilding​(org.eclipse.core.resources.IWorkspace workspace)
                                        throws org.eclipse.core.runtime.CoreException
        Throws:
        org.eclipse.core.runtime.CoreException
      • cleanupDir

        public static void cleanupDir​(org.eclipse.core.resources.IProject project)
                               throws org.eclipse.core.runtime.CoreException
        Throws:
        org.eclipse.core.runtime.CoreException
      • cleanupDir

        public static void cleanupDir​(org.eclipse.core.resources.IProject project,
                                      java.lang.String folderPath)
                               throws org.eclipse.core.runtime.CoreException
        Throws:
        org.eclipse.core.runtime.CoreException
      • cleanupDir

        public static void cleanupDir​(org.eclipse.core.resources.IProject project,
                                      java.lang.String folderPath,
                                      java.lang.String[] excluding)
                               throws org.eclipse.core.runtime.CoreException
        Throws:
        org.eclipse.core.runtime.CoreException
      • delete

        public static void delete​(java.io.File fileOrDir,
                                  java.lang.String[] excluding)
      • writeFile

        public static void writeFile​(org.eclipse.core.runtime.IPath location,
                                     java.lang.CharSequence contents)
                              throws org.eclipse.core.runtime.CoreException
        Throws:
        org.eclipse.core.runtime.CoreException