Java Code Examples for org.eclipse.draw2d.MouseEvent#consume()
The following examples show how to use
org.eclipse.draw2d.MouseEvent#consume() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ScaledSliderFigure.java From nebula with Eclipse Public License 2.0 | 6 votes |
public void mousePressed(MouseEvent me) { if(me.button != 1) return; armed = true; double valuePosition = ((LinearScale)scale).getValuePosition(getCoercedValue(), false); start = new Point( horizontal? valuePosition: 0, horizontal ? 0 : valuePosition); label.setVisible(true); if(!ScaledSliderFigure.this.hasFocus()){ ScaledSliderFigure.this.requestFocus(); } me.consume(); }
Example 2
Source File: Annotation.java From nebula with Eclipse Public License 2.0 | 5 votes |
public void mousePressed(MouseEvent me) { command = new MovingAnnotationLabelCommand(Annotation.this); command.setBeforeMovingDxDy(dx, dy); infoLabelArmed = true; Annotation.this.revalidate(); Annotation.this.repaint(); me.consume(); // it must be consumed to make dragging smoothly. }
Example 3
Source File: OverviewSelectionMover.java From nebula with Eclipse Public License 2.0 | 5 votes |
@Override public void mouseDragged(MouseEvent me) { if (fLocation != null) { final Point targetLocation = me.getLocation(); final Dimension offset = targetLocation.getDifference(fLocation); if (offset.width() != 0) { final TimeBaseConverter timeDetails = RootFigure.getRootFigure(fFigure).getTimeViewDetails(); if (timeDetails.translateOverviewAreaOffset(offset.width())) fLocation = targetLocation; me.consume(); } } }
Example 4
Source File: OverviewSelectionMover.java From nebula with Eclipse Public License 2.0 | 5 votes |
@Override public void mouseReleased(MouseEvent me) { if (fLocation != null) { fLocation = null; me.consume(); } fFigure.removeMouseMotionListener(this); }
Example 5
Source File: OverviewSelectionMover.java From nebula with Eclipse Public License 2.0 | 5 votes |
@Override public void mousePressed(MouseEvent me) { fLocation = me.getLocation(); me.consume(); fFigure.addMouseMotionListener(this); }
Example 6
Source File: CursorMover.java From nebula with Eclipse Public License 2.0 | 5 votes |
@Override public void mouseReleased(MouseEvent me) { if (me.button == 3) { hideCursorTimings(); final ICursor cursor = (ICursor) fFigure.getParent().getLayoutManager().getConstraint(fFigure); RootFigure.getRootFigure(fFigure).deleteCursor(cursor); } if (fLocation != null) { fLocation = null; me.consume(); } }
Example 7
Source File: CursorMover.java From nebula with Eclipse Public License 2.0 | 5 votes |
@Override public void mouseDragged(MouseEvent me) { if (fLocation != null) { final Point targetLocation = me.getLocation(); Long targetEventTime = snapToEvent(targetLocation); if (targetEventTime == null) { final Dimension offset = targetLocation.getDifference(fLocation); if (offset.width() != 0) { final TimeBaseConverter timeDetails = RootFigure.getRootFigure(fFigure).getTimeViewDetails(); targetEventTime = timeDetails.screenOffsetToEventTime(targetLocation.x()); } fLocation = targetLocation; } if (targetEventTime != null) { final ICursor cursor = (ICursor) fFigure.getParent().getLayoutManager().getConstraint(fFigure); cursor.setTimestamp(targetEventTime); fFigure.getParent().revalidate(); RootFigure.getFigure(fFigure, CursorTimingsLayer.class).revalidate(); RootFigure.getFigure(fFigure, OverviewCursorLayer.class).revalidate(); } } me.consume(); }
Example 8
Source File: DetailAreaListener.java From nebula with Eclipse Public License 2.0 | 5 votes |
@Override public void mousePressed(MouseEvent me) { fDragged = false; fLocation = me.getLocation(); me.consume(); }
Example 9
Source File: Annotation.java From nebula with Eclipse Public License 2.0 | 5 votes |
public void mousePressed(MouseEvent me) { command = new MovingAnnotationCommand(Annotation.this); if (isFree()) command.setBeforeMovePosition(currentPosition); else command.setBeforeMoveSnappedSample(currentSnappedSample); command.setBeforeDxDy(dx, dy); me.consume(); // it must be consumed to make dragging smoothly. }
Example 10
Source File: SwitchPoolSelectionEditPolicy.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
public void mousePressed(MouseEvent me) { try { IUndoableOperation c = new SwitchPoolOrderCommand((IGraphicalEditPart) getHost(), type); OperationHistoryFactory.getOperationHistory().execute(c,null,null); me.consume(); refresh(); } catch (ExecutionException e) { e.printStackTrace(); } }
Example 11
Source File: Annotation.java From nebula with Eclipse Public License 2.0 | 5 votes |
public void mouseReleased(MouseEvent me) { command.setAfterMovingDxDy(dx, dy); xyGraph.getOperationsManager().addCommand(command); infoLabelArmed = false; Annotation.this.revalidate(); Annotation.this.repaint(); me.consume(); }
Example 12
Source File: Annotation.java From nebula with Eclipse Public License 2.0 | 5 votes |
@Override public void mouseDragged(MouseEvent me) { x0 = me.getLocation().x - currentPosition.x; y0 = me.getLocation().y - currentPosition.y; knowX0Y0 = true; updatedxdyFromX0Y0(); Annotation.this.revalidate(); Annotation.this.repaint(); me.consume(); }
Example 13
Source File: KnobFigure.java From nebula with Eclipse Public License 2.0 | 5 votes |
public void mouseReleased(MouseEvent me) { if(me.button != 1) return; if (!armed) return; armed = false; me.consume(); }
Example 14
Source File: KnobFigure.java From nebula with Eclipse Public License 2.0 | 5 votes |
public void mousePressed(MouseEvent me) { if(me.button != 1) return; armed = true; pole = scale.getBounds().getCenter(); startPP = PolarPoint.point2PolarPoint(pole, bounds.getCenter()); //rotate axis to endAngle startPP.rotateAxis(((RoundScale)scale).getEndAngle(), false); oldValuePosition = ((RoundScale)scale).getValuePosition( getCoercedValue(), true); me.consume(); }
Example 15
Source File: KnobFigure.java From nebula with Eclipse Public License 2.0 | 5 votes |
public void mouseDragged(MouseEvent me) { if (!armed) return; PolarPoint currentPP = PolarPoint.point2PolarPoint(pole, me.getLocation()); //rotate axis to endAngle currentPP.rotateAxis(((RoundScale)scale).getEndAngle(), false); //coerce currentPP to min or max if(currentPP.theta * 180.0/Math.PI > (((RoundScale)scale).getLengthInDegrees())) { if(Math.abs(((RoundScale)scale).getValuePosition(getCoercedValue(), true)- (((RoundScale)scale).getLengthInDegrees())) < ((RoundScale)scale).getLengthInDegrees()/2.0) currentPP.theta = ((RoundScale)scale).getLengthInDegrees() * Math.PI/180.0; else currentPP.theta = 0; } double difference = currentPP.theta * 180.0/Math.PI - oldValuePosition; double valueChange = calcValueChange(difference, value); if(increment <= 0 || Math.abs(valueChange) > increment/2.0) { // manualSetValue = true; if(increment > 0) manualSetValue(value + increment * Math.round(valueChange/increment)); else manualSetValue(value + valueChange); oldValuePosition = ((RoundScale)scale).getValuePosition( value, true); fireManualValueChange(value); KnobFigure.this.revalidate(); KnobFigure.this.repaint(); } me.consume(); }
Example 16
Source File: IntensityGraphFigure.java From nebula with Eclipse Public License 2.0 | 5 votes |
public void mousePressed(MouseEvent me) { requestFocus(); // Only react to 'main' mouse button if (me.button != 1) return; armed = true; //get start position start = me.getLocation(); end = null; me.consume(); }
Example 17
Source File: UpdateSizePoolSelectionEditPolicy.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
@Override public void mousePressed(MouseEvent me) { try { IFigure f = ((CustomMainProcessEditPart) poolEditPart.getParent()).getFigure() ; IFigure p = f ; while(!(p instanceof Viewport)){ p = p.getParent(); } int y = ((Viewport)p).getVerticalRangeModel().getValue() ; int x = ((Viewport)p).getHorizontalRangeModel().getValue() ; IUndoableOperation c = new UpdatePoolSizeCommand(poolEditPart, type); OperationHistoryFactory.getOperationHistory().execute(c,null,null); me.consume(); poolEditPart.getViewer().setSelection(new StructuredSelection(poolEditPart)); refresh(); poolEditPart.getViewer().setSelection(new StructuredSelection(getHost())); if(type.equals(ADD_RIGHT)){ ((Viewport)p).setHorizontalLocation(x+150); } ((Viewport)p).setVerticalLocation(y); } catch (ExecutionException e) { e.printStackTrace(); } }
Example 18
Source File: ROIFigure.java From nebula with Eclipse Public License 2.0 | 5 votes |
public void mouseReleased(MouseEvent me) { if(armed){ armed = false; updateROIBounds(me); fireROIUpdated(); me.consume(); } }
Example 19
Source File: ROIFigure.java From nebula with Eclipse Public License 2.0 | 4 votes |
public void mousePressed(MouseEvent me) { start = me.getLocation(); startROIBounds = roiGeoBounds.getCopy(); me.consume(); }
Example 20
Source File: ROIFigure.java From nebula with Eclipse Public License 2.0 | 4 votes |
@Override public void mouseDragged(MouseEvent me) { armed = true; updateROIBounds(me); me.consume(); }