Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Delete workbench.xml before startup
Delete workbench.xml before startup [message #725637] Thu, 15 September 2011 11:55 Go to next message
Richard Koop is currently offline Richard KoopFriend
Messages: 15
Registered: July 2009
Junior Member
I have an old user workspace that I want to migrate to use with a new version of my RCP app (to not loose user preferences). Problem is that some of the view IDs have changed so I get invalid view/perspectives after startup. I want to clear out the workbench.xml the 1st time the app is started (then I'll set a preference to not do it again the next time!). Is there a command to do this?
Re: Delete workbench.xml before startup [message #726199 is a reply to message #725637] Fri, 16 September 2011 19:03 Go to previous message
Richard Koop is currently offline Richard KoopFriend
Messages: 15
Registered: July 2009
Junior Member
Figured it out. Before the workbench starts (ie. in a bundle with a lower start level than the workbench bundle) you just have to delete the workbench.xml. Then I set a preference to ensure this is only done once.

if (!(new InstanceScope().getNode("org.eclipse.ui.workbench").getBoolean("alreadyMigrated", false)) {
  IPath location = Platform.getLocation();
  IPath workbenchXml = location.addTrailingSeperator().append(".metadata").addTrailingSeperator().append(".plugins").addTrailingSeperator().append("org.eclipse.ui.workbench").addTrailingSeperator().append("workbench.xml");
  if (workbenchXml.toFile().exists()) {
    workbenchXml.toFile().delete();
  }
new InstanceScope().getNode("org.eclipse.ui.workbench").setBoolean("alreadyMigrated", true);

[Updated on: Fri, 16 September 2011 19:08]

Report message to a moderator

Previous Topic:Open Perspective manually
Next Topic:View ID changed - how to migrate perspectives
Goto Forum:
  


Current Time: Sat Nov 29 06:46:20 GMT 2014

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

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