Skip to main content



      Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » StyleRange Persistence(How can I persist a StyleRange object to a file or database?)
StyleRange Persistence [message #1701425] Mon, 13 July 2015 07:34 Go to next message
Eclipse UserFriend
I am using the StyledText widget in my application. I persist the text string in a database, but I also need to persist the formatting (i.e., the StyleRange data). Using myStyleRange.writeObject() would seem to suffice, but StyleRange is not serializable. So, how do I go about doing this?

Mark
Re: StyleRange Persistence [message #1701457 is a reply to message #1701425] Mon, 13 July 2015 10:06 Go to previous messageGo to next message
Eclipse UserFriend
StyledText doesn't support any way of serializing information like that out of the box: it's flexible in allowing arbitrary objects (including SWT controls) that there's no format to store a perfect representation. From what I've seen, apps that use StyledText maintain a parallel model that is used to update the StyledText, and the app serializes out their model instead.

That said, StyledText can serialize out to RTF via the clipboard (RTFTransfer). The representation will be imperfect if you have controls or images, and it overwrites the clipboard contents (though you could try to save and then restore the clipboard).

Brian.
Re: StyleRange Persistence [message #1701479 is a reply to message #1701457] Mon, 13 July 2015 11:20 Go to previous message
Eclipse UserFriend
Okay, thanks. It looks like I'll just have to roll my own!
Mark
Previous Topic:Slider, Scrollbar
Next Topic:How to make both Shell and Composite transparent under linux?
Goto Forum:
  


Current Time: Sun Aug 31 03:31:33 EDT 2025

Powered by FUDForum. Page generated in 0.03214 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top