Ejemplo n.º 1
0
  /** 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();
  }
Ejemplo n.º 2
0
  /**
   * Adds appropriate testcase libraries to the given project's reused projects set.
   *
   * @param newProject The project that will reuse the testcase libraries.
   */
  private void addUnboundModules(IProjectPO newProject) {

    // Use toolkit-specific module, and modules for all required toolkits
    ToolkitDescriptor desc =
        ComponentBuilder.getInstance()
            .getCompSystem()
            .getToolkitDescriptor(newProject.getToolkit());

    while (desc != null) {
      try {
        String moduleName = LIBRARY_PREFIX + desc.getName();
        IProjectPO ubmProject = ProjectPM.loadLatestVersionOfProjectByName(moduleName);
        if (ubmProject != null) {
          newProject.addUsedProject(PoMaker.createReusedProjectPO(ubmProject));
        } else {
          if (log.isInfoEnabled()) {
            log.info(
                Messages.Project
                    + StringConstants.SPACE
                    + StringConstants.APOSTROPHE
                    + moduleName
                    + StringConstants.APOSTROPHE
                    + Messages.DoesNotExist
                    + StringConstants.DOT);
          }
        }
      } catch (JBException e) {
        log.error(e + StringConstants.COLON + StringConstants.SPACE + e.getMessage());
      }
      desc =
          ComponentBuilder.getInstance().getCompSystem().getToolkitDescriptor(desc.getIncludes());
    }
  }
  /** {@inheritDoc} */
  public boolean performOk() {
    try {
      if (!m_oldProjectName.equals(m_newProjectName)) {
        if (ProjectPM.doesProjectNameExist(m_newProjectName)) {

          ErrorHandlingUtil.createMessageDialog(
              MessageIDs.E_PROJECTNAME_ALREADY_EXISTS, new Object[] {m_newProjectName}, null);
          return false;
        }
      }
      if (m_isReusableCheckbox != null) {
        getProject().setIsReusable(m_isReusableCheckbox.getSelection());
      }
      if (m_isProtectedCheckbox != null) {
        getProject().setIsProtected(m_isProtectedCheckbox.getSelection());
      }
      storeAutoTestResultCleanup();

      if (!m_oldProjectName.equals(m_newProjectName)) {
        ProjectNameBP.getInstance()
            .setName(getEditSupport().getSession(), getProject().getGuid(), m_newProjectName);
      }
      fireOkPressed();
      Set<IReusedProjectPO> origReused =
          ((IProjectPropertiesPO) getEditSupport().getOriginal()).getUsedProjects();
      Set<IReusedProjectPO> newReused =
          new HashSet<IReusedProjectPO>(
              ((IProjectPropertiesPO) getEditSupport().getWorkVersion()).getUsedProjects());
      newReused.removeAll(origReused);
      getEditSupport().saveWorkVersion();
      refreshAutMainList();
      DataEventDispatcher.getInstance().fireProjectStateChanged(ProjectState.prop_modified);
      for (IReusedProjectPO reused : newReused) {
        try {
          IProjectPO reusedProject = ProjectPM.loadReusedProject(reused);
          if (reusedProject != null) {
            // incomplete database, see https://bxapps.bredex.de/bugzilla/show_bug.cgi?id=854
            ComponentNamesBP.getInstance().refreshNames(reusedProject.getId());
          }
        } catch (JBException e) {
          // Could not refresh Component Name information for
          // reused project. Log the exception.
          log.error(Messages.ErrorWhileRetrievingReusedProjectInformation, e);
        }
      }
      // FIXME zeb This updates the Test Case Browser. Once we have separate
      //           EditSupports for each property page, then we can use
      //           "real" ReusedProjectPOs instead of a placeholder.
      DataEventDispatcher.getInstance()
          .fireDataChangedListener(
              PoMaker.createReusedProjectPO("1", 1, 1), // $NON-NLS-1$
              DataState.ReuseChanged,
              UpdateState.notInEditor);
      DataEventDispatcher.getInstance()
          .fireDataChangedListener(
              GeneralStorage.getInstance().getProject(),
              DataState.Renamed,
              UpdateState.notInEditor);
      CompletenessBP.getInstance().completeProjectCheck();
    } catch (PMException e) {
      ErrorHandlingUtil.createMessageDialog(e, null, null);
    } catch (ProjectDeletedException e) {
      PMExceptionHandler.handleProjectDeletedException();
    } catch (IncompatibleTypeException ite) {
      ErrorHandlingUtil.createMessageDialog(ite, ite.getErrorMessageParams(), null);
    }

    return true;
  }