boolean rightButton = InputState.isRightButtonDown();
if (rightButton)
{
Figure f = null;
ProcessElementContainer pec = (ProcessElementContainer) FigureUtil.findInnermostFigure(((ProcessDrawing) drawing()), x, y, ProcessElementContainer.class);
if (pec != null && pec != drawing())
{
f = pec;
}
else
{
f = FigureUtil.findInnermostFigure(((ProcessDrawing) drawing()), x, y, VisualElement.class);
}
if (f != null && f != drawing())
{
view.displayPopupMenu(f, e);
lastFigure = (ProcessDrawing) drawing();
}
}
else if (e.getClickCount() == 2)
{
// Double click caught, cancel pending in place editor timer
if (inPlaceEditorDelayTimer != null)
{
inPlaceEditorDelayTimer.cancel();
inPlaceEditorDelayTimer = null;
}
Figure figure = drawing().findFigure(x, y);
if (figure instanceof VisualElement)
{
// Let the figure itself handle the doubleclick
if (((VisualElement) figure).handleEvent(new VisualElementEvent(VisualElementEvent.DOUBLE_CLICK, editor, e, x, y)))
{
// Handled by the element itself
return;
}
}
if (figure instanceof ProcessElementContainer)
{
// Let's see if the process element behind the figure can handle this...
ProcessElementContainer pec = (ProcessElementContainer) FigureUtil.findInnermostFigure(figure, x, y, ProcessElementContainer.class);
// Double click means opening the item, pass to association plugin
JaspiraEventMgr.fireGlobalEvent("plugin.association.open", new BasicTransferable(pec.getReferredProcessElement()));
}
}
// Update input state
InputState.updateStateOnMouseUpEvent(e);