Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » JFace » ViewPart title image(ViewPart title image displayes wrong icon)
ViewPart title image [message #723299] Thu, 08 September 2011 05:22 Go to next message
Janusz Dalecki is currently offline Janusz Dalecki
Messages: 53
Registered: January 2010
Location: Sydney
Member
I have a perspective with a few ViewPart objects of the same class (let's say IncidentView). However IncidentView objects in my case might internally of two types (let's say Accident or Fault) for which I am using different title image (displayed as an icon in the tab). If I run my Eclipse based workbench and create new IncidentVews of both types (Accident or Fault), all of them have the correct image. If I than quit the workbench and restart it only the IncidentView that was selected when I closed the workbench has the correct image, all the other IncidentViews have some default images. I debugged the application and found that Eclipse asks my IncidentView for a title image only if it is selected in the perspective (as a tab), for all the others it is using default images. Can I somehow force Eclipse to ask every instance of the IncidentView for its image?
Re: ViewPart title image [message #723312 is a reply to message #723299] Thu, 08 September 2011 06:00 Go to previous messageGo to next message
Eclipse User
Originally posted by:

On 2011-09-08 11:22, Janusz Dalecki wrote:
> I have a perspective with a few ViewPart objects of the same class
> (let's say IncidentView). However IncidentView objects in my case might
> internally of two types (let's say Accident or Fault) for which I am
> using different title image (displayed as an icon in the tab). If I run
> my Eclipse based workbench and create new IncidentVews of both types
> (Accident or Fault), all of them have the correct image. If I than quit
> the workbench and restart it only the IncidentView that was selected
> when I closed the workbench has the correct image, all the other
> IncidentViews have some default images. I debugged the application and
> found that Eclipse asks my IncidentView for a title image only if it is
> selected in the perspective (as a tab), for all the others it is using
> default images. Can I somehow force Eclipse to ask every instance of the
> IncidentView for its image?

Let my try to describe whether I understood your scenario correctly:

You are using a single view part definition to create several instances
of that view, which have individual images. Since you cannot set these
during plugin definition time within the the org.eclipse.ui.views
extension point, you are assigning the images during runtime
programmatically. Is this correct? If so, I doubt that you will have
success, because all views, that are still in the non-foreground tabs,
won't be created, thus the shown information is that based on the
extension point definition.

HTH & Greetings from Bremen,

Daniel Krügler
Re: ViewPart title image [message #723334 is a reply to message #723312] Thu, 08 September 2011 07:12 Go to previous messageGo to next message
Janusz Dalecki is currently offline Janusz Dalecki
Messages: 53
Registered: January 2010
Location: Sydney
Member
Hi Daniel,
Yep, your description of my problem is better than mine. Thanks for that.
So you don't think that I can force Eclipse to ask my non-foreground tab (not created yet view) to create it and then ask it for the title image?
Can you think of any other ways in which I can fix my problem?
Regards,
Janusz
Re: ViewPart title image [message #723350 is a reply to message #723334] Thu, 08 September 2011 07:30 Go to previous messageGo to next message
Eclipse User
Originally posted by:

On 2011-09-08 13:12, Janusz Dalecki wrote:
> Hi Daniel,
> Yep, your description of my problem is better than mine. Thanks for that.
> So you don't think that I can force Eclipse to ask my non-foreground tab
> (not created yet view) to create it and then ask it for the title image?

Not really, unless you are willing to dig deep into the presentation API
of Eclipse (and I haven't done that before).

> Can you think of any other ways in which I can fix my problem?

Have you considered to make these views different extensions? You could
provide a single view part definition that contains all the
implementation you currently have inside your view (but don't register
this class via the view extension point), then derive all those with
different images from this view part and register these via the
org.eclipse.ui.views extension point.

HTH & Greetings from Bremen,

Daniel Krügler
Re: ViewPart title image [message #723610 is a reply to message #723350] Thu, 08 September 2011 20:14 Go to previous message
Janusz Dalecki is currently offline Janusz Dalecki
Messages: 53
Registered: January 2010
Location: Sydney
Member
Unfortunately the sub-type of the view is decided after the view is created not before when I could decide which sub-type to create so after sub-type is chosen by user I would have to delete the current view (if the one created is not of the correct sub-type and create new one) it is possible but bit messy I guess.
Thanks for you help,
Regards,
Janusz
Previous Topic:How to open a modal MessageDialog from a ProgressMonitorDialog?
Next Topic:Binding controls to null-valued bean properties
Goto Forum:
  


Current Time: Sat Aug 02 00:32:18 EDT 2014

Powered by FUDForum. Page generated in 0.03862 seconds