本文整理汇总了Java中org.eclipse.swt.SWT.COMMAND属性的典型用法代码示例。如果您正苦于以下问题:Java SWT.COMMAND属性的具体用法?Java SWT.COMMAND怎么用?Java SWT.COMMAND使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.eclipse.swt.SWT
的用法示例。
在下文中一共展示了SWT.COMMAND属性的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: keyModifiersToEmbedKeyModifiers
static int keyModifiersToEmbedKeyModifiers(int extModifiers) {
int embedModifiers = 0;
if ((extModifiers & SWT.SHIFT) != 0) {
embedModifiers |= AbstractEvents.MODIFIER_SHIFT;
}
if ((extModifiers & SWT.CTRL) != 0) {
embedModifiers |= AbstractEvents.MODIFIER_CONTROL;
}
if ((extModifiers & SWT.ALT) != 0) {
embedModifiers |= AbstractEvents.MODIFIER_ALT;
}
// NOTE: can't get Windows key from SWT
if ((extModifiers & SWT.COMMAND) != 0) {
embedModifiers |= AbstractEvents.MODIFIER_META;
}
return embedModifiers;
}
示例2: sendMouseEventToFX
private void sendMouseEventToFX(MouseEvent me, int embedMouseType) {
if (scenePeer == null) {
return;
}
Point los = toDisplay(me.x, me.y);
boolean primaryBtnDown = (me.stateMask & SWT.BUTTON1) != 0;
boolean middleBtnDown = (me.stateMask & SWT.BUTTON2) != 0;
boolean secondaryBtnDown = (me.stateMask & SWT.BUTTON3) != 0;
boolean shift = (me.stateMask & SWT.SHIFT) != 0;
boolean control = (me.stateMask & SWT.CONTROL) != 0;
boolean alt = (me.stateMask & SWT.ALT) != 0;
boolean meta = (me.stateMask & SWT.COMMAND) != 0;
int button = me.button;
switch (embedMouseType) {
case AbstractEvents.MOUSEEVENT_PRESSED:
primaryBtnDown |= me.button == 1;
middleBtnDown |= me.button == 2;
secondaryBtnDown |= me.button == 3;
break;
case AbstractEvents.MOUSEEVENT_RELEASED:
primaryBtnDown &= me.button != 1;
middleBtnDown &= me.button != 2;
secondaryBtnDown &= me.button != 3;
break;
case AbstractEvents.MOUSEEVENT_CLICKED:
// Don't send click events to FX, as they are generated in Scene
return;
case AbstractEvents.MOUSEEVENT_MOVED:
case AbstractEvents.MOUSEEVENT_DRAGGED:
case AbstractEvents.MOUSEEVENT_ENTERED:
case AbstractEvents.MOUSEEVENT_EXITED:
// If this event was the result of mouse movement and has no
// button associated with it, then we look at the state to
// determine which button to report
if (button == 0) {
if ((me.stateMask & SWT.BUTTON1) != 0) {
button = 1;
} else if ((me.stateMask & SWT.BUTTON2) != 0) {
button = 2;
} else if ((me.stateMask & SWT.BUTTON3) != 0) {
button = 3;
}
}
break;
default:
break;
}
scenePeer.mouseEvent(
embedMouseType,
SWTEvents.mouseButtonToEmbedMouseButton(button, me.stateMask),
primaryBtnDown, middleBtnDown, secondaryBtnDown,
me.x, me.y,
los.x, los.y,
shift, control, alt, meta,
SWTEvents.getWheelRotation(me, embedMouseType),
false); // RT-32990: popup trigger not implemented
}
示例3: GitPerspective
public GitPerspective() throws XulException {
// Loading Xul Document
KettleXulLoader loader = new KettleXulLoader();
loader.registerClassLoader( getClass().getClassLoader() );
container = loader.loadXul( "org/pentaho/di/git/spoon/xul/git_perspective.xul", resourceBundle );
// Adding Event Handlers
controller = new GitController();
gitSpoonMenuController = new GitSpoonMenuController();
gitSpoonMenuController.setGitController( controller );
container.addEventHandler( controller );
container.addEventHandler( gitSpoonMenuController );
final XulRunner runner = new SwtXulRunner();
runner.addContainer( container );
runner.initialize(); //calls any onload events
/*
* To make compatible with webSpoon
* Create a temporary parent for the UI and then call layout().
* A different parent will be assigned to the UI in SpoonPerspectiveManager.PerspectiveManager.performInit().
*/
SwtDeck deck = (SwtDeck) Spoon.getInstance().getXulDomContainer().getDocumentRoot().getElementById( "canvas-deck" );
box = deck.createVBoxCard();
getUI().setParent( (Composite) box.getManagedObject() );
getUI().layout();
/**
* Hack: setAccelerator 'CTRL(CMD) + D' to "Data Integration" menu
*/
int mask = 'D';
if ( System.getProperty( "KETTLE_CONTEXT_PATH" ) == null ) { // Spoon
boolean isMac = System.getProperty( "os.name" ).toLowerCase().indexOf( "mac" ) >= 0;
mask += isMac ? SWT.COMMAND : SWT.CTRL;
} else { // webSpoon
mask += SWT.CTRL;
}
int keyCode = mask;
XulMenupopup menuPopup = (XulMenupopup) Spoon.getInstance().getXulDomContainer().getDocumentRoot().getElementById( "view-perspectives-popup" );
MenuManager menuMgr = (MenuManager) menuPopup.getManagedObject();
// No guarantee that "Data Integration" gets "menuitem-0" as its ID, but looks ok so far
Stream.of( menuMgr.getItems() )
.filter( menu -> menu.getId().equals( "menuitem-0" ) ).findFirst().ifPresent( menu -> {
IAction action = ( (ActionContributionItem) menu ).getAction();
action.setAccelerator( keyCode );
} );
}