From df39999cb6372909bdd2666742b611411483b12d Mon Sep 17 00:00:00 2001 From: peter Date: Wed, 14 Mar 2012 19:54:54 +0400 Subject: [PATCH] when creating a breakpoint by shift+click, replace the default value with selection from editor, but not with the reference under the caret --- .../ui/breakpoints/BreakpointManager.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/BreakpointManager.java b/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/BreakpointManager.java index 736178a73875..660e569e5f87 100644 --- a/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/BreakpointManager.java +++ b/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/BreakpointManager.java @@ -28,10 +28,12 @@ import com.intellij.debugger.SourcePosition; import com.intellij.debugger.engine.DebugProcessImpl; import com.intellij.debugger.engine.DebuggerUtils; import com.intellij.debugger.engine.evaluation.CodeFragmentKind; -import com.intellij.debugger.engine.evaluation.TextWithImports; import com.intellij.debugger.engine.evaluation.TextWithImportsImpl; import com.intellij.debugger.engine.requests.RequestManagerImpl; -import com.intellij.debugger.impl.*; +import com.intellij.debugger.impl.DebuggerContextImpl; +import com.intellij.debugger.impl.DebuggerContextListener; +import com.intellij.debugger.impl.DebuggerManagerImpl; +import com.intellij.debugger.impl.DebuggerSession; import com.intellij.debugger.settings.DebuggerSettings; import com.intellij.debugger.ui.DebuggerExpressionComboBox; import com.intellij.debugger.ui.DebuggerExpressionTextField; @@ -311,12 +313,10 @@ public class BreakpointManager implements JDOMExternalizable { if (e.getMouseEvent().isShiftDown() && breakpoint != null) { breakpoint.LOG_EXPRESSION_ENABLED = true; - final TextWithImports logMessage = DebuggerUtilsEx.getEditorText(editor); - breakpoint.setLogMessage(logMessage != null - ? logMessage - : new TextWithImportsImpl(CodeFragmentKind.EXPRESSION, - DebuggerBundle.message("breakpoint.log.message", - breakpoint.getDisplayName()))); + String selection = editor.getSelectionModel().getSelectedText(); + String text = selection != null ? selection : DebuggerBundle.message("breakpoint.log.message", + breakpoint.getDisplayName()); + breakpoint.setLogMessage(new TextWithImportsImpl(CodeFragmentKind.EXPRESSION, text)); breakpoint.SUSPEND_POLICY = DebuggerSettings.SUSPEND_NONE; DialogWrapper dialog = DebuggerManagerEx.getInstanceEx(myProject).getBreakpointManager()