@Override protected AnAction createAddingAction(final AnActionEvent e, final String name, final Icon icon, final Type type, final DomCollectionChildDescription description) { final DomElement parentDomElement = getParentDomElement(e); if (parentDomElement instanceof MergedObject) { final List<DomElement> implementations = (List<DomElement>)((MergedObject)parentDomElement).getImplementations(); final DefaultActionGroup actionGroup = new DefaultActionGroup(name, true); for (DomElement implementation : implementations) { final XmlFile xmlFile = DomUtil.getFile(implementation); actionGroup.add(new MyDefaultAddAction(implementation, xmlFile.getName(), xmlFile.getIcon(0), e, type, description)); } return actionGroup; } return new MyDefaultAddAction(parentDomElement, name, icon, e, type, description); }
protected AnAction createAddingAction(final AnActionEvent e, final String name, final Icon icon, final Type type, final DomCollectionChildDescription description) { final DomElement parentDomElement = getParentDomElement(e); if (parentDomElement instanceof MergedObject) { final List<DomElement> implementations = (List<DomElement>)((MergedObject)parentDomElement).getImplementations(); final DefaultActionGroup actionGroup = new DefaultActionGroup(name, true); for (DomElement implementation : implementations) { final XmlFile xmlFile = DomUtil.getFile(implementation); actionGroup.add(new MyDefaultAddAction(implementation, xmlFile.getName(), xmlFile.getIcon(0), e, type, description)); } return actionGroup; } return new MyDefaultAddAction(parentDomElement, name, icon, e, type, description); }
protected AnAction createAddingAction(final AnActionEvent e, final String name, final Icon icon, final Type type, final DomCollectionChildDescription description) { final DomElement parentDomElement = getParentDomElement(e); if (parentDomElement instanceof MergedObject) { final List<DomElement> implementations = (List<DomElement>)((MergedObject)parentDomElement).getImplementations(); final DefaultActionGroup actionGroup = new DefaultActionGroup(name, true); for (DomElement implementation : implementations) { final XmlFile xmlFile = DomUtil.getFile(implementation); actionGroup.add(new MyDefaultAddAction(implementation, xmlFile.getName(), IconDescriptorUpdaters.getIcon(xmlFile, 0), e, type, description)); } return actionGroup; } return new MyDefaultAddAction(parentDomElement, name, icon, e, type, description); }
public StableInvocationHandler(final T initial, final Factory<T> provider, Condition<T> validator) { myProvider = provider; myCachedValue = initial; myOldValue = initial; myValidator = validator; final Class superClass = initial.getClass().getSuperclass(); final Set<Class> classes = new HashSet<Class>(); ContainerUtil.addAll(classes, initial.getClass().getInterfaces()); ContainerUtil.addIfNotNull(superClass, classes); classes.remove(MergedObject.class); myClasses = classes; }
@Nullable private SimpleNode visit(SimpleNode simpleNode, DomElement domElement) { boolean validCandidate = false; if (simpleNode instanceof AbstractDomElementNode) { final DomElement nodeElement = ((AbstractDomElementNode)simpleNode).getDomElement(); if (nodeElement != null) { validCandidate = !(simpleNode instanceof DomElementsGroupNode); if (validCandidate && nodeElement.equals(domElement)) { return simpleNode; } if (!(nodeElement instanceof MergedObject) && !isParent(nodeElement, domElement)) { return null; } } } final Object[] childElements = myBuilder.getTreeStructure().getChildElements(simpleNode); if (childElements.length == 0 && validCandidate) { // leaf return simpleNode; } for (Object child: childElements) { SimpleNode result = visit((SimpleNode)child, domElement); if (result != null) { return result; } } return validCandidate ? simpleNode : null; }