Source:
<code>public boolean performFinish() { try { IProject project = selectContextPage.getProject(); final ContextType type = selectContextPage.getContextType(); String name = selectContextPage.getContextName(); IPath containerPath = selectContextPage.getPathInProject(); IQ7Folder folder = RcpttCore.create(project).getFolder(containerPath); context = folder.createContext(name, type, true, new NullProgressMonitor()); if (takeSnapshot) { ContextViewer viewer = ContextUIManager.getInstance() .getViewer(type); IQ7NamedElement workingCopy = context .getWorkingCopy(new NullProgressMonitor()); try { final IQ7Editor<Context> editor = viewer.getViewer() .createEditor(); editor.setElement(workingCopy); ContextSnapshotAction action = new ContextSnapshotAction( editor); action.setJoin(true); action.run(); if (action.getStatus() == Status.CANCEL_STATUS) { ResourcesPlugin.getWorkspace().getRoot().findMember(context.getPath()).delete(true, null); return false; } final IWorkspaceRunnable operation = new IWorkspaceRunnable() { public void run(IProgressMonitor monitor) throws CoreException { editor.save(); } }; try { ResourcesPlugin.getWorkspace().run(operation, new NullProgressMonitor()); <START> Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); <END> WriteAccessChecker writeAccessChecker = new WriteAccessChecker(shell); if (!writeAccessChecker.makeResourceWritable(workingCopy)) { return false; } workingCopy.commitWorkingCopy(true, new NullProgressMonitor()); } catch (CoreException e) { Q7UIPlugin.log(e.getCause()); } finally { editor.dispose(); } } finally { workingCopy.discardWorkingCopy(); } } else { IDE.openEditor(getPage(), (IFile) context.getResource()); } } catch (Exception e) { Q7UIPlugin.log(e); return false; } return true; }</code><technical_language>Wizard dialog shell</technical_language>

Target:
public boolean performFinish() { try { IProject project = selectContextPage.getProject(); final ContextType type = selectContextPage.getContextType(); String name = selectContextPage.getContextName(); IPath containerPath = selectContextPage.getPathInProject(); IQ7Folder folder = RcpttCore.create(project).getFolder(containerPath); context = folder.createContext(name, type, true, new NullProgressMonitor()); if (takeSnapshot) { ContextViewer viewer = ContextUIManager.getInstance() .getViewer(type); IQ7NamedElement workingCopy = context .getWorkingCopy(new NullProgressMonitor()); try { final IQ7Editor<Context> editor = viewer.getViewer() .createEditor(); editor.setElement(workingCopy); ContextSnapshotAction action = new ContextSnapshotAction( editor); action.setJoin(true); action.run(); if (action.getStatus() == Status.CANCEL_STATUS) { ResourcesPlugin.getWorkspace().getRoot().findMember(context.getPath()).delete(true, null); return false; } final IWorkspaceRunnable operation = new IWorkspaceRunnable() { public void run(IProgressMonitor monitor) throws CoreException { editor.save(); } }; try { ResourcesPlugin.getWorkspace().run(operation, new NullProgressMonitor()); WriteAccessChecker writeAccessChecker = new WriteAccessChecker(getShell()); if (!writeAccessChecker.makeResourceWritable(workingCopy)) { return false; } workingCopy.commitWorkingCopy(true, new NullProgressMonitor()); } catch (CoreException e) { Q7UIPlugin.log(e.getCause()); } finally { editor.dispose(); } } finally { workingCopy.discardWorkingCopy(); } } else { IDE.openEditor(getPage(), (IFile) context.getResource()); } } catch (Exception e) { Q7UIPlugin.log(e); return false; } return true; }