/** * Do the work after everything is specified. * <!-- begin-user-doc --> * <!-- end-user-doc --> * * @generated */ public boolean performFinish() { try { // Get the URI of the model file. // final URI fileURI = getModelURI(); if (new File(fileURI.toFileString()).exists()) { if (!MessageDialog.openQuestion( getShell(), WorkaroundEditorPlugin.INSTANCE.getString("_UI_Question_title"), WorkaroundEditorPlugin.INSTANCE.getString( "_WARN_FileConflict", new String[] {fileURI.toFileString()}))) { initialObjectCreationPage.selectFileField(); return false; } } // Do the work within an operation. // IRunnableWithProgress operation = new IRunnableWithProgress() { public void run(IProgressMonitor progressMonitor) { try { // Create a resource set // ResourceSet resourceSet = new ResourceSetImpl(); // Create a resource for this file. // Resource resource = resourceSet.createResource(fileURI); // Add the initial model object to the contents. // EObject rootObject = createInitialModel(); if (rootObject != null) { resource.getContents().add(rootObject); } // Save the contents of the resource to the file system. // Map options = new HashMap(); options.put(XMLResource.OPTION_ENCODING, initialObjectCreationPage.getEncoding()); resource.save(options); } catch (Exception exception) { WorkaroundEditorPlugin.INSTANCE.log(exception); } finally { progressMonitor.done(); } } }; getContainer().run(false, false, operation); return WorkaroundEditorAdvisor.openEditor(workbench, fileURI); } catch (Exception exception) { WorkaroundEditorPlugin.INSTANCE.log(exception); return false; } }