summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarsten Thoms2012-01-27 03:58:20 (EST)
committerKarsten Thoms2012-01-27 03:58:20 (EST)
commit5e8985600dbf035ae01e72b4ea965a8d1b5a594c (patch)
tree9e9016ba3acf9167568e0179bfd5b0ec4b434f67
parentc78bd5cc180ddc1528906cd84cdb7d38e19abf36 (diff)
downloadorg.eclipse.mwe-5e8985600dbf035ae01e72b4ea965a8d1b5a594c.zip
org.eclipse.mwe-5e8985600dbf035ae01e72b4ea965a8d1b5a594c.tar.gz
org.eclipse.mwe-5e8985600dbf035ae01e72b4ea965a8d1b5a594c.tar.bz2
Bug369909
Added ProgressMonitor2 interface Avoided NoSuchMethodException when init() method is missing Signed-off-by: Karsten Thoms <karsten.thoms@itemis.de>
-rw-r--r--plugins/org.eclipse.emf.mwe.core/src/org/eclipse/emf/mwe/core/WorkflowRunner.java6
-rw-r--r--plugins/org.eclipse.emf.mwe.core/src/org/eclipse/emf/mwe/core/monitor/ProgressMonitor2.java18
2 files changed, 21 insertions, 3 deletions
diff --git a/plugins/org.eclipse.emf.mwe.core/src/org/eclipse/emf/mwe/core/WorkflowRunner.java b/plugins/org.eclipse.emf.mwe.core/src/org/eclipse/emf/mwe/core/WorkflowRunner.java
index b3d279b..3f3ca38 100644
--- a/plugins/org.eclipse.emf.mwe.core/src/org/eclipse/emf/mwe/core/WorkflowRunner.java
+++ b/plugins/org.eclipse.emf.mwe.core/src/org/eclipse/emf/mwe/core/WorkflowRunner.java
@@ -26,6 +26,7 @@ import org.apache.commons.cli.Options;
import org.apache.commons.cli.ParseException;
import org.apache.commons.cli.PosixParser;
import org.eclipse.emf.mwe.core.monitor.ProgressMonitor;
+import org.eclipse.emf.mwe.core.monitor.ProgressMonitor2;
import org.eclipse.emf.mwe.core.resources.ResourceLoaderFactory;
/**
@@ -146,9 +147,8 @@ public class WorkflowRunner {
throw new ClassNotFoundException("Didn't find class " + monitorOptValues[0]);
}
monitor = (ProgressMonitor) clazz.newInstance();
- final Method method = monitor.getClass().getMethod("init", new Class[] { String[].class });
- if (method != null) {
- method.invoke(monitor, new Object[] { monitorOptValues });
+ if (monitor instanceof ProgressMonitor2) {
+ ((ProgressMonitor2)monitor).init(monitorOptValues);
}
}
diff --git a/plugins/org.eclipse.emf.mwe.core/src/org/eclipse/emf/mwe/core/monitor/ProgressMonitor2.java b/plugins/org.eclipse.emf.mwe.core/src/org/eclipse/emf/mwe/core/monitor/ProgressMonitor2.java
new file mode 100644
index 0000000..abef76f
--- /dev/null
+++ b/plugins/org.eclipse.emf.mwe.core/src/org/eclipse/emf/mwe/core/monitor/ProgressMonitor2.java
@@ -0,0 +1,18 @@
+/*******************************************************************************
+ * Copyright (c) 2012 itemis AG (http://www.itemis.eu) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+package org.eclipse.emf.mwe.core.monitor;
+
+/**
+ * @author thoms - Initial contribution and API
+ */
+public interface ProgressMonitor2 extends ProgressMonitor {
+ /**
+ * Initializes the Monitor after instantiation with arguments passed to the workflow engine
+ */
+ void init (String[] args);
+}