use of com.intellij.util.ui.update.Update in project intellij-community by JetBrains.
the class FinderRecursivePanel method updatePanel.
public void updatePanel() {
if (myUpdateSelectedPathModeActive.get()) {
return;
}
myList.setPaintBusy(true);
myMergingUpdateQueue.queue(new Update("update") {
@Override
public void run() {
final T oldValue = getSelectedValue();
final int oldIndex = myList.getSelectedIndex();
ApplicationManager.getApplication().executeOnPooledThread(() -> DumbService.getInstance(getProject()).runReadActionInSmartMode(() -> {
try {
final List<T> listItems = getListItems();
SwingUtilities.invokeLater(() -> {
mergeListItems(myListModel, myList, listItems);
if (myList.isEmpty()) {
createRightComponent(true);
} else if (myList.getSelectedIndex() < 0) {
myList.setSelectedIndex(myListModel.getSize() > oldIndex ? oldIndex : 0);
} else {
Object newValue = myList.getSelectedValue();
updateRightComponent(oldValue == null || !oldValue.equals(newValue) || myList.isEmpty());
}
});
} finally {
myList.setPaintBusy(false);
}
}));
}
});
}
use of com.intellij.util.ui.update.Update in project intellij-community by JetBrains.
the class HistoryDialog method doScheduleUpdate.
private void doScheduleUpdate(int id, final Computable<Runnable> update) {
myUpdateQueue.queue(new Update(HistoryDialog.this, id) {
@Override
public boolean canEat(Update update1) {
return getPriority() >= update1.getPriority();
}
public void run() {
if (isDisposed() || myProject.isDisposed())
return;
invokeAndWait(() -> {
if (isDisposed() || myProject.isDisposed())
return;
isUpdating = true;
updateActions();
myDiffView.startUpdating();
});
Runnable apply = null;
try {
apply = update.compute();
} catch (Exception e) {
LocalHistoryLog.LOG.error(e);
}
final Runnable finalApply = apply;
invokeAndWait(new Runnable() {
@Override
public void run() {
if (isDisposed() || myProject.isDisposed())
return;
isUpdating = false;
if (finalApply != null) {
try {
finalApply.run();
} catch (Exception e) {
LocalHistoryLog.LOG.error(e);
}
}
updateActions();
myDiffView.finishUpdating();
}
});
}
});
}
use of com.intellij.util.ui.update.Update in project intellij-community by JetBrains.
the class Updater method update.
public final void update() {
myQueue.cancelAllUpdates();
myQueue.queue(new Update("update") {
@Override
public void run() {
update(myPainter);
if (myPainter.isModified()) {
myScrollBar.invalidate();
myScrollBar.repaint();
}
}
});
}
use of com.intellij.util.ui.update.Update in project intellij-community by JetBrains.
the class ServerConnectionEventDispatcher method queueConnectionStatusChanged.
public void queueConnectionStatusChanged(final ServerConnectionImpl<?> connection) {
myEventsQueue.activate();
myEventsQueue.queue(new Update(connection) {
@Override
public void run() {
myMessageBus.syncPublisher(ServerConnectionListener.TOPIC).onConnectionStatusChanged(connection);
}
});
}
use of com.intellij.util.ui.update.Update in project intellij-community by JetBrains.
the class ExternalSystemProjectsWatcher method onQueued.
@Override
public void onQueued(@NotNull ExternalSystemTaskId id, String workingDir) {
if (id.getType() == ExternalSystemTaskType.RESOLVE_PROJECT) {
final ProjectSystemId systemId = id.getProjectSystemId();
for (String filePath : ContainerUtil.newArrayList(myKnownAffectedFiles.get(workingDir))) {
VirtualFile file = VfsUtil.findFileByIoFile(new File(filePath), false);
if (file != null && !file.isDirectory()) {
file.putUserData(CRC_WITHOUT_SPACES_BEFORE_LAST_IMPORT, file.getUserData(CRC_WITHOUT_SPACES_CURRENT));
}
}
myUpdatesQueue.queue(new Update(Pair.create(systemId, workingDir)) {
public void run() {
doUpdateNotifications(true, systemId, workingDir);
}
});
}
}
Aggregations