Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Display a form on a property label(Edditing propertys using Jface)
Display a form on a property label [message #792506] Tue, 07 February 2012 04:04
luke richards is currently offline luke richards
Messages: 1
Registered: February 2012
Junior Member
index.php/fa/7050/0/
I would like to add this button to a field of a shape's property:


I use it to open a form to fill out a list of strings.

also would like some guidance on how to use JFace inside a GEF project.

Sorry, I'm not very good with English, also i'm newbie with eclipse, but I have much interest in learning.

Add the source of my shape's model:

package org.eclipse.gef.examples.shapes.model;

import org.eclipse.swt.graphics.Image;
import org.eclipse.ui.views.properties.IPropertyDescriptor;
import org.eclipse.ui.views.properties.TextPropertyDescriptor;

public class TransitionShape extends Shape {
  /** A 16x16 pictogram of a rectangular shape. */
  private static final String TRANS_NAME_PROP = "Name";
  private static final Image RECTANGLE_ICON = createImage("icons/rectangle16.gif");

  private static final long serialVersionUID = 1;

  private String Name = new String();

  static {

    descriptors = new IPropertyDescriptor[]{new TextPropertyDescriptor(TRANS_NAME_PROP, "Name")};
  } // static

  public IPropertyDescriptor[] getPropertyDescriptors() {
    return descriptors;
  }

  public Object getPropertyValue(Object propertyId) {
    if (TRANS_NAME_PROP.equals(propertyId)) {
      return Name;
    }
    return super.getPropertyValue(propertyId);
  }

  public void setPropertyValue(Object propertyId, Object value) {

    if (TRANS_NAME_PROP.equals(propertyId)) {
      setName((String) value);
    } else {
      super.setPropertyValue(propertyId, value);
    }
  }

  public Image getIcon() {
    return RECTANGLE_ICON;
  }

  public String toString() {
    return "Rectangle " + hashCode();
  }

  public void setName(String name) {
    Name = name;
  }

  public String getName() {
    return Name;
  }

}
Previous Topic:Problems with autoscroll behavior
Next Topic:SelectionListener for GraphicalEditor
Goto Forum:
  


Current Time: Fri Oct 31 05:43:43 GMT 2014

Powered by FUDForum. Page generated in 0.01606 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software