Skip to content

Commit

Permalink
Merge branch 'master' of github.com:eclipse-platform/eclipse.platform…
Browse files Browse the repository at this point in the history
….ui into HEAD
  • Loading branch information
mickaelistria committed Oct 11, 2023
2 parents 2db6dae + 985eb29 commit 16cb21c
Show file tree
Hide file tree
Showing 30 changed files with 274 additions and 1,305 deletions.
2 changes: 1 addition & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
pipeline {
options {
timeout(time: 60, unit: 'MINUTES')
timeout(time: 80, unit: 'MINUTES')
buildDiscarder(logRotator(numToKeepStr:'5'))
disableConcurrentBuilds(abortPrevious: true)
}
Expand Down
4 changes: 2 additions & 2 deletions bundles/org.eclipse.ui.ide/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %Plugin.name
Bundle-SymbolicName: org.eclipse.ui.ide; singleton:=true
Bundle-Version: 3.21.200.qualifier
Bundle-Version: 3.22.0.qualifier
Bundle-Activator: org.eclipse.ui.internal.ide.IDEWorkbenchPlugin
Bundle-ActivationPolicy: lazy
Bundle-Vendor: %Plugin.providerName
Expand Down Expand Up @@ -45,7 +45,7 @@ Export-Package: org.eclipse.ui,
org.eclipse.ui.views.tasklist,
org.eclipse.ui.wizards.datatransfer,
org.eclipse.ui.wizards.newresource
Require-Bundle: org.eclipse.core.resources;bundle-version="[3.19.0,4.0.0)";resolution:=optional,
Require-Bundle: org.eclipse.core.resources;bundle-version="[3.20.0,4.0.0)";resolution:=optional,
org.eclipse.core.runtime;bundle-version="[3.29.0,4.0.0)",
org.eclipse.core.filesystem;bundle-version="[1.10.0,2.0.0)",
org.eclipse.help;bundle-version="[3.10.0,4.0.0)",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.mapping.IResourceChangeDescriptionFactory;
import org.eclipse.core.resources.undo.snapshot.IResourceSnapshot;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IProgressMonitor;
Expand Down Expand Up @@ -44,7 +45,7 @@ abstract class AbstractCreateResourcesOperation extends
* the label of the operation
*/
AbstractCreateResourcesOperation(
ResourceDescription[] resourceDescriptions, String label) {
IResourceSnapshot<? extends IResource>[] resourceDescriptions, String label) {
super(resourceDescriptions, label);
}

Expand Down Expand Up @@ -80,7 +81,7 @@ protected boolean updateResourceChangeDescriptionFactory(
modified = true;
}
} else {
for (ResourceDescription resourceDescription : resourceDescriptions) {
for (IResourceSnapshot<? extends IResource> resourceDescription : resourceDescriptions) {
if (resourceDescription != null) {
IResource resource = resourceDescription.createResourceHandle();
factory.create(resource);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,14 @@

import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.undo.snapshot.IMarkerSnapshot;
import org.eclipse.core.resources.undo.snapshot.ResourceSnapshotFactory;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.ISchedulingRule;
import org.eclipse.core.runtime.jobs.MultiRule;
import org.eclipse.ui.internal.ide.undo.MarkerDescription;
import org.eclipse.ui.internal.ide.undo.UndoMessages;
import org.eclipse.ui.views.markers.internal.MarkerType;
import org.eclipse.ui.views.markers.internal.MarkerTypesModel;
Expand All @@ -44,7 +45,7 @@
*/
abstract class AbstractMarkersOperation extends AbstractWorkspaceOperation {

MarkerDescription[] markerDescriptions;
IMarkerSnapshot[] markerDescriptions;

IMarker[] markers;

Expand All @@ -68,7 +69,7 @@ abstract class AbstractMarkersOperation extends AbstractWorkspaceOperation {
* the name used to describe the operation
*/
AbstractMarkersOperation(IMarker[] markers,
MarkerDescription[] markerDescriptions, Map attributes, String name) {
IMarkerSnapshot[] markerDescriptions, Map attributes, String name) {
super(name);
this.markers = markers;
this.attributes = null;
Expand Down Expand Up @@ -111,9 +112,9 @@ protected void deleteMarkers(int work, IProgressMonitor monitor)
return;
}
int markerWork = work / markers.length;
markerDescriptions = new MarkerDescription[markers.length];
markerDescriptions = new IMarkerSnapshot[markers.length];
for (int i = 0; i < markers.length; i++) {
markerDescriptions[i] = new MarkerDescription(markers[i]);
markerDescriptions[i] = ResourceSnapshotFactory.fromMarker(markers[i]);
markers[i].delete();
monitor.worked(markerWork);
}
Expand Down Expand Up @@ -199,7 +200,7 @@ protected void updateMarkers(int work, IProgressMonitor monitor,
* @param descriptions
* the descriptions of markers that can be created.
*/
protected void setMarkerDescriptions(MarkerDescription[] descriptions) {
protected void setMarkerDescriptions(IMarkerSnapshot[] descriptions) {
markerDescriptions = descriptions;
addUndoContexts();
updateTargetResources();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import java.util.Set;

import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.undo.snapshot.IResourceSnapshot;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IProgressMonitor;
Expand Down Expand Up @@ -54,7 +55,7 @@ abstract class AbstractResourcesOperation extends AbstractWorkspaceOperation {
* The array of resource descriptions known by this operation to create or
* restore overwritten resources.
*/
protected ResourceDescription[] resourceDescriptions;
protected IResourceSnapshot<? extends IResource>[] resourceDescriptions;

/*
* Return true if the specified subResource is a descendant of the specified
Expand Down Expand Up @@ -91,7 +92,7 @@ private static boolean isDescendantOf(IResource subResource,
* @param label
* the label of the operation
*/
AbstractResourcesOperation(ResourceDescription[] resourceDescriptions,
AbstractResourcesOperation(IResourceSnapshot<? extends IResource>[] resourceDescriptions,
String label) {
super(label);
addContext(WorkspaceUndoUtil.getWorkspaceUndoContext());
Expand Down Expand Up @@ -143,7 +144,7 @@ protected void recreate(IProgressMonitor monitor, IAdaptable uiInfo)
throws CoreException {
setTargetResources(WorkspaceUndoUtil.recreate(resourceDescriptions,
monitor, uiInfo));
setResourceDescriptions(new ResourceDescription[0]);
setResourceDescriptions(new IResourceSnapshot<?>[0]);
}

/**
Expand Down Expand Up @@ -171,7 +172,7 @@ protected IStatus computeCreateStatus(boolean allowOverwrite) {
markInvalid();
return getErrorStatus(UndoMessages.AbstractResourcesOperation_NotEnoughInfo);
}
for (ResourceDescription resourceDescription : resourceDescriptions) {
for (IResourceSnapshot<? extends IResource> resourceDescription : resourceDescriptions) {
// Check for enough info to restore the resource
if (resourceDescription == null || !resourceDescription.isValid()) {
markInvalid();
Expand Down Expand Up @@ -245,9 +246,9 @@ IStatus checkReadOnlyResources(IResource[] resourcesToCheck) {
* @param descriptions
* the array of resource descriptions
*/
protected void setResourceDescriptions(ResourceDescription[] descriptions) {
protected void setResourceDescriptions(IResourceSnapshot<? extends IResource>[] descriptions) {
if (descriptions == null) {
resourceDescriptions = new ResourceDescription[0];
resourceDescriptions = new IResourceSnapshot<?>[0];
} else {
resourceDescriptions = descriptions;
}
Expand Down Expand Up @@ -313,7 +314,7 @@ protected ISchedulingRule computeDeleteSchedulingRule() {
protected void setTargetResources(IResource[] targetResources) {
// Remove any descendants if the parent has also
// been specified.
Set subResources = new HashSet();
Set<IResource> subResources = new HashSet<>();
for (IResource subResource : targetResources) {
for (IResource superResource : targetResources) {
if (isDescendantOf(subResource, superResource) && !subResources.contains(subResource))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
import org.eclipse.core.resources.IProjectDescription;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.mapping.IResourceChangeDescriptionFactory;
import org.eclipse.core.resources.undo.snapshot.IResourceSnapshot;
import org.eclipse.core.resources.undo.snapshot.ResourceSnapshotFactory;
import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IAdaptable;
Expand All @@ -30,7 +32,6 @@
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.SubMonitor;
import org.eclipse.ui.internal.ide.undo.ProjectDescription;
import org.eclipse.ui.internal.ide.undo.UndoMessages;

/**
Expand All @@ -52,7 +53,7 @@ public class CopyProjectOperation extends AbstractCopyOrMoveResourcesOperation {

private IProject originalProject;

private ProjectDescription originalProjectDescription;
private IResourceSnapshot<? extends IResource> originalProjectDescription;

/**
* Create a CopyProjectOperation that copies the specified project and sets
Expand Down Expand Up @@ -123,7 +124,7 @@ protected void doExecute(IProgressMonitor monitor, IAdaptable uiInfo)
IProject newProject = copyProject(originalProject, destination,
projectLocation, monitor);
setTargetResources(new IResource[] { newProject });
setResourceDescriptions(new ResourceDescription[0]);
setResourceDescriptions(new IResourceSnapshot<?>[0]);
}

/*
Expand All @@ -137,7 +138,7 @@ protected void doUndo(IProgressMonitor monitor, IAdaptable uiInfo)
WorkspaceUndoUtil.delete(resources, subMonitor.split(1), uiInfo, true);
// Set the target resource to the original
setTargetResources(new IResource[] { originalProject });
setResourceDescriptions(new ResourceDescription[0]);
setResourceDescriptions(new IResourceSnapshot<?>[0]);
}

@Override
Expand Down Expand Up @@ -204,7 +205,7 @@ IProject copyProject(IProject project, IPath destinationPath,
// description for performing the undo.
project.open(null);
}
originalProjectDescription = new ProjectDescription(project);
originalProjectDescription = ResourceSnapshotFactory.fromResource(project);
IProjectDescription description = project.getDescription();

// Set the new name and location into the project's description
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@

import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.mapping.IResourceChangeDescriptionFactory;
import org.eclipse.core.resources.undo.snapshot.IResourceSnapshot;
import org.eclipse.core.resources.undo.snapshot.ResourceSnapshotFactory;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IPath;
Expand Down Expand Up @@ -55,7 +57,7 @@ public class CopyResourcesOperation extends

IResource[] originalResources;

ResourceDescription[] snapshotResourceDescriptions;
IResourceSnapshot<? extends IResource>[] snapshotResourceDescriptions;

/**
* Create a CopyResourcesOperation that copies a single resource to a new
Expand Down Expand Up @@ -148,12 +150,12 @@ protected void copy(IProgressMonitor monitor, IAdaptable uiInfo)
resources.length + (resourceDescriptions != null ? resourceDescriptions.length : 0));
subMonitor.setTaskName(UndoMessages.AbstractResourcesOperation_CopyingResourcesProgress);
List<IResource> resourcesAtDestination = new ArrayList<>();
List<ResourceDescription> overwrittenResources = new ArrayList<>();
List<IResourceSnapshot<? extends IResource>> overwrittenResources = new ArrayList<>();

for (int i = 0; i < resources.length; i++) {
// Copy the resources and record the overwrites that would
// be restored if this operation were reversed
ResourceDescription[] overwrites;
IResourceSnapshot<? extends IResource>[] overwrites;
overwrites = WorkspaceUndoUtil.copy(new IResource[] { resources[i] }, getDestinationPath(resources[i], i),
resourcesAtDestination, subMonitor.split(1), uiInfo, true, fCreateGroups, fCreateLinks,
fRelativeToVariable);
Expand All @@ -163,7 +165,7 @@ protected void copy(IProgressMonitor monitor, IAdaptable uiInfo)

// Are there any previously overwritten resources to restore now?
if (resourceDescriptions != null) {
for (ResourceDescription resourceDescription : resourceDescriptions) {
for (IResourceSnapshot<? extends IResource> resourceDescription : resourceDescriptions) {
if (resourceDescription != null) {
resourceDescription.createResource(subMonitor.split(1));
}
Expand All @@ -172,7 +174,7 @@ protected void copy(IProgressMonitor monitor, IAdaptable uiInfo)

// Reset resource descriptions to the just overwritten resources
setResourceDescriptions(overwrittenResources
.toArray(new ResourceDescription[overwrittenResources.size()]));
.toArray(new IResourceSnapshot[overwrittenResources.size()]));

// Reset the target resources to refer to the resources in their new
// location.
Expand All @@ -193,7 +195,7 @@ protected void doUndo(IProgressMonitor monitor, IAdaptable uiInfo)
WorkspaceUndoUtil.delete(resources, subMonitor.split(1), uiInfo, true);
// then restoring any overwritten by the previous copy...
WorkspaceUndoUtil.recreate(resourceDescriptions, subMonitor.split(1), uiInfo);
setResourceDescriptions(new ResourceDescription[0]);
setResourceDescriptions(new IResourceSnapshot[0]);
// then setting the target resources back to the original ones.
// Note that the destination paths never changed since they
// are not used during undo.
Expand All @@ -210,7 +212,7 @@ protected boolean updateResourceChangeDescriptionFactory(
update = true;
factory.delete(resource);
}
for (ResourceDescription resourceDescription : resourceDescriptions) {
for (IResourceSnapshot resourceDescription : resourceDescriptions) {
if (resourceDescription != null) {
update = true;
IResource resource = resourceDescription.createResourceHandle();
Expand Down Expand Up @@ -244,7 +246,7 @@ public IStatus computeUndoableStatus(IProgressMonitor monitor) {
markInvalid();
return getErrorStatus(UndoMessages.CopyResourcesOperation_NotAllowedDueToDataLoss);
}
for (ResourceDescription snapshotResourceDescription : snapshotResourceDescriptions) {
for (IResourceSnapshot snapshotResourceDescription : snapshotResourceDescriptions) {
if (!snapshotResourceDescription.verifyExistence(true)) {
markInvalid();
return getErrorStatus(UndoMessages.CopyResourcesOperation_NotAllowedDueToDataLoss);
Expand All @@ -271,10 +273,9 @@ public IStatus computeUndoableStatus(IProgressMonitor monitor) {
*/
private void setOriginalResources(IResource[] originals) {
originalResources = originals;
snapshotResourceDescriptions = new ResourceDescription[originals.length];
snapshotResourceDescriptions = new IResourceSnapshot[originals.length];
for (int i = 0; i < originals.length; i++) {
snapshotResourceDescriptions[i] = ResourceDescription
.fromResource(originals[i]);
snapshotResourceDescriptions[i] = ResourceSnapshotFactory.fromResource(originals[i]);
}
}
}
Loading

0 comments on commit 16cb21c

Please sign in to comment.