Skip to main content



      Home
Home » Eclipse Projects » GEF » Accessing the GraphicalViewer of a GraphicalEditor and vice-vera
Accessing the GraphicalViewer of a GraphicalEditor and vice-vera [message #88244] Thu, 24 July 2003 11:58 Go to next message
Eclipse UserFriend
Originally posted by: bgrieder.nospam.thanks

Hi,

I am creating a (GEF) ContentOutlinePage for an OutlineViewer and, for
clarity, wishes the class implementing the ContentOutlinePage not being
an inner class of the GraphicalEditor (in contrary to the logic example).

However, it seems that I have to pass BOTH the GraphicalEditor object
and its associated GraphicalViewer object to the ContentOutlinePage,
because I cannot access the GraphicalViewer from the GraphicalEditor.

Why is the getGraphicalViewer method on the GraphicalEditor protected?
Is there a better implementation than passing both objects?

Many Thanks

bruno
Re: Accessing the GraphicalViewer of a GraphicalEditor and vice-vera [message #88279 is a reply to message #88244] Thu, 24 July 2003 13:01 Go to previous messageGo to next message
Eclipse UserFriend
You can call GraphicalEditor.getAdapter(GraphicalViewer.class) to get the
GraphicalViewer.

Bruno Grieder wrote:

> Hi,
>
> I am creating a (GEF) ContentOutlinePage for an OutlineViewer and, for
> clarity, wishes the class implementing the ContentOutlinePage not being
> an inner class of the GraphicalEditor (in contrary to the logic example).
>
> However, it seems that I have to pass BOTH the GraphicalEditor object
> and its associated GraphicalViewer object to the ContentOutlinePage,
> because I cannot access the GraphicalViewer from the GraphicalEditor.
>
> Why is the getGraphicalViewer method on the GraphicalEditor protected?
> Is there a better implementation than passing both objects?
>
> Many Thanks
>
> bruno
>
Re: Accessing the GraphicalViewer of a GraphicalEditor and vice-vera [message #88370 is a reply to message #88279] Fri, 25 July 2003 02:54 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: bgrieder.nospam.thanks

Thanks Eric.

Eric Bordeau wrote:
> You can call GraphicalEditor.getAdapter(GraphicalViewer.class) to get
> the GraphicalViewer.
>
> Bruno Grieder wrote:
>
>> Hi,
>>
>> I am creating a (GEF) ContentOutlinePage for an OutlineViewer and, for
>> clarity, wishes the class implementing the ContentOutlinePage not
>> being an inner class of the GraphicalEditor (in contrary to the logic
>> example).
>>
>> However, it seems that I have to pass BOTH the GraphicalEditor object
>> and its associated GraphicalViewer object to the ContentOutlinePage,
>> because I cannot access the GraphicalViewer from the GraphicalEditor.
>>
>> Why is the getGraphicalViewer method on the GraphicalEditor protected?
>> Is there a better implementation than passing both objects?
>>
>> Many Thanks
>>
>> bruno
>>
>
Re: Accessing the GraphicalViewer of a GraphicalEditor and vice-vera [message #88460 is a reply to message #88244] Fri, 25 July 2003 08:17 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: g.wagenknecht.planet-wagenknecht.de

Bruno Grieder wrote:

> Why is the getGraphicalViewer method on the GraphicalEditor protected?
> Is there a better implementation than passing both objects?

You can overwrite it in your editor and make it public :)

Cu, Gunnar
Re: Accessing the GraphicalViewer of a GraphicalEditor and vice-vera [message #88505 is a reply to message #88460] Fri, 25 July 2003 12:20 Go to previous message
Eclipse UserFriend
Originally posted by: bgrieder.nospam.thanks

Hi,

Yes. That is what I initially did ;-) But honestly, it is not great from
a maintenance and clarity point of view. So, I implemented the solution
proposed by Eric, which works fine.

The Adapter(s) are quite tricky to get into but really powerful. I now
have a customized View which automatically displays information
depending on what is clicked or changed in the GraphicalEditor. Pretty
cool :-)







Gunnar Wagenknecht wrote:
> Bruno Grieder wrote:
>
>
>>Why is the getGraphicalViewer method on the GraphicalEditor protected?
>>Is there a better implementation than passing both objects?
>
>
> You can overwrite it in your editor and make it public :)
>
> Cu, Gunnar
>
>
Previous Topic:How do i Import a java project into Workspace by programming
Next Topic:how do you reveal an edit part when model object selected via outline
Goto Forum:
  


Current Time: Fri Jul 25 02:41:35 EDT 2025

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

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

Back to the top