Java 类com.intellij.util.ui.update.Update 实例源码

项目:intellij-ce-playground    文件:AbstractTreeUpdater.java   
public final void queueSelection(final SelectionRequest request) {
  queue(new Update("UserSelection", Update.LOW_PRIORITY) {
    @Override
    public void run() {
      request.execute(myTreeBuilder.getUi());
    }

    @Override
    public boolean isExpired() {
      return myTreeBuilder.isDisposed();
    }

    @Override
    public void setRejected() {
      request.reject();
    }
  });
}
项目:intellij-ce-playground    文件:FileEditorManagerImpl.java   
/**
 * Updates tab title and tab tool tip for the specified <code>file</code>
 */
void updateFileName(@Nullable final VirtualFile file) {
  // Queue here is to prevent title flickering when tab is being closed and two events arriving: with component==null and component==next focused tab
  // only the last event makes sense to handle
  myQueue.queue(new Update("UpdateFileName " + (file == null ? "" : file.getPath())) {
    @Override
    public boolean isExpired() {
      return myProject.isDisposed() || !myProject.isOpen() || (file == null ? super.isExpired() : !file.isValid());
    }

    @Override
    public void run() {
      Set<EditorsSplitters> all = getAllSplitters();
      for (EditorsSplitters each : all) {
        each.updateFileName(file);
      }
    }
  });
}
项目:intellij-ce-playground    文件:FileChooserDialogImpl.java   
private void updateTreeFromPath(final String text) {
  if (!isToShowTextField()) return;
  if (myPathTextField.isPathUpdating()) return;
  if (text == null) return;

  myUiUpdater.queue(new Update("treeFromPath.1") {
    public void run() {
      ApplicationManager.getApplication().executeOnPooledThread(new Runnable() {
        public void run() {
          final LocalFsFinder.VfsFile toFind = (LocalFsFinder.VfsFile)myPathTextField.getFile();
          if (toFind == null || !toFind.exists()) return;

          myUiUpdater.queue(new Update("treeFromPath.2") {
            public void run() {
              selectInTree(toFind.getFile(), text);
            }
          });
        }
      });
    }
  });
}
项目:intellij-ce-playground    文件:FileTextFieldImpl.java   
public final void setText(final String text, boolean now, @Nullable final Runnable onDone) {
  final Update update = new Update("pathFromTree") {
    public void run() {
      myPathIsUpdating = true;
      getField().setText(text);
      myPathIsUpdating = false;
      if (onDone != null) {
        onDone.run();
      }
    }
  };
  if (now) {
    update.run();
  }
  else {
    myUiUpdater.queue(update);
  }
}
项目:intellij-ce-playground    文件:LightToolWindowManager.java   
private void bindToDesigner(final DesignerEditorPanelFacade designer) {
  myWindowQueue.cancelAllUpdates();
  myWindowQueue.queue(new Update("update") {
    @Override
    public void run() {
      if (myToolWindowDisposed) {
        return;
      }
      if (myToolWindow == null) {
        if (designer == null) {
          return;
        }
        initToolWindow();
      }
      updateToolWindow(designer);
    }
  });
}
项目:intellij-ce-playground    文件:ScopeTreeViewPanel.java   
private void queueUpdate(final VirtualFile fileToRefresh,
                         final Function<PsiFile, DefaultMutableTreeNode> rootToReloadGetter, final String scopeName) {
  if (myProject.isDisposed()) return;
  AbstractProjectViewPane pane = ProjectView.getInstance(myProject).getCurrentProjectViewPane();
  if (pane == null || !ScopeViewPane.ID.equals(pane.getId()) ||
      !scopeName.equals(pane.getSubId())) {
    return;
  }
  myUpdateQueue.queue(new Update(fileToRefresh) {
    @Override
    public void run() {
      if (myProject.isDisposed() || !fileToRefresh.isValid()) return;
      final PsiFile psiFile = PsiManager.getInstance(myProject).findFile(fileToRefresh);
      if (psiFile != null) {
        reload(rootToReloadGetter.fun(psiFile));
      }
    }

    @Override
    public boolean isExpired() {
      return !isTreeShowing();
    }
  });
}
项目:intellij-ce-playground    文件:CommonAssetSetStep.java   
/**
 * (Re)schedule the background task which updates the preview images.
 */
private void requestPreviewUpdate() {
  myUpdateQueue.cancelAllUpdates();
  myUpdateQueue.queue(new Update("update") {
    @Override
    public void run() {
      try {
        myAssetGenerator.generateImages(myImageMap, true, true);
        SwingUtilities.invokeLater(new Runnable() {
          @Override
          public void run() {
            updatePreviewImages();
          }
        });
      }
      catch (final ImageGeneratorException e) {
        SwingUtilities.invokeLater(new Runnable() {
          @Override
          public void run() {
            setErrorHtml(e.getMessage());
          }
        });
      }
    }
  });
}
项目:intellij-ce-playground    文件:MavenProjectIndicesManager.java   
public void scheduleUpdateIndicesList(@Nullable final Consumer<List<MavenIndex>> consumer) {
  myUpdateQueue.queue(new Update(MavenProjectIndicesManager.this) {
    public void run() {
      Set<Pair<String, String>> remoteRepositoriesIdsAndUrls;
      File localRepository;

      AccessToken accessToken = ReadAction.start();

      try {
        if (myProject.isDisposed()) return;

        remoteRepositoriesIdsAndUrls = collectRemoteRepositoriesIdsAndUrls();
        localRepository = getLocalRepository();
      }
      finally {
        accessToken.finish();
      }

      myProjectIndices = MavenIndicesManager.getInstance().ensureIndicesExist(myProject, localRepository, remoteRepositoriesIdsAndUrls);
      if(consumer != null) {
        consumer.consume(myProjectIndices);
      }
    }
  });
}
项目:intellij-ce-playground    文件:MavenShortcutsManager.java   
private void scheduleKeymapUpdate(List<MavenProject> mavenProjects, boolean forUpdate) {
  synchronized (mySheduledProjects) {
    for (MavenProject each : mavenProjects) {
      mySheduledProjects.put(each, forUpdate);
    }
  }

  myUpdateQueue.queue(new Update(MavenShortcutsManager.this) {
    @Override
    public void run() {
      List<MavenProject> projectToUpdate;
      List<MavenProject> projectToDelete;
      synchronized (mySheduledProjects) {
        projectToUpdate = selectScheduledProjects(true);
        projectToDelete = selectScheduledProjects(false);
        mySheduledProjects.clear();
      }
      if (!myProject.isDisposed()) {
        MavenKeymapExtension.clearActions(myProject, projectToDelete);
        MavenKeymapExtension.updateActions(myProject, projectToUpdate);
      }
    }
  });
}
项目:intellij-ce-playground    文件:MavenMergingUpdateQueue.java   
@Override
public void queue(@NotNull Update update) {
  boolean passThrough = false;
  if (ApplicationManager.getApplication().isUnitTestMode()) {
    passThrough = isPassThrough();
  }
  else if (MavenUtil.isNoBackgroundMode()) {
    passThrough = true;
  }

  if (passThrough) {
    update.run();
    return;
  }
  super.queue(update);
}
项目:intellij-ce-playground    文件:SelectLocationStep.java   
private void updateTreeFromPath(final String text) {
  if (!myShowPath) return;
  if (myPathTextField.isPathUpdating()) return;
  if (text == null) return;

  myUiUpdater.queue(new Update("treeFromPath.1") {
    public void run() {
      ApplicationManager.getApplication().executeOnPooledThread(new Runnable() {
        public void run() {
          final LocalFsFinder.VfsFile toFind = (LocalFsFinder.VfsFile)myPathTextField.getFile();
          if (toFind == null || !toFind.exists()) return;

          myUiUpdater.queue(new Update("treeFromPath.2") {
            public void run() {
              selectInTree(toFind.getFile(), text);
            }
          });
        }
      });
    }
  });
}
项目:tools-idea    文件:AbstractTreeUpdater.java   
public final void queueSelection(final SelectionRequest request) {
  queue(new Update("UserSelection", Update.LOW_PRIORITY) {
    @Override
    public void run() {
      request.execute(myTreeBuilder.getUi());
    }

    @Override
    public boolean isExpired() {
      return myTreeBuilder.isDisposed();
    }

    @Override
    public void setRejected() {
      request.reject();
    }
  });
}
项目:tools-idea    文件:FileEditorManagerImpl.java   
/**
 * Updates tab title and tab tool tip for the specified <code>file</code>
 */
void updateFileName(@Nullable final VirtualFile file) {
  // Queue here is to prevent title flickering when tab is being closed and two events arriving: with component==null and component==next focused tab
  // only the last event makes sense to handle
  myQueue.queue(new Update("UpdateFileName " + (file == null ? "" : file.getPath())) {
    public boolean isExpired() {
      return myProject.isDisposed() || !myProject.isOpen() || (file == null ? super.isExpired() : !file.isValid());
    }

    public void run() {
      Set<EditorsSplitters> all = getAllSplitters();
      for (EditorsSplitters each : all) {
        each.updateFileName(file);
      }
    }
  });
}
项目:tools-idea    文件:FileChooserDialogImpl.java   
private void updateTreeFromPath(final String text) {
  if (!isToShowTextField()) return;
  if (myPathTextField.isPathUpdating()) return;
  if (text == null) return;

  myUiUpdater.queue(new Update("treeFromPath.1") {
    public void run() {
      ApplicationManager.getApplication().executeOnPooledThread(new Runnable() {
        public void run() {
          final LocalFsFinder.VfsFile toFind = (LocalFsFinder.VfsFile)myPathTextField.getFile();
          if (toFind == null || !toFind.exists()) return;

          myUiUpdater.queue(new Update("treeFromPath.2") {
            public void run() {
              selectInTree(toFind.getFile(), text);
            }
          });
        }
      });
    }
  });
}
项目:tools-idea    文件:FileTextFieldImpl.java   
public final void setText(final String text, boolean now, @Nullable final Runnable onDone) {
  final Update update = new Update("pathFromTree") {
    public void run() {
      myPathIsUpdating = true;
      getField().setText(text);
      myPathIsUpdating = false;
      if (onDone != null) {
        onDone.run();
      }
    }
  };
  if (now) {
    update.run();
  }
  else {
    myUiUpdater.queue(update);
  }
}
项目:tools-idea    文件:LanguageConsoleImpl.java   
public void queueUiUpdate(final boolean forceScrollToEnd) {
  myForceScrollToEnd.compareAndSet(false, forceScrollToEnd);
  myUpdateQueue.queue(new Update("UpdateUi") {
    @Override
    public void run() {
      if (Disposer.isDisposed(LanguageConsoleImpl.this)) return;
      if (isConsoleEditorEnabled()) {
        myPanel.revalidate();
        myPanel.repaint();
      }
      if (myUiUpdateRunnable != null) {
        ApplicationManager.getApplication().runReadAction(myUiUpdateRunnable);
      }
    }
  });
}
项目:tools-idea    文件:ScopeTreeViewPanel.java   
private void queueUpdate(final VirtualFile fileToRefresh,
                         final Function<PsiFile, DefaultMutableTreeNode> rootToReloadGetter, final String scopeName) {
  if (myProject.isDisposed()) return;
  AbstractProjectViewPane pane = ProjectView.getInstance(myProject).getCurrentProjectViewPane();
  if (pane == null || !ScopeViewPane.ID.equals(pane.getId()) ||
      !scopeName.equals(pane.getSubId())) {
    return;
  }
  myUpdateQueue.queue(new Update(fileToRefresh) {
    @Override
    public void run() {
      if (myProject.isDisposed() || !fileToRefresh.isValid()) return;
      final PsiFile psiFile = PsiManager.getInstance(myProject).findFile(fileToRefresh);
      if (psiFile != null) {
        reload(rootToReloadGetter.fun(psiFile));
      }
    }

    @Override
    public boolean isExpired() {
      return !isTreeShowing();
    }
  });
}
项目:tools-idea    文件:MavenShortcutsManager.java   
private void scheduleKeymapUpdate(List<MavenProject> mavenProjects, boolean forUpdate) {
  synchronized (mySheduledProjects) {
    for (MavenProject each : mavenProjects) {
      mySheduledProjects.put(each, forUpdate);
    }
  }

  myUpdateQueue.queue(new Update(MavenShortcutsManager.this) {
    @Override
    public void run() {
      List<MavenProject> projectToUpdate;
      List<MavenProject> projectToDelete;
      synchronized (mySheduledProjects) {
        projectToUpdate = selectScheduledProjects(true);
        projectToDelete = selectScheduledProjects(false);
        mySheduledProjects.clear();
      }
      MavenKeymapExtension.clearActions(myProject, projectToDelete);
      MavenKeymapExtension.updateActions(myProject, projectToUpdate);
    }
  });
}
项目:tools-idea    文件:MavenMergingUpdateQueue.java   
@Override
public void queue(@NotNull Update update) {
  boolean passThrough = false;
  if (ApplicationManager.getApplication().isUnitTestMode()) {
    passThrough = isPassThrough();
  }
  else if (MavenUtil.isNoBackgroundMode()) {
    passThrough = true;
  }

  if (passThrough) {
    update.run();
    return;
  }
  super.queue(update);
}
项目:tools-idea    文件:SelectLocationStep.java   
private void updateTreeFromPath(final String text) {
  if (!myShowPath) return;
  if (myPathTextField.isPathUpdating()) return;
  if (text == null) return;

  myUiUpdater.queue(new Update("treeFromPath.1") {
    public void run() {
      ApplicationManager.getApplication().executeOnPooledThread(new Runnable() {
        public void run() {
          final LocalFsFinder.VfsFile toFind = (LocalFsFinder.VfsFile)myPathTextField.getFile();
          if (toFind == null || !toFind.exists()) return;

          myUiUpdater.queue(new Update("treeFromPath.2") {
            public void run() {
              selectInTree(toFind.getFile(), text);
            }
          });
        }
      });
    }
  });
}
项目:tools-idea    文件:AbstractToolWindowManager.java   
private void bindToDesigner(final DesignerEditorPanel designer) {
  myWindowQueue.cancelAllUpdates();
  myWindowQueue.queue(new Update("update") {
    @Override
    public void run() {
      if (!myToolWindowReady || myToolWindowDisposed) {
        return;
      }
      if (myToolWindow == null) {
        if (designer == null) {
          return;
        }
        initToolWindow();
      }
      updateToolWindow(designer);
    }
  });
}
项目:cordovastudio    文件:AbstractToolWindowManager.java   
private void bindToDesigner(final CordovaDesignerEditorPanel designer) {
  myWindowQueue.cancelAllUpdates();
  myWindowQueue.queue(new Update("update") {
    @Override
    public void run() {
      if (!myToolWindowReady || myToolWindowDisposed) {
        return;
      }
      if (myToolWindow == null) {
        if (designer == null) {
          return;
        }
        initToolWindow();
      }
      updateToolWindow(designer);
    }
  });
}
项目:consulo    文件:AbstractTreeUpdater.java   
public final void queueSelection(final SelectionRequest request) {
  queue(new Update("UserSelection", Update.LOW_PRIORITY) {
    @Override
    public void run() {
      request.execute(myTreeBuilder.getUi());
    }

    @Override
    public boolean isExpired() {
      return myTreeBuilder.isDisposed();
    }

    @Override
    public void setRejected() {
      request.reject();
    }
  });
}
项目:consulo    文件:PresentationModeProgressPanel.java   
public PresentationModeProgressPanel(InlineProgressIndicator progress) {
  myProgress = progress;
  Font font = JBUI.Fonts.label(11);
  myText.setFont(font);
  myText2.setFont(font);
  myText.setIcon(JBUI.scale(EmptyIcon.create(1, 16)));
  myText2.setIcon(JBUI.scale(EmptyIcon.create(1, 16)));
  myUpdateQueue = new MergingUpdateQueue("Presentation Mode Progress", 100, true, null);
  myUpdate = new Update("Update UI") {
    @Override
    public void run() {
      updateImpl();
    }
  };
  myEastButtons = myProgress.createEastButtons();
  myButtonPanel.add(InlineProgressIndicator.createButtonPanel(myEastButtons.map(b -> b.button)));
}
项目:consulo    文件:FileEditorManagerImpl.java   
/**
 * Updates tab title and tab tool tip for the specified {@code file}
 */
void updateFileName(@Nullable final VirtualFile file) {
  // Queue here is to prevent title flickering when tab is being closed and two events arriving: with component==null and component==next focused tab
  // only the last event makes sense to handle
  myQueue.queue(new Update("UpdateFileName " + (file == null ? "" : file.getPath())) {
    @Override
    public boolean isExpired() {
      return myProject.isDisposed() || !myProject.isOpen() || (file == null ? super.isExpired() : !file.isValid());
    }

    @Override
    public void run() {
      Set<EditorSplitters> all = getAllSplitters();
      for (EditorSplitters each : all) {
        each.updateFileName(file);
      }
    }
  });
}
项目:consulo    文件:FileTextFieldImpl.java   
public final void setText(final String text, boolean now, @Nullable final Runnable onDone) {
  final Update update = new Update("pathFromTree") {
    public void run() {
      myPathIsUpdating = true;
      getField().setText(text);
      myPathIsUpdating = false;
      if (onDone != null) {
        onDone.run();
      }
    }
  };
  if (now) {
    update.run();
  }
  else {
    myUiUpdater.queue(update);
  }
}
项目:consulo    文件:LightToolWindowManager.java   
private void bindToDesigner(final DesignerEditorPanelFacade designer) {
  myWindowQueue.cancelAllUpdates();
  myWindowQueue.queue(new Update("update") {
    @Override
    public void run() {
      if (myToolWindowDisposed) {
        return;
      }
      if (myToolWindow == null) {
        if (designer == null) {
          return;
        }
        initToolWindow();
      }
      updateToolWindow(designer);
    }
  });
}
项目:consulo    文件:ScopeTreeViewPanel.java   
private void queueUpdate(final VirtualFile fileToRefresh,
                         final Function<PsiFile, DefaultMutableTreeNode> rootToReloadGetter, final String scopeName) {
  if (myProject.isDisposed()) return;
  AbstractProjectViewPane pane = ProjectView.getInstance(myProject).getCurrentProjectViewPane();
  if (pane == null || !ScopeViewPane.ID.equals(pane.getId()) ||
      !scopeName.equals(pane.getSubId())) {
    return;
  }
  myUpdateQueue.queue(new Update(fileToRefresh) {
    @Override
    public void run() {
      if (myProject.isDisposed() || !fileToRefresh.isValid()) return;
      final PsiFile psiFile = PsiManager.getInstance(myProject).findFile(fileToRefresh);
      if (psiFile != null) {
        reload(rootToReloadGetter.fun(psiFile));
      }
    }

    @Override
    public boolean isExpired() {
      return !isTreeShowing();
    }
  });
}
项目:consulo    文件:FileChooserDialogImpl.java   
private void updateTreeFromPath(final String text) {
  if (!isToShowTextField()) return;
  if (myPathTextField.isPathUpdating()) return;
  if (text == null) return;

  myUiUpdater.queue(new Update("treeFromPath.1") {
    public void run() {
      ApplicationManager.getApplication().executeOnPooledThread(new Runnable() {
        public void run() {
          final LocalFsFinder.VfsFile toFind = (LocalFsFinder.VfsFile)myPathTextField.getFile();
          if (toFind == null || !toFind.exists()) return;

          myUiUpdater.queue(new Update("treeFromPath.2") {
            public void run() {
              selectInTree(toFind.getFile(), text);
            }
          });
        }
      });
    }
  });
}
项目:intellij-ce-playground    文件:HotSwapProgressImpl.java   
public void setText(final String text) {
  myUpdateQueue.queue(new Update("Text") {
    @Override
    public void run() {
      DebuggerInvocationUtil.invokeLater(getProject(), new Runnable() {
        public void run() {
          if (!myProgressWindow.isCanceled() && myProgressWindow.isRunning()) {
            myProgressWindow.setText(text);
          }
        }
      }, myProgressWindow.getModalityState());
    }
  });
}
项目:intellij-ce-playground    文件:ProjectStructureDaemonAnalyzer.java   
public void reset() {
  LOG.debug("analyzer started");
  myAnalyzerQueue.activate();
  myResultsUpdateQueue.activate();
  myAnalyzerQueue.queue(new Update("reset") {
    @Override
    public void run() {
      myStopped.set(false);
    }
  });
}
项目:intellij-ce-playground    文件:ServerConnectionEventDispatcher.java   
public void queueConnectionStatusChanged(final ServerConnectionImpl<?> connection) {
  myEventsQueue.activate();
  myEventsQueue.queue(new Update(connection) {
    @Override
    public void run() {
      myMessageBus.syncPublisher(ServerConnectionListener.TOPIC).onConnectionStatusChanged(connection);
    }
  });
}
项目:intellij-ce-playground    文件:ServerConnectionEventDispatcher.java   
public void queueDeploymentsChanged(final ServerConnectionImpl<?> connection) {
  myEventsQueue.activate();
  myEventsQueue.queue(new Update(connection) {
    @Override
    public void run() {
      myMessageBus.syncPublisher(ServerConnectionListener.TOPIC).onDeploymentsChanged(connection);
    }
  });
}
项目:intellij-ce-playground    文件:FilteringTreeBuilder.java   
public ActionCallback refilter(@Nullable final Object preferredSelection, final boolean adjustSelection, final boolean now) {
  if (myRefilterQueue != null) {
    myRefilterQueue.cancelAllUpdates();
  }
  final ActionCallback callback = new ActionCallback();
  final Runnable afterCancelUpdate = new Runnable() {
    @Override
    public void run() {
      if (myRefilterQueue == null || now) {
        refilterNow(preferredSelection, adjustSelection).doWhenDone(callback.createSetDoneRunnable());
      }
      else {
        myRefilterQueue.queue(new Update(this) {
          @Override
          public void run() {
            refilterNow(preferredSelection, adjustSelection).notifyWhenDone(callback);
          }

          @Override
          public void setRejected() {
            super.setRejected();
            callback.setDone();
          }
        });
      }
    }
  };
  if (!isDisposed()) {
    if (!ApplicationManager.getApplication().isUnitTestMode()) {
      getUi().cancelUpdate().doWhenProcessed(afterCancelUpdate);
    } else {
      afterCancelUpdate.run();
    }
  }

  return callback;
}
项目:intellij-ce-playground    文件:InfoAndProgressPanel.java   
@Override
protected void queueRunningUpdate(final Runnable update) {
  myUpdateQueue.queue(new Update(new Object(), false, 0) {
    @Override
    public void run() {
      ApplicationManager.getApplication().invokeLater(update);
    }
  });
}
项目:intellij-ce-playground    文件:PresentationModeProgressPanel.java   
public PresentationModeProgressPanel(InlineProgressIndicator progress) {
  myProgress = progress;
  Font font = JBUI.Fonts.label(11);
  myText.setFont(font);
  myText2.setFont(font);
  myText.setIcon(EmptyIcon.create(1, 16));
  myText2.setIcon(EmptyIcon.create(1, 16));
  myUpdateQueue = new MergingUpdateQueue("Presentation Mode Progress", 100, true, null);
  myUpdate = new Update("Update UI") {
    @Override
    public void run() {
      updateImpl();
    }
  };
}
项目:intellij-ce-playground    文件:RemoteFilePanel.java   
@Override
public void progressMessageChanged(final boolean indeterminate, @NotNull final String message) {
  myProgressUpdatesQueue.queue(new Update("progress text") {
    @Override
    public void run() {
      myProgressLabel.setText(message);
    }
  });
}
项目:intellij-ce-playground    文件:RemoteFilePanel.java   
@Override
public void progressFractionChanged(final double fraction) {
  myProgressUpdatesQueue.queue(new Update("fraction") {
    @Override
    public void run() {
      myProgressBar.setValue((int)Math.round(100 * fraction));
    }
  });
}
项目:intellij-ce-playground    文件:FileEditorManagerImpl.java   
protected void queueUpdateFile(@NotNull final VirtualFile file) {
  myQueue.queue(new Update(file) {
    @Override
    public void run() {
      if (isFileOpen(file)) {
        updateFileIcon(file);
        updateFileColor(file);
        updateFileBackgroundColor(file);
      }

    }
  });
}
项目:intellij-ce-playground    文件:OptionsEditor.java   
private void queueModificationCheck() {
  final Configurable configurable = getContext().getCurrentConfigurable();
  myModificationChecker.queue(new Update(this) {
    @Override
    public void run() {
      checkModified(configurable);
    }

    @Override
    public boolean isExpired() {
      return getContext().getCurrentConfigurable() != configurable;
    }
  });
}