From 83719f04cc96d483d0a32a6db40122d007f51b3c Mon Sep 17 00:00:00 2001 From: Anton Leherbauer Date: Mon, 16 May 2011 07:36:53 +0000 Subject: [PATCH] Bug 340526 - Create watch expression: line endings should be removed Patch by Axel Mueller --- .../ui/actions/AddExpressionEditorActionDelegate.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/AddExpressionEditorActionDelegate.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/AddExpressionEditorActionDelegate.java index 33e789f65db..0b1c15b9b06 100644 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/AddExpressionEditorActionDelegate.java +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/AddExpressionEditorActionDelegate.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004, 2005 QNX Software Systems and others. + * Copyright (c) 2004, 2011 QNX Software Systems and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -54,6 +54,7 @@ public class AddExpressionEditorActionDelegate extends ActionDelegate implements fEditorPart = editorPart; } + @Override public void run( IAction action ) { String text = getSelectedText(); ExpressionDialog dlg = new ExpressionDialog( getShell(), text ); @@ -66,7 +67,7 @@ public class AddExpressionEditorActionDelegate extends ActionDelegate implements private String getSelectedText() { ISelection selection = getTargetSelection(); if ( selection != null && selection instanceof ITextSelection ) { - return ((ITextSelection)selection).getText().trim(); + return ((ITextSelection)selection).getText().replaceAll("(\\r\\n|\\n|\\t| )+", " ").trim(); //$NON-NLS-1$ //$NON-NLS-2$; } return ""; //$NON-NLS-1$ }