Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » JFace » Object in property view
Object in property view [message #502818] Wed, 09 December 2009 19:32 Go to next message
John S. is currently offline John S.Friend
Messages: 22
Registered: October 2009
Junior Member
Hello,

I have a tree viewer and a property view, so when I click on an element in the tree view, its content will be displayed in the property view. My property view has Texts for each property. For example when I click on a model element in the Tree view, one of the Texts is an Object, so when I databinded it I had to convert it Object to String (Texts only work with String values). So it is a long reference String value in the user interface which is not nice.

I would like to display only Class employee

instead of

org.eclipse.emf.ecore.impl.EObjectImpl@1f7896f (eProxyURI: platform:/resource/gmfchange/default2.uml2rdbms#//@umlModel/ @classes.1)

It would be nice if I could do it in a Text widget, but if it cannot be done in this way anyhow, what other advice would it be suggested?

Best Regards,
John
Re: Object in property view [message #502952 is a reply to message #502818] Thu, 10 December 2009 12:24 Go to previous messageGo to next message
saurav sarkar is currently offline saurav sarkarFriend
Messages: 428
Registered: July 2009
Senior Member
Eclipse property views work on property sources.
It is an interface of your model.Just create a property source for your model and implement the getPropertyValue() method and return the actual name of the object.I hope i got your problem correctly.

cheers,
Saurav


Re: Object in property view [message #503094 is a reply to message #502952] Thu, 10 December 2009 20:40 Go to previous message
John S. is currently offline John S.Friend
Messages: 22
Registered: October 2009
Junior Member
Hello,

Thanks, your suggestion works, but I still would like to inquire that there is any other solution? Actually the JFace GUIs for the end-users only can read (not edit) the metamodels (to be precise they only give us the model), so putting an interface in the model code would not be fit for the system requirements in most of the cases.

And for the sake of clarity, this is how I bind the string and the object values so far:

UpdateValueStrategy strategy = new UpdateValueStrategy();
strategy.setConverter(new Converter(Object.class, String.class) {
public String convert(final Object arg) {
if (arg != null) return arg.toString();
return "null";
}
});
ctx.bindValue(prop.observeDelayed(400, t), mProp.observeDetail(master), strategy, strategy);

So it only displays a long text.

Regards,
John
Previous Topic:Group from tree view
Next Topic:Empty name to be accepted in the TextCellEditor
Goto Forum:
  


Current Time: Sat Apr 20 03:52:23 GMT 2024

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

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

Back to the top