本文整理汇总了Java中org.eclipse.jface.viewers.ICellEditorValidator类的典型用法代码示例。如果您正苦于以下问题:Java ICellEditorValidator类的具体用法?Java ICellEditorValidator怎么用?Java ICellEditorValidator使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ICellEditorValidator类属于org.eclipse.jface.viewers包,在下文中一共展示了ICellEditorValidator类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: validateTargetFieldCells
import org.eclipse.jface.viewers.ICellEditorValidator; //导入依赖的package包/类
/**
* The Function will validate Target table values
* @param text
*/
private ICellEditorValidator validateTargetFieldCells(String message){
ICellEditorValidator propertyValidator = new ICellEditorValidator() {
@Override
public String isValid(Object value) {
isAnyUpdatePerformed = true;
String valueToValidate = String.valueOf(value).trim();
if(!sourceFieldsList.isEmpty()){
if(!sourceFieldsList.contains(valueToValidate)){
lblPropertyError.setVisible(true);
lblPropertyError.setText(message);
targetTable.getItem(targetTable.getSelectionIndex()).setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_RED));
okButton.setEnabled(false);
}else{
okButton.setEnabled(true);
lblPropertyError.setVisible(false);
lblPropertyError.setText("");
targetTable.getItem(targetTable.getSelectionIndex()).setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_BLACK));
}
}
validateTargetFieldOnDrop();
return null;
}
};
return propertyValidator;
}
示例2: createValueEditorValidator
import org.eclipse.jface.viewers.ICellEditorValidator; //导入依赖的package包/类
private ICellEditorValidator createValueEditorValidator(final String ErrorMessage) {
ICellEditorValidator propertyValidator = new ICellEditorValidator() {
@Override
public String isValid(Object value) {
isAnyUpdatePerformed = true;
targetTable.getItem(targetTable.getSelectionIndex()).getText();
String valueToValidate = String.valueOf(value).trim();
if (valueToValidate.isEmpty()) {
lblPropertyError.setText(ErrorMessage);
lblPropertyError.setVisible(true);
return Constants.ERROR; //$NON-NLS-1$
} else {
lblPropertyError.setVisible(false);
}
return null;
}
};
return propertyValidator;
}
示例3: createValueEditorValidator
import org.eclipse.jface.viewers.ICellEditorValidator; //导入依赖的package包/类
private ICellEditorValidator createValueEditorValidator(final String ErrorMessage) {
ICellEditorValidator propertyValidator = new ICellEditorValidator() {
@Override
public String isValid(Object value) {
isAnyUpdatePerformed = true;
String valueToValidate = String.valueOf(value).trim();
if (valueToValidate.isEmpty()) {
lblPropertyError.setText(ErrorMessage);
lblPropertyError.setVisible(true);
return ERROR; //$NON-NLS-1$
} else {
lblPropertyError.setVisible(false);
}
return null;
}
};
return propertyValidator;
}
示例4: setMinValidator
import org.eclipse.jface.viewers.ICellEditorValidator; //导入依赖的package包/类
private void setMinValidator() {
this.minValidator = new ICellEditorValidator() {
@Override
public String isValid(Object min) {
if (min != null) {
if ((max != null && (Float) min > max)) {
return "Min can't be bigger than max";
} else if (minRange != null && (Float) min > minRange) {
return "Min can't be bigger than maxRange";
} else if (maxRange != null && (Float) min > maxRange) {
return "Min can't be bigger than maxRange";
} else if (value != null && (Float) min > value) {
return "Min can't be bigger than value";
}
}
return null;
}
};
}
示例5: setMaxValidator
import org.eclipse.jface.viewers.ICellEditorValidator; //导入依赖的package包/类
private void setMaxValidator() {
this.maxValidator = new ICellEditorValidator() {
@Override
public String isValid(Object max) {
if (max != null) {
if (min != null && (Float) max < min) {
return "Max can't be smaller than maxRange";
} else if (maxRange != null && (Float) max < maxRange) {
return "Max can't be smaller than maxRange";
} else if (minRange != null && (Float) max < minRange) {
return "Max can't be smaller than minRange";
} else if (value != null && (Float) max < value) {
return "Max can't be smaller than value";
}
}
return null;
}
};
}
示例6: setMinRangeValidator
import org.eclipse.jface.viewers.ICellEditorValidator; //导入依赖的package包/类
private void setMinRangeValidator() {
this.minRangeValidator = new ICellEditorValidator() {
@Override
public String isValid(Object minRange) {
if (minRange != null) {
if ((min != null && (Float) minRange < min)) {
return "MinRange can't be smaller than min";
} else if ((max != null && (Float) minRange > max)) {
return "MinRange can't be bigger than max";
} else if (value != null && (Float) minRange > value) {
return "MinRange can't be bigger than value";
} else if (maxRange != null && (Float) minRange > maxRange) {
return "MinRange can't be bigger than maxRange";
}
}
return null;
}
};
}
示例7: setMaxRangeValidator
import org.eclipse.jface.viewers.ICellEditorValidator; //导入依赖的package包/类
private void setMaxRangeValidator() {
this.maxRangeValidator = new ICellEditorValidator() {
@Override
public String isValid(Object maxRange) {
if (maxRange != null) {
if (min != null && (Float) maxRange < min) {
return "MaxRange can't be smaller than min";
} else if (max != null && (Float) maxRange > max) {
return "MaxRange can't be bigger than max";
} else if (minRange != null && (Float) maxRange < minRange) {
return "MaxRange can't be smaller than minRange";
} else if (value != null && (Float) maxRange < value) {
return "MaxRange can't be smaller than value";
}
}
return null;
}
};
}
示例8: setValueValidator
import org.eclipse.jface.viewers.ICellEditorValidator; //导入依赖的package包/类
private void setValueValidator() {
this.valueValidator = new ICellEditorValidator() {
@Override
public String isValid(Object value) {
if (value != null) {
if (minRange != null && (Float) value < minRange) {
return "Value can't be smaller than minRange";
} else if (maxRange != null && (Float) value > maxRange) {
return "Value can't be bigger than maxRange";
} else if (minRange == null && min != null && (Float) value < min) {
return "Value can't be smaller than min";
} else if (maxRange == null && max != null && (Float) value > max) {
return "Value can't be bigger than max";
}
}
return null;
}
};
}
示例9: getFieldValidator
import org.eclipse.jface.viewers.ICellEditorValidator; //导入依赖的package包/类
@Override
protected ICellEditorValidator getFieldValidator(Field f) {
String fieldName = f.getName();
if (fieldName.equals(PROP_MIN)){
return minValidator;
} else if (fieldName.equals(PROP_MAX)){
return maxValidator;
} else if (fieldName.equals(PROP_MIN_RANGE)){
return minRangeValidator;
} else if (fieldName.equals(PROP_MAX_RANGE)){
return maxRangeValidator;
} else if (fieldName.equals(PROP_VALUE)){
return valueValidator;
}
return super.getFieldValidator(f);
}
示例10: getPropertyDescriptors
import org.eclipse.jface.viewers.ICellEditorValidator; //导入依赖的package包/类
@Override
public IPropertyDescriptor[] getPropertyDescriptors() {
List<IPropertyDescriptor> fullList = new ArrayList<IPropertyDescriptor>();
fullList.addAll(Arrays.asList(super.getPropertyDescriptors()));
TextPropertyDescriptor tpd = new TextPropertyDescriptor(PRP_TAB_NUM, PRP_TAB_NUM);
tpd.setValidator(new ICellEditorValidator() {
@Override
public String isValid(Object value) {
int intValue = -1;
try {
intValue = Integer.parseInt((String) value);
} catch (NumberFormatException exc) {
return "Not a number";
}
return (intValue >= 2) ? null : "Value must be >= 2";
}
});
fullList.add(tpd);
return fullList.toArray(new IPropertyDescriptor[fullList.size()]);
}
示例11: getFieldValidator
import org.eclipse.jface.viewers.ICellEditorValidator; //导入依赖的package包/类
protected ICellEditorValidator getFieldValidator(Field f){
if (f.isAnnotationPresent(FloatValueRange.class)) {
FloatValueRange valueRange = f.getAnnotation(FloatValueRange.class);
float minValue = valueRange.from();
float maxValue = valueRange.to();
String type = valueRange.type();
MinmaxValidator minmaxValidator = null;
if (MinmaxValidator.MIN_ONLY.equals(type)){
minmaxValidator = new MinmaxValidator(minValue, MinmaxValidator.MIN_ONLY);
} else if (MinmaxValidator.MAX_ONLY.equals(type)){
minmaxValidator = new MinmaxValidator(minValue, MinmaxValidator.MAX_ONLY);
} else {
minmaxValidator = new MinmaxValidator(minValue, maxValue);
}
return minmaxValidator;
}
return null;
}
示例12: getCellEditor
import org.eclipse.jface.viewers.ICellEditorValidator; //导入依赖的package包/类
@Override
public CellEditor getCellEditor(Object element) {
TextCellEditor textCellEditor = new TextCellEditor((Composite) getViewer().getControl());
textCellEditor.setValidator(new ICellEditorValidator() {
public String isValid(Object value) {
try {
Long.parseLong((String) value);
} catch (NumberFormatException e) {
return "No valid integer value!";
}
return null;
}
});
return textCellEditor;
}
示例13: getCellEditor
import org.eclipse.jface.viewers.ICellEditorValidator; //导入依赖的package包/类
@Override
public CellEditor getCellEditor(Object element) {
TextCellEditor textCellEditor = new TextCellEditor((Composite) getViewer().getControl());
textCellEditor.setValidator(new ICellEditorValidator() {
public String isValid(Object value) {
String stringValue = (String) value;
try {
Double.parseDouble(stringValue);
} catch (NumberFormatException e) {
return "No valid real value!";
}
return null;
}
});
return textCellEditor;
}
示例14: evaluationDescriptor
import org.eclipse.jface.viewers.ICellEditorValidator; //导入依赖的package包/类
/**
* @param descriptors
* @param attr
* @param propertyid
*/
private void evaluationDescriptor(Collection descriptors, EStructuralFeature attr, PropertyID propertyid) {
if (attr.getName() == "evaluation") { //$NON-NLS-1$
TextPropertyDescriptor pd = new TextPropertyDescriptor(propertyid, "evaluationLevel (100 to -100)"); //$NON-NLS-1$
((PropertyDescriptor) pd).setValidator(new ICellEditorValidator() {
public String isValid(Object value) {
int intValue = -1;
try {
intValue = Integer.parseInt((String) value);
return null;
} catch (NumberFormatException exc) {
return "Not Number"; //$NON-NLS-1$
}
}
});
pd.setCategory("Strategy"); //$NON-NLS-1$
descriptors.add(pd);
}
}
示例15: getValidator
import org.eclipse.jface.viewers.ICellEditorValidator; //导入依赖的package包/类
protected ICellEditorValidator getValidator(String propertyName) {
return new ICellEditorValidator() {
@Override
public String isValid(Object value) {
if (!acceptSymbols() && isSymbolValue(value)) {
return "Symbols are not allowed for this component";
}
return null;
}
};
}