/** Adds the pages of this wizard. */ public void addPages() { Plugin.startLongRunning(); final String emptystr = StringConstants.EMPTY; m_newProject = NodeMaker.createProjectPO(emptystr, IVersion.JB_CLIENT_METADATA_VERSION); m_autMain = PoMaker.createAUTMainPO(emptystr); m_newProject.addAUTMain(m_autMain); m_autConfig = PoMaker.createAUTConfigPO(); m_autMain.addAutConfigToSet(m_autConfig); IValidator autIdValidator = new AutIdValidator(m_newProject, null, m_autConfig); m_projectSettingWizardPage = new ProjectSettingWizardPage(PROJECT_SETTING_WP, m_newProject); m_projectSettingWizardPage.setTitle(Messages.ProjectWizardProjectSettings); m_projectSettingWizardPage.setDescription(Messages.ProjectWizardNewProject); addPage(m_projectSettingWizardPage); m_autSettingWizardPage = new AUTSettingWizardPage(AUT_SETTING_WP, m_newProject, m_autMain); m_autSettingWizardPage.setTitle(Messages.ProjectWizardAutSettings); m_autSettingWizardPage.setDescription(Messages.ProjectWizardNewAUT); m_autSettingWizardPage.setPageComplete(true); addPage(m_autSettingWizardPage); m_autConfigSettingWizardPage = new AutConfigSettingWizardPage(AUT_CONFIG_SETTING_WP, m_autConfig, autIdValidator); m_autConfigSettingWizardPage.setTitle(Messages.ProjectWizardAutSettings); m_autConfigSettingWizardPage.setDescription(Messages.ProjectWizardAUTData); m_autConfigSettingWizardPage.setPageComplete(true); addPage(m_autConfigSettingWizardPage); Plugin.stopLongRunning(); }
/** * Returns the default toolkit for a project by inspecting its first AUT * * @param project the project * @return the name of the default toolkit */ private String determineDefaultToolkit(IProjectPO project) { String toolkit = null; IAUTMainPO firstAUT = null; try { firstAUT = project.getAutCont().getAutMainList().iterator().next(); } catch (NoSuchElementException e) { ErrorMessagePresenter.getPresenter() .showErrorMessage( new JBException(Messages.NoAutInProject, MessageIDs.E_NO_AUT_IN_PROJECT), null, null); progressMonitor.setCanceled(true); } if (firstAUT != null) { toolkit = firstAUT.getToolkit(); } if (toolkit.equals(CommandConstants.RCP_TOOLKIT)) { toolkit = CommandConstants.SWT_TOOLKIT; } return toolkit; }
/** * Creates a new project, stops a started AUT, closes all opened editors. * * @param newProjectName the name for this project * @param monitor The progress monitor for this potentially long-running operation. * @throws InterruptedException if the operation is canceled. */ private void createNewProject(final String newProjectName, IProgressMonitor monitor) throws InterruptedException { Plugin.closeAllOpenedJubulaEditors(false); m_newProject.setIsReusable(m_projectSettingWizardPage.isProjectReusable()); m_newProject.setIsProtected(m_projectSettingWizardPage.isProjectProtected()); if (m_autMain.getName() == null || StringConstants.EMPTY.equals(m_autMain.getName())) { m_newProject.removeAUTMain(m_autMain); } if (m_autConfig.getName() == null || StringConstants.EMPTY.equals(m_autConfig.getName())) { m_autMain.removeAutConfig(m_autConfig); } ParamNameBPDecorator paramNameMapper = new ParamNameBPDecorator(ParamNameBP.getInstance()); final IWritableComponentNameMapper compNamesMapper = new ProjectComponentNameMapper(new ComponentNamesDecorator(null), m_newProject); List<INameMapper> mapperList = new ArrayList<INameMapper>(); List<IWritableComponentNameMapper> compNameCacheList = new ArrayList<IWritableComponentNameMapper>(); addUnboundModules(m_newProject); mapperList.add(paramNameMapper); compNameCacheList.add(compNamesMapper); try { GeneralStorage.getInstance().reset(); ProjectPM.attachProjectToROSession( m_newProject, newProjectName, mapperList, compNameCacheList, monitor); } catch (PMSaveException e) { PMExceptionHandler.handlePMExceptionForMasterSession( new PMSaveException(e.getMessage(), MessageIDs.E_CREATE_NEW_PROJECT_FAILED)); } catch (PMException e) { PMExceptionHandler.handlePMExceptionForMasterSession(e); } catch (ProjectDeletedException e) { PMExceptionHandler.handleProjectDeletedException(); } catch (InterruptedException ie) { throw ie; } }
/** * Returns all supported languages of the given IAUTMainPO * * @param aut the aut whose languages to get * @return a List of locales */ public List<Locale> getLanguages(IAUTMainPO aut) { return aut != null ? aut.getLangHelper().getLanguageList() : new ArrayList<Locale>(0); }