Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Plugin Development Environment (PDE) » Change the style (viewer) of a view
Change the style (viewer) of a view [message #30960] Tue, 04 November 2008 09:38 Go to next message
Matthias Kohles is currently offline Matthias KohlesFriend
Messages: 71
Registered: July 2009
Member
Hey,

i created my own view in a plugin. This view uses a table viewer for
displaying the input by default. Now i want to implement an option to
switch from the table viewer to a treeviewer. I know how the viewers are
working but i don't know how i can change the viewer in my View. There is
no "setViewer()" method or something like that. Does anyone know how i can
manage this?

regards

Matthias
Re: Change the style (viewer) of a view [message #30996 is a reply to message #30960] Tue, 04 November 2008 14:59 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: eclipse-news.rizzoweb.com

On 11/4/2008 4:38 AM, Matthias Kohles wrote:
> Hey,
>
> i created my own view in a plugin. This view uses a table viewer for
> displaying the input by default. Now i want to implement an option to
> switch from the table viewer to a treeviewer. I know how the viewers are
> working but i don't know how i can change the viewer in my View. There
> is no "setViewer()" method or something like that. Does anyone know how
> i can manage this?

One option would be to use a org.eclipse.swt.custom.StackLayout as the
top-level layout of your view and then you can easily switch between two
children, a tree and a table.

Hope this helps,
Eric
Re: Change the style (viewer) of a view [message #31364 is a reply to message #30996] Thu, 06 November 2008 06:20 Go to previous messageGo to next message
Matthias Kohles is currently offline Matthias KohlesFriend
Messages: 71
Registered: July 2009
Member
Hey,

thanks for your answer. I've found an example for the StackLayout on
google, but unfortunately it didn't work for me :(

There must be another way. I have already looked in the sources of the
eclipse SDK to see how they have implemented their search view. But i
found nothing.

regards

Matthias
Re: Change the style (viewer) of a view [message #31488 is a reply to message #31364] Thu, 06 November 2008 13:48 Go to previous messageGo to next message
Matthias Kohles is currently offline Matthias KohlesFriend
Messages: 71
Registered: July 2009
Member
a little update from me. I've now tried to set a new TreeViewer to my
viewer variable when i trigger the "View as Tree" action in the view. Then
i call the parent.redraw() method. So if i now trigger the action and
change the view size to trigger the redraw, i have both viewer in the
view, the old tableviewer and the new treeviewer... Is there a way to
repaint the view without changing the size to trigger it? How can i get
rid of the old viewer?

regards

Matthias
Re: Change the style (viewer) of a view [message #31523 is a reply to message #31364] Thu, 06 November 2008 15:08 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: eclipse-news.rizzoweb.com

On 11/6/2008 1:20 AM, Matthias Kohles wrote:
> Hey,
> thanks for your answer. I've found an example for the StackLayout on
> google, but unfortunately it didn't work for me :(

StackLayout is extremely simple - the Javadoc for it even has example
code. Perhaps if you describe what "didn't work" and show some code you
tried, then we could tell you what is wrong.

Eric
Re: Change the style (viewer) of a view [message #31695 is a reply to message #31523] Fri, 07 November 2008 07:42 Go to previous message
Matthias Kohles is currently offline Matthias KohlesFriend
Messages: 71
Registered: July 2009
Member
Hey,

schame on me. I now tried to use the StackLayout again. My very stupid
mistake was that i forgot to call the layout method when i switch the
viewer :(

the loop exception is fired by another, yet unknown, error in my code.

Finally now it works very fine.

Thank you for your help. :-)

regards Matthias
Re: Change the style (viewer) of a view [message #584210 is a reply to message #30960] Tue, 04 November 2008 14:59 Go to previous message
Eric Rizzo is currently offline Eric RizzoFriend
Messages: 3070
Registered: July 2009
Senior Member
On 11/4/2008 4:38 AM, Matthias Kohles wrote:
> Hey,
>
> i created my own view in a plugin. This view uses a table viewer for
> displaying the input by default. Now i want to implement an option to
> switch from the table viewer to a treeviewer. I know how the viewers are
> working but i don't know how i can change the viewer in my View. There
> is no "setViewer()" method or something like that. Does anyone know how
> i can manage this?

One option would be to use a org.eclipse.swt.custom.StackLayout as the
top-level layout of your view and then you can easily switch between two
children, a tree and a table.

Hope this helps,
Eric
Re: Change the style (viewer) of a view [message #584397 is a reply to message #30996] Thu, 06 November 2008 06:20 Go to previous message
Matthias Kohles is currently offline Matthias KohlesFriend
Messages: 71
Registered: July 2009
Member
Hey,

thanks for your answer. I've found an example for the StackLayout on
google, but unfortunately it didn't work for me :(

There must be another way. I have already looked in the sources of the
eclipse SDK to see how they have implemented their search view. But i
found nothing.

regards

Matthias
Re: Change the style (viewer) of a view [message #584451 is a reply to message #31364] Thu, 06 November 2008 13:48 Go to previous message
Matthias Kohles is currently offline Matthias KohlesFriend
Messages: 71
Registered: July 2009
Member
a little update from me. I've now tried to set a new TreeViewer to my
viewer variable when i trigger the "View as Tree" action in the view. Then
i call the parent.redraw() method. So if i now trigger the action and
change the view size to trigger the redraw, i have both viewer in the
view, the old tableviewer and the new treeviewer... Is there a way to
repaint the view without changing the size to trigger it? How can i get
rid of the old viewer?

regards

Matthias
Re: Change the style (viewer) of a view [message #584465 is a reply to message #31364] Thu, 06 November 2008 15:08 Go to previous message
Eric Rizzo is currently offline Eric RizzoFriend
Messages: 3070
Registered: July 2009
Senior Member
On 11/6/2008 1:20 AM, Matthias Kohles wrote:
> Hey,
> thanks for your answer. I've found an example for the StackLayout on
> google, but unfortunately it didn't work for me :(

StackLayout is extremely simple - the Javadoc for it even has example
code. Perhaps if you describe what "didn't work" and show some code you
tried, then we could tell you what is wrong.

Eric
Re: Change the style (viewer) of a view [message #584541 is a reply to message #31523] Fri, 07 November 2008 07:42 Go to previous message
Matthias Kohles is currently offline Matthias KohlesFriend
Messages: 71
Registered: July 2009
Member
Hey,

schame on me. I now tried to use the StackLayout again. My very stupid
mistake was that i forgot to call the layout method when i switch the
viewer :(

the loop exception is fired by another, yet unknown, error in my code.

Finally now it works very fine.

Thank you for your help. :-)

regards Matthias
Previous Topic:How to add Wizards to WizardCategory programmatically
Next Topic:Duplicate entry for plugin
Goto Forum:
  


Current Time: Thu Apr 25 10:27:29 GMT 2024

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

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

Back to the top