Class ResourceSnapshotFactory
java.lang.Object
org.eclipse.core.resources.undo.snapshot.ResourceSnapshotFactory
ResourceSnapshotFactory provides utility methods for creating snapshots of
resources or markers.
- Since:
- 3.20
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic IContainerSnapshot<? extends IContainer>
fromContainer
(IContainer container) Create a container description from the specified container handle that can be used to create the container.static IResourceSnapshot<IFile>
fromFileDetails
(IFile file, URI linkLocation, InputStream contents) Create a file snapshot from the specified file handle.static IMarkerSnapshot
fromMarker
(IMarker marker) Create a marker snapshot from the specified marker.static IMarkerSnapshot
Create a marker snapshot from the specified marker type, attributes, and resource.static IContainerSnapshot<IProject>
fromProjectDescription
(IProjectDescription projectDescription) Create a project snapshot from a specified IProjectDescription.static <T extends IResource>
IResourceSnapshot<T>fromResource
(T resource) Create a resource snapshot given the specified resource.static IContainerSnapshot<? extends IContainer>
fromVirtualFolderContainer
(IContainer container) Create a group container description from the specified container handle that can be used to create the container.
-
Constructor Details
-
ResourceSnapshotFactory
public ResourceSnapshotFactory()
-
-
Method Details
-
fromResource
Create a resource snapshot given the specified resource. The resource is assumed to exist.- Parameters:
resource
- the resource from which a description should be created- Returns:
- the resource description
-
fromProjectDescription
public static IContainerSnapshot<IProject> fromProjectDescription(IProjectDescription projectDescription) Create a project snapshot from a specified IProjectDescription. Used when the project does not yet exist.- Parameters:
projectDescription
- the project description for the future project
-
fromContainer
Create a container description from the specified container handle that can be used to create the container. The returned ContainerDescription should represent any non-existing parents in addition to the specified container.- Parameters:
container
- the handle of the container to be described- Returns:
- a container description describing the container and any non-existing parents.
-
fromVirtualFolderContainer
public static IContainerSnapshot<? extends IContainer> fromVirtualFolderContainer(IContainer container) Create a group container description from the specified container handle that can be used to create the container. The returned ContainerDescription should represent any non-existing parents in addition to the specified container.- Parameters:
container
- the handle of the container to be described- Returns:
- a container description describing the container and any non-existing parents.
-
fromFileDetails
public static IResourceSnapshot<IFile> fromFileDetails(IFile file, URI linkLocation, InputStream contents) Create a file snapshot from the specified file handle. The handle does not exist, so no information should be derived from it. If a location path is specified, this file should represent a link to another location. The content description describes any state that should be used when the file resource is created.- Parameters:
file
- the file to be describedlinkLocation
- the location of the file's link, ornull
if the file is not linkedcontents
- an input stream representing the contents of the file
-
fromMarker
Create a marker snapshot from the specified marker.- Parameters:
marker
- the marker to be described- Throws:
CoreException
-
fromMarkerDetails
public static IMarkerSnapshot fromMarkerDetails(String type, Map<String, Object> attributes, IResource resource) Create a marker snapshot from the specified marker type, attributes, and resource.- Parameters:
type
- the type of marker to be created.attributes
- the attributes to be assigned to the markerresource
- the resource on which the marker should be created
-