Hi,
I need to avoid word wrapping.
i.e.: "Hello World" is displayed as case N°1 but I need the case N°2.
1|Hello | 2|Hello Wor|
|World | |ld |
Is it possible to have this behaviour with SWT.CONSTANT style ?
The development platform is an Eclipse RCP 3.4 on Fedora (It's using Gtk native component).
I've seen that swt Text handle is build with OS.GTK_WRAP_WORD_CHAR wrap mode. I would like to test the behaviour with constant like OS.GTK_WRAP_WORD or OS.GTK_WRAP_NONE.
Is it possible to modify platform specific configuration programmatically without override swt Text widget?
This snippet can do the trick, but it's platform dependant:
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();
}
}
}
}