Package org.eclipse.ui.views.properties

Examples of org.eclipse.ui.views.properties.PropertyDescriptor


        if ( constraints == null ) {
            return;
        }

        for ( int i = 0, length = constraints.length; i < length; i++ ) {
            PropertyDescriptor prop = new PropertyDescriptor( CONSTRAINT + (i + 1),
                                                              CONSTRAINT_CAP + " " + (i + 1) );
            addOther( prop,
                      constraints[i].toString(),
                      descriptorList,
                      valueMap );
View Full Code Here


  {
    return new IPropertySource() {
      public IPropertyDescriptor[] getPropertyDescriptors()
      {
        return new IPropertyDescriptor[] {
          new PropertyDescriptor("author", "Author"),
          new PropertyDescriptor("document", "Document"),
          new PropertyDescriptor("lastModified", "Last modified")
        };
      }
     
      public Object getPropertyValue(Object id)
      {
View Full Code Here

  {
    return new IPropertySource() {
      public IPropertyDescriptor[] getPropertyDescriptors()
      {
        return new IPropertyDescriptor[] {
          new PropertyDescriptor("author", "Author"),
          new PropertyDescriptor("document", "Document"),
          new PropertyDescriptor("lastViewed", "Last viewed"),
          new PropertyDescriptor("lastModified", "Last modified"),
          new PropertyDescriptor("lastModifiedBy", "Last modified by")
        };
      }
     
      public Object getPropertyValue(Object id)
      {
View Full Code Here

     */
    public IPropertyDescriptor[] getPropertyDescriptors() {
        if (descriptors == null) {
            boolean hasAttrs = false;
            List<IPropertyDescriptor> descrps = new ArrayList<IPropertyDescriptor>();
            PropertyDescriptor d = new PropertyDescriptor(ID, "ID"); //$NON-NLS-1$
            d.setCategory(Messages.FeaturePropertySource_feature);
            descrps.add(d);
            d = new GeometryPropertyDescriptor(DEFAULT_GEOM,
                Messages.FeaturePropertySource_defaultGeometry);
            d.setCategory(Messages.FeaturePropertySource_geometries);
            descrps.add(d);
            d = new PropertyDescriptor(BOUNDING_BOX, Messages.FeaturePropertySource_bounds);
            d.setCategory(Messages.FeaturePropertySource_feature);
            d.setLabelProvider(new LabelProvider(){
                /**
                 * @see org.eclipse.jface.viewers.LabelProvider#getText(java.lang.Object)
                 */
                public String getText( Object element ) {
                    Envelope bbox = (Envelope) element;
                    String minx = String.valueOf(bbox.getMinX());
                    minx = minx.substring(0, Math.min(10, minx.length()));
                    String maxx = String.valueOf(bbox.getMaxX());
                    maxx = maxx.substring(0, Math.min(10, maxx.length()));
                    String miny = String.valueOf(bbox.getMinY());
                    miny = miny.substring(0, Math.min(10, miny.length()));
                    String maxy = String.valueOf(bbox.getMaxY());
                    maxy = maxy.substring(0, Math.min(10, maxy.length()));
                    return "(" + minx + "," + miny + "), (" + maxx + "," + maxy + ")"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
                }
            });
            descrps.add(d);
            if (!attribute) {
                SimpleFeatureType ft = feature.getFeatureType();
                attrs = ft.getAttributeDescriptors();
                int i = -1;
                for (AttributeDescriptor at : attrs) {
                  i++;
                    String name = at.getName().getLocalPart().toLowerCase();
                    name = name.substring(0, 1).toUpperCase() + name.substring(1);
                    if ( at instanceof GeometryDescriptor ) {
                        if (feature.getAttribute(at.getLocalName()) != feature.getDefaultGeometry()) {
                            d = new GeometryPropertyDescriptor(Integer.valueOf(i), name
                                    + Messages.FeaturePropertySource_geometry);
                            d.setCategory(Messages.FeaturePropertySource_geometries);
                            descrps.add(d);
                        }
                    } else {
                        if (SimpleFeature.class.isAssignableFrom(at.getType().getBinding())) {
                            d = new PropertyDescriptor(FEATURE + Integer.valueOf(i), name);
                        } else if (Collection.class.isAssignableFrom(at.getType().getBinding()))
                            d = new PropertyDescriptor(Integer.valueOf(i), name);
                        else {
                            d = new AttributePropertyDescriptor(Integer.valueOf(i), name, at, ft, editable);
                            // if (String.class.isAssignableFrom(at.getType()))
                            // d = new TextPropertyDescriptor(Integer.valueOf(i), name);
                            // if (Integer.class.isAssignableFrom(at.getType()))
                            // d = new TextPropertyDescriptor(Integer.valueOf(i), name);
                            // if (Double.class.isAssignableFrom(at.getType()))
                            // d = new TextPropertyDescriptor(Integer.valueOf(i), name);
                            // if (Boolean.class.isAssignableFrom(at.getType()))
                            // d = new ComboBoxPropertyDescriptor(Integer.valueOf(i), name,
                            // new String[]{"true","false"});
                            // if (Float.class.isAssignableFrom(at.getType()))
                            // d = new TextPropertyDescriptor(Integer.valueOf(i), name);
                        }
                        // d.setValidator(new AttributeValidator(at));

                        if (name.equalsIgnoreCase("name")) { //$NON-NLS-1$
                            d.setCategory(Messages.FeaturePropertySource_feature);
                            descrps.add(0, d);
                        } else {
                            hasAttrs = true;
                            d.setCategory(Messages.FeaturePropertySource_featureAttributes);
                            descrps.add(d);
                        }
                    }
                }
            }
            if (!hasAttrs) {
                d = new PropertyDescriptor(
                        "", Messages.FeaturePropertySource_noOtherAttributes);   //$NON-NLS-1$
                d.setCategory(Messages.FeaturePropertySource_featureAttributes);
                descrps.add(d);
            }
            descriptors = new IPropertyDescriptor[descrps.size()];
            descrps.toArray(descriptors);
        }
View Full Code Here

     */
    public IPropertyDescriptor[] getPropertyDescriptors() {
        if (descriptors == null) {
            List<IPropertyDescriptor> desc = new ArrayList<IPropertyDescriptor>();
            AttributeDescriptor[] attrs = type.getAttributeDescriptors().toArray(new AttributeDescriptor[0]);
            PropertyDescriptor d;
            for( int i = 0; i < attrs.length; i++ ) {
                String name = attrs[i].getLocalName().toLowerCase();
                name = name.substring(0, 1).toUpperCase() + name.substring(1);
                d = new PropertyDescriptor(Integer.valueOf(i), name);
                if ( attrs[i] instanceof GeometryDescriptor )
                    d.setCategory(Messages.ScemaDescriptor_geometry);
                else
                    d.setCategory(Messages.ScemaDescriptor_attributeTypes);
                desc.add(d);
            }
            descriptors = new IPropertyDescriptor[desc.size()];
            desc.toArray(descriptors);
        }
View Full Code Here

                if (geoResource.canResolve(FeatureSource.class)) {
                    resourceDescriptor = new SchemaDescriptor(
                            FEATURE_SOURCE,
                            Messages.IGeoResourcePropertySource_schema, (FeatureSource<SimpleFeatureType, SimpleFeature>) geoResource.resolve(FeatureSource.class, null));
                } else {
                    resourceDescriptor = new PropertyDescriptor(RESOURCE,
                        Messages.IGeoResourcePropertySource_data);
                }
            } catch (IOException e) {
                // TODO Catch e
                e.printStackTrace();
View Full Code Here

     */
    public GeomPropertySource( Geometry geometry ) {
        this.geom = geometry;
        this.original = geometry;
        propertyDescriptors = new IPropertyDescriptor[3];
        propertyDescriptors[0] = new PropertyDescriptor(new ID(AREA),
                Messages.GeomPropertySource_area);
        propertyDescriptors[1] = new PropertyDescriptor(new ID(LENGTH),
                Messages.GeomPropertySource_length);
        propertyDescriptors[2] = new TextPropertyDescriptor(new ID(GEOM),
                Messages.GeomPropertySource_WKT);
    }
View Full Code Here

    /**
     * @see org.eclipse.ui.views.properties.IPropertySource#getPropertyDescriptors()
     */
    public IPropertyDescriptor[] getPropertyDescriptors() {
        if (descriptors == null) {
            descriptors = new IPropertyDescriptor[]{new PropertyDescriptor(OTHER,
                Messages.AttributePropertySource_value)};
        }

        IPropertyDescriptor[] c=new IPropertyDescriptor[descriptors.length];
        System.arraycopy(descriptors, 0, c, 0, c.length);
View Full Code Here

        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]);
        }
View Full Code Here

        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]);
        }
View Full Code Here

TOP

Related Classes of org.eclipse.ui.views.properties.PropertyDescriptor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.