/** * Check if an event is duplicate, by recording and comparing the time of * the trigger event. Returns true if an event is triggered twice with an * event with the same time */ boolean checkDuplicatedEvent(ExecutionEvent event) { if (event != null && event.getTrigger() != null && event.getTrigger() instanceof Event) { int time = ((Event) event.getTrigger()).time; if (time == timeLastEvent) { return true; } timeLastEvent = time; } return false; }
public Object execute(ExecutionEvent event) throws ExecutionException { Event ev = (Event) event.getTrigger(); run(ev.display.getActiveShell()); return null; }
/** * {@inheritDoc} */ @Override public Object execute(ExecutionEvent event) throws ExecutionException { // Class check. if (!(event.getTrigger() instanceof Event)) { return null; } Event eventWidget = (Event) event.getTrigger(); // Makes sure event came from a ToolItem. if (!(eventWidget.widget instanceof ToolItem)) { return null; } ToolItem toolItem = (ToolItem) eventWidget.widget; // Creates fake selection event. Event newEvent = new Event(); newEvent.button = 1; newEvent.widget = toolItem; newEvent.detail = SWT.ARROW; newEvent.x = toolItem.getBounds().x; newEvent.y = toolItem.getBounds().y + toolItem.getBounds().height; // Dispatches the event. toolItem.notifyListeners(SWT.Selection, newEvent); return null; }
public final Object execute(final ExecutionEvent event) throws ExecutionException { if ((action.getStyle() == IAction.AS_CHECK_BOX) || (action.getStyle() == IAction.AS_RADIO_BUTTON)) { action.setChecked(!action.isChecked()); } final Object trigger = event.getTrigger(); try { if (trigger instanceof Event) { action.runWithEvent((Event) trigger); } else { action.runWithEvent(new Event()); } } catch (Exception e) { throw new ExecutionException( "While executing the action, an exception occurred", e); //$NON-NLS-1$ } return null; }
@Override public final Object execute(final ExecutionEvent event) throws ExecutionException { if ((action.getStyle() == IAction.AS_CHECK_BOX) || (action.getStyle() == IAction.AS_RADIO_BUTTON)) { action.setChecked(!action.isChecked()); } final Object trigger = event.getTrigger(); try { if (trigger instanceof Event) { action.runWithEvent((Event) trigger); } else { action.runWithEvent(new Event()); } } catch (Exception e) { throw new ExecutionException( "While executing the action, an exception occurred", e); //$NON-NLS-1$ } return null; }
@Override public final Object execute(final ExecutionEvent event) throws ExecutionException { if ((action.getStyle() == IAction.AS_CHECK_BOX) || (action.getStyle() == IAction.AS_RADIO_BUTTON)) { action.setChecked(!action.isChecked()); } final Object trigger = event.getTrigger(); try { if (trigger instanceof Event) { action.runWithEvent((Event) trigger); } else { action.runWithEvent(new Event()); } } catch (Exception e) { throw new ExecutionException( "While executing the action, an exception occurred", e); //$NON-NLS-1$ } return null; }
final IAction action = getAction(); if (loadDelegate() && (action != null)) { final Object trigger = event.getTrigger();