diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/EditorEvaluationCommand.java b/java/debugger/impl/src/com/intellij/debugger/ui/EditorEvaluationCommand.java index 11c22f38e99c..76903f79b406 100644 --- a/java/debugger/impl/src/com/intellij/debugger/ui/EditorEvaluationCommand.java +++ b/java/debugger/impl/src/com/intellij/debugger/ui/EditorEvaluationCommand.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2016 JetBrains s.r.o. + * Copyright 2000-2017 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. @@ -18,7 +18,6 @@ package com.intellij.debugger.ui; import com.intellij.codeInsight.hint.HintManager; import com.intellij.debugger.DebuggerBundle; import com.intellij.debugger.DebuggerInvocationUtil; -import com.intellij.debugger.DebuggerManagerEx; import com.intellij.debugger.engine.evaluation.EvaluateException; import com.intellij.debugger.engine.evaluation.EvaluationContextImpl; import com.intellij.debugger.engine.events.DebuggerContextCommandImpl; @@ -27,7 +26,6 @@ import com.intellij.openapi.application.ReadAction; import com.intellij.openapi.editor.Editor; import com.intellij.openapi.progress.ProcessCanceledException; import com.intellij.openapi.progress.ProgressIndicator; -import com.intellij.openapi.project.Project; import com.intellij.psi.PsiElement; import org.jetbrains.annotations.Nullable; @@ -38,16 +36,13 @@ public abstract class EditorEvaluationCommand extends DebuggerContextCommandI protected final PsiElement myElement; @Nullable private final Editor myEditor; protected final ProgressIndicator myProgressIndicator; - private final DebuggerContextImpl myDebuggerContext; public EditorEvaluationCommand(@Nullable Editor editor, PsiElement expression, DebuggerContextImpl context, final ProgressIndicator indicator) { super(context); - Project project = expression.getProject(); myProgressIndicator = indicator; myEditor = editor; myElement = expression; - myDebuggerContext = (DebuggerManagerEx.getInstanceEx(project)).getContext(); } public Priority getPriority() { @@ -57,19 +52,19 @@ public abstract class EditorEvaluationCommand extends DebuggerContextCommandI protected abstract T evaluate(EvaluationContextImpl evaluationContext) throws EvaluateException; public T evaluate() throws EvaluateException { - myProgressIndicator.setText( - DebuggerBundle.message("progress.evaluating", - ReadAction.compute(myElement::getText))); + myProgressIndicator.setText(DebuggerBundle.message("progress.evaluating", ReadAction.compute(myElement::getText))); try { - T result = evaluate(myDebuggerContext.createEvaluationContext()); + T result = evaluate(getDebuggerContext().createEvaluationContext()); if (myProgressIndicator.isCanceled()) throw new ProcessCanceledException(); return result; } catch (final EvaluateException e) { if (myEditor != null) { - DebuggerInvocationUtil.invokeLater(myDebuggerContext.getProject(), () -> showEvaluationHint(myEditor, myElement, e), myProgressIndicator.getModalityState()); + DebuggerInvocationUtil.invokeLater(myElement.getProject(), + () -> showEvaluationHint(myEditor, myElement, e), + myProgressIndicator.getModalityState()); } throw e; }