private Collection getApplicableTagDefinitions(Object t) { Set<List<String>> paths = new HashSet<List<String>>(); Set<Object> availableTagDefs = new TreeSet<Object>(new PathComparator()); Collection stereotypes = Model.getFacade().getStereotypes(t); Project project = ProjectManager.getManager().getCurrentProject(); for (Object model : project.getModels()) { addAllUniqueModelElementsFrom( availableTagDefs, paths, Model.getModelManagementHelper() .getAllModelElementsOfKind(model, Model.getMetaTypes().getTagDefinition())); } addAllUniqueModelElementsFrom( availableTagDefs, paths, project.getProfileConfiguration().findByMetaType(Model.getMetaTypes().getTagDefinition())); List notValids = new ArrayList(); for (Object tagDef : availableTagDefs) { Object owner = Model.getFacade().getOwner(tagDef); if (owner != null && !stereotypes.contains(owner)) { notValids.add(tagDef); } } int size = availableTagDefs.size(); availableTagDefs.removeAll(notValids); int delta = size - availableTagDefs.size(); return availableTagDefs; }
/* * @see org.argouml.uml.ui.UMLComboBoxModel2#buildModelList() */ protected void buildModelList() { Set<Object> elements = new TreeSet<Object>(new PathComparator()); Project p = ProjectManager.getManager().getCurrentProject(); for (Object model : p.getUserDefinedModelList()) { elements.addAll( Model.getModelManagementHelper() .getAllModelElementsOfKind(model, Model.getMetaTypes().getClassifier())); } elements.addAll( p.getProfileConfiguration().findByMetaType(Model.getMetaTypes().getClassifier())); removeAllElements(); addAll(elements); }