Java Code Examples for org.eclipse.swt.SWT#MouseEnter

The following examples show how to use org.eclipse.swt.SWT#MouseEnter . 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: SWTSkin.java    From BiglyBT with GNU General Public License v2.0 6 votes vote down vote up
protected static Listener getHandCursorListener(Display display) {
	if (handCursorListener == null) {
		handCursor = new Cursor(display, SWT.CURSOR_HAND);
		handCursorListener = new Listener() {
			@Override
			public void handleEvent(Event event) {
				if (event.type == SWT.MouseEnter) {
					((Control) event.widget).setCursor(handCursor);
				}
				if (event.type == SWT.MouseExit) {
					((Control) event.widget).setCursor(null);
				}
			}
		};
	}

	return handCursorListener;
}
 
Example 2
Source File: CustomChooserComposite.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
void handleEventCanvasPopup( Event event )
{
	switch ( event.type )
	{
		case SWT.MouseDown :
			setChoiceValue( ( (ICustomChoice) event.widget ).getValue( ) );
			this.cmpDropDown.getShell( ).close( );
			fireSelectionEvent( );
			break;

		case SWT.MouseEnter :
			if ( popupSelection != null )
			{
				// Redraw the selection canvas in popup
				popupSelection.notifyListeners( SWT.FocusOut, new Event( ) );
				popupSelection.redraw( );
				// popupSelection = null;
			}
			popupSelection = (ICustomChoice) event.widget;
			popupSelection.notifyListeners( SWT.FocusIn, event );
			popupSelection.redraw( );
			break;

	}
}
 
Example 3
Source File: Bubble.java    From swt-bling with MIT License 6 votes vote down vote up
private void attachListeners() {
  listener = new Listener() {
    public void handleEvent(Event event) {
      switch (event.type) {
        case SWT.Paint:
          onPaint(event);
          break;
        case SWT.MouseDown:
          onMouseDown(event);
          break;
        case SWT.MouseEnter:
          BubbleRegistrant registrant = BubbleRegistry.getInstance().findRegistrant(getPoppedOverItem().getControlOrCustomElement());
          registrant.dismissBubble();
          registrant.bubble.setDisableAutoHide(false);
          break;
        default:
          break;
      }
    }
  };
  popOverShell.addListener(SWT.Paint, listener);
  popOverShell.addListener(SWT.MouseDown, listener);
  popOverShell.addListener(SWT.MouseEnter, listener);

  addAccessibilityHooks(parentControl);
}
 
Example 4
Source File: Java2DDisplaySurface.java    From gama with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void dispatchMouseEvent(final int swtMouseEvent) {
	final int x = mousePosition.x;
	final int y = mousePosition.y;
	for (final IEventLayerListener gl : listeners) {
		switch (swtMouseEvent) {
			case SWT.MouseDown:
				gl.mouseDown(x, y, 1);
				break;
			case SWT.MouseUp:
				gl.mouseUp(x, y, 1);
				break;
			case SWT.MouseMove:
				gl.mouseMove(x, y);
				break;
			case SWT.MouseEnter:
				gl.mouseEnter(x, y);
				break;
			case SWT.MouseExit:
				gl.mouseExit(x, y);
				break;
			case SWT.MenuDetect:
				gl.mouseMenu(x, y);
				break;
		}
	}
}
 
Example 5
Source File: FlatButton.java    From gama with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void handleEvent(final Event e) {
	switch (e.type) {
		case SWT.MouseExit:
			doHover(false);
			break;
		case SWT.MouseMove:
			break;
		case SWT.MouseEnter:
		case SWT.MouseHover:
			doHover(true);
			e.doit = true;
			break;
		case SWT.MouseUp:
			if (e.button == 1 && getClientArea().contains(e.x, e.y)) {
				doButtonUp();
			}
			break;
		case SWT.MouseDown:
			if (e.button == 1 && getClientArea().contains(e.x, e.y)) {
				doButtonDown();
			}
			break;
		default:
			;
	}
}
 
Example 6
Source File: SWTOpenGLDisplaySurface.java    From gama with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void dispatchMouseEvent(final int swtMouseEvent) {
	final GamaPoint p = renderer.getCameraHelper().getMousePosition();
	final int x = (int) p.x;
	final int y = (int) p.y;
	for (final IEventLayerListener gl : listeners) {
		switch (swtMouseEvent) {
			case SWT.MouseDown:
				gl.mouseDown(x, y, 1);
				break;
			case SWT.MouseUp:
				gl.mouseUp(x, y, 1);
				break;
			case SWT.MouseMove:
				gl.mouseMove(x, y);
				break;
			case SWT.MouseEnter:
				gl.mouseEnter(x, y);
				break;
			case SWT.MouseExit:
				gl.mouseExit(x, y);
				break;
			case SWT.MenuDetect:
				gl.mouseMenu(x, y);
				break;
		}
	}
}
 
Example 7
Source File: InformationPresenterControlManager.java    From Pydev with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void handleEvent(Event event) {
    switch (event.type) {
        case SWT.Activate:
        case SWT.MouseVerticalWheel:
        case SWT.MouseUp:
        case SWT.MouseDown:
        case SWT.FocusOut:
            IInformationControl iControl = fInformationControl;
            if (iControl != null && !iControl.isFocusControl()) {
                hideInformationControl();
            }
            break;

        case SWT.MouseMove:
        case SWT.MouseEnter:
        case SWT.MouseExit:
            handleMouseMove(event);
            break;

        case SWT.KeyDown:
            if (event.keyCode == SWT.ESC) {
                hideInformationControl();

            } else if (fActivateEditorBinding != null
                    && KeyBindingHelper.matchesKeybinding(event.keyCode, event.stateMask,
                            fActivateEditorBinding)) {
                hideInformationControl(true, true);
            }
            break;
    }
}
 
Example 8
Source File: LamiChartViewerTest.java    From tracecompass with Eclipse Public License 2.0 4 votes vote down vote up
/**
 * Test a few charts with the multiple similar row dataset.
 *
 * @throws SecurityException
 *             If a security manager is present and any the wrong class is
 *             loaded or the class loader is not the same as its ancestor's
 *             loader.
 *
 * @throws IllegalArgumentException
 *             the object is not the correct class type
 */
@Test
public void testSimilarRows() throws SecurityException, IllegalArgumentException {
    SWTBotView viewBot = executeAnalysis(LamiAnalyses.MULTIPLE_SIMILAR_ROW);

    // Create a new chart
    SWTBotRootMenu viewMenu = viewBot.viewMenu();
    SWTBotMenu menu = viewMenu.menu("New custom chart");
    menu.click();

    // Create a bar chart of Wakee process (name) vs scheduling latency,
    // Priority and Target CPU
    SWTBotCustomChartUtils.selectChartType(fBot, ChartType.BAR_CHART);
    SWTBotCustomChartUtils.addSeries(fBot, "Wakee process (name)", ImmutableSet.of("Scheduling latency (ns)", "Priority", "Target CPU"));
    SWTBotCustomChartUtils.confirmDialog(fBot);

    WaitUtils.waitForJobs();

    // Wait for the viewer and verify its parameters
    @Nullable
    Chart customChart = viewBot.bot().widget(WidgetOfType.widgetOfType(Chart.class), 0);
    assertNotNull(customChart);
    Event mouseMove = new Event();
    mouseMove.type = SWT.MouseEnter;
    customChart.getDisplay().post(mouseMove);

    fBot.waitUntil(ConditionHelpers.numberOfSeries(customChart, 3));
    SWTBotChart chartBot = new SWTBotChart(customChart);
    assertVisible(chartBot);

    // Verify the titles
    SWTBotCustomChartUtils.assertTitles(customChart, "Scheduling log", "Wakee process (name)", "Value");

    // Make sure the axis formatter have the right categories and range
    String[] xValues = new String[6];
    Arrays.fill(xValues, "swapper/5");
    SWTBotCustomChartUtils.assertCategoriesAxis(customChart, AxisType.X, xValues);
    SWTBotCustomChartUtils.assertAxisRange(customChart, AxisType.Y, 0, 2);
    SWTBotCustomChartUtils.assertAxisLogscale(customChart, AxisType.Y, false);

    // Verify the series titles
    SWTBotCustomChartUtils.assertSeriesTitle(customChart, ImmutableList.of("Scheduling latency (ns)", "Priority", "Target CPU"));
    closeCharts();

    // Create a bar chart of Waker process (name) vs scheduling latency,
    // Priority and Target CPU
    menu.click();
    fBot.shell("Custom chart creation").activate();

    SWTBotCustomChartUtils.selectChartType(fBot, ChartType.BAR_CHART);
    SWTBotCustomChartUtils.addSeries(fBot, "Waker process (name)", ImmutableSet.of("Scheduling latency (ns)", "Priority", "Target CPU"));
    SWTBotCustomChartUtils.confirmDialog(fBot);

    WaitUtils.waitForJobs();

    // Wait for the viewer and verify its parameters
    customChart = viewBot.bot().widget(WidgetOfType.widgetOfType(Chart.class), 0);
    assertNotNull(customChart);
    customChart.getDisplay().post(mouseMove);

    fBot.waitUntil(ConditionHelpers.numberOfSeries(customChart, 3));
    chartBot = new SWTBotChart(customChart);
    assertVisible(chartBot);

    // Verify the titles
    SWTBotCustomChartUtils.assertTitles(customChart, "Scheduling log", "Waker process (name)", "Value");

    // Make sure the axis formatter have the right categories and range
    Arrays.fill(xValues, "?");
    SWTBotCustomChartUtils.assertCategoriesAxis(customChart, AxisType.X, xValues);
    SWTBotCustomChartUtils.assertAxisRange(customChart, AxisType.Y, 0, 2);
    SWTBotCustomChartUtils.assertAxisLogscale(customChart, AxisType.Y, false);

    // Verify the series titles
    SWTBotCustomChartUtils.assertSeriesTitle(customChart, ImmutableList.of("Scheduling latency (ns)", "Priority", "Target CPU"));
    closeCharts();
}