/** * @return The Configuration element for the given {@link DatatypeDefinition} or null if none is * configured. */ public static ProrPresentationConfiguration getPresentationConfiguration(DatatypeDefinition dd) { ReqIF reqif = ReqIF10Util.getReqIF(dd); if (reqif == null) return null; ProrToolExtension prorToolExtension = getProrToolExtension(reqif); if (prorToolExtension == null) return null; ProrPresentationConfigurations extensions = prorToolExtension.getPresentationConfigurations(); if (extensions == null) return null; for (ProrPresentationConfiguration config : extensions.getPresentationConfigurations()) { if (dd.equals(config.getDatatype())) return config; } return null; }
/** * Retrieves all active {@link PresentationEditInterface} instances for the given object (which * assumes to be part of a ReqIF model). If none is found, an empty set is returned. */ public static Set<PresentationEditInterface> getPresentationEditInterfaces( Object obj, AdapterFactory adapterFactory) { ReqIF reqif = ReqIF10Util.getReqIF(obj); ProrPresentationConfigurations configs = getPresentationConfigurations(reqif); if (configs != null) { Set<PresentationEditInterface> result = new HashSet<PresentationEditInterface>(); for (ProrPresentationConfiguration config : configs.getPresentationConfigurations()) { ItemProviderAdapter ip = ProrUtil.getItemProvider(adapterFactory, config); if (ip instanceof PresentationEditInterface) { result.add((PresentationEditInterface) ip); } } return result; } return Collections.emptySet(); }