/** * 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); }
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); }
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()]); }
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]); }
/** * @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); } }
/** * 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); } }
/** * 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); }
/** * 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); }
@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; }
@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; }
@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; }
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>(); }
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; }
@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")}; }
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; }
@Override public IPropertyDescriptor[] getPropertyDescriptors() { List<IPropertyDescriptor> fullList = new ArrayList<IPropertyDescriptor>(); fullList.addAll(Arrays.asList(super.getPropertyDescriptors())); fullList.add(new PropertyDescriptor(PROP_SIZE, PROPERTY_SIZE)); int i = 0; for (IPropertyDescriptor iPropertyDescriptor : fullList) { if(iPropertyDescriptor.getDisplayName().equals(PROP_BOUNDS)) break; i++; } fullList.remove(i); return fullList.toArray(new IPropertyDescriptor[fullList.size()]); }
@Override public IPropertyDescriptor[] getPropertyDescriptors() { List<IPropertyDescriptor> fullList = new ArrayList<IPropertyDescriptor>(); fullList.addAll(Arrays.asList(super.getPropertyDescriptors())); if (!getFilteredProperties().contains(PROP_BOUNDS)) { fullList.add(new PropertyDescriptor(PROP_BOUNDS, PROP_BOUNDS)); } return fullList.toArray(new IPropertyDescriptor[fullList.size()]); }
@Override public IPropertyDescriptor[] getPropertyDescriptors() { List<IPropertyDescriptor> fullList = new ArrayList<IPropertyDescriptor>(); fullList.addAll(Arrays.asList(super.getPropertyDescriptors())); fullList.add(new PropertyDescriptor(PROP_CONTENT_OFFSET, PROP_CONTENT_OFFSET)); return fullList.toArray(new IPropertyDescriptor[fullList.size()]); }
@Override public IPropertyDescriptor[] getPropertyDescriptors() { int size = 1; if(Platform.Android == platform) size = 2; IPropertyDescriptor[] descr = new IPropertyDescriptor[size]; descr[0] = new PropertyDescriptor(Diagram.PLATFORM, Diagram.PLATFORM); if(Platform.Android == platform) descr[1] = new ResolutionPropertyDescriptor(getPlatform(), Diagram.RESOLUTION); return descr; }
@Override public IPropertyDescriptor[] getPropertyDescriptors() { return new IPropertyDescriptor[] { new PropertyDescriptor(CODE, "Code"), new PropertyDescriptor(VERSION, "Version"), new PropertyDescriptor(URI, "Uri"), }; }
/** * create the property descriptor for the specified property * * @param propertyId * @param metadata * @return */ final PropertyDescriptor createPropertyDescriptor(String propertyId, UIProperty metadata) { final PropertyDescriptor propertyDescriptor = doCreatePropertyDescriptor(propertyId, metadata); propertyDescriptor.setCategory(metadata.category()); return propertyDescriptor; }
protected PropertyDescriptor doCreatePropertyDescriptor(String propertyId, UIProperty metadata) { // TODO: ideally this would be a drop down list, where user can select // values. // In that case toModel and toUI would need to deal with indices return new TextPropertyDescriptor(propertyId, metadata.name()); }
public IPropertyDescriptor[] getPropertyDescriptors() { List<IPropertyDescriptor> result = new ArrayList<IPropertyDescriptor>(); for (P p : getPropertyInfoSet()) { result.add(new PropertyDescriptor(p, p.getHeader())); } return result.toArray(new IPropertyDescriptor[result.size()]); }
@Override public IPropertyDescriptor[] getPropertyDescriptors() { List<IPropertyDescriptor> list = new ArrayList<>(); PropertyDescriptor name = new PropertyDescriptor("Name", "Name"); PropertyDescriptor version = new PropertyDescriptor("Version", "Version"); PropertyDescriptor path = new PropertyDescriptor("Path", "Path"); Collections.addAll(list, name, version, path); return list.toArray(new IPropertyDescriptor[list.size()]); }
@Override public IPropertyDescriptor[] getPropertyDescriptors() { List<IPropertyDescriptor> list = new ArrayList<>(); PropertyDescriptor name = new PropertyDescriptor("Name", "Name"); PropertyDescriptor version = new PropertyDescriptor("Version", "Version"); PropertyDescriptor exporter = new PropertyDescriptor("Export", "Exported By"); PropertyDescriptor reexporter = new PropertyDescriptor("Reexport", "Reexported By"); Collections.addAll(list, name, version, exporter, reexporter); return list.toArray(new IPropertyDescriptor[list.size()]); }
@Override public IPropertyDescriptor[] getPropertyDescriptors() { List<IPropertyDescriptor> propList = new ArrayList<>(); for (IPropertySource source : list) { PropertyDescriptor entry = new PropertyDescriptor(source, source.toString()); propList.add(entry); } return propList.toArray(new IPropertyDescriptor[propList.size()]); }
@Override public IPropertyDescriptor[] getPropertyDescriptors() { List<IPropertyDescriptor> list = new ArrayList<>(); PropertyDescriptor name = new PropertyDescriptor("Name", "Name"); PropertyDescriptor version = new PropertyDescriptor("Version", "Version"); PropertyDescriptor optional = new PropertyDescriptor("Optional", "Optional"); PropertyDescriptor dynamicImport = new PropertyDescriptor("DynamicImport", "DynamicImport"); PropertyDescriptor reexport = new PropertyDescriptor("Reexport", "Reexport"); Collections.addAll(list, name, version, optional, dynamicImport, reexport); return list.toArray(new IPropertyDescriptor[list.size()]); }
@Override public IPropertyDescriptor[] getPropertyDescriptors() { List<IPropertyDescriptor> list = new ArrayList<>(); PropertyDescriptor name = new PropertyDescriptor("Name", "Name"); name.setCategory("General"); PropertyDescriptor version = new PropertyDescriptor("Version", "Version"); version.setCategory("General"); PropertyDescriptor exporter = new PropertyDescriptor("Export", "Exported By"); exporter.setCategory("General"); PropertyDescriptor reexporter = new PropertyDescriptor("Reexport", "Reexported By"); reexporter.setCategory("General"); PropertyDescriptor log = new PropertyDescriptor("Log", "Log"); log.setCategory("General"); log.setLabelProvider(new LabelProvider() { @Override public String getText(Object element) { if (element instanceof List<?>) { List<?> logList = (List<?>) element; StringBuilder out = new StringBuilder(); for (Object logEntry : logList) { out.append(logEntry + "\n"); } return out.toString(); } return ""; } }); PropertyDescriptor importedBy = new PropertyDescriptor("Import", "Imported By"); Collections.addAll(list, name, version, exporter, importedBy, reexporter, log); return list.toArray(new IPropertyDescriptor[list.size()]); }
private static IPropertyDescriptor createPropertyDescriptor(String field, String label){ PropertyDescriptor descriptor = new PropertyDescriptor(field, label); descriptor.setCategory("Cordova Plugin"); descriptor.setAlwaysIncompatible(true); return descriptor; }
private static IPropertyDescriptor createPropertyDescriptor(String field, String label){ PropertyDescriptor descriptor = new PropertyDescriptor(field, label); descriptor.setCategory("Cordova Platform"); descriptor.setAlwaysIncompatible(true); return descriptor; }
@Override protected IPropertyDescriptor createPropertyDescriptor(String name) { if(name.equals(InstallOptionsModel.PROPERTY_FILTER)) { String propertyName = InstallOptionsPlugin.getResourceString("filter.property.name"); //$NON-NLS-1$ PropertyDescriptor descriptor = new PropertyDescriptor(InstallOptionsModel.PROPERTY_FILTER, propertyName){ @Override public CellEditor createPropertyEditor(Composite parent) { final FileFilterCellEditor editor = new FileFilterCellEditor(InstallOptionsFileRequest.this, parent); editor.setValidator(getValidator()); final PropertyChangeListener listener = new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent evt) { if(evt.getPropertyName().equals(getId())) { editor.setValue(evt.getNewValue()); } } }; InstallOptionsFileRequest.this.addPropertyChangeListener(listener); editor.getControl().addDisposeListener(new DisposeListener() { public void widgetDisposed(DisposeEvent e) { InstallOptionsFileRequest.this.removePropertyChangeListener(listener); } }); return editor; } }; descriptor.setLabelProvider(FILTER_LABEL_PROVIDER); descriptor.setValidator(new NSISStringLengthValidator(propertyName)); return descriptor; } else { return super.createPropertyDescriptor(name); } }
public PropertySource(Object object) { this.object = object; List<IPropertyDescriptor> props = new ArrayList<IPropertyDescriptor>(); List<Method> getters = getGetters(object); for (Method method : getters) { props.add(new PropertyDescriptor(method, getReadableName(method))); } propertyDescriptors = props.toArray(new PropertyDescriptor[0]); }
public ArrayPropertySource(Object[] object) { this.array = object; List<IPropertyDescriptor> props = new ArrayList<IPropertyDescriptor>(); for (Object obj : array) { props.add(new PropertyDescriptor(obj, getDisplayName(obj))); } propertyDescriptors = props.toArray(new PropertyDescriptor[0]); }
public IPropertyDescriptor[] getPropertyDescriptors() { List<IPropertyDescriptor> descciptors = new ArrayList<IPropertyDescriptor>(); for(String name: properties.keySet()){ PropertyDescriptor descriptor = new TextPropertyDescriptor(new PropertyId(name), name); descriptor.setCategory("Properties"); descciptors.add(descriptor); } return descciptors.toArray(new IPropertyDescriptor[0]); }
/** * @param descriptors * @param propertyid */ private void workloadDescriptor(Collection descriptors, PropertyID propertyid) { PropertyDescriptor pd = new PropertyDescriptor(propertyid, Messages.getString("URNElementPropertySource.workload")); //$NON-NLS-1$ pd.setCategory(Messages.getString("URNElementPropertySource.performance")); //$NON-NLS-1$ pd.setLabelProvider(new LabelProvider() { public String getText(Object element) { return ""; //$NON-NLS-1$ } }); descriptors.add(pd); }
@Override public IPropertyDescriptor[] getPropertyDescriptors() { IPropertyDescriptor[] list = new IPropertyDescriptor[6]; list[0] = new PropertyDescriptor(Attribut.OBJECT_ID, "ID"); list[1] = new TextPropertyDescriptor(Attribut.OBJECT_NAME, "Name"); list[2] = new TextPropertyDescriptor(Attribut.OBJECT_TEMPLATE, "Template"); list[3] = new NumberPropertyDescriptor(Attribut.OBJECT_X, "X"); list[4] = new NumberPropertyDescriptor(Attribut.OBJECT_Y, "Y"); list[5] = new NumberPropertyDescriptor(Attribut.OBJECT_Z, "Z"); return list; }
private void init() { if (obj == null) descriptors = new IPropertyDescriptor[0]; else try { Class c = obj.getClass(); for (Field field : c.getDeclaredFields()) { Property p = field.getAnnotation(Property.class); if (p != null) attributs.put(field.getName(), new PropertyAttribut(field, p)); } this.descriptors = new IPropertyDescriptor[attributs.size()]; int i = 0; for (String name : attributs.keySet()) { descriptors[i++] = new PropertyDescriptor(name, attributs.get(name).getName()); } } catch (NoSuchMethodException | SecurityException e) { e.printStackTrace(); } }