Java Code Examples for org.eclipse.draw2d.MouseEvent#getLocation()
The following examples show how to use
org.eclipse.draw2d.MouseEvent#getLocation() .
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: CursorTimingsLayer.java From nebula with Eclipse Public License 2.0 | 6 votes |
public void showTimingsFor(CursorFigure cursorFigure, MouseEvent me) { removeAll(); // get all cursors except the highlighted one final List<CursorFigure> cursors = getAllCursors(); cursors.remove(cursorFigure); // sort cursors by distance to highlighted one Collections.sort(cursors, (o1, o2) -> (int) (Math.abs(cursorFigure.getEventTime() - o1.getEventTime()) - Math.abs(cursorFigure.getEventTime() - o2.getEventTime()))); final Dimension distance = new Dimension(20, me.y); for (final CursorFigure cursor : cursors) { add(new CursorConnection(cursorFigure, cursor, distance)); distance.expand(20, 30); } fConnectionsLocation = me.getLocation(); setVisible(true); }
Example 2
Source File: DetailAreaListener.java From nebula with Eclipse Public License 2.0 | 6 votes |
@Override public void mouseDragged(MouseEvent me) { if (fLocation != null) { fDragged = true; final Point targetLocation = me.getLocation(); final Dimension offset = fLocation.getDifference(targetLocation); if (offset.width() != 0) { final TimeBaseConverter timeDetails = RootFigure.getRootFigure(fFigure).getTimeViewDetails(); if (timeDetails.translateDetailAreaOffset(offset.width())) fLocation = targetLocation; me.consume(); } } }
Example 3
Source File: IntensityGraphFigure.java From nebula with Eclipse Public License 2.0 | 5 votes |
@Override public void mouseDragged(MouseEvent me) { if(!armed) return; if(graphArea.getClientArea().contains(me.getLocation())){ graphArea.updateTextCursor(me); end = me.getLocation(); graphArea.repaint(); } }
Example 4
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 5
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 6
Source File: Annotation.java From nebula with Eclipse Public License 2.0 | 5 votes |
@Override public void mouseDragged(MouseEvent me) { Point mouseLocation = new Point(horizontalMoveable ? me.getLocation().x : currentPosition.x, verticalMoveable ? me.getLocation().y : currentPosition.y); // free if (trace == null) { setCurrentPosition(mouseLocation, me.getState() == (SWT.BUTTON1 | SWT.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) - mouseLocation.x, 2) + Math.pow(yAxis.getValuePosition(s.getYValue(), false) - mouseLocation.y, 2)); if (minD > d) { minD = d; tempSample = s; } } if (tempSample != null && currentSnappedSample != tempSample) setCurrentSnappedSample(tempSample, me.getState() == (SWT.BUTTON1 | SWT.CONTROL)); else if (tempSample == null) { setCurrentPosition(mouseLocation, me.getState() == (SWT.BUTTON1 | SWT.CONTROL)); pointerDragged = true; } } me.consume(); }
Example 7
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 8
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 9
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 10
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 11
Source File: ProductSystemFigure.java From olca-app with Mozilla Public License 2.0 | 5 votes |
@Override public void mousePressed(MouseEvent arg0) { int x = arg0.getLocation().x; int y = arg0.getLocation().y; if (in(x, 350) && in(y, 120)) { SankeySelectionAction psa = new SankeySelectionAction(); psa.setSankeyDiagram(node.editor); psa.run(); } }
Example 12
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 13
Source File: CursorMover.java From nebula with Eclipse Public License 2.0 | 4 votes |
@Override public void mousePressed(MouseEvent me) { fLocation = me.getLocation(); me.consume(); }