本文整理汇总了Java中org.eclipse.swt.widgets.Text.addVerifyListener方法的典型用法代码示例。如果您正苦于以下问题:Java Text.addVerifyListener方法的具体用法?Java Text.addVerifyListener怎么用?Java Text.addVerifyListener使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.swt.widgets.Text
的用法示例。
在下文中一共展示了Text.addVerifyListener方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: attachKeyValidator
import org.eclipse.swt.widgets.Text; //导入方法依赖的package包/类
private void attachKeyValidator(final Text text) {
text.addVerifyListener(new VerifyListener() {
@Override
public void verifyText(VerifyEvent e) {
txtDecorator.hide();
String currentText = ((Text) e.widget).getText();
String newName = (currentText.substring(0, e.start) + e.text + currentText.substring(e.end));
Matcher matchName = Pattern.compile("[\\@]{1}[\\{]{1}[\\w]*[\\}]{1}||[\\w]*").matcher(newName);
if(!matchName.matches()){
text.setToolTipText(Messages.CHARACTERSET);
txtDecorator=WidgetUtility.addDecorator(text,Messages.CHARACTERSET);
txtDecorator.setDescriptionText(Messages.CHARACTERSET);
txtDecorator.show();
e.doit=false;
}
else
{
text.setToolTipText("");
text.setMessage("");
txtDecorator.hide();
}
}
});
}
示例2: createJumpPageTextBox
import org.eclipse.swt.widgets.Text; //导入方法依赖的package包/类
private void createJumpPageTextBox(Composite composite_3) {
Text jumpPageTextBox = new Text(composite_3, SWT.BORDER);
jumpPageTextBox.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
jumpPageTextBox.addVerifyListener(new VerifyListener() {
@Override
public void verifyText(VerifyEvent e) {
String currentText = ((Text) e.widget).getText();
String pageNumberText = currentText.substring(0, e.start) + e.text + currentText.substring(e.end);
try {
long pageNumber = Long.valueOf(pageNumberText);
if (pageNumber < 1) {
e.doit = false;
}
} catch (NumberFormatException ex) {
if (!pageNumberText.equals(""))
e.doit = false;
}
}
});
dataViewerListeners.attachJumpPageListener(jumpPageTextBox);
windowControls.put(ControlConstants.JUMP_TEXT, jumpPageTextBox);
}
示例3: refreshThePaletteBasedOnSearchString
import org.eclipse.swt.widgets.Text; //导入方法依赖的package包/类
private void refreshThePaletteBasedOnSearchString(final PaletteRoot paletteRoot,
final ELTGraphicalEditor editor, final Map<String, PaletteDrawer> categoryPaletteContainer,
final Text text, final List<Component> componentsConfig, final Composite container) {
text.addVerifyListener(new VerifyListener() {
@Override
public void verifyText(VerifyEvent e) {
boolean matchFound = false;
final List<Component> matchingComponents = new ArrayList<>();
paletteRoot.getChildren().clear();
String currentText = ((Text) e.widget).getText();
createPaletteContainers(paletteRoot, categoryPaletteContainer, editor);
String searchedString = (currentText.substring(0, e.start) + e.text + currentText.substring(e.end))
.toUpperCase();
if (StringUtils.isEmpty(searchedString)) {
showAllContainers(paletteRoot, editor, categoryPaletteContainer, componentsConfig);
} else {
showOpenPaletteContainers(paletteRoot.getChildren());
matchFound = checkSearchedComponentFoundInPalette(editor, categoryPaletteContainer, componentsConfig,
matchingComponents, searchedString);
showMessageWhenComponentNotFound(container, matchFound);
showMatchingContainers(paletteRoot, categoryPaletteContainer, matchingComponents);
}
}
});
}