mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-217669 Use same delay for popups shown on mouse hover in editor
GitOrigin-RevId: e59e027372d5959f60c82fb3c6d34052a6646137
This commit is contained in:
committed by
intellij-monorepo-bot
parent
d937e74376
commit
71e46b99bc
+26
-26
@@ -2,7 +2,7 @@
|
||||
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.intellij.application.options.editor.EditorOptionsPanel">
|
||||
<tabbedpane id="97a1e">
|
||||
<constraints>
|
||||
<xy x="22" y="49" width="812" height="1491"/>
|
||||
<xy x="22" y="49" width="812" height="1576"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
@@ -347,36 +347,12 @@
|
||||
<children>
|
||||
<component id="ce8e2" class="com.intellij.ui.components.JBCheckBox" binding="myCbShowQuickDocOnMouseMove">
|
||||
<constraints>
|
||||
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
<grid row="2" column="0" row-span="1" col-span="3" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value="Show quick documentation on mouse move"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="ec4ad" class="javax.swing.JTextField" binding="myQuickDocDelayTextField">
|
||||
<constraints>
|
||||
<grid row="2" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value="500"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="8691a" class="com.intellij.ui.components.JBLabel" binding="myQuickDocDelayLabel">
|
||||
<constraints>
|
||||
<grid row="2" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="0" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<horizontalAlignment value="11"/>
|
||||
<text value="Delay (ms):"/>
|
||||
</properties>
|
||||
</component>
|
||||
<vspacer id="612dd">
|
||||
<constraints>
|
||||
<grid row="5" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false">
|
||||
<preferred-size width="188" height="14"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
</vspacer>
|
||||
<component id="95944" class="javax.swing.JCheckBox" binding="myShowLSTInGutterCheckBox">
|
||||
<constraints>
|
||||
<grid row="3" column="0" row-span="1" col-span="3" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
@@ -435,6 +411,30 @@
|
||||
</component>
|
||||
</children>
|
||||
</grid>
|
||||
<component id="8691a" class="com.intellij.ui.components.JBLabel">
|
||||
<constraints>
|
||||
<grid row="5" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value="Tooltips delay:"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="ec4ad" class="javax.swing.JTextField" binding="myTooltipsDelayTextField">
|
||||
<constraints>
|
||||
<grid row="5" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value="500"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="cbf0c" class="com.intellij.ui.components.JBLabel">
|
||||
<constraints>
|
||||
<grid row="5" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value="milliseconds"/>
|
||||
</properties>
|
||||
</component>
|
||||
</children>
|
||||
</grid>
|
||||
<grid id="7bb4" layout-manager="GridLayoutManager" row-count="3" column-count="3" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="0">
|
||||
|
||||
+9
-23
@@ -41,7 +41,6 @@ import com.intellij.profile.codeInspection.ui.ErrorOptionsProvider;
|
||||
import com.intellij.profile.codeInspection.ui.ErrorOptionsProviderEP;
|
||||
import com.intellij.ui.SimpleListCellRenderer;
|
||||
import com.intellij.ui.components.JBCheckBox;
|
||||
import com.intellij.ui.components.JBLabel;
|
||||
import com.intellij.ui.components.JBTextField;
|
||||
import com.intellij.util.ui.JBEmptyBorder;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -93,8 +92,7 @@ public class EditorOptionsPanel extends CompositeConfigurable<ErrorOptionsProvid
|
||||
private JCheckBox myCbShowSoftWrapsOnlyOnCaretLine;
|
||||
private JCheckBox myPreselectCheckBox;
|
||||
private JBCheckBox myCbShowQuickDocOnMouseMove;
|
||||
private JBLabel myQuickDocDelayLabel;
|
||||
private JTextField myQuickDocDelayTextField;
|
||||
private JTextField myTooltipsDelayTextField;
|
||||
private JComboBox<String> myRichCopyColorSchemeComboBox;
|
||||
private JCheckBox myShowInlineDialogForCheckBox;
|
||||
private JCheckBox myCbEnableRichCopyByDefault;
|
||||
@@ -145,7 +143,6 @@ public class EditorOptionsPanel extends CompositeConfigurable<ErrorOptionsProvid
|
||||
initCaretStopComboBox(myWordBoundaryCaretStopComboBox, EditorCaretStopPolicyItem.WordBoundary.values());
|
||||
initCaretStopComboBox(myLineBoundaryCaretStopComboBox, EditorCaretStopPolicyItem.LineBoundary.values());
|
||||
|
||||
initQuickDocProcessing();
|
||||
initSoftWrapsSettingsProcessing();
|
||||
initVcsSettingsProcessing();
|
||||
}
|
||||
@@ -218,9 +215,7 @@ public class EditorOptionsPanel extends CompositeConfigurable<ErrorOptionsProvid
|
||||
|
||||
myCbEnsureBlankLineBeforeCheckBox.setSelected(editorSettings.isEnsureNewLineAtEOF());
|
||||
myCbShowQuickDocOnMouseMove.setSelected(editorSettings.isShowQuickDocOnMouseOverElement());
|
||||
myQuickDocDelayTextField.setText(Long.toString(editorSettings.getQuickDocOnMouseOverElementDelayMillis()));
|
||||
myQuickDocDelayTextField.setEnabled(editorSettings.isShowQuickDocOnMouseOverElement());
|
||||
myQuickDocDelayLabel.setEnabled(editorSettings.isShowQuickDocOnMouseOverElement());
|
||||
myTooltipsDelayTextField.setText(Long.toString(editorSettings.getTooltipsDelay()));
|
||||
|
||||
// Advanced mouse
|
||||
myCbEnableDnD.setSelected(editorSettings.isDndEnabled());
|
||||
@@ -315,9 +310,9 @@ public class EditorOptionsPanel extends CompositeConfigurable<ErrorOptionsProvid
|
||||
ServiceManager.getService(QuickDocOnMouseOverManager.class).setEnabled(enabled);
|
||||
}
|
||||
|
||||
int quickDocDelay = getQuickDocDelayFromGui();
|
||||
if (quickDocDelay != -1) {
|
||||
editorSettings.setQuickDocOnMouseOverElementDelayMillis(quickDocDelay);
|
||||
int tooltipsDelay = getTooltipsDelayFromGui();
|
||||
if (tooltipsDelay != -1) {
|
||||
editorSettings.setTooltipsDelay(tooltipsDelay);
|
||||
}
|
||||
|
||||
editorSettings.setDndEnabled(myCbEnableDnD.isSelected());
|
||||
@@ -402,9 +397,9 @@ public class EditorOptionsPanel extends CompositeConfigurable<ErrorOptionsProvid
|
||||
return false;
|
||||
}
|
||||
|
||||
private int getQuickDocDelayFromGui() {
|
||||
private int getTooltipsDelayFromGui() {
|
||||
try {
|
||||
return EditorSettingsExternalizable.QUICK_DOC_DELAY_RANGE.fit(Integer.parseInt(myQuickDocDelayTextField.getText().trim()));
|
||||
return EditorSettingsExternalizable.TOOLTIPS_DELAY_RANGE.fit(Integer.parseInt(myTooltipsDelayTextField.getText().trim()));
|
||||
}
|
||||
catch (NumberFormatException e) {
|
||||
return -1;
|
||||
@@ -475,7 +470,8 @@ public class EditorOptionsPanel extends CompositeConfigurable<ErrorOptionsProvid
|
||||
isModified |= isModified(myCbEnsureBlankLineBeforeCheckBox, editorSettings.isEnsureNewLineAtEOF());
|
||||
|
||||
isModified |= isModified(myCbShowQuickDocOnMouseMove, editorSettings.isShowQuickDocOnMouseOverElement());
|
||||
isModified |= isModified(myQuickDocDelayTextField, editorSettings.getQuickDocOnMouseOverElementDelayMillis(), EditorSettingsExternalizable.QUICK_DOC_DELAY_RANGE);
|
||||
isModified |= isModified(myTooltipsDelayTextField, editorSettings.getTooltipsDelay(),
|
||||
EditorSettingsExternalizable.TOOLTIPS_DELAY_RANGE);
|
||||
|
||||
// advanced mouse
|
||||
isModified |= isModified(myCbEnableDnD, editorSettings.isDndEnabled());
|
||||
@@ -550,16 +546,6 @@ public class EditorOptionsPanel extends CompositeConfigurable<ErrorOptionsProvid
|
||||
return defaultIndent;
|
||||
}
|
||||
|
||||
private void initQuickDocProcessing() {
|
||||
myCbShowQuickDocOnMouseMove.addItemListener(new ItemListener() {
|
||||
@Override
|
||||
public void itemStateChanged(ItemEvent e) {
|
||||
myQuickDocDelayTextField.setEnabled(myCbShowQuickDocOnMouseMove.isSelected());
|
||||
myQuickDocDelayLabel.setEnabled(myCbShowQuickDocOnMouseMove.isSelected());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void initSoftWrapsSettingsProcessing() {
|
||||
myCbUseCustomSoftWrapIndent.addItemListener(e -> updateSoftWrapSettingsRepresentation());
|
||||
}
|
||||
|
||||
+1
-1
@@ -230,7 +230,7 @@ public class QuickDocOnMouseOverManager {
|
||||
myAlarm.cancelAllRequests();
|
||||
if (myCurrentRequest != null) myCurrentRequest.cancel();
|
||||
myCurrentRequest = new MyShowQuickDocRequest(documentationManager, editor, mouseOffset, elementUnderMouse);
|
||||
myAlarm.addRequest(myCurrentRequest, EditorSettingsExternalizable.getInstance().getQuickDocOnMouseOverElementDelayMillis());
|
||||
myAlarm.addRequest(myCurrentRequest, EditorSettingsExternalizable.getInstance().getTooltipsDelay());
|
||||
}
|
||||
|
||||
private void closeQuickDocIfPossible() {
|
||||
|
||||
+1
-2
@@ -399,8 +399,7 @@ public class EditorMouseHoverPopupManager implements EditorMouseListener, Editor
|
||||
}
|
||||
|
||||
long getShowingDelay() {
|
||||
return getHighlightInfo() == null ? EditorSettingsExternalizable.getInstance().getQuickDocOnMouseOverElementDelayMillis()
|
||||
: Registry.intValue("ide.tooltip.initialDelay.highlighter");
|
||||
return EditorSettingsExternalizable.getInstance().getTooltipsDelay();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package com.intellij.ide;
|
||||
|
||||
import com.intellij.openapi.editor.ex.EditorSettingsExternalizable;
|
||||
import com.intellij.openapi.ui.popup.Balloon;
|
||||
import com.intellij.openapi.util.registry.Registry;
|
||||
import com.intellij.ui.awt.RelativePoint;
|
||||
@@ -131,7 +132,7 @@ public class IdeTooltip extends ComparableObject.Impl {
|
||||
}
|
||||
|
||||
public int getShowDelay() {
|
||||
return myHighlighter ? Registry.intValue("ide.tooltip.initialDelay.highlighter") : Registry.intValue("ide.tooltip.initialDelay");
|
||||
return myHighlighter ? EditorSettingsExternalizable.getInstance().getTooltipsDelay() : Registry.intValue("ide.tooltip.initialDelay");
|
||||
}
|
||||
|
||||
public int getInitialReshowDelay() {
|
||||
|
||||
+13
-5
@@ -26,7 +26,7 @@ public class EditorSettingsExternalizable implements PersistentStateComponent<Ed
|
||||
public static final String PROP_VIRTUAL_SPACE = "VirtualSpace";
|
||||
|
||||
public static final UINumericRange BLINKING_RANGE = new UINumericRange(500, 10, 1500);
|
||||
public static final UINumericRange QUICK_DOC_DELAY_RANGE = new UINumericRange(500, 1, 5000);
|
||||
public static final UINumericRange TOOLTIPS_DELAY_RANGE = new UINumericRange(500, 1, 5000);
|
||||
|
||||
private static final String SOFT_WRAP_FILE_MASKS_ENABLED_DEFAULT = "*";
|
||||
private static final String SOFT_WRAP_FILE_MASKS_DISABLED_DEFAULT = "*.md; *.txt; *.rst; *.adoc";
|
||||
@@ -43,7 +43,7 @@ public class EditorSettingsExternalizable implements PersistentStateComponent<Ed
|
||||
@NonNls public String STRIP_TRAILING_SPACES = STRIP_TRAILING_SPACES_CHANGED;
|
||||
public boolean IS_ENSURE_NEWLINE_AT_EOF = false;
|
||||
public boolean SHOW_QUICK_DOC_ON_MOUSE_OVER_ELEMENT = false;
|
||||
public int QUICK_DOC_ON_MOUSE_OVER_DELAY_MS = QUICK_DOC_DELAY_RANGE.initial;
|
||||
public int TOOLTIPS_DELAY_MS = TOOLTIPS_DELAY_RANGE.initial;
|
||||
public boolean SHOW_INTENTION_BULB = true;
|
||||
public boolean IS_CARET_BLINKING = true;
|
||||
public int CARET_BLINKING_PERIOD = BLINKING_RANGE.initial;
|
||||
@@ -478,12 +478,20 @@ public class EditorSettingsExternalizable implements PersistentStateComponent<Ed
|
||||
myOptions.SHOW_QUICK_DOC_ON_MOUSE_OVER_ELEMENT = show;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #getTooltipsDelay()} instead
|
||||
*/
|
||||
@Deprecated
|
||||
public int getQuickDocOnMouseOverElementDelayMillis() {
|
||||
return QUICK_DOC_DELAY_RANGE.fit(myOptions.QUICK_DOC_ON_MOUSE_OVER_DELAY_MS);
|
||||
return getTooltipsDelay();
|
||||
}
|
||||
|
||||
public void setQuickDocOnMouseOverElementDelayMillis(int delay) {
|
||||
myOptions.QUICK_DOC_ON_MOUSE_OVER_DELAY_MS = QUICK_DOC_DELAY_RANGE.fit(delay);
|
||||
public int getTooltipsDelay() {
|
||||
return TOOLTIPS_DELAY_RANGE.fit(myOptions.TOOLTIPS_DELAY_MS);
|
||||
}
|
||||
|
||||
public void setTooltipsDelay(int delay) {
|
||||
myOptions.TOOLTIPS_DELAY_MS = TOOLTIPS_DELAY_RANGE.fit(delay);
|
||||
}
|
||||
|
||||
public boolean isShowIntentionBulb() {
|
||||
|
||||
Reference in New Issue
Block a user