Search in sources :

Example 6 with DocumentInfo

use of com.intellij.flex.uiDesigner.DocumentFactoryManager.DocumentInfo in project intellij-plugins by JetBrains.

the class Client method renderDocument.

/**
   * final, full render document - responsible for handle problemsHolder and assetCounter - you must not do it
   */
public AsyncResult<DocumentInfo> renderDocument(Module module, XmlFile psiFile, ProblemsHolder problemsHolder) {
    VirtualFile virtualFile = psiFile.getVirtualFile();
    final int factoryId = registerDocumentFactoryIfNeed(module, psiFile, virtualFile, false, problemsHolder);
    final AsyncResult<DocumentInfo> result = new AsyncResult<>();
    if (factoryId == -1) {
        result.setRejected();
        return result;
    }
    FlexLibrarySet flexLibrarySet = registeredModules.getInfo(module).getFlexLibrarySet();
    if (flexLibrarySet != null) {
        fillAssetClassPoolIfNeed(flexLibrarySet);
    }
    if (!problemsHolder.isEmpty()) {
        DocumentProblemManager.getInstance().report(module.getProject(), problemsHolder);
    }
    final ActionCallback callback = new ActionCallback("renderDocument");
    boolean hasError = true;
    try {
        beginMessage(ClientMethod.renderDocument, callback, result, () -> result.setDone(DocumentFactoryManager.getInstance().getInfo(factoryId)));
        out.writeShort(factoryId);
        hasError = false;
    } finally {
        finalizeMessageAndFlush(hasError);
    }
    return result;
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) ActionCallback(com.intellij.openapi.util.ActionCallback) AsyncResult(com.intellij.openapi.util.AsyncResult) DocumentInfo(com.intellij.flex.uiDesigner.DocumentFactoryManager.DocumentInfo)

Example 7 with DocumentInfo

use of com.intellij.flex.uiDesigner.DocumentFactoryManager.DocumentInfo in project intellij-plugins by JetBrains.

the class AppTest method applicationLaunchedAndInitialized.

@Override
protected void applicationLaunchedAndInitialized() {
    ((MySocketInputHandler) SocketInputHandler.getInstance()).fail = fail;
    ((MySocketInputHandler) SocketInputHandler.getInstance()).semaphore = semaphore;
    MessageBusConnection connection = ApplicationManager.getApplication().getMessageBus().connect(myModule);
    connection.subscribe(DesignerApplicationManager.MESSAGE_TOPIC, new DocumentRenderedListener() {

        @Override
        public void documentRendered(DocumentInfo info) {
            semaphore.up();
        }

        @Override
        public void errorOccurred() {
            fail.set(true);
            semaphore.up();
        }
    });
}
Also used : MessageBusConnection(com.intellij.util.messages.MessageBusConnection) DocumentInfo(com.intellij.flex.uiDesigner.DocumentFactoryManager.DocumentInfo)

Aggregations

DocumentInfo (com.intellij.flex.uiDesigner.DocumentFactoryManager.DocumentInfo)7 XmlFile (com.intellij.psi.xml.XmlFile)3 Document (com.intellij.openapi.editor.Document)2 ActionCallback (com.intellij.openapi.util.ActionCallback)2 AsyncResult (com.intellij.openapi.util.AsyncResult)2 VirtualFile (com.intellij.openapi.vfs.VirtualFile)2 StylesheetFile (com.intellij.psi.css.StylesheetFile)2 ByteArrayOutputStreamEx (com.intellij.flex.uiDesigner.io.ByteArrayOutputStreamEx)1 PrimitiveAmfOutputStream (com.intellij.flex.uiDesigner.io.PrimitiveAmfOutputStream)1 StringRegistry (com.intellij.flex.uiDesigner.io.StringRegistry)1 MxmlUtil (com.intellij.flex.uiDesigner.mxml.MxmlUtil)1 PrimitiveWriter (com.intellij.flex.uiDesigner.mxml.PrimitiveWriter)1 XmlAttributeValueProvider (com.intellij.flex.uiDesigner.mxml.XmlAttributeValueProvider)1 XmlElementValueProvider (com.intellij.flex.uiDesigner.mxml.XmlElementValueProvider)1 VirtualFileWindow (com.intellij.injected.editor.VirtualFileWindow)1 FlexAnnotationNames (com.intellij.javascript.flex.FlexAnnotationNames)1 FlexPredefinedTagNames (com.intellij.javascript.flex.FlexPredefinedTagNames)1 FlexReferenceContributor (com.intellij.javascript.flex.FlexReferenceContributor)1 ClassBackedElementDescriptor (com.intellij.javascript.flex.mxml.schema.ClassBackedElementDescriptor)1 JavaScriptSupportLoader (com.intellij.lang.javascript.JavaScriptSupportLoader)1