Search in sources :

Example 31 with Update

use of com.intellij.util.ui.update.Update in project intellij-community by JetBrains.

the class ChooseByNamePopup method repaintList.

public void repaintList() {
    myRepaintQueue.cancelAllUpdates();
    myRepaintQueue.queue(new Update(this) {

        @Override
        public void run() {
            ChooseByNamePopup.this.repaintListImmediate();
        }
    });
}
Also used : Update(com.intellij.util.ui.update.Update)

Example 32 with Update

use of com.intellij.util.ui.update.Update in project intellij-community by JetBrains.

the class FileTextFieldImpl method suggestCompletion.

private void suggestCompletion(final boolean selectReplacedText, final boolean isExplicitCall) {
    if (isExplicitCall) {
        myAutopopup = true;
    }
    if (!getField().isFocusOwner())
        return;
    final CompletionResult result = new CompletionResult();
    if (myList != null && myCurrentCompletion != null) {
        int index = myList.getSelectedIndex();
        if (index >= 0 && index < myList.getModel().getSize()) {
            result.myPreselected = (LookupFile) myList.getSelectedValue();
        }
    }
    myUiUpdater.queue(new Update("textField.suggestCompletion") {

        public void run() {
            final String completionBase = getCompletionBase();
            if (completionBase != null) {
                final LookupFile file = myFinder.find(completionBase);
                if (file != null && file.exists() && !file.isDirectory()) {
                    // we've entered a complete path already, no need to autopopup completion again (IDEA-78996)
                    return;
                }
            }
            result.myCompletionBase = completionBase;
            if (result.myCompletionBase == null)
                return;
            result.myFieldText = myPathTextField.getText();
            ApplicationManager.getApplication().executeOnPooledThread(() -> {
                processCompletion(result);
                SwingUtilities.invokeLater(() -> {
                    if (!result.myCompletionBase.equals(getCompletionBase()))
                        return;
                    int pos = selectCompletionRemoveText(result, selectReplacedText);
                    showCompletionPopup(result, pos, isExplicitCall);
                });
            });
        }
    });
}
Also used : Update(com.intellij.util.ui.update.Update)

Example 33 with Update

use of com.intellij.util.ui.update.Update in project intellij-community by JetBrains.

the class ScopeTreeViewPanel method selectNode.

public void selectNode(final PsiElement element, final PsiFileSystemItem file, final boolean requestFocus) {
    final Runnable runnable = () -> myUpdateQueue.queue(new Update("Select") {

        @Override
        public void run() {
            if (myProject.isDisposed())
                return;
            PackageDependenciesNode node = myBuilder.findNode(file, element);
            if (node != null && node.getPsiElement() != element) {
                final TreePath path = new TreePath(node.getPath());
                if (myTree.isCollapsed(path)) {
                    myTree.expandPath(path);
                    myTree.makeVisible(path);
                }
            }
            node = myBuilder.findNode(file, element);
            if (node != null) {
                TreeUtil.selectPath(myTree, new TreePath(node.getPath()));
                if (requestFocus) {
                    IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
                        IdeFocusManager.getGlobalInstance().requestFocus(myTree, true);
                    });
                }
            }
        }
    });
    doWhenDone(runnable);
}
Also used : TreePath(javax.swing.tree.TreePath) Update(com.intellij.util.ui.update.Update)

Example 34 with Update

use of com.intellij.util.ui.update.Update in project intellij-community by JetBrains.

the class ExternalToolPass method applyInformationWithProgress.

@Override
protected void applyInformationWithProgress() {
    final long modificationStampBefore = myDocument.getModificationStamp();
    Update update = new Update(myFile) {

        @Override
        public void setRejected() {
            super.setRejected();
            doFinish(getHighlights(), modificationStampBefore);
        }

        @Override
        public void run() {
            if (documentChanged(modificationStampBefore) || myProject.isDisposed()) {
                return;
            }
            doAnnotate();
            ApplicationManagerEx.getApplicationEx().tryRunReadAction(() -> {
                if (documentChanged(modificationStampBefore) || myProject.isDisposed()) {
                    return;
                }
                applyRelevant();
                doFinish(getHighlights(), modificationStampBefore);
            });
        }
    };
    myExternalToolPassFactory.scheduleExternalActivity(update);
}
Also used : Update(com.intellij.util.ui.update.Update)

Example 35 with Update

use of com.intellij.util.ui.update.Update in project intellij-plugins by JetBrains.

the class OsmorcProjectComponent method scheduleImportNotification.

private void scheduleImportNotification() {
    myQueue.queue(new Update("reimport") {

        @Override
        public void run() {
            if (myProjectSettings.isBndAutoImport()) {
                BndProjectImporter.reimportWorkspace(myProject);
                return;
            }
            if (myReimportNotification.getAndSet(true)) {
                return;
            }
            String title = OsmorcBundle.message("bnd.reimport.title");
            String text = OsmorcBundle.message("bnd.reimport.text");
            BndProjectImporter.NOTIFICATIONS.createNotification(title, text, NotificationType.INFORMATION, new NotificationListener.Adapter() {

                @Override
                protected void hyperlinkActivated(@NotNull Notification notification, @NotNull HyperlinkEvent e) {
                    notification.expire();
                    if (e.getDescription().equals("auto")) {
                        myProjectSettings.setBndAutoImport(true);
                    }
                    BndProjectImporter.reimportWorkspace(myProject);
                }
            }).whenExpired(() -> myReimportNotification.set(false)).notify(myProject);
        }
    });
}
Also used : HyperlinkEvent(javax.swing.event.HyperlinkEvent) Update(com.intellij.util.ui.update.Update) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

Update (com.intellij.util.ui.update.Update)35 VirtualFile (com.intellij.openapi.vfs.VirtualFile)4 MessageBusConnection (com.intellij.util.messages.MessageBusConnection)4 Document (com.intellij.openapi.editor.Document)3 ModuleRootListener (com.intellij.openapi.roots.ModuleRootListener)3 MergingUpdateQueue (com.intellij.util.ui.update.MergingUpdateQueue)3 RenderResult (com.android.tools.idea.rendering.RenderResult)2 Editor (com.intellij.openapi.editor.Editor)2 DocumentAdapter (com.intellij.openapi.editor.event.DocumentAdapter)2 DocumentEvent (com.intellij.openapi.editor.event.DocumentEvent)2 ProjectSystemId (com.intellij.openapi.externalSystem.model.ProjectSystemId)2 Project (com.intellij.openapi.project.Project)2 ActionCallback (com.intellij.openapi.util.ActionCallback)2 AndroidDebugBridge (com.android.ddmlib.AndroidDebugBridge)1 RenderErrorModel (com.android.tools.idea.rendering.errors.ui.RenderErrorModel)1 NlComponent (com.android.tools.idea.uibuilder.model.NlComponent)1 SelectionModel (com.android.tools.idea.uibuilder.model.SelectionModel)1 ScreenView (com.android.tools.idea.uibuilder.surface.ScreenView)1 FileHyperlinkInfo (com.intellij.execution.filters.FileHyperlinkInfo)1 HyperlinkInfo (com.intellij.execution.filters.HyperlinkInfo)1