Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » How can i support IPropertySource in GEF?
How can i support IPropertySource in GEF? [message #53289] Fri, 10 January 2003 01:25 Go to next message
Eclipse UserFriend
Originally posted by: bgshim.jkdsoft.co.kr

In my project, there is some Figure. Each figure have 3 kinds of classes.

- EditPart
- ViewModel (which is model of EditPart contains graphical
information(location, size...) )
- Model( This class contains bussiness model )


The Model class have some editable properties.
So, when user click an EditPart of that Model, The PropertiesView must show
properties of Model,
not properties of ViewModel.

But, In Logic example , i can only find supporting properties of
ViewModel(EditPart's model).


Anyone know supporting other properties in GEF?
Re: How can i support IPropertySource in GEF? [message #53393 is a reply to message #53289] Fri, 10 January 2003 14:18 Go to previous message
Dag Rende is currently offline Dag RendeFriend
Messages: 17
Registered: July 2009
Junior Member
Hi!

The logic example is really complex and that hides many aspects of GEF.
Still it is a fine example of what can be done with GEF.

A short answer to your question is that the EditPart has access to both the
visual properties (through getFigure()), and the model properties (through
getModel()), so you can expose any properties you want.

For all that wants to get a property working fast, here is an example.

If you for example have a String property "name" in your model that you want
to edit in the property pane:

1. make your EditPart implement IPropertySource.
2. add the six methods below to the EditPart.

Now your name property will be visible and editable in the Property view
when you select the figure representing the edit part.

/Dag

/**
* @see org.eclipse.ui.views.properties.IPropertySource#getEditableV alue()
*/
public Object getEditableValue() {
return null;
}

/**
* @see
org.eclipse.ui.views.properties.IPropertySource#getPropertyD escriptors()
*/
public IPropertyDescriptor[] getPropertyDescriptors() {
return new IPropertyDescriptor[] {
new TextPropertyDescriptor("name", "name")};
}

/**
* @see
org.eclipse.ui.views.properties.IPropertySource#getPropertyV alue(Object)
*/
public Object getPropertyValue(Object id) {
if ("name".equals(id)) {
String name;
...set name to your model property value...
return name;
}
return null;
}

/**
* @see org.eclipse.ui.views.properties.IPropertySource#isPropertySe t(Object)
*/
public boolean isPropertySet(Object id) {
return false;
}

/**
* @see
org.eclipse.ui.views.properties.IPropertySource#resetPropert yValue(Object)
*/
public void resetPropertyValue(Object id) {
}

/**
* @see
org.eclipse.ui.views.properties.IPropertySource#setPropertyV alue(Object,
Object)
*/
public void setPropertyValue(Object id, Object value) {
if ("name".equals(id)) {
String name = (String)value;
...set your model property to value of name...
}
}

"bgshim" <bgshim@jkdsoft.co.kr> skrev i meddelandet
news:avl6p7$6i7$1@rogue.oti.com...
>
> In my project, there is some Figure. Each figure have 3 kinds of classes.
>
> - EditPart
> - ViewModel (which is model of EditPart contains graphical
> information(location, size...) )
> - Model( This class contains bussiness model )
>
>
> The Model class have some editable properties.
> So, when user click an EditPart of that Model, The PropertiesView must
show
> properties of Model,
> not properties of ViewModel.
>
> But, In Logic example , i can only find supporting properties of
> ViewModel(EditPart's model).
>
>
> Anyone know supporting other properties in GEF?
>
>
Previous Topic:PrintFigureOperation doesn't print whole figure.
Next Topic:PrintBigFigureOperation
Goto Forum:
  


Current Time: Wed Jul 17 14:03:45 GMT 2024

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

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

Back to the top