Search in sources :

Example 1 with MergedObject

use of com.intellij.util.xml.MergedObject in project intellij-community by JetBrains.

the class AddElementInCollectionAction method createAddingAction.

@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);
}
Also used : DomElement(com.intellij.util.xml.DomElement) XmlFile(com.intellij.psi.xml.XmlFile) MergedObject(com.intellij.util.xml.MergedObject) List(java.util.List) DefaultActionGroup(com.intellij.openapi.actionSystem.DefaultActionGroup)

Aggregations

DefaultActionGroup (com.intellij.openapi.actionSystem.DefaultActionGroup)1 XmlFile (com.intellij.psi.xml.XmlFile)1 DomElement (com.intellij.util.xml.DomElement)1 MergedObject (com.intellij.util.xml.MergedObject)1 List (java.util.List)1