Search in sources :

Example 11 with MergingUpdateQueue

use of com.intellij.util.ui.update.MergingUpdateQueue in project oxy-template-support-plugin by mutant-industries.

the class CompiledPreviewController method initCompiledCodeUpdater.

// ----------------------------------------------------------------------------------------------------
private void initCompiledCodeUpdater() {
    updateQueue = new MergingUpdateQueue("LIVE_PREVIEW_QUEUE", 1000, true, null, myProject);
    EditorFactory.getInstance().getEventMulticaster().addDocumentListener(new DocumentListener() {

        @Override
        public void documentChanged(DocumentEvent e) {
            Document document = e.getDocument();
            VirtualFile file = FileDocumentManager.getInstance().getFile(document);
            if (file == null || file.getFileType() != OxyTemplateFileType.INSTANCE) {
                return;
            }
            updateQueue.cancelAllUpdates();
            updateQueue.queue(new CompiledPreviewUpdater(Boolean.TRUE, myProject));
        }
    }, myProject);
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) LightVirtualFile(com.intellij.testFramework.LightVirtualFile) DocumentListener(com.intellij.openapi.editor.event.DocumentListener) MergingUpdateQueue(com.intellij.util.ui.update.MergingUpdateQueue) DocumentEvent(com.intellij.openapi.editor.event.DocumentEvent) Document(com.intellij.openapi.editor.Document)

Aggregations

MergingUpdateQueue (com.intellij.util.ui.update.MergingUpdateQueue)11 Update (com.intellij.util.ui.update.Update)3 VirtualFile (com.intellij.openapi.vfs.VirtualFile)2 UiNotifyConnector (com.intellij.util.ui.update.UiNotifyConnector)2 NotNull (org.jetbrains.annotations.NotNull)2 FileHyperlinkInfo (com.intellij.execution.filters.FileHyperlinkInfo)1 HyperlinkInfo (com.intellij.execution.filters.HyperlinkInfo)1 EditorHyperlinkSupport (com.intellij.execution.impl.EditorHyperlinkSupport)1 LocalHistoryFacade (com.intellij.history.core.LocalHistoryFacade)1 AllIcons (com.intellij.icons.AllIcons)1 AnAction (com.intellij.openapi.actionSystem.AnAction)1 AnActionEvent (com.intellij.openapi.actionSystem.AnActionEvent)1 ApplicationActivationListener (com.intellij.openapi.application.ApplicationActivationListener)1 ApplicationManager (com.intellij.openapi.application.ApplicationManager)1 Logger (com.intellij.openapi.diagnostic.Logger)1 Document (com.intellij.openapi.editor.Document)1 Editor (com.intellij.openapi.editor.Editor)1 ColorKey (com.intellij.openapi.editor.colors.ColorKey)1 EditorFontType (com.intellij.openapi.editor.colors.EditorFontType)1 DocumentEvent (com.intellij.openapi.editor.event.DocumentEvent)1