.getInstance()
.getFrameController();
controller.addToLastProjListAction(file.getAbsolutePath());
URL url = file.toURL();
Resource rootSource = new URLResource(url);
ProjectUpgrader upgrader = getApplication().getInjector().getInstance(
ProjectUpgrader.class);
UpgradeHandler handler = upgrader.getUpgradeHandler(rootSource);
UpgradeMetaData md = handler.getUpgradeMetaData();
if (UpgradeType.DOWNGRADE_NEEDED == md.getUpgradeType()) {
JOptionPane
.showMessageDialog(
Application.getFrame(),
"Can't open project - it was created using a newer version of the Modeler",
"Can't Open Project",
JOptionPane.OK_OPTION);
closeProject(false);
}
else if (UpgradeType.INTERMEDIATE_UPGRADE_NEEDED == md.getUpgradeType()) {
JOptionPane
.showMessageDialog(Application.getFrame(),
// TODO: andrus 05/02/2010 - this message shows intermediate
// version of the project XML, not the Modeler code
// version that
// can be used for upgrade
"Can't upgrade project. Open the project in the Modeler v."
+ md.getIntermediateUpgradeVersion()
+ " to do an intermediate upgrade before you can upgrade to v."
+ md.getSupportedVersion(),
"Can't Upgrade Project",
JOptionPane.OK_OPTION);
closeProject(false);
}
else if (UpgradeType.UPGRADE_NEEDED == md.getUpgradeType()) {
if (processUpgrades(md)) {
// perform upgrade
logObj.info("Will upgrade project " + url.getPath());
Resource upgraded = handler.performUpgrade();
if (upgraded != null) {
Project project = openProjectResourse(upgraded, controller);
getProjectController().getProjectWatcher().pauseWatching();
getProjectController().getProjectWatcher().reconfigure();