Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    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 11:34 Go to next message
Mark Mising name is currently offline Mark Mising nameFriend
Messages: 73
Registered: July 2009
Location: Ohio, USA
Member
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 14: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 15:20 Go to previous message
Mark Mising name is currently offline Mark Mising nameFriend
Messages: 73
Registered: July 2009
Location: Ohio, USA
Member
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: Tue Mar 19 10:51:55 GMT 2024

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

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

Back to the top