Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhilip Langer2015-03-10 19:57:07 +0000
committerAxel RICHARD2015-03-12 09:57:14 +0000
commit1767592c59cd27c2610c3c81a0d0262a6633f751 (patch)
treef829cd2c1cc434c3f182af52ae4f47a8a0434ce4
parentf4420f85337d0fbc7acc1c1210ccae4087b97a15 (diff)
downloadorg.eclipse.emf.compare-1767592c59cd27c2610c3c81a0d0262a6633f751.tar.gz
org.eclipse.emf.compare-1767592c59cd27c2610c3c81a0d0262a6633f751.tar.xz
org.eclipse.emf.compare-1767592c59cd27c2610c3c81a0d0262a6633f751.zip
[461504] Removes line-breaks in UI from attribute change values
Bug: 461504 Change-Id: I324a3dff8aa8e240974d1e123c901af401f4dfc3 Signed-off-by: Philip Langer <planger@eclipsesource.com>
-rw-r--r--plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/provider/spec/AttributeChangeItemProviderSpec.java4
-rw-r--r--plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/provider/spec/Strings.java14
2 files changed, 16 insertions, 2 deletions
diff --git a/plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/provider/spec/AttributeChangeItemProviderSpec.java b/plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/provider/spec/AttributeChangeItemProviderSpec.java
index ddd48dc6d..51c991c8e 100644
--- a/plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/provider/spec/AttributeChangeItemProviderSpec.java
+++ b/plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/provider/spec/AttributeChangeItemProviderSpec.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2012, 2014 Obeo.
+ * Copyright (c) 2012, 2015 Obeo.
* 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
@@ -7,6 +7,7 @@
*
* Contributors:
* Obeo - initial API and implementation
+ * Philip Langer - fixed bug 461504
*******************************************************************************/
package org.eclipse.emf.compare.provider.spec;
@@ -133,6 +134,7 @@ public class AttributeChangeItemProviderSpec extends AttributeChangeItemProvider
value = "<null>"; //$NON-NLS-1$
}
} else {
+ value = org.eclipse.emf.compare.provider.spec.Strings.removeLineBreaks(value);
value = org.eclipse.emf.compare.provider.spec.Strings.elide(value, ELIDE_LENGTH, "..."); //$NON-NLS-1$
}
return value;
diff --git a/plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/provider/spec/Strings.java b/plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/provider/spec/Strings.java
index b08f9b7bc..f41573c03 100644
--- a/plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/provider/spec/Strings.java
+++ b/plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/provider/spec/Strings.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2012 Obeo.
+ * Copyright (c) 2012, 2015 Obeo 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
@@ -7,6 +7,7 @@
*
* Contributors:
* Obeo - initial API and implementation
+ * Philip Langer - adds method removeLineBreaks(String)
*******************************************************************************/
package org.eclipse.emf.compare.provider.spec;
@@ -44,4 +45,15 @@ public final class Strings {
}
return original;
}
+
+ /**
+ * Removes line-breaks (\r\n or \r or \n) from the given {@code original} and replaces it with blanks.
+ *
+ * @param original
+ * the original string to remove line breaks from.
+ * @return the string without line breaks but blanks instead.
+ */
+ public static String removeLineBreaks(String original) {
+ return original.replaceAll("\\r\\n|\\r|\\n", " "); //$NON-NLS-1$ //$NON-NLS-2$
+ }
}

Back to the top