Java 类com.intellij.ui.popup.PopupUpdateProcessor 实例源码

项目:intellij-ce-playground    文件:DocumentationManager.java   
public void showJavaDocInfo(@NotNull final PsiElement element,
                            final PsiElement original,
                            @Nullable Runnable closeCallback) {
  if (!element.isValid()) {
    return;
  }

  PopupUpdateProcessor updateProcessor = new PopupUpdateProcessor(element.getProject()) {
    @Override
    public void updatePopup(Object lookupItemObject) {
      if (lookupItemObject instanceof PsiElement) {
        doShowJavaDocInfo((PsiElement)lookupItemObject, false, this, original, null);
      }
    }
  };

  doShowJavaDocInfo(element, false, updateProcessor, original, closeCallback);
}
项目:tools-idea    文件:DocumentationManager.java   
public void showJavaDocInfo(@NotNull final PsiElement element,
                            final PsiElement original,
                            boolean allowReuse,
                            @Nullable Runnable closeCallback)
{
  PopupUpdateProcessor updateProcessor = new PopupUpdateProcessor(element.getProject()) {
    @Override
    public void updatePopup(Object lookupItemObject) {
      if (lookupItemObject instanceof PsiElement) {
        doShowJavaDocInfo((PsiElement)lookupItemObject, false, this, original, false);
      }
    }
  };

  doShowJavaDocInfo(element, false, updateProcessor, original, allowReuse, closeCallback);
}
项目:consulo    文件:DocumentationManager.java   
public void showJavaDocInfo(@Nonnull final PsiElement element,
                            final PsiElement original,
                            final boolean requestFocus,
                            @Nullable Runnable closeCallback) {
  if (!element.isValid()) {
    return;
  }

  PopupUpdateProcessor updateProcessor = new PopupUpdateProcessor(element.getProject()) {
    @Override
    public void updatePopup(Object lookupItemObject) {
      if (lookupItemObject instanceof PsiElement) {
        doShowJavaDocInfo((PsiElement)lookupItemObject, requestFocus, this, original, null);
      }
    }
  };

  doShowJavaDocInfo(element, requestFocus, updateProcessor, original, closeCallback);
}
项目:intellij-ce-playground    文件:ChooseByNameBase.java   
public void updateHint(PsiElement element) {
  if (myHint == null || !myHint.isVisible()) return;
  final PopupUpdateProcessor updateProcessor = myHint.getUserData(PopupUpdateProcessor.class);
  if (updateProcessor != null) {
    updateProcessor.updatePopup(element);
  }
}
项目:tools-idea    文件:JBTreeWithHintProvider.java   
public void updateHint(PsiElement element) {
  if (!isHintBeingShown()) return;

  final PopupUpdateProcessor updateProcessor = myHint.getUserData(PopupUpdateProcessor.class);
  if (updateProcessor != null) {
    updateProcessor.updatePopup(element);
  }
}
项目:tools-idea    文件:JBTableWithHintProvider.java   
public void updateHint(PsiElement element) {
  if (myHint == null || !myHint.isVisible()) return;

  final PopupUpdateProcessor updateProcessor = myHint.getUserData(PopupUpdateProcessor.class);
  if (updateProcessor != null) {
    updateProcessor.updatePopup(element);
  }
}
项目:tools-idea    文件:ChooseByNameBase.java   
public void updateHint(PsiElement element) {
  if (myHint == null || !myHint.isVisible()) return;
  final PopupUpdateProcessor updateProcessor = myHint.getUserData(PopupUpdateProcessor.class);
  if (updateProcessor != null) {
    updateProcessor.updatePopup(element);
  }
}
项目:consulo    文件:ChooseByNameBase.java   
public void updateHint(PsiElement element) {
  if (myHint == null || !myHint.isVisible()) return;
  final PopupUpdateProcessor updateProcessor = myHint.getUserData(PopupUpdateProcessor.class);
  if (updateProcessor != null) {
    updateProcessor.updatePopup(element);
  }
}
项目:intellij-ce-playground    文件:DocumentationManager.java   
private void doShowJavaDocInfo(@NotNull final PsiElement element,
                               boolean requestFocus,
                               PopupUpdateProcessor updateProcessor,
                               final PsiElement originalElement,
                               @Nullable final Runnable closeCallback) {
  Project project = getProject(element);
  if (!project.isOpen()) return;

  storeOriginalElement(project, originalElement, element);

  myPreviouslyFocused = WindowManagerEx.getInstanceEx().getFocusedComponent(project);

  JBPopup _oldHint = getDocInfoHint();
  if (PreviewManager.SERVICE.preview(myProject, DocumentationPreviewPanelProvider.ID, Couple.of(element, originalElement), requestFocus) != null) {
    return;
  }

  if (myToolWindow == null && PropertiesComponent.getInstance().isTrueValue(SHOW_DOCUMENTATION_IN_TOOL_WINDOW)) {
    createToolWindow(element, originalElement);
  }
  else if (myToolWindow != null) {
    Content content = myToolWindow.getContentManager().getSelectedContent();
    if (content != null) {
      DocumentationComponent component = (DocumentationComponent)content.getComponent();
      boolean sameElement = element.getManager().areElementsEquivalent(component.getElement(), element);
      if (sameElement) {
        JComponent preferredFocusableComponent = content.getPreferredFocusableComponent();
        // focus toolwindow on the second actionPerformed
        boolean focus = requestFocus || CommandProcessor.getInstance().getCurrentCommand() != null;
        if (preferredFocusableComponent != null && focus) {
          IdeFocusManager.getInstance(myProject).requestFocus(preferredFocusableComponent, true);
        }
      }
      if (!sameElement || !component.isUpToDate()) {
        content.setDisplayName(getTitle(element, true));
        fetchDocInfo(getDefaultCollector(element, originalElement), component, true);
      }
    }

    if (!myToolWindow.isVisible()) {
      myToolWindow.show(null);
    }
  }
  else if (_oldHint != null && _oldHint.isVisible() && _oldHint instanceof AbstractPopup) {
    DocumentationComponent oldComponent = (DocumentationComponent)((AbstractPopup)_oldHint).getComponent();
    fetchDocInfo(getDefaultCollector(element, originalElement), oldComponent);
  }
  else {
    showInPopup(element, requestFocus, updateProcessor, originalElement, closeCallback);
  }
}
项目:tools-idea    文件:DocumentationManager.java   
private void doShowJavaDocInfo(final PsiElement element, boolean requestFocus, PopupUpdateProcessor updateProcessor,
                               final PsiElement originalElement, final boolean autoupdate)
{
  doShowJavaDocInfo(element, requestFocus, updateProcessor, originalElement, autoupdate, null);
}
项目:consulo    文件:DocumentationManager.java   
private void doShowJavaDocInfo(@Nonnull final PsiElement element,
                               boolean requestFocus,
                               PopupUpdateProcessor updateProcessor,
                               final PsiElement originalElement,
                               @Nullable final Runnable closeCallback) {
  Project project = getProject(element);
  if (!project.isOpen()) return;

  storeOriginalElement(project, originalElement, element);

  myPreviouslyFocused = WindowManagerEx.getInstanceEx().getFocusedComponent(project);

  JBPopup _oldHint = getDocInfoHint();

  if (myToolWindow == null && PropertiesComponent.getInstance().isTrueValue(SHOW_DOCUMENTATION_IN_TOOL_WINDOW)) {
    createToolWindow(element, originalElement);
  }
  else if (myToolWindow != null) {
    Content content = myToolWindow.getContentManager().getSelectedContent();
    if (content != null) {
      DocumentationComponent component = (DocumentationComponent)content.getComponent();
      boolean sameElement = element.getManager().areElementsEquivalent(component.getElement(), element);
      if (sameElement) {
        JComponent preferredFocusableComponent = content.getPreferredFocusableComponent();
        // focus toolwindow on the second actionPerformed
        boolean focus = requestFocus || CommandProcessor.getInstance().getCurrentCommand() != null;
        if (preferredFocusableComponent != null && focus) {
          IdeFocusManager.getInstance(myProject).requestFocus(preferredFocusableComponent, true);
        }
      }
      if (!sameElement || !component.isUpToDate()) {
        content.setDisplayName(getTitle(element, true));
        fetchDocInfo(getDefaultCollector(element, originalElement), component, true);
      }
    }

    if (!myToolWindow.isVisible()) {
      myToolWindow.show(null);
    }
  }
  else if (_oldHint != null && _oldHint.isVisible() && _oldHint instanceof AbstractPopup) {
    DocumentationComponent oldComponent = (DocumentationComponent)((AbstractPopup)_oldHint).getComponent();
    fetchDocInfo(getDefaultCollector(element, originalElement), oldComponent);
  }
  else {
    showInPopup(element, requestFocus, updateProcessor, originalElement, closeCallback);
  }
}