本文整理汇总了Java中org.eclipse.ui.views.properties.PropertyDescriptor类的典型用法代码示例。如果您正苦于以下问题:Java PropertyDescriptor类的具体用法?Java PropertyDescriptor怎么用?Java PropertyDescriptor使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PropertyDescriptor类属于org.eclipse.ui.views.properties包,在下文中一共展示了PropertyDescriptor类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addProperty
import org.eclipse.ui.views.properties.PropertyDescriptor; //导入依赖的package包/类
/**
* Adds a new property to this {@link PropertyHolder}.
*
* @param displayName
* the display name of the generated {@link IPropertyDescriptor}
* @param description
* the description of the generated {@link IPropertyDescriptor}
* @param value
* the property value
*/
public void addProperty(final String displayName, final String description, final Object value) {
final Object id = new Integer(nextId++);
propertyValues.put(id, value);
final PropertyDescriptor propertyDescriptor = new PropertyDescriptor(id, displayName);
propertyDescriptor.setDescription(description);
/*
* Calling setAlwaysIncompatible(true) keeps this property from showing
* up in the properties view when the selection contains more than one
* element.
*/
propertyDescriptor.setAlwaysIncompatible(true);
propertyDescriptors.add(propertyDescriptor);
}
示例2: createPropertyDescriptors
import org.eclipse.ui.views.properties.PropertyDescriptor; //导入依赖的package包/类
public static void createPropertyDescriptors(List<IPropertyDescriptor> desc, Map<String, Object> defaultsMap, String preID, String prefix) {
PropertyDescriptor pd = new DoublePropertyDescriptor(preID + PadUtil.PADDING_TOP, Messages.common_top);
pd.setDescription(Messages.common_top);
pd.setCategory(prefix);
desc.add(pd);
pd = new DoublePropertyDescriptor(preID + PadUtil.PADDING_BOTTOM, Messages.common_bottom);
pd.setDescription(Messages.common_bottom);
pd.setCategory(prefix);
desc.add(pd);
pd = new DoublePropertyDescriptor(preID + PadUtil.PADDING_LEFT, Messages.common_left);
pd.setDescription(Messages.common_left);
pd.setCategory(prefix);
desc.add(pd);
pd = new DoublePropertyDescriptor(preID + PadUtil.PADDING_RIGHT, Messages.common_right);
pd.setDescription(Messages.common_right);
pd.setCategory(prefix);
desc.add(pd);
defaultsMap.put(preID + PadUtil.PADDING_TOP, 0.0d);
defaultsMap.put(preID + PadUtil.PADDING_BOTTOM, 0.0d);
defaultsMap.put(preID + PadUtil.PADDING_LEFT, 0.0d);
defaultsMap.put(preID + PadUtil.PADDING_RIGHT, 0.0d);
}
示例3: getPropertyDescriptors
import org.eclipse.ui.views.properties.PropertyDescriptor; //导入依赖的package包/类
public IPropertyDescriptor[] getPropertyDescriptors()
{
List<IPropertyDescriptor> result = new ArrayList<IPropertyDescriptor>();
for (P p : getPropertyInfoSet())
{
PropertyDescriptor descriptor = new PropertyDescriptor(p, p.getHeader());
String category = p.getCategory();
if (!StringUtil.isEmpty(category))
{
descriptor.setCategory(category);
}
result.add(descriptor);
}
return result.toArray(new IPropertyDescriptor[result.size()]);
}
示例4: MarkerPropertySource
import org.eclipse.ui.views.properties.PropertyDescriptor; //导入依赖的package包/类
public MarkerPropertySource(IMarker marker) {
this.marker = marker;
List<IPropertyDescriptor> props = new ArrayList<IPropertyDescriptor>();
try {
Map<?, ?> attributes = marker.getAttributes();
Set<?> keySet = new TreeSet<Object>(attributes.keySet());
for (Object object : keySet) {
props.add(new PropertyDescriptor(object, "" + object));
}
} catch (CoreException e) {
FindbugsPlugin.getDefault().logException(e, "MarkerPropertySource: marker access failed");
}
props.add(new PropertyDescriptor(PropId.Bug, "Bug"));
props.add(new PropertyDescriptor(PropId.Resource, "Resource"));
props.add(new PropertyDescriptor(PropId.Id, "Marker id"));
props.add(new PropertyDescriptor(PropId.Type, "Marker type"));
props.add(new PropertyDescriptor(PropId.CreationTime, "Creation time"));
propertyDescriptors = props.toArray(new PropertyDescriptor[0]);
}
示例5: evaluationDescriptor
import org.eclipse.ui.views.properties.PropertyDescriptor; //导入依赖的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);
}
}
示例6: addPropertyToDescriptor
import org.eclipse.ui.views.properties.PropertyDescriptor; //导入依赖的package包/类
/**
* This function will add an attribute to the current descriptor. Currently, it handles a limited number of types.
*
* @param descriptors
* @param attr
* @param c
*/
public void addPropertyToDescriptor(Collection descriptors, EStructuralFeature attr, EClass c) {
// Get type for the structural feature
EClassifier type = getFeatureType(attr);
String propertyname = attr.getName();
// we are changing the passed property parameter because our feature id
// depends on the Eclass, which it does not contain.
// String propertyid = Integer.toString(attr.getFeatureID());
PropertyID propertyid = new PropertyID(c, attr);
if (attr instanceof EAttribute && ((EAttribute) attr).isID()) {
// shouldn't be editable
descriptors.add(new PropertyDescriptor(propertyid, propertyname));
} else if (type.getInstanceClass() == String.class) {
stringDescriptor(descriptors, attr, propertyid);
} else if (type.getInstanceClass() == boolean.class) {
booleanDescriptor(descriptors, attr, propertyid);
} else if (type.getInstanceClass() == int.class) {
intDescriptor(descriptors, attr, propertyid);
} else if (type.getInstanceClass() == double.class) {
doubleDescriptor(descriptors, attr, propertyid);
}
}
示例7: intDescriptor
import org.eclipse.ui.views.properties.PropertyDescriptor; //导入依赖的package包/类
/**
* int property descriptor
*
* @param descriptors
* @param attr
* @param propertyid
*/
protected void intDescriptor(Collection descriptors, EStructuralFeature attr, PropertyID propertyid) {
TextPropertyDescriptor desc = new TextPropertyDescriptor(propertyid, attr.getName());
((PropertyDescriptor) desc).setValidator(new ICellEditorValidator() {
public String isValid(Object value) {
int intValue = -1;
try {
intValue = Integer.parseInt((String) value);
return null;
} catch (NumberFormatException exc) {
return Messages.getString("EObjectPropertySource.notNumber"); //$NON-NLS-1$
}
}
});
String name = attr.getName().toLowerCase();
if (name.equals("x") || name.equals("y") || name.equals("deltax") || name.equals("deltay") || name.equals("height") || name.equals("width")) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
desc.setCategory(Messages.getString("EObjectPropertySource.appearance")); //$NON-NLS-1$
} else if (object.eClass() != propertyid.getEClass()) {
desc.setCategory(Messages.getString("EObjectPropertySource.reference")); //$NON-NLS-1$
} else {
desc.setCategory(Messages.getString("EObjectPropertySource.misc")); //$NON-NLS-1$
}
descriptors.add(desc);
}
示例8: doubleDescriptor
import org.eclipse.ui.views.properties.PropertyDescriptor; //导入依赖的package包/类
/**
* int property descriptor
*
* @param descriptors
* @param attr
* @param propertyid
*/
protected void doubleDescriptor(Collection descriptors, EStructuralFeature attr, PropertyID propertyid) {
TextPropertyDescriptor desc = new TextPropertyDescriptor(propertyid, attr.getName());
((PropertyDescriptor) desc).setValidator(new ICellEditorValidator() {
public String isValid(Object value) {
double doubleValue = -1;
try {
doubleValue = Double.parseDouble(value.toString());
return null;
} catch (NumberFormatException exc) {
return Messages.getString("EObjectPropertySource.notValidNumber"); //$NON-NLS-1$
}
}
});
desc.setCategory(Messages.getString("EObjectPropertySource.misc")); //$NON-NLS-1$
descriptors.add(desc);
}
示例9: loadDescriptors
import org.eclipse.ui.views.properties.PropertyDescriptor; //导入依赖的package包/类
@Override
protected IPropertyDescriptor[] loadDescriptors() {
IPropertyDescriptor[] propertyDescriptors = new IPropertyDescriptor[3];
propertyDescriptors[0] = new TextPropertyDescriptor("tagname", "Column tag name");
((PropertyDescriptor)propertyDescriptors[0]).setCategory("Configuration");
propertyDescriptors[1] = new TextPropertyDescriptor("colxpath", "Column XPath");
((PropertyDescriptor)propertyDescriptors[1]).setCategory("Selection");
propertyDescriptors[2] = new ComboBoxPropertyDescriptor("extract", "Extract children", new String[]{"false","true"});
((PropertyDescriptor)propertyDescriptors[2]).setCategory("Selection");
return propertyDescriptors;
}
示例10: loadDescriptors
import org.eclipse.ui.views.properties.PropertyDescriptor; //导入依赖的package包/类
@Override
protected IPropertyDescriptor[] loadDescriptors() {
IPropertyDescriptor[] propertyDescriptors = new IPropertyDescriptor[3];
propertyDescriptors[0] = new TextPropertyDescriptor("name", "Data tag name");
((PropertyDescriptor)propertyDescriptors[0]).setCategory("Configuration");
propertyDescriptors[1] = new TextPropertyDescriptor("xpath", "Data XPath");
((PropertyDescriptor)propertyDescriptors[1]).setCategory("Selection");
propertyDescriptors[2] = new ComboBoxPropertyDescriptor("extract", "Extract children", new String[]{"false","true"});
((PropertyDescriptor)propertyDescriptors[2]).setCategory("Selection");
return propertyDescriptors;
}
示例11: loadDescriptors
import org.eclipse.ui.views.properties.PropertyDescriptor; //导入依赖的package包/类
@Override
protected IPropertyDescriptor[] loadDescriptors() {
IPropertyDescriptor[] propertyDescriptors = new IPropertyDescriptor[2];
propertyDescriptors[0] = new TextPropertyDescriptor("tagname", "Row tag name");
((PropertyDescriptor)propertyDescriptors[0]).setCategory("Configuration");
propertyDescriptors[1] = new TextPropertyDescriptor("rowxpath", "Row XPath");
((PropertyDescriptor)propertyDescriptors[1]).setCategory("Selection");
return propertyDescriptors;
}
示例12: getDynamicPropertyDescriptors
import org.eclipse.ui.views.properties.PropertyDescriptor; //导入依赖的package包/类
protected List<PropertyDescriptor> getDynamicPropertyDescriptors() {
/*List<PropertyDescriptor> l = new ArrayList<PropertyDescriptor>();
if (this instanceof IDynamicPropertyProvider) {
IDynamicPropertyProvider provider = (IDynamicPropertyProvider)this;
l.addAll(provider.getDynamicPropertyDescriptorProvider().
getDynamicPropertyDescriptors());
}
return l;*/
return new ArrayList<PropertyDescriptor>();
}
示例13: getPropertyDescriptor
import org.eclipse.ui.views.properties.PropertyDescriptor; //导入依赖的package包/类
protected java.beans.PropertyDescriptor getPropertyDescriptor(String propertyName) {
int len = databaseObjectPropertyDescriptors.length;
java.beans.PropertyDescriptor databaseObjectPropertyDescriptor = null;
for (int i = 0; i < len; i++) {
databaseObjectPropertyDescriptor = databaseObjectPropertyDescriptors[i];
if (propertyName.equals(databaseObjectPropertyDescriptor.getName()))
return databaseObjectPropertyDescriptor;
}
return null;
}
示例14: getPropertyDescriptors
import org.eclipse.ui.views.properties.PropertyDescriptor; //导入依赖的package包/类
@Override
public IPropertyDescriptor[] getPropertyDescriptors() {
return new IPropertyDescriptor[] {new PropertyDescriptor(DetailPropertySource.ID, "ID"),
new PropertyDescriptor(DetailPropertySource.LENGTH, "Length"),
new PropertyDescriptor(DetailPropertySource.LINE_NUMBER, "Line Number"),
new PropertyDescriptor(DetailPropertySource.OFFSET, "Offset"),
new PropertyDescriptor(DetailPropertySource.PATH, "Path"),
new PropertyDescriptor(DetailPropertySource.TEXT, "Text"),
new PropertyDescriptor(DetailPropertySource.TYPE, "Type")};
}
示例15: getPropertyDescriptors
import org.eclipse.ui.views.properties.PropertyDescriptor; //导入依赖的package包/类
public IPropertyDescriptor[] getPropertyDescriptors() {
int size = 1;
if(Platform.Android == getPlatform())
size = 2;
IPropertyDescriptor[] descr = new IPropertyDescriptor[size];
descr[0] = new PropertyDescriptor(Diagram.PLATFORM, Diagram.PLATFORM);
if(Platform.Android == getPlatform())
descr[1] = new ResolutionPropertyDescriptor(getPlatform(), Diagram.RESOLUTION);
return descr;
}