Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2007-11-02 10:53:21 +0000
committerEike Stepper2007-11-02 10:53:21 +0000
commit22ab9b75100dab7c49a3c7d945091d625be3d391 (patch)
tree0564a2629e72a2b27645c5e9035598c13f97c08a
parent193c7bae9efd0bda2feb2c1242a8a5fa1f98b51b (diff)
downloadcdo-22ab9b75100dab7c49a3c7d945091d625be3d391.tar.gz
cdo-22ab9b75100dab7c49a3c7d945091d625be3d391.tar.xz
cdo-22ab9b75100dab7c49a3c7d945091d625be3d391.zip
*** empty log message ***
-rw-r--r--plugins/org.eclipse.emf.cdo.migrator/plugin.xml1
-rw-r--r--plugins/org.eclipse.emf.cdo.migrator/src/org/eclipse/emf/cdo/migrator/actions/MigrateAction.java41
2 files changed, 37 insertions, 5 deletions
diff --git a/plugins/org.eclipse.emf.cdo.migrator/plugin.xml b/plugins/org.eclipse.emf.cdo.migrator/plugin.xml
index ffae4b7ae2..5eb381fd6b 100644
--- a/plugins/org.eclipse.emf.cdo.migrator/plugin.xml
+++ b/plugins/org.eclipse.emf.cdo.migrator/plugin.xml
@@ -31,6 +31,7 @@
point="org.eclipse.ui.popupMenus">
<objectContribution
id="org.eclipse.emf.cdo.migrator.MigrateContribution"
+ nameFilter="*.genmodel"
objectClass="org.eclipse.core.resources.IFile">
<menu
id="org.eclipse.emf.cdo.migrator.menu1"
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 3112166d83..b5cb9145e7 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
@@ -30,6 +30,7 @@ import org.eclipse.jface.action.IAction;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IObjectActionDelegate;
import org.eclipse.ui.IWorkbenchPart;
@@ -73,21 +74,19 @@ public class MigrateAction implements IObjectActionDelegate
IFile file = getFile();
if (file == null)
{
- MessageDialog.openError(new Shell(), "CDO Migrator", "The selected element is not a *.genmodel file.");
+ showMessage("The selected element is not a *.genmodel file.", true);
}
else
{
GenModel genModel = getGenModel(file);
if (genModel == null)
{
- MessageDialog.openError(new Shell(), "CDO Migrator",
- "The selected file does not contain a generator model.");
+ showMessage("The selected file does not contain a generator model.", true);
}
else
{
CDOMigrator.adjustGenModel(genModel, file.getProject());
- MessageDialog.openInformation(new Shell(), "CDO Migrator",
- "The selected generator model has been migrated.");
+ showMessage("The selected generator model has been migrated.", false);
}
}
}
@@ -141,4 +140,36 @@ public class MigrateAction implements IObjectActionDelegate
return null;
}
+
+ protected void showMessage(final String msg, final boolean error)
+ {
+ try
+ {
+ final Shell shell = new Shell();
+ Display display = shell.getDisplay();
+ display.syncExec(new Runnable()
+ {
+ public void run()
+ {
+ try
+ {
+ if (error)
+ {
+ MessageDialog.openError(shell, "CDO Migrator", msg);
+ }
+ else
+ {
+ MessageDialog.openInformation(shell, "CDO Migrator", msg);
+ }
+ }
+ catch (RuntimeException ignore)
+ {
+ }
+ }
+ });
+ }
+ catch (RuntimeException ignore)
+ {
+ }
+ }
}

Back to the top