/** @generated */ public boolean performFinish() { LinkedList<IFile> affectedFiles = new LinkedList<IFile>(); IFile diagramFile = myFileCreationPage.createNewFile(); de.tud.cs.st.vespucci.vespucci_model.diagram.part.VespucciDiagramEditorUtil.setCharset( diagramFile); affectedFiles.add(diagramFile); URI diagramModelURI = URI.createPlatformResourceURI(diagramFile.getFullPath().toString(), true); ResourceSet resourceSet = myEditingDomain.getResourceSet(); final Resource diagramResource = resourceSet.createResource(diagramModelURI); AbstractTransactionalCommand command = new AbstractTransactionalCommand( myEditingDomain, de.tud.cs.st.vespucci.vespucci_model.diagram.part.Messages .VespucciNewDiagramFileWizard_InitDiagramCommand, affectedFiles) { protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { int diagramVID = de.tud.cs.st.vespucci.vespucci_model.diagram.part.VespucciVisualIDRegistry .getDiagramVisualID(diagramRootElementSelectionPage.getModelElement()); if (diagramVID != de.tud.cs.st.vespucci.vespucci_model.diagram.edit.parts.ShapesDiagramEditPart .VISUAL_ID) { return CommandResult.newErrorCommandResult( de.tud.cs.st.vespucci.vespucci_model.diagram.part.Messages .VespucciNewDiagramFileWizard_IncorrectRootError); } Diagram diagram = ViewService.createDiagram( diagramRootElementSelectionPage.getModelElement(), de.tud.cs.st.vespucci.vespucci_model.diagram.edit.parts.ShapesDiagramEditPart .MODEL_ID, de.tud.cs.st.vespucci.vespucci_model.diagram.part.VespucciDiagramEditorPlugin .DIAGRAM_PREFERENCES_HINT); diagramResource.getContents().add(diagram); diagramResource.getContents().add(diagram.getElement()); return CommandResult.newOKCommandResult(); } }; try { OperationHistoryFactory.getOperationHistory() .execute(command, new NullProgressMonitor(), null); diagramResource.save( de.tud.cs.st.vespucci.vespucci_model.diagram.part.VespucciDiagramEditorUtil .getSaveOptions()); de.tud.cs.st.vespucci.vespucci_model.diagram.part.VespucciDiagramEditorUtil.openDiagram( diagramResource); } catch (ExecutionException e) { de.tud.cs.st.vespucci.vespucci_model.diagram.part.VespucciDiagramEditorPlugin.getInstance() .logError("Unable to create model and diagram", e); // $NON-NLS-1$ } catch (IOException ex) { de.tud.cs.st.vespucci.vespucci_model.diagram.part.VespucciDiagramEditorPlugin.getInstance() .logError("Save operation failed for: " + diagramModelURI, ex); // $NON-NLS-1$ } catch (PartInitException ex) { de.tud.cs.st.vespucci.vespucci_model.diagram.part.VespucciDiagramEditorPlugin.getInstance() .logError("Unable to open editor", ex); // $NON-NLS-1$ } return true; }