Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [platform-swt-dev] StyledTextContent

Hi,

While reading the DefaultContent implementation, I tried the situtation that I described below using DefaultContent.
Here is the code:

styledText.append("test line1\r\n");
styledText.append("test line2\r");
styledText.append("\ntest line3\r\n");

The widget shows two line breaks between "test line2" and "test line3". And if I try to delete that extra break(by user input):

Exception in thread "main" java.lang.IllegalArgumentException: Argument not valid
   at org.eclipse.swt.SWT.error(SWT.java:2926)
   at org.eclipse.swt.SWT.error(SWT.java:2865)
   at org.eclipse.swt.SWT.error(SWT.java:2836)
at org.eclipse.swt.custom.DefaultContent.replaceTextRange(DefaultContent.java:772)
   at org.eclipse.swt.custom.StyledText.modifyContent(StyledText.java:5787)
   at org.eclipse.swt.custom.StyledText.sendKeyEvent(StyledText.java:6625)
   at org.eclipse.swt.custom.StyledText.doDelete(StyledText.java:2688)
   at org.eclipse.swt.custom.StyledText.invokeAction(StyledText.java:5671)
   at org.eclipse.swt.custom.StyledText.handleKey(StyledText.java:5102)
   at org.eclipse.swt.custom.StyledText.handleKeyDown(StyledText.java:5124)
   at org.eclipse.swt.custom.StyledText$7.handleEvent(StyledText.java:4857)
   at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
   at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:843)
   at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:867)
   at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:852)
   at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:880)
   at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:876)
   at org.eclipse.swt.widgets.Widget.wmKeyDown(Widget.java:1475)
   at org.eclipse.swt.widgets.Control.WM_KEYDOWN(Control.java:3348)
   at org.eclipse.swt.widgets.Control.windowProc(Control.java:3067)
   at org.eclipse.swt.widgets.Display.windowProc(Display.java:3706)
   at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method)
   at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:1656)
   at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2711)
   at test.styledDeneme.main(styledDeneme.java:79)

should I enter a bugzilla report or is it my fault splitting the delimiter?

Bahadir

Bahadır Yağan wrote:


Thank you for your answers,
I will check the DefaultContent class, but I am not sure that the JavaViewer example uses SytledTextContent implementation. I will also check it. Anyway I managed my implementation to get work yesterday after hours of debugging. The problem appeared to be the splitting of the delimiter. My data was coming from a socket and the delimiter (\r\n) is sometimes splitting in to two consecutive read() statements. (ie: one with ending \r, and next starting with \n)

What is the correct behaviour for this situation? I solved it by deleting '\r' from the end of the fist read() and adding it in front of the next read().

Thanks
Bahadir


Felipe Heidrich wrote:

Did you check:
org.eclipse.swt.custom.DefaultContent
It is a bit complicated but maybe it helps.
Felipe




Carolyn MacLeod wrote:
Also, the JavaViewer example is a fairly simple example of using a StyledText. See org.eclipse.swt.examples.javaviewer in the eclipse example plugins zip. If you haven't downloaded the eclipse examples zip yet, then you can get it on the download page for the version of eclipse SDK you are using - just scroll down a little bit further and look for "Example Plug-ins". Unzip this right on to of your eclipse install, and just overwrite the 2 license files when prompted.
Good luck,
Carolyn

_______________________________________________
platform-swt-dev mailing list
platform-swt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/platform-swt-dev



--
Bahadir Yagan
MHT Elektronik
+90 312 265 02 10




Back to the top