use of java.util.EventObject in project robovm by robovm.
the class EventObjectTest method testGetSource.
public void testGetSource() {
Object source = new Object();
assertSame(source, new EventObject(source).getSource());
}
use of java.util.EventObject in project robovm by robovm.
the class EventObjectTest method testSerializationNullsOutSource.
public void testSerializationNullsOutSource() {
String s = "aced0005737200156a6176612e7574696c2e4576656e744f626a6563744" + "c8d094e186d7da80200007870";
Object source = new Object();
EventObject eventObject = new EventObject(source);
new SerializationTester<EventObject>(eventObject, s) {
@Override
protected boolean equals(EventObject a, EventObject b) {
return a.getSource() == null || b.getSource() == null || a.getSource() == b.getSource();
}
}.test();
}
use of java.util.EventObject in project intellij-community by JetBrains.
the class LineStatusMarkerPopup method showHintAt.
public void showHintAt(@Nullable Point mousePosition) {
if (!myTracker.isValid())
return;
final Disposable disposable = Disposer.newDisposable();
FileType fileType = getFileType();
List<DiffFragment> wordDiff = computeWordDiff();
installMasterEditorHighlighters(wordDiff, disposable);
JComponent editorComponent = createEditorComponent(fileType, wordDiff);
ActionToolbar toolbar = buildToolbar(mousePosition, disposable);
// we need valid ActionToolbar.getPreferredSize() to calc size of popup
toolbar.updateActionsImmediately();
toolbar.setReservePlaceAutoPopupIcon(false);
PopupPanel popupPanel = new PopupPanel(myEditor, toolbar, editorComponent);
LightweightHint hint = new LightweightHint(popupPanel);
HintListener closeListener = new HintListener() {
public void hintHidden(final EventObject event) {
Disposer.dispose(disposable);
}
};
hint.addHintListener(closeListener);
int line = myEditor.getCaretModel().getLogicalPosition().line;
Point point = HintManagerImpl.getHintPosition(hint, myEditor, new LogicalPosition(line, 0), HintManager.UNDER);
if (mousePosition != null) {
// show right after the nearest line
int lineHeight = myEditor.getLineHeight();
int delta = (point.y - mousePosition.y) % lineHeight;
if (delta < 0)
delta += lineHeight;
point.y = mousePosition.y + delta;
}
// align main editor with the one in popup
point.x -= popupPanel.getEditorTextOffset();
int flags = HintManager.HIDE_BY_ANY_KEY | HintManager.HIDE_BY_TEXT_CHANGE | HintManager.HIDE_BY_SCROLLING;
HintManagerImpl.getInstanceImpl().showEditorHint(hint, myEditor, point, flags, -1, false, new HintHint(myEditor, point));
if (!hint.isVisible()) {
closeListener.hintHidden(null);
}
}
use of java.util.EventObject in project intellij-community by JetBrains.
the class TrafficTooltipRendererImpl method show.
@Override
public LightweightHint show(@NotNull Editor editor, @NotNull Point p, boolean alignToRight, @NotNull TooltipGroup group, @NotNull HintHint hintHint) {
myTrafficLightRenderer = (TrafficLightRenderer) ((EditorMarkupModelImpl) editor.getMarkupModel()).getErrorStripeRenderer();
myPanel = new TrafficProgressPanel(myTrafficLightRenderer, editor, hintHint);
repaintTooltipWindow();
LineTooltipRenderer.correctLocation(editor, myPanel, p, alignToRight, true, myPanel.getMinWidth());
LightweightHint hint = new LightweightHint(myPanel);
HintManagerImpl hintManager = (HintManagerImpl) HintManager.getInstance();
hintManager.showEditorHint(hint, editor, p, HintManager.HIDE_BY_ANY_KEY | HintManager.HIDE_BY_TEXT_CHANGE | HintManager.HIDE_BY_OTHER_HINT | HintManager.HIDE_BY_SCROLLING, 0, false, hintHint);
hint.addHintListener(new HintListener() {
@Override
public void hintHidden(EventObject event) {
//double hide?
if (myPanel == null)
return;
myPanel = null;
onHide.run();
}
});
return hint;
}
use of java.util.EventObject in project camel by apache.
the class EventNotifierFailureHandledEventsTest method createCamelContext.
@Override
protected CamelContext createCamelContext() throws Exception {
DefaultCamelContext context = new DefaultCamelContext(createRegistry());
context.getManagementStrategy().addEventNotifier(new EventNotifierSupport() {
public void notify(EventObject event) throws Exception {
events.add(event);
}
public boolean isEnabled(EventObject event) {
return true;
}
@Override
protected void doStart() throws Exception {
}
@Override
protected void doStop() throws Exception {
}
});
return context;
}
Aggregations