本文整理汇总了Java中org.eclipse.ui.views.properties.TextPropertyDescriptor.setValidator方法的典型用法代码示例。如果您正苦于以下问题:Java TextPropertyDescriptor.setValidator方法的具体用法?Java TextPropertyDescriptor.setValidator怎么用?Java TextPropertyDescriptor.setValidator使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.ui.views.properties.TextPropertyDescriptor
的用法示例。
在下文中一共展示了TextPropertyDescriptor.setValidator方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getPropertyDescriptors
import org.eclipse.ui.views.properties.TextPropertyDescriptor; //导入方法依赖的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()]);
}
示例2: getPropertyDescriptors
import org.eclipse.ui.views.properties.TextPropertyDescriptor; //导入方法依赖的package包/类
/**
* Children should override this. The default implementation returns an
* empty array.
*/
public IPropertyDescriptor[] getPropertyDescriptors() {
IPropertyDescriptor[] descr = new IPropertyDescriptor[descriptors.length + 1];
System.arraycopy(descriptors, 0, descr, 0, descriptors.length);
TextPropertyDescriptor nameDescr = new TextPropertyDescriptor(
PROPERTY_NAME, "Name");
nameDescr.setValidator(getDiagram().getUniqueNameValidator(this));
descr[descriptors.length] = nameDescr;
return descr;
}
示例3: getPropertyDescriptors
import org.eclipse.ui.views.properties.TextPropertyDescriptor; //导入方法依赖的package包/类
@Override
public IPropertyDescriptor[] getPropertyDescriptors() {
List<IPropertyDescriptor> props = new ArrayList<IPropertyDescriptor>();
TextPropertyDescriptor masterPropDes = new TextPropertyDescriptor(PROPERTY_MASTER_VIEW, PROPERTY_MASTER_VIEW);
masterPropDes.setValidator(getDiagram().getUniqueNameValidator(this));
props.add(masterPropDes);
TextPropertyDescriptor detailPropDes = new TextPropertyDescriptor(PROPERTY_DETAIL_VIEW, PROPERTY_DETAIL_VIEW);
detailPropDes.setValidator(getDiagram().getUniqueNameValidator(this));
props.add(detailPropDes);
props.add(new BooleanPropertyDescriptor(PROPERTY_SHOW_MASTER_IN_PORTRAIT, PROPERTY_SHOW_MASTER_IN_PORTRAIT,true));
return props.toArray(new IPropertyDescriptor[props.size()]);
}
示例4: getPropertyDescriptors
import org.eclipse.ui.views.properties.TextPropertyDescriptor; //导入方法依赖的package包/类
@Override
public IPropertyDescriptor[] getPropertyDescriptors() {
List<IPropertyDescriptor> props = new ArrayList<IPropertyDescriptor>();
TextPropertyDescriptor nameDescr = new TextPropertyDescriptor(PROPERTY_NAME, PROPERTY_NAME);
nameDescr.setValidator(getDiagram().getUniqueNameValidator(this));
props.add(nameDescr);
props.add(new TextPropertyDescriptor(TITLE_PROP, TITLE_PROP));
props.add(new TextPropertyDescriptor(TITLE_ID_PROP, TITLE_ID_PROP));
props.add(new TextPropertyDescriptor(OK_PROP, OK_PROP));
if (!getPlatform().isAndroid()) {
props.add(new TextPropertyDescriptor(OK_ID_PROP, OK_ID_PROP));
}
props.add(new TextPropertyDescriptor(MESSAGE_PROP, MESSAGE_PROP));
props.add(new TextPropertyDescriptor(MESSAGE_ID_PROP, MESSAGE_ID_PROP));
NumberPropertyDescriptor npd = new NumberPropertyDescriptor(PROPERTY_CHILDREN, "optionsCount",
NumberCellEditor.INTEGER, true);
// set Maximum number of buttons to 3 under Android platform
int maxValue = Platform.Android.equals(getPlatform()) ? 3 : 30;
npd.setValidator(new MinmaxValidator(1, maxValue));
props.add(npd);
npd = new NumberPropertyDescriptor(CANCEL_PROP, CANCEL_PROP, NumberCellEditor.INTEGER, true);
npd.setValidator(new MinmaxValidator(0, MinmaxValidator.MIN_ONLY));
props.add(npd);
return props.toArray(new IPropertyDescriptor[props.size()]);
}
示例5: getPropertyDescriptors
import org.eclipse.ui.views.properties.TextPropertyDescriptor; //导入方法依赖的package包/类
@Override
public IPropertyDescriptor[] getPropertyDescriptors() {
List<IPropertyDescriptor> props = new ArrayList<IPropertyDescriptor>();
TextPropertyDescriptor nameDescr = new TextPropertyDescriptor(
PROPERTY_NAME, PROPERTY_NAME);
nameDescr.setValidator(getDiagram().getUniqueNameValidator(this));
props.add(nameDescr);
props.add(new TextPropertyDescriptor(TITLE_PROP, TITLE_PROP));
props.add(new TextPropertyDescriptor(TITLE_ID_PROP, TITLE_ID_PROP));
NumberPropertyDescriptor npd = new NumberPropertyDescriptor(PROPERTY_CHILDREN,
"buttonsCount", NumberCellEditor.INTEGER, false);
npd.setValidator(new MinmaxValidator(2, 30));
props.add(npd);
npd = new NumberPropertyDescriptor(CANCEL_PROP,
CANCEL_PROP, NumberCellEditor.INTEGER, true);
npd.setValidator(new MinmaxValidator(0, MinmaxValidator.MIN_ONLY));
props.add(npd);
npd = new NumberPropertyDescriptor(DESTRUCTIVE_PROP,
DESTRUCTIVE_PROP, NumberCellEditor.INTEGER, true);
npd.setValidator(new MinmaxValidator(0, MinmaxValidator.MIN_ONLY));
props.add(npd);
if (getPlatform().isAndroid()){
npd = new NumberPropertyDescriptor(SELECTED_PROP,
SELECTED_PROP, NumberCellEditor.INTEGER, true);
npd.setValidator(new MinmaxValidator(0, MinmaxValidator.MIN_ONLY));
props.add(npd);
}
return props.toArray(new IPropertyDescriptor[props.size()]);
}
示例6: getPropertyDescriptors
import org.eclipse.ui.views.properties.TextPropertyDescriptor; //导入方法依赖的package包/类
@Override
public IPropertyDescriptor[] getPropertyDescriptors() {
List<IPropertyDescriptor> fullList = new ArrayList<IPropertyDescriptor>();
fullList.addAll(Arrays.asList(getPropertyDescriptorsForElement()));
TextPropertyDescriptor nameDescr = new TextPropertyDescriptor(PROPERTY_NAME, "name");
nameDescr.setValidator(getDiagram().getUniqueNameValidator(this));
fullList.add(nameDescr);
// now get all descriptors for all the properties that we have ...
// Note : To do : We need some advanced collapsible editor
return fullList.toArray(new IPropertyDescriptor[fullList.size()]);
}