Search in sources :

Example 1 with MxmlWriter

use of com.intellij.flex.uiDesigner.mxml.MxmlWriter in project intellij-plugins by JetBrains.

the class Client method writeDocumentFactory.

/**
   * You must rollback block out if this method returns false
   */
private boolean writeDocumentFactory(DocumentInfo documentInfo, Module module, XmlFile psiFile, ProblemsHolder problemsHolder) throws IOException {
    final AccessToken token = ReadAction.start();
    final int flags;
    try {
        final JSClass jsClass = XmlBackedJSClassFactory.getXmlBackedClass(psiFile);
        assert jsClass != null;
        out.writeAmfUtf(jsClass.getQualifiedName());
        if (ActionScriptClassResolver.isParentClass(jsClass, FlexCommonTypeNames.SPARK_APPLICATION) || ActionScriptClassResolver.isParentClass(jsClass, FlexCommonTypeNames.MX_APPLICATION)) {
            flags = 1;
        } else if (ActionScriptClassResolver.isParentClass(jsClass, FlexCommonTypeNames.IUI_COMPONENT)) {
            flags = 0;
        } else {
            flags = 2;
        }
    } finally {
        token.finish();
    }
    out.write(flags);
    Pair<ProjectComponentReferenceCounter, List<RangeMarker>> result = new MxmlWriter(out, problemsHolder, registeredModules.getInfo(module).getFlexLibrarySet().assetCounterInfo.demanded).write(psiFile);
    if (result == null) {
        return false;
    }
    blockOut.end();
    documentInfo.setRangeMarkers(result.second);
    return result.first.unregistered.isEmpty() || registerDocumentReferences(result.first.unregistered, module, problemsHolder);
}
Also used : ProjectComponentReferenceCounter(com.intellij.flex.uiDesigner.mxml.ProjectComponentReferenceCounter) MxmlWriter(com.intellij.flex.uiDesigner.mxml.MxmlWriter) AccessToken(com.intellij.openapi.application.AccessToken) ArrayList(java.util.ArrayList) List(java.util.List) JSClass(com.intellij.lang.javascript.psi.ecmal4.JSClass)

Aggregations

MxmlWriter (com.intellij.flex.uiDesigner.mxml.MxmlWriter)1 ProjectComponentReferenceCounter (com.intellij.flex.uiDesigner.mxml.ProjectComponentReferenceCounter)1 JSClass (com.intellij.lang.javascript.psi.ecmal4.JSClass)1 AccessToken (com.intellij.openapi.application.AccessToken)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1