/** * Adds the pages. * * @see org.eclipse.jface.wizard.Wizard#addPages() */ @Override public void addPages() { page1 = new PomJavaSynchronizationWizardPage( getPROJECT_NAMES(), getLIBRARIES(), getCHOSENPROJECT()); page1.setTitle(WizardsMessages.PomJavaFolderSynchronizationWizard_choose_project_and_libraries); page1.setImageDescriptor( BasePlugin.getDefault().getImages().getImageDescriptor(PluginImages.LOGO_ORG_64)); addPage(page1); page2 = new ChooseFolderWizardPage(); page2.setTitle(WizardsMessages.PomJavaFolderSynchronizationWizard_choose_folder); page2.setImageDescriptor( BasePlugin.getDefault().getImages().getImageDescriptor(PluginImages.LOGO_ORG_64)); addPage(page2); }
/** * This method is called when the user hits the "Finish" button.<br> * It runs a job downloading libraries to a given folder. * * @return true, if perform finish * @see org.eclipse.jface.wizard.Wizard#performFinish() */ @Override public boolean performFinish() { IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot(); IProject selectedProject = workspaceRoot.getProject(page1.getChosenProjectName()); IFolder selectedFolder = selectedProject.getFolder( page2.getChosenFolder() == null ? AggregatedProperties.getDefaultLibFolder(selectedProject) : page2.getChosenFolder()); IProgressMonitor pm = Job.getJobManager().createProgressGroup(); pm.beginTask(WizardsMessages.PomJavaFolderSynchronizationWizard_monitor_task_name, 100); Job job = new DownloadAndAddToFolderJob( selectedProject, selectedFolder, page1.getSelectedLibraries()); job.setProgressGroup(pm, 100); job.schedule(); return true; }