1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 14:42:11 +02:00

Bug 340526 - Create watch expression: line endings should be removed

Patch by Axel Mueller
This commit is contained in:
Anton Leherbauer 2011-05-16 07:36:53 +00:00
parent f87a7ad4e3
commit 83719f04cc

View file

@ -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 * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -54,6 +54,7 @@ public class AddExpressionEditorActionDelegate extends ActionDelegate implements
fEditorPart = editorPart; fEditorPart = editorPart;
} }
@Override
public void run( IAction action ) { public void run( IAction action ) {
String text = getSelectedText(); String text = getSelectedText();
ExpressionDialog dlg = new ExpressionDialog( getShell(), text ); ExpressionDialog dlg = new ExpressionDialog( getShell(), text );
@ -66,7 +67,7 @@ public class AddExpressionEditorActionDelegate extends ActionDelegate implements
private String getSelectedText() { private String getSelectedText() {
ISelection selection = getTargetSelection(); ISelection selection = getTargetSelection();
if ( selection != null && selection instanceof ITextSelection ) { 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$ return ""; //$NON-NLS-1$
} }