diff options
author | Tor Norbye <tnorbye@google.com> | 2014-07-25 13:10:36 -0700 |
---|---|---|
committer | Tor Norbye <tnorbye@google.com> | 2014-07-25 13:10:36 -0700 |
commit | e5266e2343c8d275d79fa0be725180d0fe3a993c (patch) | |
tree | 0ba72f5de1949e0527874a799baa224cbe1537e0 /platform/lang-impl/src/com/intellij/unscramble/AnalyzeStacktraceOnErrorAction.java | |
parent | b03a5855292feb8c331815f883fe64372aacd872 (diff) | |
parent | 2e5965e996aad62ab1338b09d54caaf99ff3dd6a (diff) | |
download | idea-e5266e2343c8d275d79fa0be725180d0fe3a993c.tar.gz |
Merge remote-tracking branch 'aosp/upstream-master' into merge
Conflicts:
.idea/modules.xml
Change-Id: I5e3d04bc83cdc26b2b56fca66b44b1dd8941b143
Diffstat (limited to 'platform/lang-impl/src/com/intellij/unscramble/AnalyzeStacktraceOnErrorAction.java')
-rw-r--r-- | platform/lang-impl/src/com/intellij/unscramble/AnalyzeStacktraceOnErrorAction.java | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/platform/lang-impl/src/com/intellij/unscramble/AnalyzeStacktraceOnErrorAction.java b/platform/lang-impl/src/com/intellij/unscramble/AnalyzeStacktraceOnErrorAction.java index e1de663c9418..d3385e88b4b1 100644 --- a/platform/lang-impl/src/com/intellij/unscramble/AnalyzeStacktraceOnErrorAction.java +++ b/platform/lang-impl/src/com/intellij/unscramble/AnalyzeStacktraceOnErrorAction.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 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. @@ -19,26 +19,28 @@ package com.intellij.unscramble; import com.intellij.diagnostic.IdeErrorsDialog; import com.intellij.openapi.actionSystem.AnAction; import com.intellij.openapi.actionSystem.AnActionEvent; -import com.intellij.openapi.actionSystem.CommonDataKeys; -import com.intellij.openapi.actionSystem.DataContext; -import com.intellij.openapi.actionSystem.PlatformDataKeys; import com.intellij.openapi.project.Project; /** * @author spleaner */ public class AnalyzeStacktraceOnErrorAction extends AnAction { + @Override + public void update(AnActionEvent e) { + Project project = e.getProject(); + String message = getMessage(e); + e.getPresentation().setEnabledAndVisible(project != null && message != null); + } @Override public void actionPerformed(AnActionEvent e) { - final DataContext dataContext = e.getDataContext(); - - final Project project = CommonDataKeys.PROJECT.getData(dataContext); - if (project == null) return; + Project project = e.getProject(); + String message = getMessage(e); + if (project == null || message == null) return; + AnalyzeStacktraceUtil.addConsole(project, null, "<Stacktrace>", message); + } - final String message = IdeErrorsDialog.CURRENT_TRACE_KEY.getData(dataContext); - if (message != null) { - AnalyzeStacktraceUtil.addConsole(project, null, "<Stacktrace>", message); - } + private static String getMessage(AnActionEvent e) { + return IdeErrorsDialog.CURRENT_TRACE_KEY.getData(e.getDataContext()); } }
\ No newline at end of file |