mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-66333 Quick documentation lookup on mouse hover
Don't overwrite documentation for the element under cursor by documentation for the element under caret
This commit is contained in:
+1
-1
@@ -150,7 +150,7 @@ public abstract class DockablePopupManager<T extends JComponent & Disposable> {
|
||||
if (myAutoUpdateRequest == null) {
|
||||
myAutoUpdateRequest = new Runnable() {
|
||||
public void run() {
|
||||
if (myProject.isDisposed()) return;
|
||||
if (!myAutoUpdateDocumentation || myProject.isDisposed()) return;
|
||||
|
||||
AsyncResult<DataContext> asyncResult = DataManager.getInstance().getDataContextFromFocus();
|
||||
DataContext dataContext = asyncResult.getResult();
|
||||
|
||||
+4
@@ -175,6 +175,10 @@ public class DocumentationManager extends DockablePopupManager<DocumentationComp
|
||||
return myToolWindow != null;
|
||||
}
|
||||
|
||||
public void setAllowContentUpdateFromContext(boolean allow) {
|
||||
myAutoUpdateDocumentation = allow;
|
||||
}
|
||||
|
||||
/**
|
||||
* Asks to show quick doc for the target element.
|
||||
*
|
||||
|
||||
+24
-6
@@ -211,6 +211,7 @@ public class QuickDocOnMouseOverManager {
|
||||
{
|
||||
return;
|
||||
}
|
||||
allowUpdateFromContext(false);
|
||||
closeQuickDocIfPossible();
|
||||
myActiveElements.put(editor, targetElementUnderMouse);
|
||||
myDelayedQuickDocInfo = new DelayedQuickDocInfo(documentationManager, editor, targetElementUnderMouse, elementUnderMouse);
|
||||
@@ -221,12 +222,7 @@ public class QuickDocOnMouseOverManager {
|
||||
|
||||
private void closeQuickDocIfPossible() {
|
||||
myAlarm.cancelAllRequests();
|
||||
WeakReference<DocumentationManager> ref = myDocumentationManager;
|
||||
if (ref == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
DocumentationManager docManager = ref.get();
|
||||
DocumentationManager docManager = getDocManager();
|
||||
if (docManager == null) {
|
||||
return;
|
||||
}
|
||||
@@ -240,6 +236,27 @@ public class QuickDocOnMouseOverManager {
|
||||
myDocumentationManager = null;
|
||||
}
|
||||
|
||||
private void allowUpdateFromContext(boolean allow) {
|
||||
DocumentationManager documentationManager = getDocManager();
|
||||
if (documentationManager != null) {
|
||||
documentationManager.setAllowContentUpdateFromContext(allow);
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private DocumentationManager getDocManager() {
|
||||
WeakReference<DocumentationManager> ref = myDocumentationManager;
|
||||
if (ref == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
DocumentationManager docManager = ref.get();
|
||||
if (docManager == null) {
|
||||
return null;
|
||||
}
|
||||
return docManager;
|
||||
}
|
||||
|
||||
private static class DelayedQuickDocInfo {
|
||||
|
||||
@NotNull public final DocumentationManager docManager;
|
||||
@@ -333,6 +350,7 @@ public class QuickDocOnMouseOverManager {
|
||||
private class MyCaretListener implements CaretListener {
|
||||
@Override
|
||||
public void caretPositionChanged(CaretEvent e) {
|
||||
allowUpdateFromContext(true);
|
||||
closeQuickDocIfPossible();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user