Search in sources :

Example 1 with XmlNSDescriptorImpl

use of com.intellij.xml.impl.dtd.XmlNSDescriptorImpl in project intellij-community by JetBrains.

the class XmlDtdTest method createDescriptor.

private static XmlNSDescriptor createDescriptor(String dtdText) {
    PsiFile dtdFile = createLightFile("test.dtd", dtdText);
    XmlNSDescriptorImpl descriptor = new XmlNSDescriptorImpl();
    descriptor.init(dtdFile);
    return descriptor;
}
Also used : PsiFile(com.intellij.psi.PsiFile) XmlNSDescriptorImpl(com.intellij.xml.impl.dtd.XmlNSDescriptorImpl)

Example 2 with XmlNSDescriptorImpl

use of com.intellij.xml.impl.dtd.XmlNSDescriptorImpl in project intellij-community by JetBrains.

the class DomPerformanceTest method testVisitorPerformance.

public void testVisitorPerformance() throws Throwable {
    final MyElement element = createElement("<root xmlns=\"adsf\" targetNamespace=\"adsf\"/>", MyElement.class);
    MetaRegistry.bindDataToElement(DomUtil.getFile(element).getDocument(), new XmlNSDescriptorImpl());
    final MyElement child = element.addChildElement();
    child.getAttr().setValue("239");
    child.getChild239().getAttr().setValue("42");
    child.getChild().getAttr().setValue("42xx");
    child.getChild2().getAttr().setValue("42yy");
    child.addChildElement().getChild().addFooChild().getAttr().setValue("xxx");
    child.addChildElement().addFooChild().getAttr().setValue("yyy");
    child.addChildElement().addFooChild().addBarChild().addBarChild().addChildElement().getChild().getAttr().setValue("xxx");
    child.addChildElement().addBarComposite().setValue("ssss");
    child.addBarChild().getChild2().getAttr().setValue("234178956023");
    PlatformTestUtil.startPerformanceTest(getTestName(false), 80000, () -> ApplicationManager.getApplication().runWriteAction(() -> {
        for (int i = 0; i < 239; i++) {
            element.addChildElement().copyFrom(child);
        }
    })).cpuBound().attempts(1).useLegacyScaling().assertTiming();
    final MyElement newElement = createElement(DomUtil.getFile(element).getText(), MyElement.class);
    PlatformTestUtil.startPerformanceTest(getTestName(false), 300, new ThrowableRunnable() {

        @Override
        public void run() throws Exception {
            newElement.acceptChildren(new DomElementVisitor() {

                @Override
                public void visitDomElement(DomElement element) {
                    element.acceptChildren(this);
                }
            });
        }
    }).cpuBound().useLegacyScaling().assertTiming();
}
Also used : ThrowableRunnable(com.intellij.util.ThrowableRunnable) XmlNSDescriptorImpl(com.intellij.xml.impl.dtd.XmlNSDescriptorImpl)

Example 3 with XmlNSDescriptorImpl

use of com.intellij.xml.impl.dtd.XmlNSDescriptorImpl in project intellij-plugins by JetBrains.

the class FlexHighlightingTest method testAfterRename.

@JSTestOptions({ JSTestOption.WithFlexFacet, JSTestOption.WithGumboSdk })
@SuppressWarnings({ "ConstantConditions" })
public void testAfterRename() throws Exception {
    configureByFile(getBasePath() + "/afterRename.xml");
    XmlNSDescriptor nsDescriptor = ((XmlFile) getFile()).getDocument().getRootTagNSDescriptor();
    assertTrue(nsDescriptor.toString(), nsDescriptor instanceof XmlNSDescriptorImpl);
    doDoTest(true, true);
    new RenameProcessor(getProject(), getFile(), "afterRename.mxml", false, false).run();
    assertEquals("afterRename.mxml", getFile().getName());
    assertFalse(myFile.isValid());
    myFile = myPsiManager.findFile(getFile().getVirtualFile().getParent().findChild("afterRename.mxml"));
    assertTrue(myFile.isValid());
    nsDescriptor = ((XmlFile) getFile()).getDocument().getRootTagNSDescriptor();
    assertTrue(nsDescriptor.toString(), nsDescriptor instanceof FlexMxmlNSDescriptor);
    doDoTest(true, true);
}
Also used : XmlNSDescriptor(com.intellij.xml.XmlNSDescriptor) RenameProcessor(com.intellij.refactoring.rename.RenameProcessor) XmlFile(com.intellij.psi.xml.XmlFile) FlexMxmlNSDescriptor(com.intellij.javascript.flex.mxml.schema.FlexMxmlNSDescriptor) XmlNSDescriptorImpl(com.intellij.xml.impl.dtd.XmlNSDescriptorImpl)

Aggregations

XmlNSDescriptorImpl (com.intellij.xml.impl.dtd.XmlNSDescriptorImpl)3 FlexMxmlNSDescriptor (com.intellij.javascript.flex.mxml.schema.FlexMxmlNSDescriptor)1 PsiFile (com.intellij.psi.PsiFile)1 XmlFile (com.intellij.psi.xml.XmlFile)1 RenameProcessor (com.intellij.refactoring.rename.RenameProcessor)1 ThrowableRunnable (com.intellij.util.ThrowableRunnable)1 XmlNSDescriptor (com.intellij.xml.XmlNSDescriptor)1