Java 类org.eclipse.draw2d.InputEvent 实例源码

项目:cogtool    文件:SEDemoMouseState.java   
protected int getActionButtonModifier(int mouseEventModifier)
{
    int result = AAction.NONE;

    if ((mouseEventModifier & InputEvent.SHIFT) > 0) {
        result |= AAction.SHIFT;
    }
    if ((mouseEventModifier & InputEvent.ALT) > 0) {
        result |= AAction.ALT;
    }
    if ((mouseEventModifier & InputEvent.CONTROL) > 0) {
        result |= AAction.CTRL;
    }
    // COMMAND only reachable by using contextual menu to select

    return result;
}
项目:scouter    文件:Annotation.java   
@Override
public void mouseDragged(MouseEvent me) {
    //System.out.println("Annotation.Pointer.PointerDragger.mouseDragged()");

    //free
    if(trace == null){
        setCurrentPosition(me.getLocation(), 
                me.getState() == (InputEvent.BUTTON1 | InputEvent.CONTROL));        
    }else{ //snap to trace
        //double tempX = xAxis.getPositionValue(me.getLocation().x, false);
        //double tempY = yAxis.getPositionValue(me.getLocation().y, false);
        ISample tempSample = null;
        double minD = Double.POSITIVE_INFINITY;
        double d;
        for(ISample s : trace.getHotSampleList()){
            d =  Math.sqrt(Math.pow(
                    xAxis.getValuePosition(s.getXValue(), false) - me.getLocation().x, 2) + 
                    Math.pow(yAxis.getValuePosition(s.getYValue(), false) - me.getLocation().y, 2));
            if(minD > d){
                minD = d;
                tempSample = s;
            }                        
        }   
        if(tempSample != null && currentSnappedSample != tempSample)
            setCurrentSnappedSample(tempSample, 
                    me.getState() == (InputEvent.BUTTON1 | InputEvent.CONTROL));
        else if(tempSample == null){
            setCurrentPosition(me.getLocation(), 
                    me.getState() == (InputEvent.BUTTON1 | InputEvent.CONTROL));    
            pointerDragged = true;
        }

    }       
    me.consume();
}
项目:gef-gwt    文件:DomainEventDispatcher.java   
/**
 * @see EventDispatcher#dispatchMouseMoved(org.eclipse.swt.events.MouseEvent)
 */
public void dispatchMouseMoved(org.eclipse.swt.events.MouseEvent me) {
    if (!editorCaptured) {
        super.dispatchMouseMoved(me);
        if (draw2dBusy())
            return;
    }
    if (okToDispatch()) {
        if ((me.stateMask & InputEvent.ANY_BUTTON) != 0)
            domain.mouseDrag(me, viewer);
        else
            domain.mouseMove(me, viewer);
    }
}
项目:cogtool    文件:Draw2DContextMenuUtil.java   
/**
 * Utility to determine which modifier mask to use
 * to open the context menu on a mouse click for Draw2D
 *
 * @return the modifier key mask to determine if a mouse click
 *         indicates the need to pop a context menu in a Draw2D environment
 */
public static int platformContextKey()
{
    if (OSUtils.MACOSX) {
        return InputEvent.CONTROL;
    }

    return SWT.NONE;
}
项目:cogtool    文件:DesignEditorMouseState.java   
protected void handleMousePressed(int filter)
{
    if (filter == StructureViewUIModel.NO_LABEL) {
        ResizeThumb thumb =
            ui.getResizeAtXY(mouseDownX, mouseDownY);

        if (thumb != null) {
            hitTransition =
                (DesignEditorTransition) thumb.getData();

            selection.setSelectedTransition(hitTransition);

            if (thumb.thumbType == DesignEditorUI.SOURCE) {
                setMouseState(PotentialChangeSource);
            }
            else {
                setMouseState(PotentialChangeTarget);
            }

            return;
        }
    }

    IFigure target = ui.structureView.getFigureAtXY(mouseDownX,
                                                         mouseDownY,
                                                         filter);

    if (target instanceof DesignEditorTransition) {
        hitTransition = (DesignEditorTransition) target;

        if ((mouseDownState & InputEvent.SHIFT) != 0) {
            setMouseState(PotentialToggleTransition);
        }
        else {
            setMouseState(PotentialSelectTransition);
        }
    }
    else if (target instanceof GraphicalSource<?>) {
        potentialTransitionSource = (GraphicalSource<?>) target;
        setMouseState(PotentialCreatingTransition);
        // drag creates arrow
    }
    else if (target instanceof DesignEditorFrame) {
        DesignEditorFrame frameFigure = (DesignEditorFrame) target;
        Frame frame = frameFigure.getFrame();

        if ((mouseDownState & InputEvent.SHIFT) != 0) {
            setMouseState(PotentialTogglingSelection);
        }
        else if ((mouseDownState & platformDuplicateModifierKey()) != 0)
        {
            if (! selection.isFrameSelected(frame)) {
                selection.setSelectedFrame(frameFigure);
            }

            setMouseState(PotentialDuplicatingFrame);
        }
        else {
            if (selection.isFrameSelected(frame)) {
                setMouseState(PotentialMovingSelection);
            }
            else {
                selection.setSelectedFrame(frameFigure);

                setMouseState(PotentialMovingFrame);
            }
        }
    }
    else { // out in space
        if ((mouseDownState & InputEvent.SHIFT) != 0) {
            setMouseState(PotentialTogglingSelection);
        }
        else {
            selection.deselectAll();
            setMouseState(PotentialSelectingFrames);
        }
    }
}