summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2007-11-02 07:07:57 (EDT)
committerEike Stepper2007-11-02 07:07:57 (EDT)
commitba888876894fd251f1134c41f360ec45f8969e1d (patch)
tree4a382e338080cdeb915e884a684018604c0c6c4e
parent22ab9b75100dab7c49a3c7d945091d625be3d391 (diff)
downloadcdo-ba888876894fd251f1134c41f360ec45f8969e1d.zip
cdo-ba888876894fd251f1134c41f360ec45f8969e1d.tar.gz
cdo-ba888876894fd251f1134c41f360ec45f8969e1d.tar.bz2
[208529] Provide Migrator for existing GenModels
https://bugs.eclipse.org/bugs/show_bug.cgi?id=208529
-rw-r--r--plugins/org.eclipse.emf.cdo.migrator/src/org/eclipse/emf/cdo/migrator/CDOMigrator.java37
-rw-r--r--plugins/org.eclipse.emf.cdo.migrator/src/org/eclipse/emf/cdo/migrator/actions/MigrateAction.java11
2 files changed, 42 insertions, 6 deletions
diff --git a/plugins/org.eclipse.emf.cdo.migrator/src/org/eclipse/emf/cdo/migrator/CDOMigrator.java b/plugins/org.eclipse.emf.cdo.migrator/src/org/eclipse/emf/cdo/migrator/CDOMigrator.java
index 7033b30..834fe23 100644
--- a/plugins/org.eclipse.emf.cdo.migrator/src/org/eclipse/emf/cdo/migrator/CDOMigrator.java
+++ b/plugins/org.eclipse.emf.cdo.migrator/src/org/eclipse/emf/cdo/migrator/CDOMigrator.java
@@ -41,16 +41,41 @@ public abstract class CDOMigrator
{
}
- public static void adjustGenModel(GenModel genModel, IProject project)
+ public static String adjustGenModel(GenModel genModel, IProject project)
{
- genModel.setFeatureDelegation(GenDelegationKind.REFLECTIVE_LITERAL);
- genModel.setRootExtendsClass(ROOT_EXTENDS_CLASS);
- genModel.setRootExtendsInterface(ROOT_EXTENDS_INTERFACE);
+ StringBuilder builder = new StringBuilder();
+
+ if (genModel.getFeatureDelegation() != GenDelegationKind.REFLECTIVE_LITERAL)
+ {
+ genModel.setFeatureDelegation(GenDelegationKind.REFLECTIVE_LITERAL);
+ builder.append("Set Feature Delegation = ");
+ builder.append(GenDelegationKind.REFLECTIVE_LITERAL);
+ builder.append("\n");
+ }
+
+ if (!ROOT_EXTENDS_CLASS.equals(genModel.getRootExtendsClass()))
+ {
+ genModel.setRootExtendsClass(ROOT_EXTENDS_CLASS);
+ builder.append("Set Root Extends Class = ");
+ builder.append(ROOT_EXTENDS_CLASS);
+ builder.append("\n");
+ }
+
+ if (!ROOT_EXTENDS_INTERFACE.equals(genModel.getRootExtendsInterface()))
+ {
+ genModel.setRootExtendsInterface(ROOT_EXTENDS_INTERFACE);
+ builder.append("Set Root Extends Interface = ");
+ builder.append(ROOT_EXTENDS_INTERFACE);
+ builder.append("\n");
+ }
EList<String> pluginVariables = genModel.getModelPluginVariables();
if (!pluginVariables.contains(PLUGIN_VARIABLE))
{
pluginVariables.add(PLUGIN_VARIABLE);
+ builder.append("Added Model Plugin Variables = ");
+ builder.append(PLUGIN_VARIABLE);
+ builder.append("\n");
}
IFolder folder = project.getFolder("META-INF");
@@ -59,6 +84,7 @@ public abstract class CDOMigrator
try
{
folder.create(true, true, new NullProgressMonitor());
+ builder.append("Created META-INF folder\n");
}
catch (CoreException ex)
{
@@ -73,11 +99,14 @@ public abstract class CDOMigrator
{
InputStream contents = new ByteArrayInputStream(CDO_MF_CONTENTS.getBytes());
file.create(contents, true, new NullProgressMonitor());
+ builder.append("Created CDO.MF marker file\n");
}
catch (CoreException ex)
{
throw new WrappedException(ex);
}
}
+
+ return builder.length() == 0 ? null : builder.toString();
}
} \ No newline at end of file
diff --git a/plugins/org.eclipse.emf.cdo.migrator/src/org/eclipse/emf/cdo/migrator/actions/MigrateAction.java b/plugins/org.eclipse.emf.cdo.migrator/src/org/eclipse/emf/cdo/migrator/actions/MigrateAction.java
index b5cb914..d6de82d 100644
--- a/plugins/org.eclipse.emf.cdo.migrator/src/org/eclipse/emf/cdo/migrator/actions/MigrateAction.java
+++ b/plugins/org.eclipse.emf.cdo.migrator/src/org/eclipse/emf/cdo/migrator/actions/MigrateAction.java
@@ -85,8 +85,15 @@ public class MigrateAction implements IObjectActionDelegate
}
else
{
- CDOMigrator.adjustGenModel(genModel, file.getProject());
- showMessage("The selected generator model has been migrated.", false);
+ String msg = CDOMigrator.adjustGenModel(genModel, file.getProject());
+ if (msg == null)
+ {
+ showMessage("The selected generator model was already migrated.", false);
+ }
+ else
+ {
+ showMessage("The selected generator model has been migrated:\n\n" + msg, false);
+ }
}
}
}