}
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)))