当前位置: 首页>>代码示例>>Java>>正文


Java MouseTrackAdapter类代码示例

本文整理汇总了Java中org.eclipse.swt.events.MouseTrackAdapter的典型用法代码示例。如果您正苦于以下问题:Java MouseTrackAdapter类的具体用法?Java MouseTrackAdapter怎么用?Java MouseTrackAdapter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


MouseTrackAdapter类属于org.eclipse.swt.events包,在下文中一共展示了MouseTrackAdapter类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addListener

import org.eclipse.swt.events.MouseTrackAdapter; //导入依赖的package包/类
private void addListener(final Control ownerControl, final ToolBar toolBar) {

		toolBar.addMouseTrackListener(new MouseTrackAdapter() {
			@Override
			public void mouseExit(final MouseEvent e) {

				// prevent to open the tooltip
				_canOpenToolTip = false;
			}
		});

//		ownerControl.addDisposeListener(new DisposeListener() {
//			@Override
//			public void widgetDisposed(final DisposeEvent e) {
//				onDispose();
//			}
//		});
	}
 
开发者ID:wolfgang-ch,项目名称:mytourbook,代码行数:19,代码来源:DialogSelectMap3Color.java

示例2: DialogPhotoProperties

import org.eclipse.swt.events.MouseTrackAdapter; //导入依赖的package包/类
public DialogPhotoProperties(final Control ownerControl, final ToolBar toolBar, final IDialogSettings state) {

		super(ownerControl);

		_state = state;

		toolBar.addMouseTrackListener(new MouseTrackAdapter() {
			@Override
			public void mouseExit(final MouseEvent e) {

				// prevent to open the tooltip
				_canOpenToolTip = false;
			}
		});

		PhotoManager.addPhotoEventListener(this);

		setToolTipCreateStyle(AnimatedToolTipShell.TOOLTIP_STYLE_KEEP_CONTENT);
		setBehaviourOnMouseOver(AnimatedToolTipShell.MOUSE_OVER_BEHAVIOUR_IGNORE_OWNER);
		setIsKeepShellOpenWhenMoved(false);
		setFadeInSteps(1);
	}
 
开发者ID:wolfgang-ch,项目名称:mytourbook,代码行数:23,代码来源:DialogPhotoProperties.java

示例3: createCellEditorOn

import org.eclipse.swt.events.MouseTrackAdapter; //导入依赖的package包/类
/**
 * Creates the cell editor on the given composite. The cell editor is
 * created by instantiating the cell editor type passed into this
 * DirectEditManager's constuctor.
 * 
 * @param composite
 *            the composite to create the cell editor on
 * @return the newly created cell editor
 */
protected CellEditor createCellEditorOn( Composite composite )
{
	int style = this.applyBidiStyle( SWT.MULTI | SWT.WRAP ); // bidi_hcg

	LabelCellEditor editor = new LabelCellEditor( composite, style );
		//new LabelCellEditor( composite, SWT.MULTI | SWT.WRAP );
	final Control c = editor.getControl( );
	c.addMouseTrackListener( new MouseTrackAdapter( )
	{

		public void mouseEnter( MouseEvent e )
		{
			c.setCursor( SharedCursors.IBEAM );
		}

	} );
	return editor;
}
 
开发者ID:eclipse,项目名称:birt,代码行数:28,代码来源:LabelEditManager.java

示例4: addMouseHoverListenerToLink

import org.eclipse.swt.events.MouseTrackAdapter; //导入依赖的package包/类
private void addMouseHoverListenerToLink(Link link,final Composite container) {
	link.addMouseTrackListener(new MouseTrackAdapter() {
		@Override
		public void mouseHover(MouseEvent e) {
			container.setFocus();
 		}
	});
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:9,代码来源:ComponentTooltip.java

示例5: addToolTipContainerFocusListener

import org.eclipse.swt.events.MouseTrackAdapter; //导入依赖的package包/类
/**
 * adds listener to focus container when mouse hover on container 
 * @param container
 */
private void addToolTipContainerFocusListener(final Composite container) {
	container.addMouseTrackListener(new MouseTrackAdapter() {
		@Override
		public void mouseHover(MouseEvent e) {
			container.setFocus();
			logger.debug("ComponentTooltip.addToolTipContainerFocusListener() - mouseHover - container focused");
		}
	});
	logger.debug("ComponentTooltip.addToolTipContainerFocusListener() - added container focus listener");
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:15,代码来源:ComponentTooltip.java

示例6: addListener

import org.eclipse.swt.events.MouseTrackAdapter; //导入依赖的package包/类
private void addListener(final Control ownerControl, final ToolBar toolBar) {

		toolBar.addMouseTrackListener(new MouseTrackAdapter() {
			@Override
			public void mouseExit(final MouseEvent e) {

				// prevent to open the tooltip
				_canOpenToolTip = false;
			}
		});
	}
 
开发者ID:wolfgang-ch,项目名称:mytourbook,代码行数:12,代码来源:DialogTourTrackConfig.java

示例7: addListener

import org.eclipse.swt.events.MouseTrackAdapter; //导入依赖的package包/类
private void addListener(final Control ownerControl) {

		ownerControl.addMouseTrackListener(new MouseTrackAdapter() {
			@Override
			public void mouseExit(final MouseEvent e) {

				// prevent to open the tooltip
				_canOpenToolTip = false;
			}
		});
	}
 
开发者ID:wolfgang-ch,项目名称:mytourbook,代码行数:12,代码来源:AdvancedSlideout.java

示例8: getMainComposite

import org.eclipse.swt.events.MouseTrackAdapter; //导入依赖的package包/类
protected Composite getMainComposite() {
	if(this.mainComposite != null)
		return this.mainComposite;

	mainComposite = new Composite(shell, SWT.NONE);

	mainComposite.addMouseTrackListener(new MouseTrackAdapter() {
		@Override
		public void mouseExit(MouseEvent e) {
			// mouse leaves the tooltip, dispose the tooltip
			if (!mainComposite.getBounds().intersects(e.x, e.y, 1, 1)) {
				shell.setVisible(false);
			}

			// check if parent should be disposed
			if (groupScaleTimelineMarkerTooltip != null
					&& !groupScaleTimelineMarkerTooltip.shell.isDisposed()
					&& !shell.isVisible()) {

				Point point = new Point(e.x, e.y);
				point = shell.toDisplay(point);
				point = groupScaleTimelineMarkerTooltip.getMainComposite().toControl(point);
				Rectangle bounds = groupScaleTimelineMarkerTooltip.getMainComposite().getBounds();
				if (!bounds.intersects(point.x, point.y, 1, 1)) {
					// child tooltip disposed and mouse no longer over tooltip
					groupScaleTimelineMarkerTooltip.shell.dispose();
				}
			}
			if (!shell.isDisposed() && !shell.isVisible()) {
				shell.dispose();
			}
		}
	});

	mainComposite.setBackground(shell.getBackground());
	mainComposite.setLayout(new TableWrapLayout());

	return mainComposite;
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:40,代码来源:ScaleTimelineMarkerTooltip.java

示例9: hookShellListeners

import org.eclipse.swt.events.MouseTrackAdapter; //导入依赖的package包/类
/**
 * @see PopUpHelper#hookShellListeners()
 */
protected void hookShellListeners() {
	// Close the tooltip window if the mouse enters the tooltip
	getShell().addMouseTrackListener(new MouseTrackAdapter() {
		public void mouseEnter(org.eclipse.swt.events.MouseEvent e) {
			hide();
			currentTipSource = null;
			// if (timer != null) {
			// timer.cancel();
			// }
		}
	});
}
 
开发者ID:ghillairet,项目名称:gef-gwt,代码行数:16,代码来源:ToolTipHelper.java

示例10: addToolTip

import org.eclipse.swt.events.MouseTrackAdapter; //导入依赖的package包/类
/**
 * Add Tooltip for root TreeItem.
 */
protected void addToolTip( )
{
	final Tree tree = getTreeViewer( ).getTree( );
	tree.addMouseTrackListener( new MouseTrackAdapter( ) {

		public void mouseHover( MouseEvent event )
		{
			Widget widget = event.widget;
			if ( widget == tree )
			{
				Point pt = new Point( event.x, event.y );
				TreeItem item = tree.getItem( pt );

				if ( item == null )
				{
					tree.setToolTipText( null );
				}
				else
				{
					if ( getTreeViewer( ).getLabelProvider( ) instanceof FileLabelProvider )
					{
						tree.setToolTipText( ( (FileLabelProvider) getTreeViewer( ).getLabelProvider( ) ).getToolTip( item.getData( ) ) );
					}
					else
					{
						tree.setToolTipText( null );
					}
				}
			}
		}
	} );
	refreshRoot( );
}
 
开发者ID:eclipse,项目名称:birt,代码行数:37,代码来源:ProjectFileDialog.java

示例11: addToolTip

import org.eclipse.swt.events.MouseTrackAdapter; //导入依赖的package包/类
/**
 * Add Tooltip for root TreeItem.
 */
protected void addToolTip( )
{
	final Tree tree = getTreeViewer( ).getTree( );
	tree.addMouseTrackListener( new MouseTrackAdapter( ) {

		public void mouseHover( MouseEvent event )
		{
			Widget widget = event.widget;
			if ( widget == tree )
			{
				Point pt = new Point( event.x, event.y );
				TreeItem item = tree.getItem( pt );

				if ( item == null )
				{
					tree.setToolTipText( null );
				}
				else
				{
					if ( getTreeViewer( ).getLabelProvider( ) instanceof ResourceFileLabelProvider )
					{
						tree.setToolTipText( ( (ResourceFileLabelProvider) getTreeViewer( ).getLabelProvider( ) ).getToolTip( item.getData( ) ) );
					}
					else
					{
						tree.setToolTipText( null );
					}
				}
			}
		}
	} );
	refreshRoot( );
}
 
开发者ID:eclipse,项目名称:birt,代码行数:37,代码来源:ResourceFileFolderSelectionDialog.java

示例12: AnnotationExpansionControl

import org.eclipse.swt.events.MouseTrackAdapter; //导入依赖的package包/类
/**
	 * Creates a new control.
	 *
	 * @param parent parent shell
	 * @param shellStyle additional style flags
	 * @param access the annotation access
	 */
	public AnnotationExpansionControl(Shell parent, int shellStyle, IAnnotationAccess access) {
		fPaintListener= new MyPaintListener();
		fMouseTrackListener= new MyMouseTrackListener();
		fMouseListener= new MyMouseListener();
		fMenuDetectListener= new MyMenuDetectListener();
		fDisposeListener= new MyDisposeListener();
		fViewportListener= new IViewportListener() {

			public void viewportChanged(int verticalOffset) {
				dispose();
			}

		};
		fLayouter= new LinearLayouter();

		if (access instanceof IAnnotationAccessExtension)
			fAnnotationAccessExtension= (IAnnotationAccessExtension) access;

		fShell= new Shell(parent, shellStyle | SWT.NO_FOCUS | SWT.ON_TOP);
		Display display= fShell.getDisplay();
		fShell.setBackground(display.getSystemColor(SWT.COLOR_BLACK));
		fComposite= new Composite(fShell, SWT.NO_FOCUS | SWT.NO_REDRAW_RESIZE | SWT.NO_TRIM);
//		fComposite= new Composite(fShell, SWT.NO_FOCUS | SWT.NO_REDRAW_RESIZE | SWT.NO_TRIM | SWT.V_SCROLL);

		GridLayout layout= new GridLayout(1, true);
		layout.marginHeight= 0;
		layout.marginWidth= 0;
		fShell.setLayout(layout);

		GridData data= new GridData(GridData.FILL_BOTH);
		data.heightHint= fLayouter.getAnnotationSize() + 2 * fLayouter.getBorderWidth() + 4;
		fComposite.setLayoutData(data);
		fComposite.addMouseTrackListener(new MouseTrackAdapter() {

			@Override
			public void mouseExit(MouseEvent e) {
				if (fComposite == null)
						return;
				Control[] children= fComposite.getChildren();
				Rectangle bounds= null;
				for (int i= 0; i < children.length; i++) {
					if (bounds == null)
						bounds= children[i].getBounds();
					else
						bounds.add(children[i].getBounds());
					if (bounds.contains(e.x, e.y))
						return;
				}

				// if none of the children contains the event, we leave the popup
				dispose();
			}

		});

//		fComposite.getVerticalBar().addListener(SWT.Selection, new Listener() {
//
//			public void handleEvent(Event event) {
//				Rectangle bounds= fShell.getBounds();
//				int x= bounds.x - fLayouter.getAnnotationSize() - fLayouter.getBorderWidth();
//				int y= bounds.y;
//				fShell.setBounds(x, y, bounds.width, bounds.height);
//			}
//
//		});

		Cursor handCursor= getHandCursor(display);
		fShell.setCursor(handCursor);
		fComposite.setCursor(handCursor);

		setInfoSystemColor();
	}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:80,代码来源:AnnotationExpansionControl.java

示例13: initPage

import org.eclipse.swt.events.MouseTrackAdapter; //导入依赖的package包/类
/**
 * Initializes the data view page.
 */
protected void initPage( )
{
	createContextMenus( );

	// !remove sorter to keep same order with outline view
	// treeViewer.setSorter( new ViewerSorter( ) {
	//
	// public int category( Object element )
	// {
	// if ( element instanceof LibraryHandle )
	// {
	// return 1;
	// }
	// return super.category( element );
	// }
	//
	// } );

	final Tree tree = getTreeViewer( ).getTree( );

	tree.addMouseTrackListener( new MouseTrackAdapter( ) {

		public void mouseHover( MouseEvent event )
		{
			Widget widget = event.widget;
			if ( widget == tree )
			{
				Point pt = new Point( event.x, event.y );
				TreeItem item = tree.getItem( pt );

				try
				{
					tree.setToolTipText( getTooltip( item ) );
				}
				catch ( IOException e )
				{
					// Does nothing
				}
			}
		}
	} );
}
 
开发者ID:eclipse,项目名称:birt,代码行数:46,代码来源:LibraryExplorerTreeViewPage.java

示例14: initTable

import org.eclipse.swt.events.MouseTrackAdapter; //导入依赖的package包/类
private void initTable( TableViewer tableViewer, boolean leafOnly )
{
	final Table table = tableViewer.getTable( );

	GridData gd = new GridData( GridData.FILL_BOTH );
	gd.heightHint = 150;
	table.setLayoutData( gd );
	table.setToolTipText( null );

	final TableColumn column = new TableColumn( table, SWT.NONE );
	column.setWidth( 200 );
	table.getShell( ).addControlListener( new ControlAdapter( ) {

		public void controlResized( ControlEvent e )
		{
			Display.getCurrent( ).asyncExec( new Runnable( ) {

				public void run( )
				{
					if ( column != null && !column.isDisposed( ) )
					{
						column.setWidth( table.getSize( ).x > 204 ? table.getSize( ).x - 4
								: 200 );
					}
				}
			} );

		}

	} );

	table.addMouseTrackListener( new MouseTrackAdapter( ) {

		public void mouseHover( MouseEvent event )
		{
			Widget widget = event.widget;
			if ( widget == table )
			{
				Point pt = new Point( event.x, event.y );
				TableItem item = table.getItem( pt );
				if ( item == null )
				{

					table.setToolTipText( null );
				}
				else
				{
					table.setToolTipText( provider.getTooltipText( item.getData( ) ) );
				}
			}
		}
	} );

	tableViewer.setLabelProvider( new ExpressionLabelProvider( ) );
	tableViewer.setContentProvider( new TableContentProvider( tableViewer, leafOnly ) );
	tableViewer.addSelectionChangedListener( selectionListener );
	tableViewer.addDoubleClickListener( doubleClickListener );
}
 
开发者ID:eclipse,项目名称:birt,代码行数:59,代码来源:ExpressionBuilder.java


注:本文中的org.eclipse.swt.events.MouseTrackAdapter类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。