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


Java Text.addVerifyListener方法代码示例

本文整理汇总了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();
			}
		}
	});
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:25,代码来源:ParameterGridDialog.java

示例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);

}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:25,代码来源:DebugDataViewer.java

示例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);
				}
		}
	});
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:26,代码来源:CustomPaletteViewer.java


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