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();
}
});
}
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);
});
});
}
});
}
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);
}
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);
}
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);
}
});
}
Aggregations