/**
* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy
+* European Distributed Institute of Taxonomy
* http://www.e-taxonomy.eu
-*
+*
* The contents of this file are subject to the Mozilla Public License Version 1.1
* See LICENSE.TXT at the top of this package for the full license terms.
*/
package eu.etaxonomy.taxeditor.editor.name.container;
-import org.apache.log4j.Logger;
+import org.apache.logging.log4j.LogManager;import org.apache.logging.log4j.Logger;
import org.eclipse.jface.text.TextViewer;
import org.eclipse.swt.custom.StyledText;
import org.eclipse.swt.events.ModifyEvent;
* @created 19.05.2008
*/
public class LineWrapSupport {
- private static final Logger logger = Logger
- .getLogger(LineWrapSupport.class);
-
+ private static final Logger logger = LogManager.getLogger(LineWrapSupport.class);
+
ModifyListener listener = new LineWrapListener();
int lineCount;
private ScrolledForm scrolledForm;
// private TextViewer viewer;
-
+
/**
* <p>Constructor for LineWrapSupport.</p>
*
// return viewer;
// }
public LineWrapSupport(TextViewer viewer, IManagedForm form) {
-
+
if (viewer == null) {
throw new IllegalArgumentException(
"The provided TextViewer object is null."); //$NON-NLS-1$
}
-
+
// this.viewer = viewer;
-
+
textWidget = viewer.getTextWidget();
textWidget.addModifyListener(listener);
-
+
this.lineCount = textWidget.getLinePixel(textWidget.getLineCount());
this.scrolledForm = form.getForm();
-
+
logger.trace(this.getClass().getSimpleName() + " created"); //$NON-NLS-1$
}
-
+
/**
- * Redraws the scrolledForm if a line wrap is detected.
+ * Redraws the scrolledForm if a line wrap is detected.
*/
private void checkLineCount() {
scrolledForm.getBody().layout();
}
}
-
+
/**
* Calls <code>checkLineCount()</code> on a modify event.
- *
+ *
* @author p.ciardelli
* @created 21.05.2008
*/
class LineWrapListener implements ModifyListener {
- public void modifyText(ModifyEvent e) {
+ @Override
+ public void modifyText(ModifyEvent e) {
checkLineCount();
}
}