platform: profiling actions overhauled
authorRoman Shevchenko <roman.shevchenko@jetbrains.com>
Mon, 9 Jun 2014 18:08:02 +0000 (22:08 +0400)
committerRoman Shevchenko <roman.shevchenko@jetbrains.com>
Mon, 9 Jun 2014 18:08:02 +0000 (22:08 +0400)
- controller availability check added
- better error reporting
- actions fixed
- common code extracted

platform/platform-impl/src/com/intellij/ide/actions/ShowFilePathAction.java
platform/platform-resources-en/src/messages/ActionsBundle.properties
platform/platform-resources-en/src/messages/CommonBundle.properties

index e7a3f23febd2ef5148ab09a7fd38fb8742b4ca44..59fdfc24ab30499f81031f69c76f76cb4f927a2c 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2013 JetBrains s.r.o.
+ * Copyright 2000-2014 JetBrains s.r.o.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -21,6 +21,8 @@ import com.intellij.execution.configurations.GeneralCommandLine;
 import com.intellij.execution.util.ExecUtil;
 import com.intellij.ide.DataManager;
 import com.intellij.ide.IdeBundle;
+import com.intellij.notification.Notification;
+import com.intellij.notification.NotificationListener;
 import com.intellij.openapi.actionSystem.AnAction;
 import com.intellij.openapi.actionSystem.AnActionEvent;
 import com.intellij.openapi.actionSystem.CommonDataKeys;
@@ -50,6 +52,7 @@ import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
 import javax.swing.*;
+import javax.swing.event.HyperlinkEvent;
 import javax.swing.filechooser.FileSystemView;
 import java.awt.*;
 import java.awt.event.MouseEvent;
@@ -57,6 +60,7 @@ import java.io.BufferedReader;
 import java.io.File;
 import java.io.FileReader;
 import java.io.IOException;
+import java.net.URL;
 import java.util.ArrayList;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
@@ -64,6 +68,15 @@ import java.util.regex.Pattern;
 public class ShowFilePathAction extends AnAction {
   private static final Logger LOG = Logger.getInstance("#com.intellij.ide.actions.ShowFilePathAction");
 
+  public static final NotificationListener FILE_SELECTING_LISTENER = new NotificationListener.Adapter() {
+    @Override
+    protected void hyperlinkActivated(@NotNull Notification notification, @NotNull HyperlinkEvent e) {
+      URL url = e.getURL();
+      if (url != null) openFile(new File(url.getPath()));
+      notification.expire();
+    }
+  };
+
   private static NotNullLazyValue<Boolean> canUseNautilus = new NotNullLazyValue<Boolean>() {
     @NotNull
     @Override
index e5a5de80c9aa629845595aa47594ec30a2644fd7..59e89750f30bd254fb35119fd25d6addb92a57a8 100644 (file)
@@ -6,8 +6,10 @@ action.CaptureMemorySnapShot.text=Capture Memory Snapshot
 action.CaptureMemorySnapShot.description=Capture memory snapshot
 action.CaptureCPUUsageData.text=Start CPU Usage Profiling
 action.CaptureCPUUsageData.description=Capture CPU usage data
+stop.capture.cpu.usage.data.action.name=Stop CPU Usage Profiling
 action.CaptureAllocations.text=Capture Allocations
 action.CaptureAllocations.description=Capture memory allocations data
+stop.capture.allocations.data.action.name=Stop Capturing Allocations
 action.ContextHelp.text=Conte_xt Help
 action.ContextHelp.description=Show context help
 action.RunConfiguration.text=Select Run/Debug Configuration
@@ -1030,11 +1032,6 @@ action.UsageView.ShowRecentFindUsages.description=Choose and re-run recent find
 group.ShowRecentFindUsagesGroup.text=Recent Find Usages
 group.ShowRecentFindUsagesGroup.description=Choose and re-run recent find usages
 
-stop.capture.cpu.usage.data.action.name=Stop CPU Usage Profiling
-stop.capture.cpu.usage.data.action.description=Stop capturing CPU usage data
-stop.capture.allocations.usage.data.action.name=Capture allocations data, now capturing
-stop.capture.allocations.usage.data.action.description=Stop capturing allocations data
-
 action.IntegrateFiles.text=Integrate
 action.IntegrateFiles.description=Integrate selected files or directories
 action.Vcs.IntegrateProject.text=Inte_grate Project
index 7820960979a71823a18edc4ffeca5d715b4e8f5f..46750d536a0639817dd0b62f41307aea62531eb8 100644 (file)
@@ -124,10 +124,8 @@ format.file.size.bytes={0}b
 format.file.size.kbytes={0}Kb
 format.file.size.mbytes={0}Mb
 
-profiling.captured.cpu.snapshot.message.text=Captured CPU snapshot: ''{0}'' is placed in user home directory.
-profiling.captured.allocations.snapshot.message.text=Captured allocations snapshot: ''{0}'' is placed in user home directory.
-information.dialog.title=Information
-captured.memory.snapshot.placed.in.user.home.directory.message.text=Captured memory snapshot: ''{0}'' is placed in user home directory.
+profiling.capture.snapshot.success=Captured snapshot ''{0}'' is placed in user home directory. <a href="{1}">Show in {2}</a>.
+profiling.capture.snapshot.error=Failed to capture snapshot: {0}
 
 cannot.undo.dialog.title=Cannot Undo
 cannot.undo.error.other.affected.files.changed.message=Following files affected by this action have been already changed: