Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » cast exception for an EAttribute
cast exception for an EAttribute [message #232922] Mon, 08 June 2009 11:48 Go to next message
spyro  is currently offline spyro Friend
Messages: 18
Registered: July 2009
Junior Member
hello,
in my editor the root edtipart has an EAtribute and i need to get that
attribute but it seems to not be working. i can reach to it but i get a
cast exception everytime i try to get it. can some of you tell me how can
i access the attribute of my root edit part of my editor?
i can access it with
((XXXImpl)this.getDiagramGraphicalViewer().getContents()).ge tAtribute();
inside the YYYYDiagramEditor class but i get

java.lang.ClassCastException: YYYY.diagram.edit.parts.EditorEditPart
cannot be cast to YYYY.impl.XXXImpl

when i try this
((EditorEditPart)this.getDiagramGraphicalViewer().getContent s()).getAtribute();
then the attribute is not visible.

can anyone help me?
Re: cast exception for an EAttribute [message #232957 is a reply to message #232922] Mon, 08 June 2009 14:05 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello spyro,

Try something like: ((XXXImpl) ((View) EditPart.getModel()).getElement())

-----------------
Alex Shatalin
Re: cast exception for an EAttribute [message #232965 is a reply to message #232957] Mon, 08 June 2009 14:30 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 31035
Registered: July 2009
Senior Member
And if XXXImpl is an EMF generated implementation class for interface
XXX, then don't use the Impl class. :-P

Alex Shatalin wrote:
> Hello spyro,
>
> Try something like: ((XXXImpl) ((View) EditPart.getModel()).getElement())
>
> -----------------
> Alex Shatalin
>
>
Re: cast exception for an EAttribute [message #233168 is a reply to message #232965] Tue, 09 June 2009 18:55 Go to previous message
spyro  is currently offline spyro Friend
Messages: 18
Registered: July 2009
Junior Member
thanks a lot Alex and Ed... that worked fine
Previous Topic:How to set Avoid obstructions and Closest distance on my connections by default.
Next Topic:Compartment item copy/paste
Goto Forum:
  


Current Time: Mon Apr 06 21:41:10 GMT 2020

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

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

Back to the top