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


Java SWT.CTRL属性代码示例

本文整理汇总了Java中org.eclipse.swt.SWT.CTRL属性的典型用法代码示例。如果您正苦于以下问题:Java SWT.CTRL属性的具体用法?Java SWT.CTRL怎么用?Java SWT.CTRL使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.eclipse.swt.SWT的用法示例。


在下文中一共展示了SWT.CTRL属性的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
 
开发者ID:TRUEJASONFANS,项目名称:JavaFX-FrameRateMeter,代码行数:17,代码来源:SWTEvents.java

示例2: handleEvent

public void handleEvent(Event event) {
	if (event.type == SWT.KeyUp && (event.stateMask & SWT.CTRL) != 0) {
		switch (event.character) {
			case 0x01:		// CTRL+A
				showAboutAppleCommander();
				break;
			case 0x03:		// CTRL+C
				createDiskImage();
				break;
			case 0x0f:		// CTRL+O
				openFile();
				break;
			case 0x05:		// CTRL+E
				compareDiskImages();
				break;
		}
	}		
}
 
开发者ID:AppleCommander,项目名称:AppleCommander,代码行数:18,代码来源:SwtAppleCommander.java

示例3: createToolbarCommandHandler

/**
 * The toolbar command handler contains the global toolbar
 * actions. The intent is that the listener is then added to 
 * multiple visual components.
 */
public Listener createToolbarCommandHandler() {
	return new Listener() {
		public void handleEvent(Event event) {
			if (event.type == SWT.KeyUp) {
				if ((event.stateMask & SWT.CTRL) != 0) {	// CTRL+key
					switch (event.character) {
						case CTRL_C:
							getContentTypeAdapter().copy();
							break;
						case CTRL_A:
							getContentTypeAdapter().selectAll();
							break;
						case CTRL_P:
							getContentTypeAdapter().print();
							break;
					}
				} else if ((event.stateMask & SWT.ALT) == 0) { // key alone
					switch (event.keyCode) {
						case SWT.F2:	// the "native" file format (image, text, etc)
							getNativeFilterAdapter().display();
							setFilterToolItemSelection(true, false, false);
							break;
						case SWT.F3:	// Hex format
							getHexFilterAdapter().display();
							setFilterToolItemSelection(false, true, false);
							break;
						case SWT.F4:	// "Raw" hex format
							getRawDumpFilterAdapter().display();
							setFilterToolItemSelection(false, false, true);
							break;
					}
				}
			}
		}
	};
}
 
开发者ID:AppleCommander,项目名称:AppleCommander,代码行数:41,代码来源:FileViewerWindow.java

示例4: createDirectoryKeyboardHandler

/**
 * Create the keyboard handler for the directory pane.
 * These are keys that are <em>only</em> active in the directory
 * viewer.  See createToolbarCommandHandler for the general application
 * keyboard handler.  
 * @see #createToolbarCommandHandler
 */
private Listener createDirectoryKeyboardHandler() {
	return new Listener() {
		public void handleEvent(Event event) {
			if (event.type == SWT.KeyUp) {
				TreeItem[] treeItem = null;
				if ((event.stateMask & SWT.CTRL) != 0) {
					switch (event.character) {
						case '-':
							treeItem = getDirectoryTree().getSelection();
							setDirectoryExpandedStates(treeItem[0], false);
							break;
						case '+':
							treeItem = getDirectoryTree().getSelection();
							setDirectoryExpandedStates(treeItem[0], true);
							break;
					}
				} else {	// assume no control and no alt
					switch (event.character) {
						case '-':
							treeItem = getDirectoryTree().getSelection();
							treeItem[0].setExpanded(false);
							break;
						case '+':
							treeItem = getDirectoryTree().getSelection();
							treeItem[0].setExpanded(true);
							break;
					}
				}
			}
		}		
	};
}
 
开发者ID:AppleCommander,项目名称:AppleCommander,代码行数:39,代码来源:DiskExplorerTab.java

示例5: createFileKeyboardHandler

/**
 * Create the keyboard handler for the file pane.
 * These are keys that are <em>only</em> active in the file
 * viewer.  See createToolbarCommandHandler for the general application
 * keyboard handler.  
 * @see #createToolbarCommandHandler
 */
private Listener createFileKeyboardHandler() {
	return new Listener() {
		public void handleEvent(Event event) {
			FileEntry fileEntry = getSelectedFileEntry();
			if (fileEntry != null && event.type == SWT.KeyUp && (event.stateMask & SWT.CTRL) != 0) {
				switch (event.character) {
					case CTRL_C:	// Compile Wizard
						if (getCompileToolItem().isEnabled()) {
							compileFileWizard();
						}
						break;
					case CTRL_D:	// Delete file
						if (getDeleteToolItem().isEnabled()) {
							deleteFile();
						}
						break;
					case CTRL_E:	// Export Wizard
						exportFileWizard();
						break;
					case CTRL_V:	// View file
						viewFile(null);
						break;
				}		
			}
		}
	};
}
 
开发者ID:AppleCommander,项目名称:AppleCommander,代码行数:34,代码来源:DiskExplorerTab.java

示例6: getHeaderSelectionAdapter

private SelectionAdapter getHeaderSelectionAdapter(final Columns index) {
    return new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            if ((e.stateMask & SWT.CTRL) != 0){
                comparator.clearSortList();
                setColumnHeaders();
            }
            sortViewer(index);
        }
    };
}
 
开发者ID:pgcodekeeper,项目名称:pgcodekeeper,代码行数:13,代码来源:DiffTableViewer.java

示例7: createToolbarCommandHandler

/**
 * The toolbar command handler contains the global toolbar
 * actions.  This does not include file-specific actions.
 * The intent is that the listener is then added to multiple
 * visual components (i.e., the file listing as well as the
 * directory listing).
 */
private Listener createToolbarCommandHandler() {
	return new Listener() {
		public void handleEvent(Event event) {
			if (event.type == SWT.KeyUp) {
				if ((event.stateMask & SWT.CTRL) != 0) {	// CTRL key held
					if ((event.stateMask & SWT.SHIFT) != 0) {	// SHIFT key held
						switch (event.character) {
							case CTRL_S:	// Save As...
								saveAs();
								break;
						}
					} else {
						switch (event.character) {
							case CTRL_I:	// Import Wizard
								importFiles();
								break;
							case CTRL_P:	// Print...
								print();
								break;
							case CTRL_S:	// Save
								if (getSaveToolItem().isEnabled()) {
									save();
								}
								break;
						}
					}
				} else {	// No CTRL key
				    if ((event.stateMask & SWT.ALT) != SWT.ALT) {	// Ignore ALT key combinations like alt-F4!
					switch (event.keyCode) {
						case SWT.F2:	// Standard file display
							changeCurrentFormat(FormattedDisk.FILE_DISPLAY_STANDARD);
							break;
						case SWT.F3:	// Native file display
							changeCurrentFormat(FormattedDisk.FILE_DISPLAY_NATIVE);
							break;
						case SWT.F4:	// Detail file display
							changeCurrentFormat(FormattedDisk.FILE_DISPLAY_DETAIL);
							break;
						case SWT.F5:	// Show deleted files
							setShowDeletedFiles(!getShowDeletedFilesToolItem().getSelection());
							getShowDeletedFilesToolItem().setSelection(isShowDeletedFiles());
							fillFileTable(getCurrentFileList());
							break;
						}
					}
				}
			}
		}
	};
}
 
开发者ID:AppleCommander,项目名称:AppleCommander,代码行数:57,代码来源:DiskExplorerTab.java

示例8: handleVerifyKeyPressed

private void handleVerifyKeyPressed(VerifyEvent event) {
	if (!event.doit) {
		return;
	}
	try {
		KeyStroke triggerKeyStroke = HotKeyUtil.getHotKey(HotKeyUtil.contentAssist);
		if (triggerKeyStroke != null) {

			if ((triggerKeyStroke.getModifierKeys() == KeyStroke.NO_KEY && triggerKeyStroke.getNaturalKey() == event.character)
					||
					(((triggerKeyStroke.getNaturalKey() == event.keyCode)
							|| (Character.toLowerCase(triggerKeyStroke.getNaturalKey()) == event.keyCode) || (Character
									.toUpperCase(triggerKeyStroke.getNaturalKey()) == event.keyCode)) && ((triggerKeyStroke
											.getModifierKeys() & event.stateMask) == triggerKeyStroke.getModifierKeys()))) {

				doOperation(ISourceViewer.CONTENTASSIST_PROPOSALS);
				event.doit = false;
				return;
			}
		}
	} 
	catch (Exception e) {
	}

	if (event.stateMask != SWT.CTRL) {
		return;
	}

	switch (event.character) {
	case ' ':
		doOperation(ISourceViewer.CONTENTASSIST_PROPOSALS);
		event.doit = false;
		break;

	case '.':
		doOperation(ISourceViewer.CONTENTASSIST_PROPOSALS);
		event.doit = false;
		break;
	case 'y' - 'a' + 1:
		doOperation(ITextOperationTarget.REDO);
	event.doit = false;
	break;
	case 'z' - 'a' + 1:
		doOperation(ITextOperationTarget.UNDO);
	event.doit = false;
	break;
	default:
	}
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:49,代码来源:SourceViewer.java

示例9: 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 );
    } );
}
 
开发者ID:HiromuHota,项目名称:pdi-git-plugin,代码行数:47,代码来源:GitPerspective.java


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