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


Java SWT.SHIFT属性代码示例

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


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

示例1: onClick

protected void onClick(MouseEvent event) {
	// update selection
	final VisualisationNode mNode = getNodeAt(event.x, event.y);
	// final Node mNode = getNodeAt(event.x, event.y);
	final boolean shiftPressed = (event.stateMask & SWT.SHIFT) != 0;
	if (!shiftPressed) {
		if (mNode == null) {
			clearSelection();
		} else {
			setSelectedNodes(mNode);
		}
	} else {
		if (mNode == null) {
			// do nothing
		} else {
			toggleSelection(mNode);
		}
	}
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:19,代码来源:VisualisationCanvas.java

示例2: onClick

protected void onClick(MouseEvent event) {
	// update selection
	final Node mNode = getNodeAt(event.x, event.y);
	final boolean shiftPressed = (event.stateMask & SWT.SHIFT) != 0;
	if (!shiftPressed) {
		if (mNode == null) {
			clearSelection();
		} else {
			setSelectedNodes(mNode);
		}
	} else {
		if (mNode == null) {
			// do nothing
		} else {
			toggleSelection(mNode);
		}
	}
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:18,代码来源:GraphCanvas.java

示例3: makeXPathKeyAccelerator

public KeyAccelerator makeXPathKeyAccelerator(final boolean overwrite) {
	return new KeyAccelerator() {
		public boolean doAction(TwsDomTree tree, KeyEvent e) {
			boolean doNext = true;
			if (e.keyCode == SWT.CR || e.keyCode == SWT.KEYPAD_CR) {
				if (tree.getSelection().length > 0) {
					Node node = (Node)tree.getSelection()[0].getData();
					if ((e.stateMask & SWT.SHIFT) == 0) {//without SHIFT > relative
						if (canGenerateSelectionXpath(overwrite, node)) {
							generateSelectionXpath(overwrite, tree);
							doNext = false;
						}
					} else {//with SHIFT > absolute
						generateAbsoluteXpath(overwrite, node);
						doNext = false;
					}
				}
			}
			return doNext;
		}
	};
}
 
开发者ID:convertigo,项目名称:convertigo-eclipse,代码行数:22,代码来源:XpathEvaluatorComposite.java

示例4: 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

示例5: onKeyPressed

protected void onKeyPressed(KeyEvent e) {
  if ((e.character == '\r') && ((e.stateMask & SWT.SHIFT) == 0)) {
    close(true);
  } else if (e.character == SWT.ESC) {
    close(false);
  } else {
    m_Table.scrollToFocus();
  }
}
 
开发者ID:convertigo,项目名称:convertigo-eclipse,代码行数:9,代码来源:KTableCellEditor.java

示例6: glMouseDown

public void glMouseDown(double x, double y, double z,  MouseEvent e, ParamSet paramSet) {
	Sketch sketch = AvoGlobal.project.getActiveSketch();
	if(sketch != null && !sketch.isConsumed){		
		
		if((e.stateMask & SWT.SHIFT) != 0){
			shiftIsDown = true;
		}else{
			shiftIsDown = false;
		}
		if(!shiftIsDown){				
			sketch.deselectAllFeat2D();
		}

		//
		// iterate over all features in the current set to see if they've been clicked
		//
		for(int i = 0; i < sketch.getFeat2DListSize(); i++){
			Feature2D f2D = sketch.getAtIndex(i);
			for(Prim2D prim2D : f2D.getPrim2DList()){
				// TODO: HACK do not hardcode the distance!
				if(prim2D.distFromPrim(new Point2D(x,y)) < 0.2){
					f2D.setSelected(true);
					//
					// give paramDialog the paramSet so that it can
					// be displayed to the user for manual parameter
					// input.
					//
					AvoGlobal.paramDialog.setParamSet(f2D.paramSet);
					//navigationToolbar.showMessage("Feature " +  f2D.ID + " selected");			
				}
			}
		}
		AvoGlobal.glView.updateGLView = true;			
	}
}
 
开发者ID:avoCADo-3d,项目名称:avoCADo,代码行数:35,代码来源:ToolSketchSelectCtrl.java

示例7: glMouseDown

public void glMouseDown(double x, double y, double z, MouseEvent e, ParamSet paramSet) {
	
	Build build = AvoGlobal.project.getActiveFeat2D3D();
	if(build != null){	
		Sketch sketch = build.getPrimarySketch();
		if(sketch != null){
			//ParamSet paramSet = feat2D3D.paramSet;
			if(!(new ToolBuildExtrudeModel()).paramSetIsValid(paramSet)){
				//System.out.println("%% making new extrude paramSet");
				// paramSet is not valid for this feature, create a new one.
				paramSet = (new ToolBuildExtrudeModel()).constructNewParamSet();
				build.paramSet = paramSet;
			}
			
			try{
				SelectionList selectionList = paramSet.getParam("regions").getDataSelectionList();
				if((e.stateMask & SWT.SHIFT) != 0){
					// shift is down
				}else{
					// shift is not down
					selectionList.clearList();						
				}					
				
				Point2D clickedPoint = new Point2D(x,y);
				//System.out.println("looking at point: " + clickedPoint);
				for(int i=0; i < sketch.getRegion2DListSize(); i++){
					Region2D reg  = sketch.getRegAtIndex(i);
					reg.setSelected(false); // assume all unselected first.
					if(reg.regionContainsPoint2D(clickedPoint) && !selectionList.contains(String.valueOf(i))){
						selectionList.add(String.valueOf(i));							
					}
					if(selectionList.contains(String.valueOf(i))){
						reg.setSelected(true);	// set region as selected
					}						
				}				
				
				if(selectionList.getSelectionSize() > 0){
					selectionList.isSatisfied = true;
				}else{
					selectionList.isSatisfied = false;
				}
				// TODO: shouldn't need to directly indicate param modified??
				AvoGlobal.paramEventHandler.notifyParamModified();
				
			}catch(Exception ex){
				System.out.println("Extrude(mousedown): " + ex.getClass().getName());
			}
			
			AvoGlobal.paramDialog.setParamSet(build.paramSet);				
		}
	}
	
}
 
开发者ID:avoCADo-3d,项目名称:avoCADo,代码行数:53,代码来源:ToolBuildExtrudeCtrl.java

示例8: glMouseDown

public void glMouseDown(double x, double y, double z, MouseEvent e, ParamSet paramSet) {
	Build build = AvoGlobal.project.getActiveFeat2D3D();
	if(build != null){	
		Sketch sketch = build.getPrimarySketch();
		if(sketch != null){
			//ParamSet paramSet = feat2D3D.paramSet;
			if(!(new ToolBuildRevolveModel()).paramSetIsValid(paramSet)){
				// paramSet is not valid for this feature, create a new one.
				paramSet = (new ToolBuildRevolveModel()).constructNewParamSet();
				build.paramSet = paramSet;
			}
			
			try{
				SelectionList regions    = paramSet.getParam("regions").getDataSelectionList();
				SelectionList centerline = paramSet.getParam("centerline").getDataSelectionList();
				if(centerline.hasFocus){
					System.out.println("looking for centerline.");
					// try to select a 2D line for the centerline if clicked...
					for(int i = 0; i < sketch.getFeat2DListSize(); i++){
						Feature2D f2D = sketch.getAtIndex(i);
						for(int j=0; j< f2D.getPrim2DList().size(); j++){
							Prim2D prim2D = f2D.getPrim2DList().get(j);
							// TODO: hack (hardcoded distance from line for selection.
							if(prim2D instanceof Prim2DLine && prim2D.distFromPrim(new Point2D(x,y)) < 0.2){
								centerline.clearList();
								centerline.add(String.valueOf(i) + "." + String.valueOf(j));
								centerline.isSatisfied = true;
							}
						}
					}
					if(centerline.getSelectionSize() == 1){
						centerline.isSatisfied = true;
					}else{
						centerline.isSatisfied = false;
					}
				}else{
					System.out.println("looking for region.");
					// selecting regions...
					if((e.stateMask & SWT.SHIFT) != 0){
						// shift is down
					}else{
						// shift is not down
						regions.clearList();
					}					
					
					Point2D clickedPoint = new Point2D(x,y);
					for(int i=0; i < sketch.getRegion2DListSize(); i++){
						Region2D reg  = sketch.getRegAtIndex(i);
						reg.setSelected(false);
						if(reg.regionContainsPoint2D(clickedPoint) && !regions.contains(String.valueOf(i))){
							regions.add(String.valueOf(i));
						}
						if(regions.contains(String.valueOf(i))){
							reg.setSelected(true);	// set region as selected
						}
					}
					if(regions.getSelectionSize() > 0){
						regions.isSatisfied = true;
					}else{
						regions.isSatisfied = false;
					}
					
					// TODO: shouldn't need to directly indicate param modified??
					AvoGlobal.paramEventHandler.notifyParamModified();
				}
			}catch(Exception ex){
				System.out.println("Revolve(mousedown): " + ex.getClass().getName());
			}
			
			AvoGlobal.paramDialog.setParamSet(build.paramSet);
		}
	}		
}
 
开发者ID:avoCADo-3d,项目名称:avoCADo,代码行数:73,代码来源:ToolBuildRevolveCtrl.java

示例9: 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
}
 
开发者ID:TRUEJASONFANS,项目名称:JavaFX-FrameRateMeter,代码行数:61,代码来源:OldFXCanvas.java

示例10: 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

示例11: handleSearchKeyPress

private void handleSearchKeyPress(KeyEvent e) {
		TableViewSWTFilter<?> filter = tv.getSWTFilter();
		if (filter == null || e.widget == filter.widget) {
			return;
		}

		String newText = null;

		// normal character: jump to next item with a name beginning with this character
		if (ASYOUTYPE_MODE == ASYOUTYPE_MODE_FIND) {
			if (System.currentTimeMillis() - filter.lastFilterTime > 3000)
				newText = "";
		}

		if (e.keyCode == SWT.BS) {
			if (e.stateMask == SWT.CONTROL) {
				newText = "";
			} else if (filter.nextText.length() > 0) {
				newText = filter.nextText.substring(0, filter.nextText.length() - 1);
			}
		} else if ((e.stateMask & ~SWT.SHIFT) == 0 && e.character > 32 && e.character != SWT.DEL) {
			newText = filter.nextText + String.valueOf(e.character);
		}

		if (newText == null) {
			return;
		}

		if (ASYOUTYPE_MODE == ASYOUTYPE_MODE_FILTER) {
			if (filter != null && filter.widget != null && !filter.widget.isDisposed()) {
				filter.widget.setFocus();
			}
			tv.setFilterText(newText);
//		} else {
//			TableCellCore[] cells = getColumnCells("name");
//
//			//System.out.println(sLastSearch);
//
//			Arrays.sort(cells, TableCellImpl.TEXT_COMPARATOR);
//			int index = Arrays.binarySearch(cells, filter.text,
//					TableCellImpl.TEXT_COMPARATOR);
//			if (index < 0) {
//
//				int iEarliest = -1;
//				String s = filter.regex ? filter.text : "\\Q" + filter.text + "\\E";
//				Pattern pattern = Pattern.compile(s, Pattern.CASE_INSENSITIVE);
//				for (int i = 0; i < cells.length; i++) {
//					Matcher m = pattern.matcher(cells[i].getText());
//					if (m.find() && (m.start() < iEarliest || iEarliest == -1)) {
//						iEarliest = m.start();
//						index = i;
//					}
//				}
//
//				if (index < 0)
//					// Insertion Point (best guess)
//					index = -1 * index - 1;
//			}
//
//			if (index >= 0) {
//				if (index >= cells.length)
//					index = cells.length - 1;
//				TableRowCore row = cells[index].getTableRowCore();
//				int iTableIndex = row.getIndex();
//				if (iTableIndex >= 0) {
//					setSelectedRows(new TableRowCore[] {
//						row
//					});
//				}
//			}
//			filter.lastFilterTime = System.currentTimeMillis();
		}
		e.doit = false;
	}
 
开发者ID:BiglySoftware,项目名称:BiglyBT,代码行数:74,代码来源:TableViewSWT_Common.java


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