Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » View ID changed - how to migrate perspectives
View ID changed - how to migrate perspectives [message #725260] Wed, 14 September 2011 11:37 Go to next message
Richard Koop is currently offline Richard KoopFriend
Messages: 15
Registered: July 2009
Junior Member
We have a number of perspectives in our RCP app. We want to release a new version of the app but a number of the viewIDs in the new version of the app have changed. So if we try to bring up the new app using an old workspace we get a number of 'Could not create view' errors. Is there a way to migrate the old viewIds to a new viewId so old user perspective will not break?

I was looking in the workbench.xml file and was thinking about a global search/replace mapping old viewId to new one. But this seems kind of ugly!
Re: View ID changed - how to migrate perspectives [message #725639 is a reply to message #725260] Thu, 15 September 2011 11:57 Go to previous messageGo to next message
Richard Koop is currently offline Richard KoopFriend
Messages: 15
Registered: July 2009
Junior Member
What I ended up doing was filtering out the old perspectives at startup before the workbench bundle was started. Then the workbench doesn't know about these views/perspectives anymore. You have to start the bundle that clears the preferences at a lower start level than the workbench otherwise you can't clear out the workbench *_persp perspective preferences values.
Re: View ID changed - how to migrate perspectives [message #725813 is a reply to message #725639] Thu, 15 September 2011 20:42 Go to previous messageGo to next message
Marco Lopes is currently offline Marco LopesFriend
Messages: 61
Registered: September 2010
Member
This sounds interesting. Could you post the code? Thanks.
Re: View ID changed - how to migrate perspectives [message #725845 is a reply to message #725813] Fri, 16 September 2011 00:00 Go to previous messageGo to next message
Richard Koop is currently offline Richard KoopFriend
Messages: 15
Registered: July 2009
Junior Member
Essentially you have to get a handle on the org.eclipse.ui.workbench prefs and clear out the properties where the key is 'perspective' (the current workbench perspective) and '*_persp' (the custom and changed perspectives). Once I've removed them I set a 'workbenchMigrated' preference to ensure I only do this once. From memory (not at work now) I think it's something like..

prefs = new InstanceScope("org.eclipse.ui.workbench");
if (prefs.getBoolean("workbenchMigrated", false))
return;
for (String key: prefs.keys()) {
if (key IS A PREF KEY)
prefs.remove(key);
}
prefs.setBoolean("workbenchMigrated", true);

This must be done before the workbench starts or the .remove will not work because the workbench locks them up good or something.

I still have to figure out how to 'clear' the workbench.xml file before startup otherwise I'll still get the 'Could not find view..' errors because the IDs have changed.

Re: View ID changed - how to migrate perspectives [message #726200 is a reply to message #725845] Fri, 16 September 2011 19:05 Go to previous message
Richard Koop is currently offline Richard KoopFriend
Messages: 15
Registered: July 2009
Junior Member
Figured out how to delete workbench.xml as well...

Take a look at this post - http://www.eclipse.org/forums/index.php/mv/msg/240209/725637/#msg_725637
Previous Topic:Delete workbench.xml before startup
Next Topic:Bundle Security
Goto Forum:
  


Current Time: Thu Apr 25 04:34:44 GMT 2024

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

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

Back to the top