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); }
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); }
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); }
public void updateHint(PsiElement element) { if (myHint == null || !myHint.isVisible()) return; final PopupUpdateProcessor updateProcessor = myHint.getUserData(PopupUpdateProcessor.class); if (updateProcessor != null) { updateProcessor.updatePopup(element); } }
public void updateHint(PsiElement element) { if (!isHintBeingShown()) return; final PopupUpdateProcessor updateProcessor = myHint.getUserData(PopupUpdateProcessor.class); if (updateProcessor != null) { updateProcessor.updatePopup(element); } }
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); } }
private void doShowJavaDocInfo(final PsiElement element, boolean requestFocus, PopupUpdateProcessor updateProcessor, final PsiElement originalElement, final boolean autoupdate) { doShowJavaDocInfo(element, requestFocus, updateProcessor, originalElement, autoupdate, null); }
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); } }