本文整理汇总了Java中org.eclipse.swt.SWT.CR属性的典型用法代码示例。如果您正苦于以下问题:Java SWT.CR属性的具体用法?Java SWT.CR怎么用?Java SWT.CR使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.eclipse.swt.SWT
的用法示例。
在下文中一共展示了SWT.CR属性的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: doExit
/**
* {@inheritDoc}
*
* If the entered character is not a valid identifier part, it is processed after linked editing has been quit.
* Exceptions are the {@link #exitCharacters} that have been passed into the constructor.
*/
@Override
public ExitFlags doExit(LinkedModeModel environment, VerifyEvent event, int offset, int length) {
if (event.character == '\0')
return null;
for (char c : exitCharacters) {
if (event.character == c) {
return new ExitFlags(ILinkedModeListener.UPDATE_CARET, false);
}
}
switch (event.character) {
case SWT.CR:
return new ExitFlags(ILinkedModeListener.UPDATE_CARET, false);
default: {
if (!Character.isJavaIdentifierPart(event.character)) {
return new ExitFlags(ILinkedModeListener.UPDATE_CARET, true);
}
return null;
}
}
}
示例2: 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;
}
};
}
示例3: doExit
@Override
public ExitFlags doExit(LinkedModeModel environment, VerifyEvent event, int offset, int length) {
if (event.character == fExitCharacter) {
if (environment.anyPositionContains(offset))
return new ExitFlags(ILinkedModeListener.UPDATE_CARET, false);
else
return new ExitFlags(ILinkedModeListener.UPDATE_CARET, true);
}
switch (event.character) {
case ';':
return new ExitFlags(ILinkedModeListener.NONE, true);
case SWT.CR:
// when entering an anonymous class as a parameter, we don't
// want
// to jump after the parenthesis when return is pressed
if (offset > 0) {
try {
if (fDocument.getChar(offset - 1) == '{')
return new ExitFlags(ILinkedModeListener.EXIT_ALL, true);
} catch (BadLocationException e) {
}
}
return null;
default:
return null;
}
}
示例4: handleEvent
public void handleEvent(Event event) {
switch (event.type) {
case SWT.KeyDown:
if (event.character == SWT.CR)
controlChanged((Control) event.widget);
break;
case SWT.FocusOut:
controlChanged((Control) event.widget);
break;
}
}