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


Java VerifyEvent類代碼示例

本文整理匯總了Java中org.eclipse.swt.events.VerifyEvent的典型用法代碼示例。如果您正苦於以下問題:Java VerifyEvent類的具體用法?Java VerifyEvent怎麽用?Java VerifyEvent使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


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

示例1: doExit

import org.eclipse.swt.events.VerifyEvent; //導入依賴的package包/類
/**
 * {@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;
	}
	}
}
 
開發者ID:eclipse,項目名稱:n4js,代碼行數:27,代碼來源:IdentifierExitPolicy.java

示例2: attachKeyValidator

import org.eclipse.swt.events.VerifyEvent; //導入依賴的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

示例3: initializeViewer

import org.eclipse.swt.events.VerifyEvent; //導入依賴的package包/類
private void initializeViewer(IDocument document) {
	fAnnotationPreferences = EditorsPlugin.getDefault().getMarkerAnnotationPreferences();
	setDocument(document);
	installViewerConfiguration();
	setEditable(true);
	Font font = JFaceResources.getFontRegistry().get(JFaceResources.TEXT_FONT);
	getTextWidget().setFont(font);
	getTextWidget().setData("document",document);
	Control control = getControl();
	GridData data = new GridData(GridData.FILL_BOTH);
	control.setLayoutData(data);
	prependVerifyKeyListener(new VerifyKeyListener() {

		@Override
		public void verifyKey(VerifyEvent event) {
			handleVerifyKeyPressed(event);
		}
	});
	addDocumentListener(document);
}
 
開發者ID:capitalone,項目名稱:Hydrograph,代碼行數:21,代碼來源:SourceViewer.java

示例4: addVerifyListnerToOutputEditingSupport

import org.eclipse.swt.events.VerifyEvent; //導入依賴的package包/類
public static void addVerifyListnerToOutputEditingSupport(JoinMappingEditingSupport outputEditingSupport) {
	((Text)outputEditingSupport.getEditor().getControl()).addVerifyListener(new VerifyListener() {
		
		@Override
		public void verifyText(VerifyEvent e) {
			String text=e.text;
			Matcher matcher=Pattern.compile(Constants.REGEX).matcher(text);
			
			if(matcher.matches()){
				e.doit=true;
			}else{
				e.doit=false;
			}
		}
	});
}
 
開發者ID:capitalone,項目名稱:Hydrograph,代碼行數:17,代碼來源:WidgetUtility.java

示例5: createJumpPageTextBox

import org.eclipse.swt.events.VerifyEvent; //導入依賴的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

示例6: validateForSingleAndDuplicateCharacter

import org.eclipse.swt.events.VerifyEvent; //導入依賴的package包/類
private void validateForSingleAndDuplicateCharacter(VerifyEvent e, String textBoxValue,
		ControlDecoration singleCharactorDecorator, ControlDecoration duplicateDecorator, ControlDecoration emptyDecorator) {
	singleCharactorDecorator.hide();
	duplicateDecorator.hide();
	emptyDecorator.hide();
	String value = ((Text) e.widget).getText();
	String currentValue = (value.substring(0, e.start) + e.text + value.substring(e.end));
	if (StringUtils.isNotEmpty(currentValue)) {
		validateDelimiterAndQuoteCharactorProperty(currentValue, textBoxValue, singleCharactorDecorator,
				duplicateDecorator);
	} else {
		getButton(0).setEnabled(false);
		emptyDecorator.show();
		warningLabel.setText(Messages.WARNING_MESSAGE);
		warningLabel.setVisible(true);
		warningImageLabel.setVisible(true);
	}
}
 
開發者ID:capitalone,項目名稱:Hydrograph,代碼行數:19,代碼來源:ViewDataPreferencesDialog.java

示例7: refreshThePaletteBasedOnSearchString

import org.eclipse.swt.events.VerifyEvent; //導入依賴的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

示例8: UndoRedoManager

import org.eclipse.swt.events.VerifyEvent; //導入依賴的package包/類
/**
 * Constructor. Creates data structures and adds listener to note modifications.
 * 
 * @param note
 */
public UndoRedoManager(final Note note) {
	undoDeque = new ArrayDeque<>();
	redoDeque = new ArrayDeque<>();
	this.note = note;

	// Listen to text modifications.
	note.addVerifyListener(new VerifyListener() {
		@Override
		public void verifyText(VerifyEvent event) {
			// Last modification was due to an undo/redo action: do not record it.
			if (lastActionUndoOrRedo) {
				lastActionUndoOrRedo = false;
				return;
			}
			recordNoteModification(event, note.getStyleRanges());
		}
	});
}
 
開發者ID:PyvesB,項目名稱:Notepad4e,代碼行數:24,代碼來源:UndoRedoManager.java

示例9: recordNoteModification

import org.eclipse.swt.events.VerifyEvent; //導入依賴的package包/類
/**
 * Records history for undo/redo functions.
 * 
 * @param event
 * @param styles
 */
public void recordNoteModification(VerifyEvent event, StyleRange[] styles) {
	// Previous action cannot be an undo: empty redo deque and remove stylesBeforeUndo.
	redoDeque.clear();
	stylesBeforeUndo = null;

	// Construct modification record depending on whether the function was called by a style or a text
	// modification and push it on the deque.
	if (event != null) {
		undoDeque.push(new ModificationRecord(styles, event.start, event.text.length(),
				note.getText().substring(event.start, event.end), event.text));
	} else {
		undoDeque.push(new ModificationRecord(styles, 0, 0, null, null));
	}

	// Limit maximum size of deque by clearing oldest records.
	if (undoDeque.size() > MAX_DEQUE_SIZES) {
		undoDeque.pollLast();
	}
}
 
開發者ID:PyvesB,項目名稱:Notepad4e,代碼行數:26,代碼來源:UndoRedoManager.java

示例10: createPackageField

import org.eclipse.swt.events.VerifyEvent; //導入依賴的package包/類
private void createPackageField(Composite parent) {
  Label packageNameLabel = new Label(parent, SWT.LEAD);
  packageNameLabel.setText(Messages.getString("java.package")); //$NON-NLS-1$
  javaPackageField = new Text(parent, SWT.BORDER);
  javaPackageField.addModifyListener(new ModifyListener() {
    @Override
    public void modifyText(ModifyEvent e) {
      revalidate();
    }
  });
  javaPackageField.addVerifyListener(new VerifyListener() {
    @Override
    public void verifyText(VerifyEvent event) {
      // if the user ever changes the package name field, then we never auto-generate again.
      if (!javaPackageProgrammaticUpdate) {
        autoGeneratePackageName = false;
      }
    }
  });
}
 
開發者ID:GoogleCloudPlatform,項目名稱:google-cloud-eclipse,代碼行數:21,代碼來源:AppEngineWizardPage.java

示例11: doExit

import org.eclipse.swt.events.VerifyEvent; //導入依賴的package包/類
public ExitFlags doExit(LinkedModeModel model, VerifyEvent event, int offset, int length) {
    
    if (fSize == fStack.size() && !isMasked(offset)) {
        if (event.character == fExitCharacter) {
            BracketLevel level= (BracketLevel) fStack.peek();
            if (level.fFirstPosition.offset > offset || level.fSecondPosition.offset < offset)
                return null;
            if (level.fSecondPosition.offset == offset && length == 0)
                // don't enter the character if if its the closing peer
                return new ExitFlags(ILinkedModeListener.UPDATE_CARET, false);
        }
        // when entering an anonymous class between the parenthesis', we don't want
        // to jump after the closing parenthesis when return is pressed
        if (event.character == SWT.CR && offset > 0) {
            IDocument document= sourceViewer.getDocument();
            try {
                if (document.getChar(offset - 1) == '{')
                    return new ExitFlags(ILinkedModeListener.EXIT_ALL, true);
            } catch (BadLocationException e) {
            }
        }
    }
    return null;
}
 
開發者ID:eclipse,項目名稱:texlipse,代碼行數:25,代碼來源:BracketInserter.java

示例12: preventDelAndBackspace

import org.eclipse.swt.events.VerifyEvent; //導入依賴的package包/類
private void preventDelAndBackspace(VerifyEvent e) {
	// one char max between start and end
	boolean isSingleSelect = (e.end - e.start < 2); // (e.start == e.end);
	
	// prevent backspace on start of line
	int xIndex = getCurrentXIndex();
	if (lastKeyCode == SWT.BS && xIndex == 0 && isSingleSelect && e.text.equals("")) { 
		logger.debug("preventing bs");
		e.doit = false;
		return;
	}
	
	// prevent del on end of line
	int lineLength = text.getLine(text.getLineAtOffset(text.getCaretOffset())).length();
	if (lastKeyCode == SWT.DEL && xIndex == lineLength && isSingleSelect && e.text.equals("")) { 
		logger.debug("preventing del");
		e.doit = false;
		return;
	}
}
 
開發者ID:Transkribus,項目名稱:TranskribusSwtGui,代碼行數:21,代碼來源:LineTranscriptionWidget.java

示例13: doExit

import org.eclipse.swt.events.VerifyEvent; //導入依賴的package包/類
@Override
public ExitFlags doExit(LinkedModeModel model, VerifyEvent event, int offset, int length) {
	if (length == 0 && (event.character == SWT.BS || event.character == SWT.DEL)) {
		LinkedPosition position= model.findPosition(new LinkedPosition(fDocument, offset, 0, LinkedPositionGroup.NO_STOP));
		if (position != null) {
			if (event.character == SWT.BS) {
				if (offset - 1 < position.getOffset()) {
					//skip backspace at beginning of linked position
					event.doit= false;
				}
			} else /* event.character == SWT.DEL */ {
				if (offset + 1 > position.getOffset() + position.getLength()) {
					//skip delete at end of linked position
					event.doit= false;
				}
			}
		}
	}

	return null; // don't change behavior
}
 
開發者ID:angelozerr,項目名稱:typescript.java,代碼行數:22,代碼來源:LinkedNamesAssistProposal.java

示例14: handleVerifyKeyPressed

import org.eclipse.swt.events.VerifyEvent; //導入依賴的package包/類
private void handleVerifyKeyPressed(VerifyEvent event) {
	if (!event.doit)
		return;

	if (event.stateMask != SWT.MOD1)
		return;

	switch (event.character) {
	case ' ':
		fPatternEditor.doOperation(ISourceViewer.CONTENTASSIST_PROPOSALS);
		event.doit = false;
		break;

	// CTRL-Z
	case 'z' - 'a' + 1:
		fPatternEditor.doOperation(ITextOperationTarget.UNDO);
		event.doit = false;
		break;
	}
}
 
開發者ID:angelozerr,項目名稱:typescript.java,代碼行數:21,代碼來源:EditTemplateDialog.java

示例15: doExit

import org.eclipse.swt.events.VerifyEvent; //導入依賴的package包/類
public ExitFlags doExit(LinkedModeModel model, VerifyEvent event, int offset, int length) {

			if (fSize == fStack.size() && !isMasked(offset)) {
				if (event.character == fExitCharacter) {
					BracketLevel level = (BracketLevel) fStack.peek();
					if (level.fFirstPosition.offset > offset || level.fSecondPosition.offset < offset)
						return null;
					if (level.fSecondPosition.offset == offset && length == 0)
						// don't enter the character if if its the closing peer
						return new ExitFlags(ILinkedModeListener.UPDATE_CARET, false);
				}
				// when entering an anonymous class between the parenthesis', we
				// don't want
				// to jump after the closing parenthesis when return is pressed
				if (event.character == SWT.CR && offset > 0) {
					IDocument document = getSourceViewer().getDocument();
					try {
						if (document.getChar(offset - 1) == '{')
							return new ExitFlags(ILinkedModeListener.EXIT_ALL, true);
					} catch (BadLocationException e) {
					}
				}
			}
			return null;
		}
 
開發者ID:angelozerr,項目名稱:typescript.java,代碼行數:26,代碼來源:BracketInserter.java


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