- try {
- getContainer().run(true, false, new IRunnableWithProgress() {
- @Override
- public void run(IProgressMonitor monitor)
- throws InvocationTargetException, InterruptedException {
- try {
- monitor.beginTask("Resource Creation With RAML", 2);
- monitor.worked(1);
- resource = Activator.getDefault().getResourceManager()
- .createResourceByRAML(configFilePath);
- monitor.worked(1);
- } catch (SimulatorException e) {
- wizard.setStatus("Failed to create resource.\n"
- + Utility.getSimulatorErrorString(e, null));
- } finally {
- monitor.done();
+ if (0 == resCreatedCount[0]) {
+ wizard.setStatus("Failed to create Resources.");
+ wizard.getWizardDialog().close();
+ return null;
+ }
+
+ boolean canceled = false;
+ if (null != progressMonitor && progressMonitor.isCanceled()) {
+ canceled = true;
+ }
+ progressMonitor = null;
+ if (canceled) {
+ return null;
+ }
+
+ // It is guaranteed that will be at least one resource at this
+ // point.
+ SingleResource resourceInstance = (SingleResource) multiInstanceResourceSet
+ .toArray()[0];
+ resName = resourceInstance.getResourceName();
+ resType = resourceInstance.getResourceType();
+ resURI = resourceInstance.getResourceURI();
+ UpdateMultiInstanceCreationPropertiesPage updatePageRef = wizard
+ .getUpdateMultiInstanceCreationPropPage();
+ updatePageRef.setResName(resName);
+ updatePageRef.setResType(resType);
+ nextPage = updatePageRef;
+ } else {
+ try {
+ getContainer().run(true, false, new IRunnableWithProgress() {
+ @Override
+ public void run(IProgressMonitor monitor)
+ throws InvocationTargetException,
+ InterruptedException {
+ try {
+ monitor.beginTask("Resource Creation With RAML", 2);
+ monitor.worked(1);
+ resource = Activator.getDefault()
+ .getResourceManager()
+ .createResourceByRAML(configFilePath);
+ monitor.worked(1);
+ } catch (SimulatorException e) {
+ wizard.setStatus("Failed to create resource.\n"
+ + Utility.getSimulatorErrorString(e, null));
+ } finally {
+ monitor.done();
+ }