Package com.intellij.psi.xml

Examples of com.intellij.psi.xml.XmlTag


            }
        }
    }

    private void handleChildRemoval(final PsiElement pParent, final PsiElement pChild) {
        final XmlTag parent = PsiTreeUtil.getParentOfType(pParent,
                                                          XmlTag.class,
                                                          false);
        if (parent == null)
            return;

        //
        //if the removed tag was the container tag, fire global change event
        //
        final XmlTag containerTag = containerPath.getTag();
        if (containerTag == null) {
            if (pChild instanceof XmlTag) {
                final XmlTag tag = (XmlTag) pChild;
                final String[] path = PsiUtils.getPathAndConcat(parent, tag.getName());
                if (path.equals(containerPath.getPathTokens()))
                    fireRowsChangedEvent();
            }
            return;
        }

        //
        //if the removed child was a text node, simply find which property it belonged to
        //
        if (pChild instanceof XmlText) {
            final XmlTag[] rowTags = containerTag.findSubTags(rowTagName);
            for (int i = 0; i < rowTags.length; i++) {
                rowPath.setRow(i);
                if (PsiTreeUtil.isAncestor(rowPath.getTag(), pChild, false)) {
                    final String property = mapper.findPropertyForElement(pChild);
                    if (property != null)
                        fireRowChangedEvent(i, property);
                }
            }
        }

        //
        //if the removed child is a tag, check if it is a row tag or a property tag
        //
        else if (pChild instanceof XmlTag) {
            rowPath.setRow(null);
            final XmlTag tag = (XmlTag) pChild;
            final String[] path = PsiUtils.getPathAndConcat(parent, tag.getName());

            //if the removed tag is a registered property tag
            final String propertyName = mapper.findPropertyByPath(path);
            if (propertyName != null) {
                final int row = findRowForElement(parent);
                fireRowChangedEvent(row, propertyName);
            }

            //if the removed tag is a row tag
            else if (rowTagName.equals(tag.getName())) {
                //TODO: inspect event's offset to determine row number
                //fireRowRemovedEvent(rowByOffset);

                fireRowsChangedEvent();
            }
View Full Code Here


        private int result = -1;

        public void run() {
            result = -1;
            try {
                final XmlTag containerTag = containerPath.ensureTag();
                final String namespace = containerTag.getNamespace();
                final XmlTag rowTag = (XmlTag) containerTag.add(
                        containerTag.createChildTag(rowTagName,
                                                    namespace,
                                                    null,
                                                    false));

                final XmlTag[] childTags = containerTag.findSubTags(rowTagName);
                for (int i = 0; i < childTags.length; i++) {
                    XmlTag tag = childTags[i];
                    if (tag.equals(rowTag)) {
                        result = i;
                        break;
                    }
                }
            }
View Full Code Here

    }

    public final void renameProperty(final String pPropertyName,
                                     final String pNewPropertyName) {
        final XmlTagPath tagPath = getPropertyTagPath(pPropertyName, false);
        XmlTag tag = tagPath == null ? null : tagPath.getTag();
        if (tag == null)
            return;

        //
        //rename the tag
View Full Code Here

        notifyAddition(pNewPropertyName);
    }

    public final XmlTag[] getPropertyTags() {
        final XmlTag containerTag = containerPath.getTag();
        if (containerTag == null)
            return new XmlTag[0];

        return containerTag.getSubTags();
    }
View Full Code Here

            listenerList.remove(BeanRowsListener.class, pListener);
        }
    }

    public int getRowCount() {
        final XmlTag containerTag = containerPath.getTag();
        if (containerTag == null)
            return 0;

        return containerTag.getSubTags().length;
    }
View Full Code Here

        private int result = -1;

        public void run() {
            result = -1;
            try {
                final XmlTag containerTag = containerPath.ensureTag();
                final String namespace = containerTag.getNamespace();
                final XmlTag rowTag = (XmlTag) containerTag.add(
                        containerTag.createChildTag(unknownPropertyName,
                                                    namespace,
                                                    null,
                                                    false));

                final XmlTag[] childTags = containerTag.getSubTags();
                for (int i = 0; i < childTags.length; i++) {
                    XmlTag tag = childTags[i];
                    if (tag.equals(rowTag)) {
                        result = i;
                        break;
                    }
                }
            }
View Full Code Here

            rowIndices = pRowIndices;
        }

        public void run() {
            try {
                final XmlTag containerTag = containerPath.getTag();
                if (containerTag == null)
                    return;

                final XmlTag[] childTags = containerTag.getSubTags();
                final Set<XmlTag> tags = new HashSet<XmlTag>(rowIndices.length);
                for (int rowIndice : rowIndices)
                    tags.add(childTags[rowIndice]);

                for (XmlTag xmlTag : tags)
View Full Code Here

    })) {
      // all good
      return ProblemDescriptor.EMPTY_ARRAY;
    }

    final XmlTag lastTag = ContainerUtil.iterateAndGetLastItem(visitor.getResult());

    if (lastTag == null) {
      return ProblemDescriptor.EMPTY_ARRAY;
    }
View Full Code Here

    @Override
    public void applyFix(@NotNull Project project, @NotNull ProblemDescriptor descriptor) {
      final PsiElement element = descriptor.getPsiElement();
      assert element instanceof XmlTag;

      final XmlTag parentTag = ((XmlTag)element).getParentTag();
      final PsiElement debugTag = parentTag.addAfter(element.copy(), element);
      assert debugTag instanceof XmlTag;

      appendValue((XmlTag)element, "release");
      appendValue((XmlTag)debugTag, "debug");
View Full Code Here

        return wicketId;
    }

    @Override
    public String getLocationString() {
        XmlTag tag = getTag();
        return tag != null ? tag.getName() : null;
    }
View Full Code Here

TOP

Related Classes of com.intellij.psi.xml.XmlTag

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.