private void doFinish()

in org.apache.ivyde.eclipse/src/java/org/apache/ivyde/internal/eclipse/ui/wizards/IvyNewWizard.java [136:178]


    private void doFinish(final IFile file, String org, String module, String status,
            final IProgressMonitor monitor) throws CoreException {
        // create a sample file
        monitor.beginTask("Creating " + file.getName(), 2);
        try {
            BufferedReader reader = new BufferedReader(new InputStreamReader(openContentStream()));
            final StringBuilder buf = new StringBuilder();
            for (String line = reader.readLine(); line != null; line = reader.readLine()) {
                line = line.replaceAll("@ORGANISATION@", org);
                line = line.replaceAll("@MODULE@", module);
                line = line.replaceAll("@STATUS@", status);
                buf.append(line).append(System.getProperty("line.separator", "\n"));
            }
            reader.close();
            InputStream stream = new ByteArrayInputStream(buf.toString().getBytes());
            if (file.exists()) {
                file.setContents(stream, true, true, monitor);
            } else {
                file.create(stream, true, monitor);
            }
            stream.close();
        } catch (IOException e) {
            throw new CoreException(new Status(IStatus.ERROR, IvyPlugin.ID, IStatus.ERROR,
                    "The ivy.xml file could not be created", e));
        }
        monitor.worked(1);
        monitor.setTaskName("Opening file for editing...");
        getShell().getDisplay().asyncExec(new Runnable() {
            public void run() {
                IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
                        .getActivePage();
                try {
                    page.openEditor(new IvyFileEditorInput(file), IvyModuleDescriptorEditor.ID,
                        true);
                    // IDE.openEditor(page, file, IvyEditor.ID, true);
                } catch (PartInitException e) {
                    // this should not happen
                    IvyPlugin.logError("The editor could not be opened", e);
                }
            }
        });
        monitor.worked(1);
    }