private DiagramRoot getElement(TransactionalEditingDomain editingDomain) {
    String wrProjectPath = diagramRoot.getProjectPath();
    String projectName = wrProjectPath.substring(wrProjectPath.lastIndexOf("/") + 1);
    String fileName =
        variativitySelectionPage.getText() + "." + projectName + ProjectPlweb.PLWEB_EXTENSION;

    IPath filePath = new Path(PathHelper.getProjectFile(projectName, fileName));
    IFile fileHandle = ResourcesPlugin.getWorkspace().getRoot().getFile(filePath);
    URI uri = URI.createPlatformResourceURI(fileHandle.getFullPath().toString(), true);

    ResourceSet resourceSet = editingDomain.getResourceSet();
    EObject element = null;
    try {
      Resource resource = resourceSet.getResource(uri, true);
      element = (EObject) resource.getContents().get(0);
    } catch (WrappedException ex) {
      PlwebDiagramEditorPlugin.getInstance()
          .logError("Unable to load resource: " + uri, ex); // $NON-NLS-1$
    }
    if (element == null || !(element instanceof DiagramRoot)) {
      MessageDialog.openError(
          getShell(),
          Messages.AddProduct_ResourceErrorDialogTitle,
          Messages.AddProduct_ResourceErrorDialogMessage);
      return null;
    }
    DiagramRoot diagramRoot = (DiagramRoot) element;
    return diagramRoot;
  }
  public PlwebAddProductWizard(
      URI domainModelURI, DiagramRoot diagramRoot, TransactionalEditingDomain editingDomain) {
    assert domainModelURI != null : "Domain model uri must be specified"; // $NON-NLS-1$
    assert diagramRoot != null : "Doagram root element must be specified"; // $NON-NLS-1$
    assert editingDomain != null : "Editing domain must be specified"; // $NON-NLS-1$

    variativitySelectionPage =
        new VariativitySelectionPage(Messages.AddProduct_VariativityPageName);
    variativitySelectionPage.setTitle(Messages.AddProduct_VariativityPageName);
    variativitySelectionPage.setDescription(Messages.AddProduct_VariativityResolveItems);
    Area area = diagramRoot.getArea();
    variativitySelectionPage.setModelElement(area);
    variativitySelectionPage.setDiagram(diagramRoot);

    IWorkspace workspace = ResourcesPlugin.getWorkspace();
    IWorkspaceRoot root = workspace.getRoot();
    IPath location = root.getLocation();
    String resourcePath = domainModelURI.toPlatformString(true);
    filePath = location + (new Path(resourcePath)).toString();
    projectName = resourcePath.substring(1, resourcePath.indexOf("/", 1));

    myEditingDomain = editingDomain;
    this.diagramRoot = diagramRoot;
  }
  private IFile createNewFile() {
    String wrProjectPath = diagramRoot.getProjectPath();
    String projectName = wrProjectPath.substring(wrProjectPath.lastIndexOf("/") + 1);
    String fileName =
        variativitySelectionPage.getText()
            + "."
            + projectName
            + ProjectPlweb.PLWEB_DIAGRAM_EXTENSION;

    IPath newFilePath = new Path(PathHelper.getProjectFile(projectName, fileName));
    IFile newFileHandle = ResourcesPlugin.getWorkspace().getRoot().getFile(newFilePath);
    InputStream contents = new ByteArrayInputStream(new byte[0]);
    try {
      newFileHandle.create(contents, false, null);
    } catch (CoreException e) {
      // TODO: handle exception
    }
    try {
      ResourcesPlugin.getWorkspace().getRoot().refreshLocal(IResource.DEPTH_INFINITE, null);
    } catch (CoreException e) {
      // do nothing
    }
    return newFileHandle;
  }