當前位置: 首頁>>代碼示例>>Java>>正文


Java MenuDetectEvent類代碼示例

本文整理匯總了Java中org.eclipse.swt.events.MenuDetectEvent的典型用法代碼示例。如果您正苦於以下問題:Java MenuDetectEvent類的具體用法?Java MenuDetectEvent怎麽用?Java MenuDetectEvent使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


MenuDetectEvent類屬於org.eclipse.swt.events包,在下文中一共展示了MenuDetectEvent類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: createContextMenu

import org.eclipse.swt.events.MenuDetectEvent; //導入依賴的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.MenuDetectEvent; //導入依賴的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.MenuDetectEvent; //導入依賴的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.MenuDetectEvent; //導入依賴的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.MenuDetectEvent; //導入依賴的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.MenuDetectEvent; //導入依賴的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: sendMenuEventToFX

import org.eclipse.swt.events.MenuDetectEvent; //導入依賴的package包/類
private void sendMenuEventToFX(MenuDetectEvent me) {
    if (scenePeer == null /*|| !isFxEnabled()*/) {
        return;
    }
    Point pt = toControl(me.x, me.y);
    scenePeer.menuEvent(pt.x, pt.y, me.x, me.y, false);
}
 
開發者ID:TRUEJASONFANS,項目名稱:JavaFX-FrameRateMeter,代碼行數:8,代碼來源:OldFXCanvas.java

示例8: menuDetected

import org.eclipse.swt.events.MenuDetectEvent; //導入依賴的package包/類
@Override
public void menuDetected(final MenuDetectEvent mde) {
	final Earthquake selection = (Earthquake) resultsTable.getTableViewer().getStructuredSelection().getFirstElement();
	resultsTable.getContextMenu().getShowMapMenuItem().setEnabled(selection != null && selection.getEnclosure() != null);
	resultsTable.getContextMenu().getCopyLinkMenuItem().setEnabled(selection != null && selection.getLink() != null);
	resultsTable.getContextMenu().getOpenBrowserMenuItem().setEnabled(selection != null && selection.getLink() != null);
	resultsTable.getContextMenu().getGoogleMapsBrowserMenuItem().setEnabled(selection != null);
	resultsTable.getContextMenu().getGoogleMapsPopupMenuItem().setEnabled(selection != null);
	resultsTable.getContextMenu().getExportCsvMenuItem().setEnabled(resultsTable.getTableViewer().getTable() != null && resultsTable.getTableViewer().getTable().getItemCount() > 0);
	resultsTable.getContextMenu().getMenu().setVisible(true);
}
 
開發者ID:Albertus82,項目名稱:EarthquakeBulletin,代碼行數:12,代碼來源:ResultsTableContextMenuDetectListener.java

示例9: menuDetected

import org.eclipse.swt.events.MenuDetectEvent; //導入依賴的package包/類
@Override
public void menuDetected(final MenuDetectEvent mde) {
	final DataTable dataTable = gui.getDataTable();
	dataTable.getCopyMenuItem().setEnabled(dataTable.canCopy());
	dataTable.getDeleteMenuItem().setEnabled(dataTable.canDelete());
	dataTable.getSelectAllMenuItem().setEnabled(dataTable.canSelectAll());
	dataTable.getClearMenuItem().setEnabled(dataTable.canClear());
	dataTable.getContextMenu().setVisible(true);
}
 
開發者ID:Albertus82,項目名稱:RouterLogger,代碼行數:10,代碼來源:DataTableContextMenuDetectListener.java

示例10: fireMenuDetect

import org.eclipse.swt.events.MenuDetectEvent; //導入依賴的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

示例11: menuDetected

import org.eclipse.swt.events.MenuDetectEvent; //導入依賴的package包/類
@Override
public void menuDetected(final MenuDetectEvent e) {

    //if a drag source is installed, selection event fires after menu detect but selection
    //should always change before menu detection
    //Not sure if this is necessary for nattable but it does not harm anyway
    setSelectionChangedIfNeccessary();

    //stop editing before popup opens
    stopEditing();

    Point point = new Point(e.x, e.y);
    point = table.toControl(point);

    final Position position = new Position(point.x, point.y);

    final int rowPositionByY = table.getRowPositionByY(point.y);
    final int columnPositionByX = table.getColumnPositionByX(point.x);

    final int rowIndex = table.getRowIndexByPosition(rowPositionByY);
    final int columnIndex = table.getColumnIndexByPosition(columnPositionByX);

    if (rowPositionByY == 0 && columnIndex != -1) {
        tableColumnPopupDetectionObservable.firePopupDetected(new TableColumnPopupEvent(columnIndex, position));
    }
    else if (rowIndex != -1 && columnIndex != -1) {
        tableCellPopupDetectionObservable.firePopupDetected(new TableCellPopupEvent(rowIndex, columnIndex, position));
    }
    else {
        getPopupDetectionObservable().firePopupDetected(position);
    }
}
 
開發者ID:jo-source,項目名稱:jo-widgets,代碼行數:33,代碼來源:NatTableImplSpi.java

示例12: fireMenuDetect

import org.eclipse.swt.events.MenuDetectEvent; //導入依賴的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

示例13: notifyMenuDetectListeners

import org.eclipse.swt.events.MenuDetectEvent; //導入依賴的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

示例14: sendMenuEventToFX

import org.eclipse.swt.events.MenuDetectEvent; //導入依賴的package包/類
private void sendMenuEventToFX(MenuDetectEvent me) {
    if (this.scenePeer == null /*|| !isFxEnabled()*/) {
        return;
    }
    Point pt = this.toControl(me.x, me.y);
    this.scenePeer.menuEvent(pt.x, pt.y, me.x, me.y, false);
}
 
開發者ID:SkyLandTW,項目名稱:JXTN,代碼行數:8,代碼來源:FXCanvas.java

示例15: fireMenuDetect

import org.eclipse.swt.events.MenuDetectEvent; //導入依賴的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


注:本文中的org.eclipse.swt.events.MenuDetectEvent類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。