use of org.eclipse.ui.views.properties.TextPropertyDescriptor in project sling by apache.
the class ModifiableProperties method getPropertyDescriptors.
@Override
public IPropertyDescriptor[] getPropertyDescriptors() {
final Map<String, IPropertyDescriptor> conversionMap = new HashMap<>();
for (Entry<String, String> entry : properties.entrySet()) {
TextPropertyDescriptor pd = new JcrTextPropertyDescriptor(entry, entry.getKey());
conversionMap.put(entry.getKey(), pd);
}
final List<String> propertiesOrderCopy = new LinkedList<>(propertiesOrder);
final String jcrPrimaryType = "jcr:primaryType";
if (!properties.containsKey(jcrPrimaryType)) {
Map<String, String> pseudoMap = new HashMap<>();
pseudoMap.put(jcrPrimaryType, node.getPrimaryType());
final TextPropertyDescriptor pseudoPd = new JcrTextPropertyDescriptor(pseudoMap.entrySet().iterator().next(), jcrPrimaryType);
propertiesOrderCopy.add(0, jcrPrimaryType);
conversionMap.put(jcrPrimaryType, pseudoPd);
}
IPropertyDescriptor[] result = new IPropertyDescriptor[conversionMap.size()];
for (int i = 0; i < result.length; i++) {
String aPropertyName = propertiesOrderCopy.get(i);
result[i] = conversionMap.get(aPropertyName);
}
return result;
}
use of org.eclipse.ui.views.properties.TextPropertyDescriptor in project webtools.sourceediting by eclipse.
the class XMLTableTreePropertyDescriptorFactory method createAttributePropertyDescriptor.
public IPropertyDescriptor createAttributePropertyDescriptor(Attr attr) {
IPropertyDescriptor result = null;
String attributeName = attr.getName();
ModelQuery mq = ModelQueryUtil.getModelQuery(attr.getOwnerDocument());
CMAttributeDeclaration ad = null;
if (mq != null) {
ad = mq.getCMAttributeDeclaration(attr);
}
if (ad != null) {
result = createPropertyDescriptorHelper(attributeName, attr.getOwnerElement(), ad);
}
if (result == null) {
result = new TextPropertyDescriptor(attributeName, attributeName);
}
return result;
}
use of org.eclipse.ui.views.properties.TextPropertyDescriptor in project webtools.sourceediting by eclipse.
the class XMLPropertySource method createTextPropertyDescriptor.
private IPropertyDescriptor createTextPropertyDescriptor(CMAttributeDeclaration attrDecl, Attr attr) {
String attrName = DOMNamespaceHelper.computeName(attrDecl, fNode, null);
TextPropertyDescriptor descriptor = new TextPropertyDescriptor(attrName, attrName);
descriptor.setCategory(getCategory(attrDecl, attr));
descriptor.setDescription(attrName);
if ((attrDecl.getUsage() != CMAttributeDeclaration.REQUIRED) && fSetExpertFilter) {
descriptor.setFilterFlags(new String[] { IPropertySheetEntry.FILTER_ID_EXPERT });
}
return descriptor;
}
use of org.eclipse.ui.views.properties.TextPropertyDescriptor in project knime-core by knime.
the class NodeContainerProperties method getDescriptors.
/**
* @return see {@link #getPropertyDescriptors()}
*/
protected IPropertyDescriptor[] getDescriptors() {
ArrayList<IPropertyDescriptor> descriptors = new ArrayList<IPropertyDescriptor>();
// iterate through all settings in the config
for (Enumeration<TreeNode> it = m_settings.children(); it.hasMoreElements(); ) {
AbstractConfigEntry prop = (AbstractConfigEntry) it.nextElement();
// the id should be globally unique
String hierID = m_prefix.isEmpty() ? prop.getKey() : m_prefix + CONFIG_SEPARATOR + prop.getKey();
if (prop instanceof Config) {
// sub-config
descriptors.add(new PropertyDescriptor(hierID, prop.getKey()));
} else {
// all settings are displayed as string
String typeName = prop.getType().name().substring(1);
// we don't have a label yet
String label = prop.getKey() + " (" + typeName + ")";
switch(prop.getType()) {
// if cases are changed here, setPropertyValue must be adapted
case xboolean:
case xbyte:
case xchar:
case xdouble:
case xfloat:
case xint:
case xlong:
case xshort:
case xstring:
// editable types
descriptors.add(new TextPropertyDescriptor(hierID, label));
break;
default:
descriptors.add(new PropertyDescriptor(hierID, label));
break;
}
}
}
return descriptors.toArray(new IPropertyDescriptor[descriptors.size()]);
}
use of org.eclipse.ui.views.properties.TextPropertyDescriptor in project webtools.sourceediting by eclipse.
the class XMLTableTreePropertyDescriptorFactory method createTextPropertyDescriptor.
public IPropertyDescriptor createTextPropertyDescriptor(Text text) {
IPropertyDescriptor result = null;
Node parentNode = text.getParentNode();
if ((parentNode != null) && (parentNode.getNodeType() == Node.ELEMENT_NODE)) {
Element parentElement = (Element) parentNode;
ModelQuery mq = ModelQueryUtil.getModelQuery(text.getOwnerDocument());
CMElementDeclaration ed = null;
if (mq != null) {
ed = mq.getCMElementDeclaration(parentElement);
}
if (ed != null) {
result = createPropertyDescriptorHelper(HACK, parentElement, ed);
} else {
result = createDefaultPropertyDescriptor(parentElement.getNodeName());
}
}
if (result == null) {
result = new TextPropertyDescriptor(HACK, HACK);
}
return result;
}
Aggregations