本文整理汇总了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;
}
示例2: mouseScrolled
@Override
public void mouseScrolled(MouseEvent e) {
if ((e.stateMask & SWT.MOD1) != 0) {
zoom(e);
} else {
scroll(e);
}
}
示例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;
}
示例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);
}
示例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;
}
示例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);
}
}
}