The development platform is Eclipse RCP 3.4 for Fedora (it uses its own Gtk component). I need to avoid word wrapping.
ie: "Hello World" appears as case N Β° 1, but I need case N Β° 2.
1|Hello | 2|Hello Wor| |World | |ld |
Is there a simple solution?
I saw that the swt Text handle is being built with the wrap OS.GTK_WRAP_WORD_CHAR . I would like to test behavior with a constant like OS.GTK_WRAP_WORD or OS.GTK_WRAP_NONE , but I donβt know how this miracle is? Is it possible to programmatically modify the configuration of a specific platform?
EDIT 1 . Solution of one of my colleagues:
import org.eclipse.swt.SWT; import org.eclipse.swt.internal.gtk.OS; import org.eclipse.swt.layout.*; import org.eclipse.swt.widgets.*; public class SampleGrabExcess { public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.setLayout(new GridLayout()); shell.setSize(70, 70); GridData gridData = new GridData(); Text addressText = new Text(shell, SWT.BORDER | SWT.MULTI) { @Override protected void checkSubclass() {} @Override protected void checkWidget() { OS.gtk_text_view_set_wrap_mode(handle, 1); super.checkWidget(); } }; gridData = new GridData(); gridData.horizontalAlignment = SWT.FILL; gridData.grabExcessHorizontalSpace = true; gridData.verticalAlignment = SWT.FILL; gridData.grabExcessVerticalSpace = true; addressText.setLayoutData(gridData); addressText.setText("Hello World."); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } } }
The result is expected. I am looking for a solution from http://dev.eclipse.org .
source share