Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » GMF Properties Sheet View
GMF Properties Sheet View [message #224264] Fri, 03 April 2009 11:40 Go to next message
José is currently offline JoséFriend
Messages: 18
Registered: July 2009
Junior Member
Hi all,
I'm developing a property view for a GMF eclipse application. I take the
sheet package and I implement my own class extending
AbstractPropertyClass. I can create all the control extending the method
CreateControl. I extend the method setInput too to give to the property
view the corresponding EditPart. Then, now I get a property view that
loads the EMF class and its attributes but isn't synchronized with the EMF
class in the EMF model.

The problem that I have is I have my own fields elements, not the table
standard view and I don't know what is the right way to synchronize my
elements with the GMF diagram view and with the EMF model. Can anyone help
me??

Thank you
Re: GMF Properties Sheet View [message #224360 is a reply to message #224264] Sun, 05 April 2009 08:42 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: bmoros.um.es

Hi Jos
Re: GMF Properties Sheet View [message #224594 is a reply to message #224264] Tue, 07 April 2009 08:34 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: cayla_sha.gmx.net

Hello Jose,

Perhaps this article may help you:
http://www.eclipse.org/articles/Article-Tabbed-Properties/ta bbed_properties_view.html

Especially the part with the lifecycle and the following.

I have in my diagram a class "Location" with its "LocationEditPart". In
setInput() I get the EditPart from the input and the EMF class with
..getModel().getElement(). I save the EMF class in the variable thisLocation.
And in aboutToBeShown() I add a Adapter like this:
public void aboutToBeShown()
{
super.aboutToBeShown();

if(thisLocation != null)
{
thisLocation.eAdapters().add(listenToLocationChanges);
}
}
In aboutToBeHidden() the Adapter needs to be removed!

And the Adapter looks like this:
Adapter listenToLocationChanges = new Adapter()
{
private Notifier notifier;

@Override
public void setTarget(Notifier newTarget) {
notifier = newTarget;
}

@Override
public Notifier getTarget() {
return notifier;
}

@Override
public boolean isAdapterForType(Object object) {
return false;
}

@Override
public void notifyChanged(Notification notification)
{
// gets called whenever something is changed at location
}
}

In notifyChanged I check for different changes and when they happen I
call refresh().

Hope this helps.
Best wishes
Julia


José schrieb:
> Hi all,
> I'm developing a property view for a GMF eclipse application. I take the
> sheet package and I implement my own class extending
> AbstractPropertyClass. I can create all the control extending the method
> CreateControl. I extend the method setInput too to give to the property
> view the corresponding EditPart. Then, now I get a property view that
> loads the EMF class and its attributes but isn't synchronized with the
> EMF class in the EMF model.
> The problem that I have is I have my own fields elements, not the table
> standard view and I don't know what is the right way to synchronize my
> elements with the GMF diagram view and with the EMF model. Can anyone
> help me??
>
> Thank you
>
Re: GMF Properties Sheet View [message #224608 is a reply to message #224594] Tue, 07 April 2009 09:59 Go to previous messageGo to next message
José is currently offline JoséFriend
Messages: 18
Registered: July 2009
Junior Member
Hi Julia,
That is exactly that I was trying and now I have checked it and it works
great. Now I've got the inverse problem, it means that I'm trying to
translate the changes done in the property sheet to the EMF model. I'm
trying create a command inside the Text listener to refresh the attribute.
But I'm not sure if is the best way to do that, so if someone knows a
better way, reply me, please. Moreover if someone knows how to create a
command to do that and reply me, it would help me so much. Thanks in
advance
Re: GMF Properties Sheet View [message #224647 is a reply to message #224608] Tue, 07 April 2009 11:06 Go to previous message
Eclipse UserFriend
Originally posted by: cayla_sha.gmx.net

This is a multi-part message in MIME format.
--------------010305080304080902000508
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 8bit

Hello Jose,

that thing with the text-listener sounds good. That`s what I`m doing too.
In createCommand() I create a textfield for the attribute and add a
ModifyListener. Like I told you before I get thisLocation in setInput().
In refresh() I set the current attribute-value to the textfield with
".setText(thisLocation.getAttribute())". And in the listener I set the
attribute-value with thisLocation.setAttribute() inside of a command.

I`ll attach the ModifyListener with the Command in a text-file.
Choose the String at AbstractTransactionalCommand wisely (in my example
I wrote "set location attribute") because that`s what the user sees when
he chooses in the menu "Edit"->"Undo set location attribute". And then
everything what you did inside of the command is undone.

Hope this helps
Julia


Jos
Previous Topic:How to modify notation model
Next Topic:Connections only to corners
Goto Forum:
  


Current Time: Sat Apr 20 04:18:28 GMT 2024

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

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

Back to the top