Skip to content
Snippets Groups Projects
Commit 022d37ab authored by Andreas Bayha's avatar Andreas Bayha
Browse files

Improved Tooltip for ComponentEditParts.

refs 2571
parent baf3e73c
No related branches found
No related tags found
No related merge requests found
......@@ -20,13 +20,15 @@ package org.fortiss.tooling.kernel.utils;
import java.util.ArrayList;
import java.util.List;
import org.apache.commons.lang.WordUtils;
/**
* Class containing mixed useful methods.
*
* @author doebber
* @author $Author$
* @version $Rev$
* @ConQAT.Rating GREEN Hash: 0AEE36671E84E87EA4BFDB32EC21DAC4
* @ConQAT.Rating YELLOW Hash: 655690F20BC3825195BAE4BBF9DBE2FA
*/
public class JavaUtils {
......@@ -59,4 +61,30 @@ public class JavaUtils {
public static <S, T extends S> List<T> convertList(Class<T> targetClass, List<S> sourceList) {
return (List<T>)(List<?>)sourceList;
}
/**
* Wraps long lines in 'str' after 'lineWidth' characters.
* - Words (even long words) will NOT be wrapped.
* - Leading whitespace characters in a line are trimmed.
*
* @param str
* The {@link String} to be mapped.
* @param lineWidth
* The number of characters, after which to wrap the line.
*
* @return The line wrapped String.
*/
public static String wrapLines(String str, int lineWidth) {
StringBuilder buffer = new StringBuilder();
String delim = "";
for(String line : str.trim().split("\n")) {
buffer.append(delim);
delim = "\n";
// WordUtils.wrap(...) wraps the single lines.
buffer.append(WordUtils.wrap(line, lineWidth, "\n", true));
}
return buffer.toString();
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment