org.eclipse.stp.core.infrastructure.emf
Class WorkbenchResourceHelper

java.lang.Object
  extended by WorkbenchResourceHelperBase
      extended by org.eclipse.stp.core.infrastructure.emf.WorkbenchResourceHelper

public class WorkbenchResourceHelper
extends WorkbenchResourceHelperBase


Constructor Summary
WorkbenchResourceHelper()
           
 
Method Summary
static void cacheSynchronizationStamp(ReferencedResource refResource)
          Method cacheSynchronizationStamp.
static long computeModificationStamp(ReferencedResource resource)
           
static EMFWorkbenchContextBase createEMFContext(IProject aProject, IEMFContextContributor contributor)
          Return a new or existing context base on aProject.
static void deleteResource(Resource aResource)
          Delete
static IFile getFile(ReferencedResource res)
          Return the underlying IFile for the resource if one exists.
static Resource getOrCreateResource(URI uri, ResourceSet set)
          Get or load a cached Resource or create one if it is not found.
static IFile getPlatformFile(URI uri)
          Return the IFile for the uri within the Workspace.
static IProject getProject(Resource res)
           
static long getSynchronizationStamp(ReferencedResource res)
           
static void initializeFileAdapterFactory()
          This is an internal method to be used by the plugin only
static boolean isConsistent(ReferencedResource res)
           
static boolean isReferencedResource(Resource aResource)
           
static boolean saveResourceToFile(Resource aResource, IFile aFile)
          Deprecated. This api is no longer required. You should create a resource with the absolute path (platform:/resource/...). Upon save, the file will be saved to this location.
static boolean saveResourceToFile(Resource aResource, IFile aFile, java.util.Map saveOptions)
          Deprecated. This api is no longer required. You should create a resource with the absolute path (platform:/resource/...). Upon save, the file will be saved to this location.
static void setSynhronizationStamp(ReferencedResource res, long stamp)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WorkbenchResourceHelper

public WorkbenchResourceHelper()
Method Detail

initializeFileAdapterFactory

public static void initializeFileAdapterFactory()
This is an internal method to be used by the plugin only


getFile

public static IFile getFile(ReferencedResource res)
Return the underlying IFile for the resource if one exists. This may return null if the resource does not belong to a ProjectResourceSet.


getSynchronizationStamp

public static long getSynchronizationStamp(ReferencedResource res)

setSynhronizationStamp

public static void setSynhronizationStamp(ReferencedResource res,
                                          long stamp)

isConsistent

public static boolean isConsistent(ReferencedResource res)

cacheSynchronizationStamp

public static void cacheSynchronizationStamp(ReferencedResource refResource)
Method cacheSynchronizationStamp.

Parameters:
r -

isReferencedResource

public static boolean isReferencedResource(Resource aResource)

computeModificationStamp

public static long computeModificationStamp(ReferencedResource resource)

getOrCreateResource

public static Resource getOrCreateResource(URI uri,
                                           ResourceSet set)
                                    throws WrappedException
Get or load a cached Resource or create one if it is not found. A WrappedException will only be thrown if the corresponding file exists but it failed to load.

Throws:
WrappedException

getProject

public static IProject getProject(Resource res)

getPlatformFile

public static IFile getPlatformFile(URI uri)
Return the IFile for the uri within the Workspace. This URI is assumed to be absolute in the following format: platform:/resource/....


saveResourceToFile

public static boolean saveResourceToFile(Resource aResource,
                                         IFile aFile)
                                  throws java.lang.Exception
Deprecated. This api is no longer required. You should create a resource with the absolute path (platform:/resource/...). Upon save, the file will be saved to this location.

This should only be used if you want to save aResource within the IProject that it is currently residing but you do not want to save it in the default output location. You should not use this api to save a Resource to an existing file.

Throws:
java.lang.Exception

saveResourceToFile

public static boolean saveResourceToFile(Resource aResource,
                                         IFile aFile,
                                         java.util.Map saveOptions)
                                  throws java.lang.Exception
Deprecated. This api is no longer required. You should create a resource with the absolute path (platform:/resource/...). Upon save, the file will be saved to this location.

This should only be used if you want to save aResource within the IProject that it is currently residing but you do not want to save it in the default output location. You should not use this api to save a Resource to an existing file.

Throws:
java.lang.Exception

deleteResource

public static void deleteResource(Resource aResource)
                           throws CoreException
Delete

Throws:
CoreException

createEMFContext

public static EMFWorkbenchContextBase createEMFContext(IProject aProject,
                                                       IEMFContextContributor contributor)
Return a new or existing context base on aProject. Allow the contributor to contribute to the new or existing nature prior to returning.

Parameters:
aProject -
contributor -
Returns:
the context base for the project.
Since:
1.0.0