Skip to content

Commit b7cd868

Browse files
committed
Improve entry location for LTK copy refactoring
1 parent 4f761c0 commit b7cd868

2 files changed

Lines changed: 15 additions & 10 deletions

File tree

bundles/org.eclipse.ui.ide/extensions/org/eclipse/ui/actions/CopyFilesAndFoldersOperation.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@
7777
import org.eclipse.ui.internal.ide.IDEInternalPreferences;
7878
import org.eclipse.ui.internal.ide.IDEWorkbenchMessages;
7979
import org.eclipse.ui.internal.ide.IDEWorkbenchPlugin;
80+
import org.eclipse.ui.internal.ide.actions.LTKLauncher;
8081
import org.eclipse.ui.internal.ide.dialogs.IDEResourceInfoUtils;
8182
import org.eclipse.ui.statushandlers.StatusManager;
8283
import org.eclipse.ui.wizards.datatransfer.FileStoreStructureProvider;
@@ -1241,6 +1242,14 @@ boolean isDestinationSameAsSource(IResource[] sourceResources,
12411242
private boolean performCopy(IResource[] resources, IPath destination,
12421243
IProgressMonitor monitor) {
12431244
try {
1245+
IPath[] destPaths = new IPath[resources.length];
1246+
for (int i = 0; i < resources.length; i++) {
1247+
destPaths[i] = destination.append(resources[i].getName());
1248+
}
1249+
if (LTKLauncher.copyResources(resources, destPaths)) {
1250+
return true;
1251+
}
1252+
12441253
AbstractWorkspaceOperation op = getUndoableCopyOrMoveOperation(
12451254
resources, destination);
12461255
op.setModelProviderIds(getModelProviderIds());
@@ -1301,6 +1310,11 @@ private boolean performCopyWithAutoRename(IResource[] resources,
13011310
workspace);
13021311
}
13031312
}
1313+
1314+
if (LTKLauncher.copyResources(resources, destinationPaths)) {
1315+
return true;
1316+
}
1317+
13041318
CopyResourcesOperation op = new CopyResourcesOperation(resources,
13051319
destinationPaths,
13061320
IDEWorkbenchMessages.CopyFilesAndFoldersOperation_copyTitle);

bundles/org.eclipse.ui.ide/src/org/eclipse/ui/ide/undo/CopyResourcesOperation.java

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
import org.eclipse.core.runtime.IProgressMonitor;
2929
import org.eclipse.core.runtime.IStatus;
3030
import org.eclipse.core.runtime.SubMonitor;
31-
import org.eclipse.ui.internal.ide.actions.LTKLauncher;
3231
import org.eclipse.ui.internal.ide.undo.UndoMessages;
3332

3433
/**
@@ -146,14 +145,6 @@ protected void doExecute(IProgressMonitor monitor, IAdaptable uiInfo)
146145
*/
147146
protected void copy(IProgressMonitor monitor, IAdaptable uiInfo)
148147
throws CoreException {
149-
IPath[] destPaths = new IPath[resources.length];
150-
for (int i = 0; i < resources.length; i++) {
151-
destPaths[i] = getDestinationPath(resources[i], i);
152-
}
153-
if (LTKLauncher.copyResources(resources, destPaths)) {
154-
return;
155-
}
156-
157148
SubMonitor subMonitor = SubMonitor.convert(monitor,
158149
resources.length + (resourceDescriptions != null ? resourceDescriptions.length : 0));
159150
subMonitor.setTaskName(UndoMessages.AbstractResourcesOperation_CopyingResourcesProgress);
@@ -164,7 +155,7 @@ protected void copy(IProgressMonitor monitor, IAdaptable uiInfo)
164155
// Copy the resources and record the overwrites that would
165156
// be restored if this operation were reversed
166157
IResourceSnapshot<? extends IResource>[] overwrites;
167-
overwrites = WorkspaceUndoUtil.copy(new IResource[] { resources[i] }, destPaths[i],
158+
overwrites = WorkspaceUndoUtil.copy(new IResource[] { resources[i] }, getDestinationPath(resources[i], i),
168159
resourcesAtDestination, subMonitor.split(1), uiInfo, true, fCreateGroups, fCreateLinks,
169160
fRelativeToVariable);
170161
// Accumulate the overwrites into the full list

0 commit comments

Comments
 (0)