|
|
|
|
|
Re: How to line-wrap/word-wrap? [message #198387 is a reply to message #198323] |
Wed, 07 March 2007 21:59 |
Eclipse User |
|
|
|
Originally posted by: jacek.pospychala.pl.ibm.com
James,
SWT StyledText component lying under TextEditor can be set an option
SWT.WRAP, which is definitely not alpha, works well, but has still low
functionality. It is a basic word wrap. Try out this example:
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.StyledText;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
public class Snip {
public static void main(String[] args) {
Display display = new Display();
Shell shell = new Shell(display);
shell.setLayout(new FillLayout());
StyledText text = new StyledText (shell, SWT.WRAP);
shell.pack();
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
display.dispose();
}
}
James Robertson wrote:
> Bartosz Michalik wrote:
> ....
>> http://ahtik.com/blog/2006/06/18/first-alpha-of-eclipse-word -wrap-released/
>>
>>
>> bartek michalik
> Thanks, but no thanks. A non-functional alpha release that hasn't been
> updated for 9 months, isn't my idea of a practical solution. Sorry.
|
|
|
|
|
|
Re: How to line-wrap/word-wrap? [message #199843 is a reply to message #199312] |
Fri, 16 March 2007 06:59 |
Eclipse User |
|
|
|
Originally posted by: jacek.pospychala.pl.ibm.com
James,
if you try this code you can have a look how does basic SWT word-wrap
look like. Text is wrapped like in Windows Notepad - to not exceed the
visible area. You cannot for example set a certain column to be wrapped.
The StyledText is a widget used in standard text editor, so in your own
editor you only have to set SWT.WRAP flag.
James Robertson wrote:
> Jacek Pospychala wrote:
>> James,
>>
>> SWT StyledText component lying under TextEditor can be set an option
>> SWT.WRAP, which is definitely not alpha, works well, but has still low
>> functionality. It is a basic word wrap. Try out this example:
>>
>> import org.eclipse.swt.SWT;
>> import org.eclipse.swt.custom.StyledText;
>> import org.eclipse.swt.layout.FillLayout;
>> import org.eclipse.swt.widgets.Display;
>> import org.eclipse.swt.widgets.Shell;
>>
>> public class Snip {
>>
>> public static void main(String[] args) {
>> Display display = new Display();
>> Shell shell = new Shell(display);
>> shell.setLayout(new FillLayout());
>> StyledText text = new StyledText (shell, SWT.WRAP);
>>
>> shell.pack();
>> shell.open();
>> while (!shell.isDisposed()) {
>> if (!display.readAndDispatch())
>> display.sleep();
>> }
>> display.dispose();
>> }
>> }
>>
> ....
>
> Hi Jacek
>
> Sounds interesting, but not sure it's what I want. Does this 'component'
> add word-wrapping ability to normal Eclipse editor?
|
|
|
|
Re: How to line-wrap/word-wrap? [message #200569 is a reply to message #200315] |
Tue, 20 March 2007 03:13 |
Eclipse User |
|
|
|
Originally posted by: eclipse5.rizzoweb.com
James Robertson wrote:
> Hi Jacek
>
> I really appreciate you trying to help me, but I'm afraid I still don't
> under stand. Where ... do I 'set SWT.WRAP flag'?
>
> I have looked through the 'Preferences...' options in Eclipse and can
> find no such setting.
>
> Thanks
> James
James,
Jacek's suggestion was a code-level option, to apply if you were writing
your own editor or modifying the Eclipse source. And even with that,
from what little I've read, it will not work seamlessly with the Eclipse
Java editor - there are problems with the interaction with line-based
editor features like decorators, etc.
The Bugzilla report that was posted earlier in this thread goes into the
details of why this is such a can of worms and not as simple as it seems
on the surface.
Hope this helps,
Eric
By the way, are you the same James Robertson of Smalltalk fame?
>
> Jacek Pospychala wrote:
>> James,
>> if you try this code you can have a look how does basic SWT word-wrap
>> look like. Text is wrapped like in Windows Notepad - to not exceed the
>> visible area. You cannot for example set a certain column to be
>> wrapped. The StyledText is a widget used in standard text editor, so
>> in your own editor you only have to set SWT.WRAP flag.
> ...
|
|
|
Powered by
FUDForum. Page generated in 0.06149 seconds