From f6cf377d00eec467c458e5a900566aa0ae2fe252 Mon Sep 17 00:00:00 2001 From: Rob Stryker Date: Wed, 13 Sep 2023 11:35:54 -0400 Subject: [PATCH] Rename API to use snapshot instead of description for clarity Signed-off-by: Rob Stryker --- .../META-INF/MANIFEST.MF | 1 + .../snapshot/AbstractResourceSnapshot.java} | 20 +++--- .../snapshot/ContainerSnapshot.java} | 62 +++++++++---------- .../snapshot/FileSnapshot.java} | 51 +++++++-------- .../snapshot/FolderSnapshot.java} | 36 +++++------ .../snapshot/IFileContentSnapshot.java} | 6 +- .../snapshot/MarkerSnapshot.java} | 30 ++++----- .../snapshot/ProjectSnapshot.java} | 26 ++++---- .../snapshot/ResourceSnapshot.java} | 21 +++---- .../snapshot/ResourceSnapshotMessages.java} | 10 +-- .../ResourceSnapshotMessages.properties} | 0 11 files changed, 125 insertions(+), 138 deletions(-) rename resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/resources/{descriptions/AbstractResourceDescription.java => undo/snapshot/AbstractResourceSnapshot.java} (86%) rename resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/resources/{descriptions/ContainerDescription.java => undo/snapshot/ContainerSnapshot.java} (80%) rename resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/resources/{descriptions/FileDescription.java => undo/snapshot/FileSnapshot.java} (76%) rename resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/resources/{descriptions/FolderDescription.java => undo/snapshot/FolderSnapshot.java} (71%) rename resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/resources/{descriptions/IFileContentDescription.java => undo/snapshot/IFileContentSnapshot.java} (91%) rename resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/resources/{descriptions/MarkerDescription.java => undo/snapshot/MarkerSnapshot.java} (71%) rename resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/resources/{descriptions/ProjectDescription.java => undo/snapshot/ProjectSnapshot.java} (78%) rename resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/resources/{descriptions/ResourceDescription.java => undo/snapshot/ResourceSnapshot.java} (86%) rename resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/resources/{descriptions/ResourceDescriptionMessages.java => undo/snapshot/ResourceSnapshotMessages.java} (86%) rename resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/resources/{descriptions/ResourceDescriptionMessages.properties => undo/snapshot/ResourceSnapshotMessages.properties} (100%) diff --git a/resources/bundles/org.eclipse.core.resources/META-INF/MANIFEST.MF b/resources/bundles/org.eclipse.core.resources/META-INF/MANIFEST.MF index f01dd4fa079..57bff4adfd3 100644 --- a/resources/bundles/org.eclipse.core.resources/META-INF/MANIFEST.MF +++ b/resources/bundles/org.eclipse.core.resources/META-INF/MANIFEST.MF @@ -23,6 +23,7 @@ Export-Package: org.eclipse.core.internal.dtree;x-internal:=true, org.eclipse.core.resources.mapping, org.eclipse.core.resources.refresh, org.eclipse.core.resources.team, + org.eclipse.core.resources.undo.snapshot, org.eclipse.core.resources.variableresolvers Require-Bundle: org.eclipse.ant.core;bundle-version="[3.1.0,4.0.0)";resolution:=optional, org.eclipse.core.expressions;bundle-version="[3.2.0,4.0.0)", diff --git a/resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/resources/descriptions/AbstractResourceDescription.java b/resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/resources/undo/snapshot/AbstractResourceSnapshot.java similarity index 86% rename from resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/resources/descriptions/AbstractResourceDescription.java rename to resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/resources/undo/snapshot/AbstractResourceSnapshot.java index a231b167720..5a16f5ccf7f 100644 --- a/resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/resources/descriptions/AbstractResourceDescription.java +++ b/resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/resources/undo/snapshot/AbstractResourceSnapshot.java @@ -12,7 +12,7 @@ * IBM Corporation - initial API and implementation *******************************************************************************/ -package org.eclipse.core.resources.descriptions; +package org.eclipse.core.resources.undo.snapshot; import org.eclipse.core.resources.IContainer; import org.eclipse.core.resources.IMarker; @@ -24,15 +24,15 @@ import org.eclipse.core.runtime.IProgressMonitor; /** - * Base implementation of ResourceDescription that describes the common - * attributes of a resource to be created. + * Base implementation of ResourceSnapshot that describes the common attributes + * of a resource to be created. * * This class is not intended to be instantiated or used by clients. * * @since 3.20 * */ -abstract class AbstractResourceDescription extends ResourceDescription { +abstract class AbstractResourceSnapshot extends ResourceSnapshot { IContainer parent; long modificationStamp = IResource.NULL_STAMP; @@ -41,12 +41,12 @@ abstract class AbstractResourceDescription extends ResourceDescription { ResourceAttributes resourceAttributes; - MarkerDescription[] markerDescriptions; + MarkerSnapshot[] markerDescriptions; /** * Create a resource description with no initial attributes */ - protected AbstractResourceDescription() { + protected AbstractResourceSnapshot() { super(); } @@ -56,7 +56,7 @@ protected AbstractResourceDescription() { * @param resource * the resource to be described */ - protected AbstractResourceDescription(IResource resource) { + protected AbstractResourceSnapshot(IResource resource) { super(); parent = resource.getParent(); if (resource.isAccessible()) { @@ -66,9 +66,9 @@ protected AbstractResourceDescription(IResource resource) { try { IMarker[] markers = resource.findMarkers(null, true, IResource.DEPTH_INFINITE); - markerDescriptions = new MarkerDescription[markers.length]; + markerDescriptions = new MarkerSnapshot[markers.length]; for (int i = 0; i < markers.length; i++) { - markerDescriptions[i] = new MarkerDescription(markers[i]); + markerDescriptions[i] = new MarkerSnapshot(markers[i]); } } catch (CoreException e) { // Eat this exception because it only occurs when the resource @@ -114,7 +114,7 @@ protected void restoreResourceAttributes(IResource resource) resource.setResourceAttributes(resourceAttributes); } if (markerDescriptions != null) { - for (MarkerDescription markerDescription : markerDescriptions) { + for (MarkerSnapshot markerDescription : markerDescriptions) { if (markerDescription.resource.exists()) markerDescription.createMarker(); } diff --git a/resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/resources/descriptions/ContainerDescription.java b/resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/resources/undo/snapshot/ContainerSnapshot.java similarity index 80% rename from resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/resources/descriptions/ContainerDescription.java rename to resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/resources/undo/snapshot/ContainerSnapshot.java index 906f5488b14..a516b5eb270 100644 --- a/resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/resources/descriptions/ContainerDescription.java +++ b/resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/resources/undo/snapshot/ContainerSnapshot.java @@ -12,7 +12,7 @@ * IBM Corporation - initial API and implementation *******************************************************************************/ -package org.eclipse.core.resources.descriptions; +package org.eclipse.core.resources.undo.snapshot; import java.net.URI; import org.eclipse.core.resources.IContainer; @@ -37,7 +37,7 @@ * @since 3.20 * */ -public abstract class ContainerDescription extends AbstractResourceDescription { +public abstract class ContainerSnapshot extends AbstractResourceSnapshot { String name; @@ -47,7 +47,7 @@ public abstract class ContainerDescription extends AbstractResourceDescription { String defaultCharSet; - AbstractResourceDescription[] members; + AbstractResourceSnapshot[] members; /** * Create a container description from the specified container handle that @@ -61,7 +61,7 @@ public abstract class ContainerDescription extends AbstractResourceDescription { * non-existing parents. */ - public static ContainerDescription fromContainer(IContainer container) { + public static ContainerSnapshot fromContainer(IContainer container) { return fromContainer(container, false); } @@ -77,21 +77,21 @@ public static ContainerDescription fromContainer(IContainer container) { * non-existing parents. */ - public static ContainerDescription fromVirtualFolderContainer(IContainer container) { + public static ContainerSnapshot fromVirtualFolderContainer(IContainer container) { return fromContainer(container, true); } - protected static ContainerDescription fromContainer(IContainer container, boolean usingVirtualFolder) { + protected static ContainerSnapshot fromContainer(IContainer container, boolean usingVirtualFolder) { IPath fullPath = container.getFullPath(); - ContainerDescription firstCreatedParent = null; - ContainerDescription currentContainerDescription = null; + ContainerSnapshot firstCreatedParent = null; + ContainerSnapshot currentContainerDescription = null; // Does the container exist already? If so, then the parent exists and // we use the normal creation constructor. IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); IContainer currentContainer = (IContainer) root.findMember(fullPath); if (currentContainer != null) { - return (ContainerDescription) ResourceDescription + return (ContainerSnapshot) ResourceSnapshot .fromResource(container); } @@ -106,13 +106,13 @@ protected static ContainerDescription fromContainer(IContainer container, boolea currentContainer = (IContainer) resource; } else if (i == 0) { // parent does not exist and it is a project - firstCreatedParent = new ProjectDescription(root + firstCreatedParent = new ProjectSnapshot(root .getProject(currentSegment)); currentContainerDescription = firstCreatedParent; } else { IFolder folderHandle = currentContainer.getFolder(IPath.fromOSString(currentSegment)); - ContainerDescription currentFolder; - currentFolder = new FolderDescription(folderHandle, usingVirtualFolder); + ContainerSnapshot currentFolder; + currentFolder = new FolderSnapshot(folderHandle, usingVirtualFolder); currentContainer = folderHandle; if (currentContainerDescription != null) { currentContainerDescription.addMember(currentFolder); @@ -129,7 +129,7 @@ protected static ContainerDescription fromContainer(IContainer container, boolea /** * Create a ContainerDescription with no state. */ - public ContainerDescription() { + public ContainerSnapshot() { } @@ -142,7 +142,7 @@ public ContainerDescription() { * @param container * the container to be described */ - public ContainerDescription(IContainer container) { + public ContainerSnapshot(IContainer container) { super(container); this.name = container.getName(); if (container.isLinked()) { @@ -152,9 +152,9 @@ public ContainerDescription(IContainer container) { if (container.isAccessible()) { defaultCharSet = container.getDefaultCharset(false); IResource[] resourceMembers = container.members(); - members = new AbstractResourceDescription[resourceMembers.length]; + members = new AbstractResourceSnapshot[resourceMembers.length]; for (int i = 0; i < resourceMembers.length; i++) { - members[i] = (AbstractResourceDescription) ResourceDescription + members[i] = (AbstractResourceSnapshot) ResourceSnapshot .fromResource(resourceMembers[i]); } } @@ -180,7 +180,7 @@ protected final void createChildResources(IContainer parentHandle, // restore any children if (members != null && members.length > 0) { SubMonitor subMonitor = SubMonitor.convert(monitor, members.length); - for (AbstractResourceDescription member : members) { + for (AbstractResourceSnapshot member : members) { member.parent = parentHandle; member.createResource(subMonitor.split(1)); } @@ -190,16 +190,16 @@ protected final void createChildResources(IContainer parentHandle, @Override public void recordStateFromHistory(IResource resource, IProgressMonitor mon) throws CoreException { if (members != null) { - SubMonitor subMonitor = SubMonitor.convert(mon, ResourceDescriptionMessages.FolderDescription_SavingUndoInfoProgress, + SubMonitor subMonitor = SubMonitor.convert(mon, ResourceSnapshotMessages.FolderDescription_SavingUndoInfoProgress, members.length); - for (AbstractResourceDescription member : members) { + for (AbstractResourceSnapshot member : members) { SubMonitor iterationMonitor = subMonitor.split(1); - if (member instanceof FileDescription) { - IPath path = resource.getFullPath().append(((FileDescription) member).name); + if (member instanceof FileSnapshot) { + IPath path = resource.getFullPath().append(((FileSnapshot) member).name); IFile fileHandle = resource.getWorkspace().getRoot().getFile(path); member.recordStateFromHistory(fileHandle, iterationMonitor); - } else if (member instanceof FolderDescription) { - IPath path = resource.getFullPath().append(((FolderDescription) member).name); + } else if (member instanceof FolderSnapshot) { + IPath path = resource.getFullPath().append(((FolderSnapshot) member).name); IFolder folderHandle = resource.getWorkspace().getRoot().getFolder(path); member.recordStateFromHistory(folderHandle, iterationMonitor); } @@ -223,15 +223,15 @@ public String getName() { * @return the container description for the first child in the receiver * that is a leaf, or this container if there are no children. */ - public ContainerDescription getFirstLeafFolder() { + public ContainerSnapshot getFirstLeafFolder() { // If there are no members, this is a leaf if (members == null || members.length == 0) { return this; } // Traverse the members and find the first potential leaf - for (AbstractResourceDescription member : members) { - if (member instanceof ContainerDescription) { - return ((ContainerDescription) member).getFirstLeafFolder(); + for (AbstractResourceSnapshot member : members) { + if (member instanceof ContainerSnapshot) { + return ((ContainerSnapshot) member).getFirstLeafFolder(); } } // No child folders were found, this is a leaf @@ -246,11 +246,11 @@ public ContainerDescription getFirstLeafFolder() { * the resource description considered a member of this * container. */ - public void addMember(AbstractResourceDescription member) { + public void addMember(AbstractResourceSnapshot member) { if (members == null) { - members = new AbstractResourceDescription[] { member }; + members = new AbstractResourceSnapshot[] { member }; } else { - AbstractResourceDescription[] expandedMembers = new AbstractResourceDescription[members.length + 1]; + AbstractResourceSnapshot[] expandedMembers = new AbstractResourceSnapshot[members.length + 1]; System.arraycopy(members, 0, expandedMembers, 0, members.length); expandedMembers[members.length] = member; members = expandedMembers; @@ -295,7 +295,7 @@ public boolean verifyExistence(boolean checkMembers) { if (checkMembers) { // restore any children if (members != null && members.length > 0) { - for (AbstractResourceDescription member : members) { + for (AbstractResourceSnapshot member : members) { if (!member.verifyExistence(checkMembers)) { return false; } diff --git a/resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/resources/descriptions/FileDescription.java b/resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/resources/undo/snapshot/FileSnapshot.java similarity index 76% rename from resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/resources/descriptions/FileDescription.java rename to resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/resources/undo/snapshot/FileSnapshot.java index aec9164f85b..dc340f5fcb3 100644 --- a/resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/resources/descriptions/FileDescription.java +++ b/resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/resources/undo/snapshot/FileSnapshot.java @@ -12,7 +12,7 @@ * IBM Corporation - initial API and implementation *******************************************************************************/ -package org.eclipse.core.resources.descriptions; +package org.eclipse.core.resources.undo.snapshot; import java.io.ByteArrayInputStream; import java.io.InputStream; @@ -38,7 +38,7 @@ * @since 3.20 * */ -public class FileDescription extends AbstractResourceDescription { +public class FileSnapshot extends AbstractResourceSnapshot { String name; @@ -46,17 +46,16 @@ public class FileDescription extends AbstractResourceDescription { String charset; - private IFileContentDescription fileContentDescription; + private IFileContentSnapshot fileContentDescription; /** - * Create a FileDescription that can be used to later restore the given - * file. The file typically already exists, but this constructor will not - * fail if the file does not exist. + * Create a FileSnapshot that can be used to later restore the given file. The + * file typically already exists, but this constructor will not fail if the file + * does not exist. * - * @param file - * the file to be restored. + * @param file the file to be restored. */ - public FileDescription(IFile file) { + public FileSnapshot(IFile file) { super(file); this.name = file.getName(); try { @@ -71,23 +70,21 @@ public FileDescription(IFile file) { } /** - * Create a file description 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. + * 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. * - * @param file - * the file to be described - * @param linkLocation - * the location of the file's link, or null if the - * file is not linked - * @param fileContentDescription - * the file content description that can be used to get - * information about the file, such as its initial content + * @param file the file to be described + * @param linkLocation the location of the file's link, or + * null if the file is not linked + * @param fileContentDescription the file content description that can be used + * to get information about the file, such as its + * initial content */ - public FileDescription(IFile file, URI linkLocation, - IFileContentDescription fileContentDescription) { + public FileSnapshot(IFile file, URI linkLocation, + IFileContentSnapshot fileContentDescription) { super(file); this.name = file.getName(); this.location = linkLocation; @@ -107,7 +104,7 @@ public void recordStateFromHistory(IResource resource, IFileState[] states = ((IFile) resource).getHistory(monitor); if (states.length > 0) { final IFileState state = getMatchingFileState(states); - this.fileContentDescription = new IFileContentDescription() { + this.fileContentDescription = new IFileContentSnapshot() { @Override public boolean exists() { return state.exists(); @@ -142,13 +139,13 @@ public void createExistentResourceFromHandle(IResource resource, IProgressMonito } IFile fileHandle = (IFile) resource; SubMonitor subMonitor = SubMonitor.convert(mon, 200); - subMonitor.setTaskName(ResourceDescriptionMessages.FileDescription_NewFileProgress); + subMonitor.setTaskName(ResourceSnapshotMessages.FileDescription_NewFileProgress); try { if (location != null) { fileHandle.createLink(location, IResource.ALLOW_MISSING_LOCAL, subMonitor.split(200)); } else { InputStream contents = new ByteArrayInputStream( - ResourceDescriptionMessages.FileDescription_ContentsCouldNotBeRestored + ResourceSnapshotMessages.FileDescription_ContentsCouldNotBeRestored .getBytes()); // Retrieve the contents from the file content // description. Other file state attributes, such as timestamps, diff --git a/resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/resources/descriptions/FolderDescription.java b/resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/resources/undo/snapshot/FolderSnapshot.java similarity index 71% rename from resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/resources/descriptions/FolderDescription.java rename to resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/resources/undo/snapshot/FolderSnapshot.java index ec6493d025d..fae5b4a14d0 100644 --- a/resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/resources/descriptions/FolderDescription.java +++ b/resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/resources/undo/snapshot/FolderSnapshot.java @@ -12,7 +12,7 @@ * IBM Corporation - initial API and implementation ******************************************************************************/ -package org.eclipse.core.resources.descriptions; +package org.eclipse.core.resources.undo.snapshot; import java.net.URI; import org.eclipse.core.resources.IFolder; @@ -34,36 +34,32 @@ * @since 3.20 * */ -public class FolderDescription extends ContainerDescription { +public class FolderSnapshot extends ContainerSnapshot { private boolean virtual = false; + /** - * Create a FolderDescription from the specified folder handle. Typically - * used when the folder handle represents a resource that actually exists, - * although it will not fail if the resource is non-existent. + * Create a FolderSnapshot from the specified folder handle. Typically used when + * the folder handle represents a resource that actually exists, although it + * will not fail if the resource is non-existent. * - * @param folder - * the folder to be described - * @param virtual - * the folder is a virtual folder + * @param folder the folder to be described + * @param virtual the folder is a virtual folder */ - public FolderDescription(IFolder folder, boolean virtual) { + public FolderSnapshot(IFolder folder, boolean virtual) { super(folder); this.virtual = virtual; } /** - * Create a FolderDescription from the specified folder handle. If the - * folder to be created should be linked to a different location, specify - * the location. + * Create a FolderSnapshot from the specified folder handle. If the folder to be + * created should be linked to a different location, specify the location. * - * @param folder - * the folder to be described - * @param linkLocation - * the location to which the folder is linked, or - * null if it is not linked + * @param folder the folder to be described + * @param linkLocation the location to which the folder is linked, or + * null if it is not linked */ - public FolderDescription(IFolder folder, URI linkLocation) { + public FolderSnapshot(IFolder folder, URI linkLocation) { super(folder); this.name = folder.getName(); this.location = linkLocation; @@ -84,7 +80,7 @@ public void createExistentResourceFromHandle(IResource resource, IProgressMonito } IFolder folderHandle = (IFolder) resource; SubMonitor subMonitor = SubMonitor.convert(mon, 300); - subMonitor.setTaskName(ResourceDescriptionMessages.FolderDescription_NewFolderProgress); + subMonitor.setTaskName(ResourceSnapshotMessages.FolderDescription_NewFolderProgress); if (filters != null) { SubMonitor loopMonitor = subMonitor.split(100).setWorkRemaining(filters.length); for (IResourceFilterDescription filter : filters) { diff --git a/resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/resources/descriptions/IFileContentDescription.java b/resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/resources/undo/snapshot/IFileContentSnapshot.java similarity index 91% rename from resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/resources/descriptions/IFileContentDescription.java rename to resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/resources/undo/snapshot/IFileContentSnapshot.java index 844af49a241..54f105cc2c5 100644 --- a/resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/resources/descriptions/IFileContentDescription.java +++ b/resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/resources/undo/snapshot/IFileContentSnapshot.java @@ -11,20 +11,20 @@ * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ -package org.eclipse.core.resources.descriptions; +package org.eclipse.core.resources.undo.snapshot; import java.io.InputStream; import org.eclipse.core.runtime.CoreException; /** - * IFileContentDescription is a description of a file's content. + * IFileContentSnapshot is a description of a file's content. * * This class is not intended to be instantiated or used by clients. * * @since 3.20 * */ -public interface IFileContentDescription { +public interface IFileContentSnapshot { /** * Returns an open input stream on the contents of the file described. The * client is responsible for closing the stream when finished. diff --git a/resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/resources/descriptions/MarkerDescription.java b/resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/resources/undo/snapshot/MarkerSnapshot.java similarity index 71% rename from resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/resources/descriptions/MarkerDescription.java rename to resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/resources/undo/snapshot/MarkerSnapshot.java index bb8f6864999..4e21185ed4b 100644 --- a/resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/resources/descriptions/MarkerDescription.java +++ b/resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/resources/undo/snapshot/MarkerSnapshot.java @@ -12,7 +12,7 @@ * IBM Corporation - initial API and implementation ******************************************************************************/ -package org.eclipse.core.resources.descriptions; +package org.eclipse.core.resources.undo.snapshot; import java.util.Map; import org.eclipse.core.resources.IMarker; @@ -20,15 +20,15 @@ import org.eclipse.core.runtime.CoreException; /** - * MarkerDescription is a lightweight description of a marker that can be used - * to describe a marker to be created or updated. + * MarkerSnapshot is a lightweight description of a marker that can be used to + * describe a marker to be created or updated. * * This class is not intended to be instantiated or used by clients. * * @since 3.20 * */ -public class MarkerDescription { +public class MarkerSnapshot { String type; Map attributes; @@ -37,13 +37,12 @@ public class MarkerDescription { /** * - * Create a marker description from the specified marker. + * Create a marker snapshot from the specified marker. * - * @param marker - * the marker to be described + * @param marker the marker to be described * @throws CoreException */ - public MarkerDescription(IMarker marker) throws CoreException { + public MarkerSnapshot(IMarker marker) throws CoreException { this.type = marker.getType(); this.attributes = marker.getAttributes(); this.resource = marker.getResource(); @@ -51,17 +50,14 @@ public MarkerDescription(IMarker marker) throws CoreException { } /** - * Create a marker description from the specified marker type, attributes, - * and resource. + * Create a marker snapshot from the specified marker type, attributes, and + * resource. * - * @param type - * the type of marker to be created. - * @param attributes - * the attributes to be assigned to the marker - * @param resource - * the resource on which the marker should be created + * @param type the type of marker to be created. + * @param attributes the attributes to be assigned to the marker + * @param resource the resource on which the marker should be created */ - public MarkerDescription(String type, Map attributes, IResource resource) { + public MarkerSnapshot(String type, Map attributes, IResource resource) { this.type = type; this.attributes = attributes; this.resource = resource; diff --git a/resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/resources/descriptions/ProjectDescription.java b/resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/resources/undo/snapshot/ProjectSnapshot.java similarity index 78% rename from resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/resources/descriptions/ProjectDescription.java rename to resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/resources/undo/snapshot/ProjectSnapshot.java index 668a99918f1..54cbab9ea7f 100644 --- a/resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/resources/descriptions/ProjectDescription.java +++ b/resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/resources/undo/snapshot/ProjectSnapshot.java @@ -12,7 +12,7 @@ * IBM Corporation - initial API and implementation ******************************************************************************/ -package org.eclipse.core.resources.descriptions; +package org.eclipse.core.resources.undo.snapshot; import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IProjectDescription; @@ -24,26 +24,25 @@ import org.eclipse.core.runtime.SubMonitor; /** - * ProjectDescription is a lightweight description that describes a project to - * be created. + * ProjectSnapshot is a lightweight description that describes a project to be + * created. * * This class is not intended to be instantiated or used by clients. * * @since 3.20 * */ -public class ProjectDescription extends ContainerDescription { +public class ProjectSnapshot extends ContainerSnapshot { private IProjectDescription projectDescription; private boolean openOnCreate = true; /** - * Create a project description from a specified project. + * Create a project snapshot from a specified project. * - * @param project - * The project to be described. The project must exist. + * @param project The project to be described. The project must exist. */ - public ProjectDescription(IProject project) { + public ProjectSnapshot(IProject project) { super(project); Assert.isLegal(project.exists()); if (project.isOpen()) { @@ -62,13 +61,12 @@ public ProjectDescription(IProject project) { } /** - * Create a project description from a specified IProjectDescription. Used - * when the project does not yet exist. + * Create a project snapshot from a specified IProjectDescription. Used when the + * project does not yet exist. * - * @param projectDescription - * the project description for the future project + * @param projectDescription the project description for the future project */ - public ProjectDescription(IProjectDescription projectDescription) { + public ProjectSnapshot(IProjectDescription projectDescription) { super(); this.projectDescription = projectDescription; } @@ -87,7 +85,7 @@ public void createExistentResourceFromHandle(IResource resource, return; } IProject projectHandle = (IProject) resource; - subMonitor.setTaskName(ResourceDescriptionMessages.FolderDescription_NewFolderProgress); + subMonitor.setTaskName(ResourceSnapshotMessages.FolderDescription_NewFolderProgress); if (projectDescription == null) { projectHandle.create(subMonitor.split(100)); } else { diff --git a/resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/resources/descriptions/ResourceDescription.java b/resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/resources/undo/snapshot/ResourceSnapshot.java similarity index 86% rename from resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/resources/descriptions/ResourceDescription.java rename to resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/resources/undo/snapshot/ResourceSnapshot.java index 2920c33ca8f..759137370ff 100644 --- a/resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/resources/descriptions/ResourceDescription.java +++ b/resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/resources/undo/snapshot/ResourceSnapshot.java @@ -12,7 +12,7 @@ * IBM Corporation - initial API and implementation ******************************************************************************/ -package org.eclipse.core.resources.descriptions; +package org.eclipse.core.resources.undo.snapshot; import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IFolder; @@ -22,7 +22,7 @@ import org.eclipse.core.runtime.IProgressMonitor; /** - * ResourceDescription is a lightweight description that describes the common + * ResourceSnapshot is a lightweight description that describes the common * attributes of a resource to be created. * * This class is not intended to be extended by clients. @@ -30,23 +30,22 @@ * @since 3.20 * */ -public abstract class ResourceDescription { +public abstract class ResourceSnapshot { /** - * Create a resource description given the specified resource. The resource - * is assumed to exist. + * Create a resource snapshot given the specified resource. The resource is + * assumed to exist. * - * @param resource - * the resource from which a description should be created + * @param resource the resource from which a description should be created * @return the resource description */ - public static ResourceDescription fromResource(IResource resource) { + public static ResourceSnapshot fromResource(IResource resource) { if (resource.getType() == IResource.PROJECT) { - return new ProjectDescription((IProject) resource); + return new ProjectSnapshot((IProject) resource); } else if (resource.getType() == IResource.FOLDER) { - return new FolderDescription((IFolder) resource, resource.isVirtual()); + return new FolderSnapshot((IFolder) resource, resource.isVirtual()); } else if (resource.getType() == IResource.FILE) { - return new FileDescription((IFile) resource); + return new FileSnapshot((IFile) resource); } else { throw new IllegalArgumentException(); } diff --git a/resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/resources/descriptions/ResourceDescriptionMessages.java b/resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/resources/undo/snapshot/ResourceSnapshotMessages.java similarity index 86% rename from resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/resources/descriptions/ResourceDescriptionMessages.java rename to resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/resources/undo/snapshot/ResourceSnapshotMessages.java index c7bf83d4348..3ce8de992a7 100644 --- a/resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/resources/descriptions/ResourceDescriptionMessages.java +++ b/resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/resources/undo/snapshot/ResourceSnapshotMessages.java @@ -18,22 +18,22 @@ * Jens Reimann , Fabian Pfaff - Bug 197850: [quick assist] Add import static field/method - https://bugs.eclipse.org/bugs/show_bug.cgi?id=197850 * Jens Reimann Bug 38201: [quick assist] Allow creating abstract method - https://bugs.eclipse.org/38201 *******************************************************************************/ -package org.eclipse.core.resources.descriptions; +package org.eclipse.core.resources.undo.snapshot; import org.eclipse.osgi.util.NLS; /** * Helper class to get NLSed messages. */ -public final class ResourceDescriptionMessages extends NLS { +public final class ResourceSnapshotMessages extends NLS { - private static final String BUNDLE_NAME= ResourceDescriptionMessages.class.getName(); + private static final String BUNDLE_NAME= ResourceSnapshotMessages.class.getName(); static { - NLS.initializeMessages(BUNDLE_NAME, ResourceDescriptionMessages.class); + NLS.initializeMessages(BUNDLE_NAME, ResourceSnapshotMessages.class); } - private ResourceDescriptionMessages() { + private ResourceSnapshotMessages() { // Do not instantiate } diff --git a/resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/resources/descriptions/ResourceDescriptionMessages.properties b/resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/resources/undo/snapshot/ResourceSnapshotMessages.properties similarity index 100% rename from resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/resources/descriptions/ResourceDescriptionMessages.properties rename to resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/resources/undo/snapshot/ResourceSnapshotMessages.properties