Пример #1
0
 /**
  * Returns a pseudo component identifier representing the most abstract realizing toolkit
  * component for an abstract component with default mapping or <code>null</code> if none can be
  * found
  *
  * @param toolkitID the toolkit id
  * @param cc the concrete component
  * @return the component identifier
  */
 public static IComponentIdentifier getIdentifierOfMostAbstractRealizingComponentInToolkit(
     String toolkitID, ConcreteComponent cc) {
   ConcreteComponent concreteComponent = getMostAbstractRealizingComponentInToolkit(toolkitID, cc);
   IComponentIdentifier technicalName = new ComponentIdentifier();
   technicalName.setComponentClassName(concreteComponent.getComponentClass().getName());
   return technicalName;
 }
Пример #2
0
  /**
   * Returns the most abstract realizing toolkit component for an abstract component with default
   * mapping or <code>null</code> if none can be found
   *
   * @param toolkitID the toolkit id
   * @param cc the concrete component
   * @return the component
   */
  public static ConcreteComponent getMostAbstractRealizingComponentInToolkit(
      String toolkitID, ConcreteComponent cc) {
    String toolkitIdToSearchIn = toolkitID;
    Set realizers = cc.getAllRealizers();
    ToolkitDescriptor tpd = null;
    while (!StringUtils.isEmpty(toolkitIdToSearchIn)) {

      for (Iterator iterator = realizers.iterator(); iterator.hasNext(); ) {
        ConcreteComponent concreteComponent = (ConcreteComponent) iterator.next();
        if (toolkitIdToSearchIn.equals(concreteComponent.getToolkitDesriptor().getToolkitID())
            && concreteComponent.getComponentClass() != null) {
          return concreteComponent;
        }
      }
      try {
        tpd = getToolkitDescriptor(toolkitIdToSearchIn);
        toolkitIdToSearchIn = tpd.getIncludes();
      } catch (ToolkitPluginException e) {
        log.error("No possible technical name found", e); // $NON-NLS-1$
        return null;
      }
    }
    return null;
  }