I have one requirement that I need to mark the table item when the user has already viewed that item in 开发者_开发技巧the table. It is exactly like emails in the inbox. when the user reads the mail, the font will be changed to normal. The same way I need to implement. For that I used Font for the table. Now i need to save the state for the table item. When the application restarts, the table item which the user has already viewed should be seen as viewed item. I mean normal font. Is ther any way to save the state for the table item?
Thanks Bhanu
An alternative - if we are only talking very little data, e.g. a pointer to the last read item - you can use the view state. See IViewPart.init(IViewSite site, IMemento memento)
and IViewPart.saveState(IMemento memento)
. This method is not very useful if you have lots of data as the storage is rather ineffective.
If your bundle activator subclasses org.eclipse.ui.plugin.AbstractUIPlugin
or org.eclipse.core.runtime.Plugin
you can use org.eclipse.core.runtime.Plugin.getStateLocation()
to get your plugin state location. You can use java.io.File
and FileReader/FileWriter to store information there across sessions. See org.eclipse.ui.plugin.AbstractUIPlugin.saveDialogSettings()
for an example of how a this plugin stores dialog settings there.
精彩评论