private void doFinish( String containerName, String fileName, IProgressMonitor monitor) throws CoreException {  monitor.beginTask("Creating " + fileName, 2); IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); IResource resource = root.findMember(new Path(containerName)); if (!resource.exists() || !(resource instanceof IContainer)) { throwCoreException("Container \"" + containerName + "\" does not exist."); } IContainer container = (IContainer) resource; final IFile file = container.getFile(new Path(fileName)); try { InputStream stream = openContentStream(); if (file.exists()) { file.setContents(stream, true, true, monitor); } else { file.create(stream, true, monitor); } stream.close(); } catch (IOException 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 { IDE.openEditor(page, file, true); } catch (PartInitException e) { } } }); monitor.worked(1); }
protected void doFinish(String containerName, String fileName, IProgressMonitor monitor) throws CoreException {  monitor.beginTask("Creating " + fileName, 2); IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); IResource resource = root.findMember(new Path(containerName)); if (!resource.exists() || !(resource instanceof IContainer)) { throwCoreException("Container \"" + containerName + "\" does not exist."); } IContainer container = (IContainer) resource; final IFile file = container.getFile(new Path(fileName)); try { InputStream stream = openContentStream(); if (file.exists()) { file.setContents(stream, true, true, monitor); } else { file.create(stream, true, monitor); } stream.close(); } catch (IOException e) { e.printStackTrace(); } monitor.worked(1); monitor.setTaskName("Opening file for editing..."); getShell().getDisplay().asyncExec(new Runnable() { public void run() { IWorkbenchPage activePage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); try { IDE.openEditor(activePage, file, true); } catch (PartInitException e) { e.printStackTrace(); } } }); monitor.worked(1); }
	private void doFinish(		String containerName,		String fileName,		IProgressMonitor monitor)		throws CoreException {		// create a sample file		monitor.beginTask("Creating " + fileName, 2);		IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();		IResource resource = root.findMember(new Path(containerName));		if (!resource.exists() || !(resource instanceof IContainer)) {			throwCoreException("Container \"" + containerName + "\" does not exist.");		}		IContainer container = (IContainer) resource;		final IFile file = container.getFile(new Path(fileName));		try {			InputStream stream = openContentStream();			if (file.exists()) {				file.setContents(stream, true, true, monitor);			} else {				file.create(stream, true, monitor);			}			stream.close();		} catch (IOException 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 {					IDE.openEditor(page, file, true);				} catch (PartInitException e) {				}			}		});		monitor.worked(1);	}