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


Java MenuDetectListener类代码示例

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


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

示例1: createContextMenu

import org.eclipse.swt.events.MenuDetectListener; //导入依赖的package包/类
protected void createContextMenu(final List list) {
	contextMenu = new Menu(list);

	copyMenuItem = createCopyMenuItem(list);

	new MenuItem(contextMenu, SWT.SEPARATOR);

	selectAllMenuItem = createSelectAllMenuItem(list);

	new MenuItem(contextMenu, SWT.SEPARATOR);

	clearMenuItem = createClearMenuItem();

	list.addMenuDetectListener(new MenuDetectListener() {
		@Override
		public void menuDetected(final MenuDetectEvent mde) {
			final boolean notEmpty = !isEmpty();
			selectAllMenuItem.setEnabled(notEmpty);
			clearMenuItem.setEnabled(notEmpty);
			copyMenuItem.setEnabled(list.getSelectionCount() > 0);
			contextMenu.setVisible(true);
		}
	});
	list.setMenu(contextMenu);
}
 
开发者ID:Albertus82,项目名称:JFaceUtils,代码行数:26,代码来源:ListConsole.java

示例2: createContextMenu

import org.eclipse.swt.events.MenuDetectListener; //导入依赖的package包/类
protected void createContextMenu(final StyledText styledText) {
	contextMenu = new Menu(styledText);

	copyMenuItem = createCopyMenuItem(styledText);

	new MenuItem(contextMenu, SWT.SEPARATOR);

	selectAllMenuItem = createSelectAllMenuItem(styledText);

	new MenuItem(contextMenu, SWT.SEPARATOR);

	clearMenuItem = createClearMenuItem();

	styledText.addMenuDetectListener(new MenuDetectListener() {
		@Override
		public void menuDetected(final MenuDetectEvent mde) {
			final boolean notEmpty = !isEmpty();
			selectAllMenuItem.setEnabled(notEmpty);
			clearMenuItem.setEnabled(notEmpty);
			copyMenuItem.setEnabled(styledText.getSelectionCount() > 0);
		}
	});
	styledText.setMenu(contextMenu);
}
 
开发者ID:Albertus82,项目名称:JFaceUtils,代码行数:25,代码来源:StyledTextConsole.java

示例3: MergeTreeViewer

import org.eclipse.swt.events.MenuDetectListener; //导入依赖的package包/类
public MergeTreeViewer(TreeTableComposite treeComposite, final TreeTableColumnConfiguration configuration, IWorkbenchPartSite site) {
	super(treeComposite, configuration, site);
	addFilter(new VisabilityFilter());
	treeComposite.getTree().addTreeListener(new PlanElementTreeListener()); // will be disposed with the Tree

	final Tree tree = getTree();
	tree.addMenuDetectListener(new MenuDetectListener() {
		@Override
		public void menuDetected(MenuDetectEvent e) {
			Point point = tree.toControl(e.x, e.y);
			Rectangle clientArea = tree.getClientArea();
			if (clientArea.y <= point.y && point.y < (clientArea.y + tree.getHeaderHeight())) {
				e.doit = false;
				int columnIndex = getColumnIndex(point.x);
				fillHeaderContextMenu(e.display, columnIndex, point, configuration.getColumns());
			}
		}
	});
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:20,代码来源:MergeTreeViewer.java

示例4: makePopupMenu

import org.eclipse.swt.events.MenuDetectListener; //导入依赖的package包/类
public void makePopupMenu(final TreeViewer viewer) {
	final Tree tree = viewer.getTree();
	tree.addMenuDetectListener(new MenuDetectListener() {
		@Override
		public void menuDetected(MenuDetectEvent event) {
			Point clickedAt = tree.toControl(event.x, event.y);
			Point displayAt = viewer.getControl().toDisplay(clickedAt);
			final TreeItem treeItem = tree.getItem(clickedAt);
			if (treeItem != null) {
				Object objectInTree = treeItem.getData();
				List<ContextualCommandContributor> menuContributors = getMenuContributors(objectInTree);
				if (!menuContributors.isEmpty()) {
					Shell shell = viewer.getControl().getShell();
					popupMenu(objectInTree, menuContributors, shell, displayAt);
					event.doit = false;
				}
			}
		}
	});
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:21,代码来源:TreeContextMenuFactory.java

示例5: initQuickFixMenu

import org.eclipse.swt.events.MenuDetectListener; //导入依赖的package包/类
/**
 * Initialize quick fix menu for content assist.
 */
protected void initQuickFixMenu( )
{
	if ( hasQuickFix( ) )
	{
		controlDecoration.addMenuDetectListener( new MenuDetectListener( ) {

			public void menuDetected( MenuDetectEvent event )
			{
				// no quick fix if we aren't in error state.
				if ( isValid( ) )
				{
					return;
				}
				if ( quickFixMenu == null )
				{
					quickFixMenu = FieldAssistHelper.getInstance( )
							.createQuickFixMenu( AssistField.this );
				}
				quickFixMenu.setLocation( event.x, event.y );
				quickFixMenu.setVisible( true );
			}
		} );
	}
}
 
开发者ID:eclipse,项目名称:birt,代码行数:28,代码来源:AssistField.java

示例6: NumericWidget

import org.eclipse.swt.events.MenuDetectListener; //导入依赖的package包/类
/**
 * @param parent
 *            Composite
 * @param style
 *            Integer
 * @param labelText
 *            String
 * @param regex
 *            String
 */
public NumericWidget(Composite parent, int style, final String labelText, RegexValidation regex) {
	super(parent, style, labelText, regex);

	// Create quickFix menu listener
	this.controlDecoration.addMenuDetectListener(new MenuDetectListener() {
		public void menuDetected(MenuDetectEvent event) {
			// no quick fix if we aren't in error state.
			if (NumericWidget.this.smartField.isValid()) {
				return;
			}
			if (NumericWidget.this.smartField.quickFixMenu == null) {
				NumericWidget.this.smartField.quickFixMenu = NumericWidget.this
						.createQuickFixMenu((SmartNumericField) NumericWidget.this.smartField);
			}
			NumericWidget.this.smartField.quickFixMenu.setLocation(event.x, event.y);
			NumericWidget.this.smartField.quickFixMenu.setVisible(true);
		}
	});
}
 
开发者ID:elexis,项目名称:elexis-3-base,代码行数:30,代码来源:NumericWidget.java

示例7: fireMenuDetect

import org.eclipse.swt.events.MenuDetectListener; //导入依赖的package包/类
/**
 * A context menu has been requested for the selected breadcrumb item.
 * 
 * @param event the event issued the menu detection
 */
void fireMenuDetect(MenuDetectEvent event) {
  Object[] listeners = fMenuListeners.getListeners();
  for (int i = 0; i < listeners.length; i++) {
    ((MenuDetectListener) listeners[i]).menuDetected(event);
  }
}
 
开发者ID:gwt-plugins,项目名称:gwt-eclipse-plugin,代码行数:12,代码来源:BreadcrumbViewer.java

示例8: fireMenuDetect

import org.eclipse.swt.events.MenuDetectListener; //导入依赖的package包/类
/**
 * A context menu has been requested for the selected breadcrumb item.
 *
 * @param event the event issued the menu detection
 */
void fireMenuDetect(MenuDetectEvent event) {
	Object[] listeners= fMenuListeners.getListeners();
	for (int i= 0; i < listeners.length; i++) {
		((MenuDetectListener)listeners[i]).menuDetected(event);
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:12,代码来源:BreadcrumbViewer.java

示例9: notifyMenuDetectListeners

import org.eclipse.swt.events.MenuDetectListener; //导入依赖的package包/类
private void notifyMenuDetectListeners(Event event) {
	if (getDecorationRectangle(null).contains(event.x, event.y)) {
		MenuDetectEvent clientEvent = new MenuDetectEvent(event);
		clientEvent.data = this;
		Object[] listeners = menuDetectListeners.getListeners();
		for (int i = 0; i < listeners.length; i++) {
			((MenuDetectListener) listeners[i]).menuDetected(clientEvent);

		}
	}
}
 
开发者ID:ghillairet,项目名称:gef-gwt,代码行数:12,代码来源:ControlDecoration.java

示例10: fireMenuDetect

import org.eclipse.swt.events.MenuDetectListener; //导入依赖的package包/类
/**
 * A context menu has been requested for the selected breadcrumb item.
 * 
 * @param event
 *            the event issued the menu detection
 */
void fireMenuDetect( MenuDetectEvent event )
{
	Object[] listeners = fMenuListeners.getListeners( );
	for ( int i = 0; i < listeners.length; i++ )
	{
		( (MenuDetectListener) listeners[i] ).menuDetected( event );
	}
}
 
开发者ID:eclipse,项目名称:birt,代码行数:15,代码来源:BreadcrumbViewer.java

示例11: TreeSelectionTracker

import org.eclipse.swt.events.MenuDetectListener; //导入依赖的package包/类
public TreeSelectionTracker(final TreeViewer treeViewer) {
	treeViewer.getTree().addMenuDetectListener(new MenuDetectListener() {				
		@Override
		public void menuDetected(final MenuDetectEvent e) {
			final Point point = Display.getDefault().map(null, treeViewer.getTree(), new Point(e.x, e.y));  
			final ViewerCell cell = treeViewer.getCell(point);
			if(cell != null && cell.getItem() != null) {
				treeItemData = cell.getItem().getData();
				selectedColumnIndex = cell.getColumnIndex();
			} else {
				treeItemData = null;
			}
		}
	});
}
 
开发者ID:smaccm,项目名称:smaccm,代码行数:16,代码来源:VariablesView.java

示例12: TableSelectionTracker

import org.eclipse.swt.events.MenuDetectListener; //导入依赖的package包/类
public TableSelectionTracker(final TableViewer tableViewer) {
	tableViewer.getTable().addMenuDetectListener(new MenuDetectListener() {
		@Override
		public void menuDetected(final MenuDetectEvent e) {
			final Point point = Display.getDefault().map(null, tableViewer.getControl(), new Point(e.x, e.y));  
			selection = tableViewer.getCell(point);
		}
	});
}
 
开发者ID:smaccm,项目名称:smaccm,代码行数:10,代码来源:PropertiesStateViewer.java

示例13: addMenuDetectListener

import org.eclipse.swt.events.MenuDetectListener; //导入依赖的package包/类
public void addMenuDetectListener(MenuDetectListener mdl) {
    tree.addMenuDetectListener(mdl);
}
 
开发者ID:nilsschmidt1337,项目名称:ldparteditor,代码行数:4,代码来源:Tree.java

示例14: setMenuDetectListener

import org.eclipse.swt.events.MenuDetectListener; //导入依赖的package包/类
protected void setMenuDetectListener(final MenuDetectListener menuDetectListener) {
    getUiReference().removeMenuDetectListener(this.menuDetectListener);
    this.menuDetectListener = menuDetectListener;
    getUiReference().addMenuDetectListener(menuDetectListener);
}
 
开发者ID:jo-source,项目名称:jo-widgets,代码行数:6,代码来源:SwtComponent.java

示例15: addSWTListener

import org.eclipse.swt.events.MenuDetectListener; //导入依赖的package包/类
/**
 * Hook an SWT listener on the canvas where the chart is drawn.
 * The purpose of this method is to allow some degree of customization.
 *
 * @param listener The SWT listener to attach to the canvas.
 */
public void addSWTListener(EventListener listener) {
    if (listener instanceof ControlListener) {
        this.canvas.addControlListener((ControlListener) listener);
    }
    else if (listener instanceof DisposeListener) {
        this.canvas.addDisposeListener((DisposeListener) listener);
    }
    else if (listener instanceof DragDetectListener) {
        this.canvas.addDragDetectListener((DragDetectListener) listener);
    }
    else if (listener instanceof FocusListener) {
        this.canvas.addFocusListener((FocusListener) listener);
    }
    else if (listener instanceof HelpListener) {
        this.canvas.addHelpListener((HelpListener) listener);
    }
    else if (listener instanceof KeyListener) {
        this.canvas.addKeyListener((KeyListener) listener);
    }
    else if (listener instanceof MenuDetectListener) {
        this.canvas.addMenuDetectListener((MenuDetectListener) listener);
    }
    else if (listener instanceof MouseListener) {
        this.canvas.addMouseListener((MouseListener) listener);
    }
    else if (listener instanceof MouseMoveListener) {
        this.canvas.addMouseMoveListener((MouseMoveListener) listener);
    }
    else if (listener instanceof MouseTrackListener) {
        this.canvas.addMouseTrackListener((MouseTrackListener) listener);
    }
    else if (listener instanceof MouseWheelListener) {
        this.canvas.addMouseWheelListener((MouseWheelListener) listener);
    }
    else if (listener instanceof PaintListener) {
        this.canvas.addPaintListener((PaintListener) listener);
    }
    else if (listener instanceof TraverseListener) {
        this.canvas.addTraverseListener((TraverseListener) listener);
    }
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:48,代码来源:ChartComposite.java


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