下面列出了java.awt.event.InputEvent#getWhen() 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
/**
* Should be called in response to Java MOUSE_MOVED events. The update
* will be discarded if the InputEvent is outdated.
*
* @param e the InputEvent which triggered the cursor update.
*/
public void updateCursorImmediately(InputEvent e) {
boolean shouldUpdate;
synchronized (lastUpdateLock) {
shouldUpdate = (e.getWhen() >= lastUpdateMillis);
}
if (shouldUpdate) {
_updateCursor(true);
}
}
/**
* Should be called in response to Java MOUSE_MOVED events. The update
* will be discarded if the InputEvent is outdated.
*
* @param e the InputEvent which triggered the cursor update.
*/
public void updateCursorImmediately(InputEvent e) {
boolean shouldUpdate;
synchronized (lastUpdateLock) {
shouldUpdate = (e.getWhen() >= lastUpdateMillis);
}
if (shouldUpdate) {
_updateCursor(true);
}
}
/**
* Should be called in response to Java MOUSE_MOVED events. The update
* will be discarded if the InputEvent is outdated.
*
* @param e the InputEvent which triggered the cursor update.
*/
public void updateCursorImmediately(InputEvent e) {
boolean shouldUpdate;
synchronized (lastUpdateLock) {
shouldUpdate = (e.getWhen() >= lastUpdateMillis);
}
if (shouldUpdate) {
_updateCursor(true);
}
}
/**
* Should be called in response to Java MOUSE_MOVED events. The update
* will be discarded if the InputEvent is outdated.
*
* @param e the InputEvent which triggered the cursor update.
*/
public void updateCursorImmediately(InputEvent e) {
boolean shouldUpdate;
synchronized (lastUpdateLock) {
shouldUpdate = (e.getWhen() >= lastUpdateMillis);
}
if (shouldUpdate) {
_updateCursor(true);
}
}
/**
* Should be called in response to Java MOUSE_MOVED events. The update
* will be discarded if the InputEvent is outdated.
*
* @param e the InputEvent which triggered the cursor update.
*/
public void updateCursorImmediately(InputEvent e) {
boolean shouldUpdate;
synchronized (lastUpdateLock) {
shouldUpdate = (e.getWhen() >= lastUpdateMillis);
}
if (shouldUpdate) {
_updateCursor(true);
}
}
/**
* Should be called in response to Java MOUSE_MOVED events. The update
* will be discarded if the InputEvent is outdated.
*
* @param e the InputEvent which triggered the cursor update.
*/
public void updateCursorImmediately(InputEvent e) {
boolean shouldUpdate;
synchronized (lastUpdateLock) {
shouldUpdate = (e.getWhen() >= lastUpdateMillis);
}
if (shouldUpdate) {
_updateCursor(true);
}
}
/**
* Should be called in response to Java MOUSE_MOVED events. The update
* will be discarded if the InputEvent is outdated.
*
* @param e the InputEvent which triggered the cursor update.
*/
public void updateCursorImmediately(InputEvent e) {
boolean shouldUpdate;
synchronized (lastUpdateLock) {
shouldUpdate = (e.getWhen() >= lastUpdateMillis);
}
if (shouldUpdate) {
_updateCursor(true);
}
}
@Override
public void beforeActionPerformed(@NotNull AnAction action, @NotNull DataContext dataContext, AnActionEvent event) {
final InputEvent input = event.getInputEvent();
if (input instanceof MouseEvent) {
// The following is a hack to work around an issue with IDEA, where certain events arrive
// twice. See https://youtrack.jetbrains.com/issue/IDEA-219133
if (input.getWhen() != 0 && lastEventTime == input.getWhen()) {
return;
}
lastEventTime = input.getWhen();
final String place = event.getPlace();
KeyPromoterAction kpAction;
if ("MainMenu".equals(place)) {
if (keyPromoterSettings.isMenusEnabled()) {
kpAction = new KeyPromoterAction(action, event, KeyPromoterAction.ActionSource.MENU_ENTRY);
showTip(kpAction);
}
} else if ("MainToolbar".equals(place)) {
if (keyPromoterSettings.isToolbarButtonsEnabled()) {
kpAction = new KeyPromoterAction(action, event, KeyPromoterAction.ActionSource.MAIN_TOOLBAR);
showTip(kpAction);
}
} else if (place.matches(".*Popup")) {
if (keyPromoterSettings.isEditorPopupEnabled()) {
kpAction = new KeyPromoterAction(action, event, KeyPromoterAction.ActionSource.POPUP);
showTip(kpAction);
}
} else if (keyPromoterSettings.isAllButtonsEnabled()) {
kpAction = new KeyPromoterAction(action, event, KeyPromoterAction.ActionSource.OTHER);
showTip(kpAction);
}
}
}
/**
* Should be called in response to Java MOUSE_MOVED events. The update
* will be discarded if the InputEvent is outdated.
*
* @param e the InputEvent which triggered the cursor update.
*/
public void updateCursorImmediately(InputEvent e) {
boolean shouldUpdate;
synchronized (lastUpdateLock) {
shouldUpdate = (e.getWhen() >= lastUpdateMillis);
}
if (shouldUpdate) {
_updateCursor(true);
}
}
/**
* Should be called in response to Java MOUSE_MOVED events. The update
* will be discarded if the InputEvent is outdated.
*
* @param e the InputEvent which triggered the cursor update.
*/
public void updateCursorImmediately(InputEvent e) {
boolean shouldUpdate;
synchronized (lastUpdateLock) {
shouldUpdate = (e.getWhen() >= lastUpdateMillis);
}
if (shouldUpdate) {
_updateCursor(true);
}
}
/**
* Should be called in response to Java MOUSE_MOVED events. The update
* will be discarded if the InputEvent is outdated.
*
* @param e the InputEvent which triggered the cursor update.
*/
public void updateCursorImmediately(InputEvent e) {
boolean shouldUpdate;
synchronized (lastUpdateLock) {
shouldUpdate = (e.getWhen() >= lastUpdateMillis);
}
if (shouldUpdate) {
_updateCursor(true);
}
}
private void invokeDefaultAction(URL url, InputEvent e) {
HeapViewerNode node = nodeForURL(url, context);
if (node == null) return;
HeapViewerNodeAction.Actions nodeActions = HeapViewerNodeAction.Actions.forNode(node, actionProviders, context, actions);
ActionEvent ae = e == null ? new ActionEvent(htmlComponent, ActionEvent.ACTION_PERFORMED, "link"): // NO18N
new ActionEvent(e.getSource(), e.getID(), "link", e.getWhen(), e.getModifiers()); // NO18N
nodeActions.performDefaultAction(ae);
}
private void invokeMiddleButtonAction(URL url, InputEvent e) {
HeapViewerNode node = nodeForURL(url, context);
if (node == null) return;
HeapViewerNodeAction.Actions nodeActions = HeapViewerNodeAction.Actions.forNode(node, actionProviders, context, actions);
ActionEvent ae = new ActionEvent(e.getSource(), e.getID(), "middle button", e.getWhen(), e.getModifiers()); // NO18N
nodeActions.performMiddleButtonAction(ae);
}
/**
* Should be called in response to Java MOUSE_MOVED events. The update
* will be discarded if the InputEvent is outdated.
*
* @param e the InputEvent which triggered the cursor update.
*/
public void updateCursorImmediately(InputEvent e) {
boolean shouldUpdate;
synchronized (lastUpdateLock) {
shouldUpdate = (e.getWhen() >= lastUpdateMillis);
}
if (shouldUpdate) {
_updateCursor(true);
}
}
/**
* Should be called in response to Java MOUSE_MOVED events. The update
* will be discarded if the InputEvent is outdated.
*
* @param e the InputEvent which triggered the cursor update.
*/
public void updateCursorImmediately(InputEvent e) {
boolean shouldUpdate;
synchronized (lastUpdateLock) {
shouldUpdate = (e.getWhen() >= lastUpdateMillis);
}
if (shouldUpdate) {
_updateCursor(true);
}
}
/**
* Should be called in response to Java MOUSE_MOVED events. The update
* will be discarded if the InputEvent is outdated.
*
* @param e the InputEvent which triggered the cursor update.
*/
public void updateCursorImmediately(InputEvent e) {
boolean shouldUpdate;
synchronized (lastUpdateLock) {
shouldUpdate = (e.getWhen() >= lastUpdateMillis);
}
if (shouldUpdate) {
_updateCursor(true);
}
}
/**
* Should be called in response to Java MOUSE_MOVED events. The update
* will be discarded if the InputEvent is outdated.
*
* @param e the InputEvent which triggered the cursor update.
*/
public void updateCursorImmediately(InputEvent e) {
boolean shouldUpdate;
synchronized (lastUpdateLock) {
shouldUpdate = (e.getWhen() >= lastUpdateMillis);
}
if (shouldUpdate) {
_updateCursor(true);
}
}