starting javascript debugger for app server run configuration improved
authornik <Nikolay.Chashnikov@jetbrains.com>
Thu, 4 Mar 2010 07:22:14 +0000 (10:22 +0300)
committernik <Nikolay.Chashnikov@jetbrains.com>
Thu, 4 Mar 2010 07:22:14 +0000 (10:22 +0300)
platform/lang-impl/src/com/intellij/openapi/fileEditor/impl/http/JumpFromRemoteFileToLocalAction.java
platform/platform-impl/src/com/intellij/openapi/vfs/impl/http/DefaultRemoteContentProvider.java

index c1a5969a8f11adb461d001b9fb2b5d972d9e9edf..70bc7c9d5f2d8a550b121dc842e7fb8a467aec25 100644 (file)
@@ -35,6 +35,7 @@ import org.jetbrains.annotations.NotNull;
 
 import javax.swing.*;
 import java.util.Collection;
+import java.util.Collections;
 
 /**
  * @author nik
@@ -58,15 +59,9 @@ public class JumpFromRemoteFileToLocalAction extends AnAction {
   @Override
   public void actionPerformed(AnActionEvent e) {
     final String url = myFile.getUrl();
-    for (LocalFileFinder finder : LocalFileFinder.EP_NAME.getExtensions()) {
-      final VirtualFile file = finder.findLocalFile(url, myProject);
-      if (file != null) {
-        navigateToFile(myProject, file);
-      }
-    }
+    final String fileName = myFile.getName();
+    Collection<VirtualFile> files = findLocalFiles(myProject, url, fileName);
 
-    final Collection<VirtualFile> files =
-      FilenameIndex.getVirtualFilesByName(myProject, myFile.getName(), GlobalSearchScope.allScope(myProject));
     if (files.isEmpty()) {
       Messages.showErrorDialog(myProject, "Cannot find local file for '" + url + "'", CommonBundle.getErrorTitle());
       return;
@@ -96,6 +91,17 @@ public class JumpFromRemoteFileToLocalAction extends AnAction {
     }
   }
 
+  public static Collection<VirtualFile> findLocalFiles(Project project, String url, String fileName) {
+    for (LocalFileFinder finder : LocalFileFinder.EP_NAME.getExtensions()) {
+      final VirtualFile file = finder.findLocalFile(url, project);
+      if (file != null) {
+        return Collections.singletonList(file);
+      }
+    }
+
+    return FilenameIndex.getVirtualFilesByName(project, fileName, GlobalSearchScope.allScope(project));
+  }
+
   private static void navigateToFile(Project project, @NotNull VirtualFile file) {
     new OpenFileDescriptor(project, file).navigate(true);
   }
index 58c275d5a60dbdc81f99138846da873c913499b1..4aa304456d24aa951b76b2cd3de394d6712108b1 100644 (file)
@@ -15,6 +15,7 @@
  */
 package com.intellij.openapi.vfs.impl.http;
 
+import com.intellij.openapi.util.text.StringUtil;
 import com.intellij.openapi.vfs.VirtualFile;
 import com.intellij.openapi.vfs.VfsBundle;
 import com.intellij.openapi.progress.EmptyProgressIndicator;
@@ -56,7 +57,8 @@ public class DefaultRemoteContentProvider extends RemoteContentProvider {
     InputStream input = null;
     OutputStream output = null;
     try {
-      callback.setProgressText(VfsBundle.message("download.progress.connecting", url), true);
+      String presentableUrl = StringUtil.first(url, 40, true);
+      callback.setProgressText(VfsBundle.message("download.progress.connecting", presentableUrl), true);
       HttpURLConnection connection = (HttpURLConnection)new URL(url).openConnection();
       connection.setConnectTimeout(CONNECT_TIMEOUT);
       connection.setReadTimeout(READ_TIMEOUT);
@@ -69,7 +71,7 @@ public class DefaultRemoteContentProvider extends RemoteContentProvider {
 
       final int size = connection.getContentLength();
       output = new BufferedOutputStream(new FileOutputStream(file));
-      callback.setProgressText(VfsBundle.message("download.progress.downloading", url), size == -1);
+      callback.setProgressText(VfsBundle.message("download.progress.downloading", presentableUrl), size == -1);
       if (size != -1) {
         callback.setProgressFraction(0);
       }