/** {@inheritDoc} */
 public void widgetSelected(SelectionEvent e) {
   Object o = e.getSource();
   if (o.equals(m_projectToolkitCombo)) {
     handleAutToolkitSelection();
     return;
   }
   Assert.notReached(Messages.EventActivatedUnknownWidget + StringConstants.DOT);
 }
  /**
   * @param element Object the Object
   * @return Image an Image
   */
  public Image getImage(Object element) {
    Image image = null;
    if (element instanceof IComponentNamePO) {
      image = IconConstants.LOGICAL_NAME_IMAGE;
    } else if (element instanceof IObjectMappingAssoziationPO) {
      int status = getQualitySeverity(((IObjectMappingAssoziationPO) element).getCompIdentifier());
      switch (status) {
        case IStatus.OK:
          image = IconConstants.TECH_NAME_OK_IMAGE;
          break;
        case IStatus.WARNING:
          image = IconConstants.TECH_NAME_WARNING_IMAGE;
          break;
        case IStatus.ERROR:
          image = IconConstants.TECH_NAME_ERROR_IMAGE;
          break;
        default:
          image = IconConstants.TECHNICAL_NAME_IMAGE;
          break;
      }
    } else if (element instanceof IObjectMappingCategoryPO) {
      image = IconConstants.CATEGORY_IMAGE;
    } else if (element instanceof String) {
      // Missing Component Name
      image = IconConstants.LOGICAL_NAME_IMAGE;
    } else {
      String elementType = element != null ? element.getClass().getName() : "null"; // $NON-NLS-1$
      StringBuilder msg = new StringBuilder();
      msg.append(Messages.ElementType)
          .append(StringConstants.SPACE)
          .append(StringConstants.APOSTROPHE)
          .append(elementType)
          .append(StringConstants.APOSTROPHE)
          .append(StringConstants.SPACE)
          .append(Messages.NotSupported)
          .append(StringConstants.DOT);
      Assert.notReached(msg.toString());
      return null;
    }

    Object cbContents = m_clipboard.getContents(LocalSelectionClipboardTransfer.getInstance());
    if (cbContents instanceof IStructuredSelection) {
      IStructuredSelection sel = (IStructuredSelection) cbContents;
      if (sel.toList().contains(element)) {
        image = Plugin.getCutImage(image);
      }
    }

    return image;
  }
示例#3
0
 @SuppressWarnings("synthetic-access")
 public void handleRecordModeStateChanged(RecordModeState state) {
   switch (state) {
     case running:
       m_isRecordMode = true;
       m_isOmMode = false;
       break;
     case notRunning:
       m_isRecordMode = false;
       break;
     default:
       Assert.notReached(Messages.UnsupportedRecordModeState);
   }
   updateTestSuiteButtonState(true);
 }
  /**
   * @param element Object
   * @return name String
   */
  public String getText(Object element) {
    if (element instanceof IObjectMappingAssoziationPO) {
      IComponentIdentifier compId = ((IObjectMappingAssoziationPO) element).getTechnicalName();
      if (compId != null) {
        return compId.getComponentNameToDisplay();
      }
    } else if (element instanceof IComponentNamePO) {
      return m_compMapper.getCompNameCache().getName(((IComponentNamePO) element).getGuid());
    } else if (element instanceof IObjectMappingCategoryPO) {
      IObjectMappingCategoryPO category = (IObjectMappingCategoryPO) element;
      StringBuilder nameBuilder = new StringBuilder();
      String catName = category.getName();
      if (getTopLevelCategoryName(catName) != null) {
        catName = getTopLevelCategoryName(catName);
      }
      nameBuilder.append(catName);

      if (Plugin.getDefault().getPreferenceStore().getBoolean(Constants.SHOWCHILDCOUNT_KEY)) {
        int childListSize = 0;
        childListSize += category.getUnmodifiableAssociationList().size();
        childListSize += category.getUnmodifiableCategoryList().size();
        nameBuilder
            .append(StringConstants.SPACE + StringConstants.LEFT_PARENTHESES)
            .append(childListSize)
            .append(StringConstants.RIGHT_PARENTHESES);
      }
      return nameBuilder.toString();
    } else if (element instanceof String) {
      // Missing Component Name
      return (String) element;
    }

    Assert.notReached(
        org.eclipse.jubula.client.ui.i18n.Messages.UnknownTypeOfElementInTreeOfType
            + StringConstants.SPACE
            + element.getClass().getName());
    return StringConstants.EMPTY;
  }
示例#5
0
  /**
   * Throws always an AssertException. Use this method for exceptions that must be catched, but
   * never expected to be thrown
   *
   * @param t exception or error
   */
  public static void notThrown(Throwable t) {

    log.error("Unexpected Exception\n", t); // $NON-NLS-1$
    notReached();
  }
示例#6
0
 /**
  * Throws always an AssertException. Use this method for code segments which are not expected to
  * be reached.
  */
 public static void notReached() {
   notReached(
       "Code reached that was not "
           + //$NON-NLS-1$
           " expected to be reached"); //$NON-NLS-1$
 }
 /** {@inheritDoc} */
 public void widgetDefaultSelected(SelectionEvent e) {
   Assert.notReached(Messages.EventActivatedUnknownWidget + StringConstants.DOT);
 }