Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Zest Label Provider problem
Zest Label Provider problem [message #646893] Sun, 02 January 2011 12:29 Go to next message
No real name is currently offline No real name
Messages: 2
Registered: January 2011
Junior Member
Hi,

I did the Eclipse Zest Tutorial by Lars Vogel and tried everything, but I can never see the Labels Text.
I think it's a bug.

http://www.vogella.de/articles/EclipseZest/article.html

The problem is the following:
Actually the class ZestLabelProvider should check if there exists an instance of MyConnection:

if (element instanceof MyConnection){
            MyConnection myConnection = (MyConnection) element;
            return myConnection.getLabel();
}


This is the connection:

MyConnection connect = new MyConnection("1", "Name der Verbindung", nodes.get(0),
                nodes.get(1));


But there is never an instance od MyConnection. Only an instance of EntityConnection.
So, there is never a label for a connection.

The label provider is never called for connections with the IGraphEntityContentProvider.

Is there a solution for this?

Re: Zest Label Provider problem [message #646898 is a reply to message #646893] Sun, 02 January 2011 15:20 Go to previous messageGo to next message
Fabian Steeg is currently offline Fabian Steeg
Messages: 72
Registered: July 2009
Member
It seems to be a bug in the tutorial. I'm sure Lars would be happy if you reported it at his Google group.

The main conceptual problem seems to be the fact that in View.java the GraphViewer's input is set to the nodes, which don't contain references to connections. One possible approach would be to set the connections as the viewer's input, and get the nodes from the connections in an IGraphContentProvider, similar to the way it's done in this snippet.
Re: Zest Label Provider problem [message #648315 is a reply to message #646898] Wed, 12 January 2011 06:48 Go to previous message
Johan Schulz is currently offline Johan Schulz
Messages: 20
Registered: November 2010
Junior Member
There is a solution, you have to implement the ISelfStyleProvider interface in your LabelProvider implementation.
This interface has two methods, one for styling nodes and one for connections.

With this interface you should be able to style what you want.

Regards
Johan
Previous Topic:Need optimized way to display tree items
Next Topic:[Zest] Layout
Goto Forum:
  


Current Time: Thu Aug 21 20:04:46 EDT 2014

Powered by FUDForum. Page generated in 0.02082 seconds