Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » How to temporarily store data to use after PlatformUI.getWorkbench().restart();
How to temporarily store data to use after PlatformUI.getWorkbench().restart(); [message #483182] Mon, 31 August 2009 13:45 Go to next message
Eclipse UserFriend
Originally posted by: TheRealHawk.Freenet.de

Hi,

I want to hold some data to use after restart but I don't want to store them
in Preferences because I'll only use this for restart-purposes.

I've already tried System.setProperty() but this doesn't work. :-(

Any other ideas?

Markus
Re: How to temporarily store data to use after PlatformUI.getWorkbench().restart(); [message #483283 is a reply to message #483182] Mon, 31 August 2009 21:00 Go to previous messageGo to next message
Wim Jongman is currently offline Wim JongmanFriend
Messages: 423
Registered: July 2009
Senior Member
Hi Markus,

Add lifeycle control to your RCP application:

If you override this method in your WorkbenchAdvisor:

@Override
public void initialize(IWorkbenchConfigurer configurer) {
super.initialize(configurer);
configurer.setSaveAndRestore(true);
}

then the saveState(IMemento) and restoreSate(IMemento) methods are called
during the lifecycle in your advisor classes.

If your application is not in control then I would save and restore state in
one of my activators

@See AbstractUiPlugin.getDialogSettings(),
AbstractUiPlugin.getPreferenceStore(), AbstractUiPlugin.getStateLocation()


Best regards,

Wim Jongman

> Hi,
>
> I want to hold some data to use after restart but I don't want to store
them
> in Preferences because I'll only use this for restart-purposes.
>
> I've already tried System.setProperty() but this doesn't work. :-(
>
> Any other ideas?
>
> Markus
Re: How to temporarily store data to use after PlatformUI.getWorkbench().restart(); [message #483409 is a reply to message #483283] Tue, 01 September 2009 14:13 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: TheRealHawk.Freenet.de

But I want to hold my login-data to do a relogin after restart and therefore
I don't want to store the data permanently.

Markus

"Wim Jongman" <wim.jongman@gmail.com> schrieb im Newsbeitrag
news:h7hdl5$dfp$1@build.eclipse.org...
> Hi Markus,
>
> Add lifeycle control to your RCP application:
>
> If you override this method in your WorkbenchAdvisor:
>
> @Override
> public void initialize(IWorkbenchConfigurer configurer) {
> super.initialize(configurer);
> configurer.setSaveAndRestore(true);
> }
>
> then the saveState(IMemento) and restoreSate(IMemento) methods are called
> during the lifecycle in your advisor classes.
>
> If your application is not in control then I would save and restore state
> in
> one of my activators
>
> @See AbstractUiPlugin.getDialogSettings(),
> AbstractUiPlugin.getPreferenceStore(), AbstractUiPlugin.getStateLocation()
>
>
> Best regards,
>
> Wim Jongman
>
>> Hi,
>>
>> I want to hold some data to use after restart but I don't want to store
> them
>> in Preferences because I'll only use this for restart-purposes.
>>
>> I've already tried System.setProperty() but this doesn't work. :-(
>>
>> Any other ideas?
>>
>> Markus
Re: How to temporarily store data to use after PlatformUI.getWorkbench().restart(); [message #483419 is a reply to message #483409] Tue, 01 September 2009 14:57 Go to previous message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

Eclipse User wrote on Tue, 01 September 2009 10:13
Originally posted by: TheRealHawk.Freenet.de

But I want to hold my login-data to do a relogin after restart and therefore
I don't want to store the data permanently.



The IMemento (which is a standard way to store application state between restarts) will exist until the next restart. If that's too long for you, then you should write out the information to a file in your plugin state location when your bundle stops (and you know you're doing a restart), and read it in (and delete the file) when your plugin starts (on next startup).

Then it's only on disk for the length of the restart.

Eclipse has bundles (like Equinox secure storage) that would allow you to encrypt it while on the disk ... you still need a key in your code to encrypt/unencrypt, but at least it wouldn't be plain text.

PW


Previous Topic:StatusLineContributionItem positioning
Next Topic:Headless RCP app that depends on a library the depends on Spring
Goto Forum:
  


Current Time: Fri Apr 26 11:53:19 GMT 2024

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

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

Back to the top