@Override public boolean performFinish() { boolean retVal = true; final String projectName = generalPage.getProjectName(); IPath workspacePath = ResourcesPlugin.getWorkspace().getRoot().getLocation(); IWorkspace workspace = ResourcesPlugin.getWorkspace(); final IProject projHandle = workspace.getRoot().getProject(projectName); final IProjectDescription desc = workspace.newProjectDescription(projHandle.getName()); WorkspaceModifyOperation modifyOperation = new WorkspaceModifyOperation() { @Override protected void execute(IProgressMonitor monitor) throws CoreException { try { projHandle.create(desc, monitor); projHandle.open(IResource.BACKGROUND_REFRESH, new SubProgressMonitor(monitor, 2000)); } finally { monitor.done(); } } }; try { ProjectCreationRequest projectCreationRequest = new ProjectCreationRequest(); projectCreationRequest.setTemplateName(generalPage.getTemplateName()); projectCreationRequest.setBaseDir(PathsUtil.toOsLocation(workspacePath)); projectCreationRequest.setProjectName(projectName); projectCreationRequest.setProvider(providerPage.getProvider()); projectCreationRequest.setDefaultPackageName(generalPage.getDefaultPackageName()); projectCreationRequest.setHostName(providerPage.getHostName()); projectCreationRequest.setHostPort(Integer.parseInt(providerPage.getHostPort())); projectCreationRequest.setCodePage(providerPage.getCodePage()); projectCreationRequest.setSupportTheme(generalPage.isProjectSupportTheme()); projectCreationRequest.setProjectTheme(themePage.getProjectTheme()); projectCreationRequest.setZipFile(generalPage.getZipFile()); projectCreationRequest.setTemplateFetcher(retriever.getTemplateFetcher()); EclipseDesignTimeExecuter.instance().createProject(projectCreationRequest); } catch (Exception e) { throw (new RuntimeException(e)); } try { getContainer().run(true, true, modifyOperation); } catch (Exception e) { throw (new RuntimeException(e)); } return retVal; }
@Override public boolean canFinish() { return generalPage.isDemo() || (generalPage.isPageComplete() && providerPage.isPageComplete() && themePage.isPageComplete()); }