Search in sources :

Example 6 with ProjectComponentReferenceCounter

use of com.intellij.flex.uiDesigner.mxml.ProjectComponentReferenceCounter 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

ProjectComponentReferenceCounter (com.intellij.flex.uiDesigner.mxml.ProjectComponentReferenceCounter)6 ArrayList (java.util.ArrayList)4 List (java.util.List)4 StringRegistry (com.intellij.flex.uiDesigner.io.StringRegistry)3 AccessToken (com.intellij.openapi.application.AccessToken)3 Module (com.intellij.openapi.module.Module)3 NotNull (org.jetbrains.annotations.NotNull)3 JSClass (com.intellij.lang.javascript.psi.ecmal4.JSClass)2 ApplicationManager (com.intellij.openapi.application.ApplicationManager)2 ProgressIndicator (com.intellij.openapi.progress.ProgressIndicator)2 DumbService (com.intellij.openapi.project.DumbService)2 Project (com.intellij.openapi.project.Project)2 Semaphore (com.intellij.util.concurrency.Semaphore)2 IOException (java.io.IOException)2 ExecutionException (com.intellij.execution.ExecutionException)1 AdlUtil (com.intellij.flex.uiDesigner.AdlUtil)1 LocalCssWriter (com.intellij.flex.uiDesigner.css.LocalCssWriter)1 IOUtil (com.intellij.flex.uiDesigner.io.IOUtil)1 MessageSocketManager (com.intellij.flex.uiDesigner.io.MessageSocketManager)1 StringWriter (com.intellij.flex.uiDesigner.io.StringRegistry.StringWriter)1