Esempio n. 1
0
  /**
   * 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;
    }
  }
  /** {@inheritDoc} */
  public Image getImage(Object element) {

    if (element instanceof AbstractParamValueController) {
      AbstractParamValueController controller = (AbstractParamValueController) element;
      IParamNodePO paramNode = controller.getParamNode();

      if (controller.getPropertySource().isReadOnly()) {
        return IconConstants.READ_ONLY_IMAGE;
      }

      if (StringUtils.isNotEmpty(paramNode.getDataFile())) {
        return IconConstants.EXCEL_DATA_IMAGE;
      }

      String property = controller.getProperty();
      if (StringConstants.EMPTY.equals(property)) {
        return m_missingDataImage;
      }
      if (paramNode.getReferencedDataCube() != null) {
        return IconConstants.TDC_IMAGE;
      }

      ParamValueConverter conv =
          new GuiParamValueConverter(
              property, paramNode, controller.getParamDesc(), new NullValidator());
      if (conv.containsReferences()) {
        if (paramNode.getParentNode() instanceof ITestSuitePO) {
          return m_missingDataImage;
        }
        return IconConstants.REF_VALUE_IMAGE;
      } else if (paramNode instanceof IExecTestCasePO) {
        IExecTestCasePO exTc = (IExecTestCasePO) paramNode;

        if (exTc.getHasReferencedTD()) {
          return IconConstants.ORIGINAL_DATA_IMAGE;
        }
        return IconConstants.OVERWRITTEN_DATA_IMAGE;
      }

      return null;
    }

    return super.getImage(element);
  }