Skip to content

Commit 8dddc60

Browse files
authored
Fix Project Explorer not refreshing source containers after drag-and-drop move
Fixes eclipse-platform#3525
1 parent 39d028e commit 8dddc60

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

bundles/org.eclipse.ui.navigator.resources/src/org/eclipse/ui/navigator/resources/ResourceDropAdapterAssistant.java

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,21 @@ public IStatus handleDrop(CommonDropAdapter aDropAdapter,
229229
} catch (CoreException e) {
230230
}
231231
}
232+
// Also refresh the source containers when moving resources
233+
// to ensure they are properly removed from the UI
234+
if (resources != null && resources.length > 0
235+
&& aDropAdapter.getCurrentOperation() != DND.DROP_COPY
236+
&& aDropAdapter.getCurrentOperation() != DND.DROP_LINK) {
237+
for (IResource resource : resources) {
238+
IContainer parent = resource.getParent();
239+
if (parent != null && parent.isAccessible() && !parent.equals(target)) {
240+
try {
241+
parent.refreshLocal(IResource.DEPTH_ONE, null);
242+
} catch (CoreException e) {
243+
}
244+
}
245+
}
246+
}
232247
return status;
233248
}
234249

@@ -293,6 +308,17 @@ public IStatus handlePluginTransferDrop(IStructuredSelection aDragSelection, Obj
293308
} catch (CoreException e) {
294309
}
295310
}
311+
// Also refresh the source containers when moving resources
312+
// to ensure they are properly removed from the UI
313+
for (IResource resource : resources) {
314+
IContainer parent = resource.getParent();
315+
if (parent != null && parent.isAccessible() && !parent.equals(target)) {
316+
try {
317+
parent.refreshLocal(IResource.DEPTH_ONE, null);
318+
} catch (CoreException e) {
319+
}
320+
}
321+
}
296322
return Status.OK_STATUS;
297323
}
298324

0 commit comments

Comments
 (0)