Flex Builder Tip: Moving an Entire Workspace in One Step Without Importing Anything
I had a situation recently where I had way too many workspaces sitting in my root C: drive folder, so I decided I wanted to move them to a subfolder with a very short name like “_fx” just so all my Flex workspaces are all in the same place, and to make backup archiving easier.
If you’re wondering, I have dozens of workspaces, one for each client and/or writing project, each of which has an average of 20+ projects.
Problem is, the conventional way is slow. Really slow. I’d have to create a new workspaces directory location (C:\_fx in my case), and import every single project into every new workspace. And even with saving preferences, I’d lose things like Subversion site locations in the Subclipse perspective. And with over 20 workspaces,. each with an average of 20 projects… I’d be at it for weeks. So I needed a shortcut.
So I dug around in the workspace metadata files, and eventually found where the directory locations reside for each project in that workspace. Luckily, it’s all in one file, so the hack is relatively simple.
Correction: unfortunately it’s not one file you have to edit, it could be a few XML files. And unfortunately this hack doesn’t work with all workspaces unfortunately. See below.
1. Make a copy of your workspace folder to the new location. Don’t move it, in case anything goes wrong. I found this out the hard way by wiping out the metadata for a workspace with over 30 projects — ouch!
2. Find the .metadata folder for the workspace.
3. Find the following files and open them in a text editor:
{workspace}\.metadata\.plugins\org.eclipse.ui.workbench\dialog_settings.xml
{workspace}\.metadata\.plugins\org.eclipse.ui.workbench\workingsets.xml
{workspace}\.metadata\.plugins\com.adobe.flexbuilder.editors.common\dialog_settings.xml
4. Find & Replace all instances of the old directory location with the new one.
For example, for my \profx3book workspace, I replaced all instances of “C:\profx3book\” with “C:\_fx\profx3book\“.
5. Save the file, and point Flex Builder to the new workspace. Once you’re sure everything is where it should be, delete the files in the old location.
Et voila!
PS: Yes, I know, the above lists five steps, not one — but really it’s only one step: replacing the location string in the workbench.xml file.
PPS: Important Caveat: Search for all .location files in the workspace .metadata folder. If there any files found, this technique might not work, since the directory location for that project is stored in .location files as binary data, and cannot simply be edited with a text editor. So use this technique at your own risk.