|
10 | 10 | import com.intellij.openapi.ui.Messages; |
11 | 11 | import com.intellij.openapi.vcs.VcsException; |
12 | 12 | import com.intellij.openapi.vcs.vfs.ContentRevisionVirtualFile; |
13 | | -import com.intellij.openapi.vfs.VfsUtil; |
14 | 13 | import com.intellij.openapi.vfs.VirtualFile; |
15 | 14 | import com.intellij.openapi.vfs.VirtualFileManager; |
16 | 15 | import com.intellij.testFramework.BinaryLightVirtualFile; |
|
21 | 20 | import org.jetbrains.annotations.NotNull; |
22 | 21 | import org.jetbrains.annotations.Nullable; |
23 | 22 |
|
24 | | -import java.net.MalformedURLException; |
25 | | -import java.net.URL; |
26 | 23 | import java.util.Arrays; |
27 | 24 |
|
28 | 25 | public class EditorService implements Disposable { |
@@ -174,18 +171,13 @@ private boolean showIfAlreadyOpen(String name, int lineNumber) { |
174 | 171 |
|
175 | 172 | public void openSpanWorkspaceFileInEditor(@NotNull String workspaceUri, int offset) { |
176 | 173 |
|
177 | | - try { |
178 | | - var fileToOpen = VfsUtil.findFileByURL(new URL(workspaceUri)); |
179 | | - if (fileToOpen == null) { |
180 | | - NotificationUtil.notifyError(project, "Could not find file " + workspaceUri); |
181 | | - return; |
182 | | - } |
183 | | - OpenFileDescriptor openFileDescriptor = new OpenFileDescriptor(project, fileToOpen, Math.max(offset, 0)); |
184 | | - FileEditorManager.getInstance(project).openTextEditor(openFileDescriptor, true); |
185 | | - } catch (MalformedURLException e) { |
186 | | - Log.log(LOGGER::warn, "Could not open file " + workspaceUri + ", Exception" + e.getMessage()); |
187 | | - NotificationUtil.notifyError(project, "Could not open file " + workspaceUri + ", Exception:" + e.getMessage()); |
| 174 | + var fileToOpen = VirtualFileManager.getInstance().findFileByUrl(workspaceUri); |
| 175 | + if (fileToOpen == null) { |
| 176 | + NotificationUtil.notifyError(project, "Could not find file " + workspaceUri); |
| 177 | + return; |
188 | 178 | } |
| 179 | + OpenFileDescriptor openFileDescriptor = new OpenFileDescriptor(project, fileToOpen, Math.max(offset, 0)); |
| 180 | + FileEditorManager.getInstance(project).openTextEditor(openFileDescriptor, true); |
189 | 181 | } |
190 | 182 |
|
191 | 183 |
|
|
0 commit comments