Skip to content

Commit 1af7f4d

Browse files
committed
Don't use IFileInfo.toString() in UI, use IFileStore.toString()
The `IFileInfo.toString()` isn't intended to be shown to user, it has no information interesting for users. The `IFileStore.toString()` should be used in cases if information about deleted resources need to be shown in UI. Additionally changed dialog wording to not use "location" and be more clear about what's going on. Fixes eclipse-platform/eclipse.platform#1404
1 parent 1f3c3e1 commit 1af7f4d

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

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

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,13 @@
1616
package org.eclipse.ui.actions;
1717

1818
import java.lang.reflect.InvocationTargetException;
19+
import java.net.URI;
1920
import java.util.ArrayList;
2021
import java.util.Iterator;
2122
import java.util.List;
2223

2324
import org.eclipse.core.filesystem.IFileInfo;
25+
import org.eclipse.core.filesystem.IFileStore;
2426
import org.eclipse.core.resources.IProject;
2527
import org.eclipse.core.resources.IResource;
2628
import org.eclipse.core.resources.IResourceRuleFactory;
@@ -113,11 +115,13 @@ void checkLocationDeleted(IProject project) throws CoreException {
113115
if (!project.exists()) {
114116
return;
115117
}
116-
IFileInfo location = IDEResourceInfoUtils.getFileInfo(project.getLocationURI());
118+
URI locationURI = project.getLocationURI();
119+
IFileInfo location = IDEResourceInfoUtils.getFileInfo(locationURI);
117120
if (!location.exists()) {
121+
String displayedProjectPath = toDisplayPath(locationURI);
118122
String message = NLS.bind(
119123
IDEWorkbenchMessages.RefreshAction_locationDeletedMessage,
120-
project.getName(), location.toString());
124+
project.getName(), displayedProjectPath);
121125

122126
final MessageDialog dialog = new MessageDialog(getShell(),
123127
IDEWorkbenchMessages.RefreshAction_dialogTitle, // dialog
@@ -143,6 +147,11 @@ protected int getShellStyle() {
143147
}
144148
}
145149

150+
private static String toDisplayPath(URI locationURI) {
151+
IFileStore fileStore = IDEResourceInfoUtils.getFileStore(locationURI);
152+
return fileStore != null ? fileStore.toString() : locationURI.toString();
153+
}
154+
146155
@Override
147156
protected String getOperationMessage() {
148157
return IDEWorkbenchMessages.RefreshAction_progressMessage;

bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/ide/messages.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -327,8 +327,8 @@ RefreshAction_toolTip = Refresh
327327
RefreshAction_progressMessage = Refreshing...
328328
RefreshAction_problemTitle = Refresh Problems
329329
RefreshAction_problemMessage = Problems occurred refreshing the selected resources.
330-
RefreshAction_locationDeletedMessage = The location for project ''{0}'' ({1}) has been deleted.\nDelete ''{0}'' from the workspace?
331-
RefreshAction_dialogTitle = Project location has been deleted
330+
RefreshAction_locationDeletedMessage = Directory ''{1}'' has been deleted.\nDelete also project ''{0}'' from the workspace?
331+
RefreshAction_dialogTitle = Project has been deleted on file system
332332

333333
SelectWorkingSetAction_text= Select &Working Set...
334334

0 commit comments

Comments
 (0)