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


Java SWT.MOD1屬性代碼示例

本文整理匯總了Java中org.eclipse.swt.SWT.MOD1屬性的典型用法代碼示例。如果您正苦於以下問題:Java SWT.MOD1屬性的具體用法?Java SWT.MOD1怎麽用?Java SWT.MOD1使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在org.eclipse.swt.SWT的用法示例。


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

示例1: apply

@Override
public void apply(ITextViewer viewer, char trigger, int stateMask, int offset) {
	initIfNeeded();
	IDocument document = viewer.getDocument();
	if (fTextViewer == null) {
		fTextViewer = viewer;
	}
	// don't eat if not in preferences, XOR with modifier key 1 (Ctrl)
	// but: if there is a selection, replace it!
	Point selection = viewer.getSelectedRange();
	fToggleEating = (stateMask & SWT.MOD1) != 0;
	int newLength = selection.x + selection.y - getReplacementOffset();
	if ((insertCompletion() ^ fToggleEating) && newLength >= 0) {
		setReplacementLength(newLength);
	}
	apply(document, trigger, offset);
	fToggleEating = false;
}
 
開發者ID:angelozerr,項目名稱:ec4e,代碼行數:18,代碼來源:EditorConfigCompletionProposal.java

示例2: mouseScrolled

@Override
public void mouseScrolled(MouseEvent e) {
	if ((e.stateMask & SWT.MOD1) != 0) {
		zoom(e);
	} else {
		scroll(e);
	}
}
 
開發者ID:eclipse,項目名稱:gemoc-studio,代碼行數:8,代碼來源:AbstractTimelineView.java

示例3: addConfigurableMenuItem

private MenuItem addConfigurableMenuItem(Menu menu, final String orgText,
		final String acceleratorKey, SelectionListener listener) {
	char accelerator = Config.getInstance().getString(acceleratorKey)
			.toUpperCase().charAt(0);
	int acc = SWT.MOD1 + (accelerator == ' ' ? SWT.SPACE : accelerator);
	String text = orgText + " \t Ctrl+"
			+ (accelerator == ' ' ? "[space]" : accelerator);

	final MenuItem item = addMenuItem(menu, text, acc, listener);

	Config.getInstance().addPropertyChangeListener(
			new IPropertyChangeListener() {
				public void propertyChange(PropertyChangeEvent arg0) {
					if (arg0.getProperty().equals(acceleratorKey))
						updateAccelerator(item, orgText, Config
								.getInstance().getString(acceleratorKey)
								.toUpperCase().charAt(0));
				}
			});

	return item;
}
 
開發者ID:juanerasmoe,項目名稱:pmTrans,代碼行數:22,代碼來源:MenuManager.java

示例4: updateAccelerator

private void updateAccelerator(MenuItem item, String itemText,
		char newAccelerator) {
	itemText += " \t Ctrl+"
			+ (newAccelerator == ' ' ? "[space]" : newAccelerator);
	int acc = SWT.MOD1
			+ (newAccelerator == ' ' ? SWT.SPACE : newAccelerator);
	item.setText(itemText);
	item.setAccelerator(acc);
}
 
開發者ID:juanerasmoe,項目名稱:pmTrans,代碼行數:9,代碼來源:MenuManager.java

示例5: onMouseDown

@Override
public void onMouseDown ( final MouseState e )
{
    if ( e.button != 1 || e.state != SWT.MOD1 )
    {
        return;
    }

    final Rectangle rect = this.chartArea.getClientAreaProxy ().getClientRectangle ();

    // check if we are outside the chart area
    if ( e.x < rect.x || e.x > rect.x + rect.width )
    {
        return;
    }
    if ( e.y < rect.y || e.y > rect.y + rect.height )
    {
        return;
    }

    // now start dragging

    this.active = true;

    this.startX = e.x;
    this.startY = e.y;
}
 
開發者ID:eclipse,項目名稱:neoscada,代碼行數:27,代碼來源:MouseTransformer.java

示例6: mouseMove

@Override
public void mouseMove(MouseEvent e) {
	if (originMousePosition != null) {
		final FigureCanvas canvas = (FigureCanvas)timelineViewer.getControl();
		canvas.scrollTo(offset.x, offset.y - e.y + originMousePosition.y);
		final int shift = (int)((-e.x + originMousePosition.x)
				/ (PossibleStepEditPart.SIZE + BranchEditPart.SPACING) / rootEditPart
				.getZoomManager().getZoom())
				- doneShift;
		final int multiplier;
		if ((e.stateMask & SWT.MOD1) != 0) {
			multiplier = timelineWindow.getLength();
		} else {
			multiplier = 1;
		}
		if (follow && shift < 0) {
			toggleFollow();
		}
		if (timelineWindow.getStart() + shift * multiplier < 0) {
			timelineWindow.setStart(0);
		} else if (provider != null
				&& timelineWindow.getStart() + timelineWindow.getLength() + shift * multiplier > timelineWindow
						.getMaxTimelineIndex()
						+ nbVirtualChoices) {
			timelineWindow.setStart(Math.max(timelineWindow.getMaxTimelineIndex() + nbVirtualChoices
					- timelineWindow.getLength(), 0));
		} else if (shift != 0) {
			doneShift += shift;
			timelineWindow.setStart(timelineWindow.getStart() + shift * multiplier);
		}
	}
}
 
開發者ID:eclipse,項目名稱:gemoc-studio,代碼行數:32,代碼來源:AbstractTimelineView.java


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