本文整理匯總了Java中org.eclipse.jface.preference.IntegerFieldEditor.setErrorMessage方法的典型用法代碼示例。如果您正苦於以下問題:Java IntegerFieldEditor.setErrorMessage方法的具體用法?Java IntegerFieldEditor.setErrorMessage怎麽用?Java IntegerFieldEditor.setErrorMessage使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.jface.preference.IntegerFieldEditor
的用法示例。
在下文中一共展示了IntegerFieldEditor.setErrorMessage方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: createPollChangesIntervalGroup
import org.eclipse.jface.preference.IntegerFieldEditor; //導入方法依賴的package包/類
private void createPollChangesIntervalGroup(Composite composite) {
Composite groupComposite = new Composite(composite, SWT.LEFT);
GridLayout layout = new GridLayout();
layout.numColumns = 2;
groupComposite.setLayout(layout);
GridData gd = new GridData();
gd.horizontalAlignment = GridData.FILL;
gd.grabExcessHorizontalSpace = true;
groupComposite.setLayoutData(gd);
pollChangesInterval = new IntegerFieldEditor(POLL_CHANGES_INTERVAL_PREF, "Poll changes interval (seconds)",
groupComposite);
pollChangesInterval.setTextLimit(Integer.toString(MAX_POLL_CHANGES_INTERVAL).length());
pollChangesInterval.setErrorMessage("The workspace save interval should be between 30 and 9999.");
pollChangesInterval.setValidateStrategy(StringFieldEditor.VALIDATE_ON_KEY_STROKE);
pollChangesInterval.setValidRange(MIN_POLL_CHANGES_INTERVAL, MAX_POLL_CHANGES_INTERVAL);
pollChangesInterval.setPropertyChangeListener(event -> {
if (event.getProperty().equals(FieldEditor.IS_VALID)) {
setValid(pollChangesInterval.isValid());
}
});
addField(pollChangesInterval);
}
示例2: showErrorMessage
import org.eclipse.jface.preference.IntegerFieldEditor; //導入方法依賴的package包/類
/**
* @param editor
* @param message
* @param validState
* Display error message
*/
private void showErrorMessage(IntegerFieldEditor editor, String message,boolean validState) {
setErrorMessage(message);
editor.setErrorMessage(message);
setValid(validState);
}
示例3: validationForIntegerField
import org.eclipse.jface.preference.IntegerFieldEditor; //導入方法依賴的package包/類
private void validationForIntegerField(String value, IntegerFieldEditor editor, String message){
if(StringUtils.isBlank(value) || !value.matches("\\d+") || value.equalsIgnoreCase("0")){
setErrorMessage(message);
editor.setErrorMessage(message);
setValid(false);
}else{
setErrorMessage(null);
editor.setErrorMessage("");
setValid(true);
checkState();
}
}
示例4: newMinimumRangeFieldEditor
import org.eclipse.jface.preference.IntegerFieldEditor; //導入方法依賴的package包/類
private IntegerFieldEditor newMinimumRangeFieldEditor(String name, String labelText,
int minimumValue, String errorMessagePrefix, Composite parent) {
IntegerFieldEditor editor = new IntegerFieldEditor(name, labelText, parent);
editor.setValidRange(minimumValue, Integer.MAX_VALUE);
// Overriding the error message defined by "setValidRange, ".
editor.setErrorMessage(errorMessagePrefix + " must be no less than " + minimumValue);
return editor;
}
示例5: createFieldEditors
import org.eclipse.jface.preference.IntegerFieldEditor; //導入方法依賴的package包/類
@Override
protected void createFieldEditors() {
portField = new IntegerFieldEditor(PORT, "Port number: ", getFieldEditorParent(), 5);
portField.setValidRange(1, 65536);
portField.setValidateStrategy(IntegerFieldEditor.VALIDATE_ON_FOCUS_LOST);
portField.setErrorMessage(String.format("Port number is not valid valid (1-65536).", portField.getStringValue()));
addField(portField);
final String[][] entries = new String[][] { //
new String[] { "On", Boolean.TRUE.toString() }, //
new String[] { "Off", Boolean.FALSE.toString() } };
enabledField = new ComboFieldEditor(ENABLED, "Switch ON/OFF", entries, getFieldEditorParent());
addField(enabledField);
}
示例6: createBacklogField
import org.eclipse.jface.preference.IntegerFieldEditor; //導入方法依賴的package包/類
private void createBacklogField(Composite composite) {
backlogEditor = new IntegerFieldEditor(ILogViewerConstants.PREF_BACKLOG,LogViewerPlugin.getResourceString("preferences.backlog.label.text"),composite); //$NON-NLS-1$
backlogEditor.setPreferenceStore(doGetPreferenceStore());
backlogEditor.setPage(this);
backlogEditor.setTextLimit(Integer.toString(ILogViewerConstants.MAX_BACKLOG).length());
backlogEditor.setErrorMessage(LogViewerPlugin.getResourceString("preferences.backlog.label.errortext",new Object[]{new Integer(ILogViewerConstants.MAX_BACKLOG)})); //$NON-NLS-1$
backlogEditor.setValidateStrategy(StringFieldEditor.VALIDATE_ON_KEY_STROKE);
backlogEditor.setValidRange(0,ILogViewerConstants.MAX_BACKLOG);
backlogEditor.load();
backlogEditor.setPropertyChangeListener(validityChangeListener);
}
示例7: createReadBufferField
import org.eclipse.jface.preference.IntegerFieldEditor; //導入方法依賴的package包/類
private void createReadBufferField(Composite composite) {
bufferEditor = new IntegerFieldEditor(ILogViewerConstants.PREF_BUFFER,LogViewerPlugin.getResourceString("preferences.buffer.label.text"),composite); //$NON-NLS-1$
bufferEditor.setPreferenceStore(doGetPreferenceStore());
bufferEditor.setPage(this);
bufferEditor.setTextLimit(Integer.toString(ILogViewerConstants.MAX_TAIL_BUFFER_SIZE).length());
bufferEditor.setErrorMessage(LogViewerPlugin.getResourceString("preferences.buffer.label.errortext",new Object[]{new Integer(ILogViewerConstants.MAX_TAIL_BUFFER_SIZE)})); //$NON-NLS-1$
bufferEditor.setValidateStrategy(StringFieldEditor.VALIDATE_ON_KEY_STROKE);
bufferEditor.setValidRange(0,ILogViewerConstants.MAX_TAIL_BUFFER_SIZE);
bufferEditor.load();
bufferEditor.setPropertyChangeListener(validityChangeListener);
}
示例8: createReadWaitField
import org.eclipse.jface.preference.IntegerFieldEditor; //導入方法依賴的package包/類
private void createReadWaitField(Composite composite) {
readWaitEditor = new IntegerFieldEditor(ILogViewerConstants.PREF_READWAIT,LogViewerPlugin.getResourceString("preferences.readwait.label.text"),composite); //$NON-NLS-1$
readWaitEditor.setPreferenceStore(doGetPreferenceStore());
readWaitEditor.setPage(this);
readWaitEditor.setTextLimit(Integer.toString(ILogViewerConstants.MAX_READWAIT_SIZE).length());
readWaitEditor.setErrorMessage(LogViewerPlugin.getResourceString("preferences.readwait.label.errortext",new Object[]{new Integer(ILogViewerConstants.MAX_READWAIT_SIZE)})); //$NON-NLS-1$
readWaitEditor.setValidateStrategy(StringFieldEditor.VALIDATE_ON_KEY_STROKE);
readWaitEditor.setValidRange(0,ILogViewerConstants.MAX_READWAIT_SIZE);
readWaitEditor.load();
readWaitEditor.setPropertyChangeListener(validityChangeListener);
}
示例9: createFieldEditors
import org.eclipse.jface.preference.IntegerFieldEditor; //導入方法依賴的package包/類
/**
* Creates the field editors. Field editors are abstractions of the common
* GUI blocks needed to manipulate various types of preferences. Each field
* editor knows how to save and restore itself.
*/
@Override
public void createFieldEditors() {
Composite parent = this.getFieldEditorParent();
IntegerFieldEditor cohortSizeEditor = new IntegerFieldEditor(PreferenceConstants.P_COHORT_SIZE,
"Cohort size in Dashboard charts: ", parent);
cohortSizeEditor.setValidRange(1, 99);
cohortSizeEditor.setErrorMessage("You must set a cohort size value greater then 0 but smaller then 99.");
this.addField(cohortSizeEditor);
}
示例10: showErrorMessage
import org.eclipse.jface.preference.IntegerFieldEditor; //導入方法依賴的package包/類
private void showErrorMessage(IntegerFieldEditor editor, String message,boolean validState) {
setErrorMessage(message);
editor.setErrorMessage(message);
setValid(validState);
}