use of com.intellij.codeInsight.hint.EditorHintListener in project intellij-community by JetBrains.
the class SelectUnselectOccurrenceActionsTest method setUp.
@Override
public void setUp() throws Exception {
super.setUp();
EditorHintListener listener = new EditorHintListener() {
@Override
public void hintShown(Project project, LightweightHint hint, int flags) {
hintCount++;
}
};
ApplicationManager.getApplication().getMessageBus().connect(myFixture.getTestRootDisposable()).subscribe(EditorHintListener.TOPIC, listener);
}
use of com.intellij.codeInsight.hint.EditorHintListener in project intellij-community by JetBrains.
the class FindInEditorTest method setUp.
@Override
protected void setUp() throws Exception {
super.setUp();
myFindModel = new FindModel();
myOutputStream = new ByteArrayOutputStream();
LivePreview.ourTestOutput = new PrintStream(myOutputStream);
EditorHintListener listener = (project, hint, flags) -> LivePreview.processNotFound();
ApplicationManager.getApplication().getMessageBus().connect(getTestRootDisposable()).subscribe(EditorHintListener.TOPIC, listener);
}
use of com.intellij.codeInsight.hint.EditorHintListener in project intellij-community by JetBrains.
the class CompletionProgressIndicator method showErrorHint.
private static LightweightHint showErrorHint(Project project, Editor editor, String text) {
final LightweightHint[] result = { null };
final EditorHintListener listener = (project1, hint, flags) -> result[0] = hint;
final MessageBusConnection connection = project.getMessageBus().connect();
connection.subscribe(EditorHintListener.TOPIC, listener);
assert text != null;
HintManager.getInstance().showErrorHint(editor, StringUtil.escapeXml(text), HintManager.UNDER);
connection.disconnect();
return result[0];
}
use of com.intellij.codeInsight.hint.EditorHintListener in project intellij-community by JetBrains.
the class DaemonRespondToChangesTest method testLightBulbIsHiddenWhenFixRangeIsCollapsed.
public void testLightBulbIsHiddenWhenFixRangeIsCollapsed() {
configureByText(StdFileTypes.JAVA, "class S { void foo() { boolean var; if (<selection>va<caret>r</selection>) {}} }");
((EditorImpl) myEditor).getScrollPane().getViewport().setSize(1000, 1000);
final Set<LightweightHint> visibleHints = ContainerUtil.newIdentityTroveSet();
getProject().getMessageBus().connect(getTestRootDisposable()).subscribe(EditorHintListener.TOPIC, new EditorHintListener() {
@Override
public void hintShown(final Project project, final LightweightHint hint, final int flags) {
visibleHints.add(hint);
hint.addHintListener(new HintListener() {
@Override
public void hintHidden(EventObject event) {
visibleHints.remove(hint);
hint.removeHintListener(this);
}
});
}
});
highlightErrors();
IntentionHintComponent lastHintBeforeDeletion = myDaemonCodeAnalyzer.getLastIntentionHint();
assertNotNull(lastHintBeforeDeletion);
delete(myEditor);
highlightErrors();
IntentionHintComponent lastHintAfterDeletion = myDaemonCodeAnalyzer.getLastIntentionHint();
assertSame(lastHintBeforeDeletion, lastHintAfterDeletion);
assertEmpty(visibleHints);
}
Aggregations