Change the style (viewer) of a view [message #30960] |
Tue, 04 November 2008 04:38  |
Eclipse User |
|
|
|
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 #31695 is a reply to message #31523] |
Fri, 07 November 2008 02:42  |
Eclipse User |
|
|
|
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 09:59  |
Eclipse User |
|
|
|
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 01:20  |
Eclipse User |
|
|
|
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 08:48  |
Eclipse User |
|
|
|
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 10:08  |
Eclipse User |
|
|
|
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 02:42  |
Eclipse User |
|
|
|
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
|
|
|
Powered by
FUDForum. Page generated in 0.27052 seconds