Bug 246162 - [Commands] [Services] Make IWorkbenchLocationService public
Summary: [Commands] [Services] Make IWorkbenchLocationService public
Status: NEW
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.5   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Platform UI Triaged CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on: 267083
Blocks: 246243
  Show dependency tree
 
Reported: 2008-09-03 19:01 EDT by Pawel Piech CLA
Modified: 2021-03-10 09:07 EST (History)
5 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Pawel Piech CLA 2008-09-03 19:01:41 EDT
I am trying to implement IElementUpdater.updateElement() which uses state found in the element's part.  I tried to get the IWorkbenchPartSite using the service locator as suggested in UIElement comments, but this doesn't work.  

It seems that IWorkbenchLocationService was introduced with bug 229127 as a replacement, but it's not an an API yet.  Please make this interface public.

P.S. Workaround suggestions welcome.
Comment 1 Paul Webster CLA 2008-09-04 09:40:05 EDT
AFAICT that information is only available within in the IWorkbenchLocationService in 3.4.  You can use it in 3.4, but would need to use the different (public) API in 3.5

PW
Comment 2 Pawel Piech CLA 2008-09-04 11:50:54 EDT
That makes sense, thank you.
Comment 3 Paul Webster CLA 2008-10-23 07:32:48 EDT
I'd like to get this in early in M4.  Eric, Boris, I'd like for this to be a simple pattern so that for any given IServiceLocator, you can request this service and you can "find" your location.

PW
Comment 4 Eric Moffatt CLA 2008-10-23 13:33:56 EDT
Paul, what does 'location' mean in this context? (part, site...?)
Comment 5 Paul Webster CLA 2008-10-23 14:00:38 EDT
basically, "what level am I at" and "what workbench model can I see".

There are a lot of situations (dynamic menu contribution, service creation) where the client needs to get their workbench window or the part they belong to (we had to do it for our service creation).

Before making it public, I'd like to make sure that 1) it works in the current workbench and 2) that it generalizes to the component concept (hierarchy of service locators but not restricted to Workench>Workbench Window>Part)

PW
Comment 6 Boris Bokowski CLA 2008-10-23 14:30:29 EDT
(In reply to comment #5)
> Before making it public, I'd like to make sure that 1) it works in the current
> workbench and 2) that it generalizes to the component concept (hierarchy of
> service locators but not restricted to Workench>Workbench Window>Part)

I think it does generalize, but I don't like the idea very much because it ties the consuming code to its context.

I would prefer adding a service that makes it possible to do dynamic menu contributions without having to refer to specific objects in the Workbench model.
Comment 7 Pawel Piech CLA 2008-10-23 18:22:55 EDT
(In reply to comment #6)
> I think it does generalize, but I don't like the idea very much because it ties
> the consuming code to its context.

Doesn't that make sense if the consuming code acts on its context?  In my specific case, I'm trying to implement a handler that modifies the properties of a view that its in.
Comment 8 Boris Bokowski CLA 2008-10-23 23:28:53 EDT
Maybe I don't understand the use case - Paul, could you try to explain it to me?
Comment 9 Paul Webster CLA 2009-01-19 08:18:23 EST
This (or some appropriate other answer) will need to go in for M6

Perhaps to be more consistent with what might happen in e4, it should be a lookup service.  You give us your Part or PartSite or IServiceLocator and we'll look up your IWorkbenchWindow or IWorkbenchPart

PW
Comment 10 Pawel Piech CLA 2009-02-13 00:13:41 EST
(In reply to comment #8)
> Maybe I don't understand the use case - Paul, could you try to explain it to
> me?

I have a use case in bug 246243, which is marked as depending on this one:  I am trying to convert some of the JDT actions in debugger views to the command framework.  Some of the handlers implement IElementUpdater to set the correct checked state to the UI element.  This checked state is calculated using the view part where the command appears.  But the UIElement, which is given in the IElementUpdater.updateElement(), only contains the IServiceLocator as its link to the local context...
Comment 11 Paul Webster CLA 2009-03-04 14:20:55 EST
This will have to be deferred to 3.6, as I am not confident that we can fix bug 267083 decently enough.

PW
Comment 12 Eclipse Webmaster CLA 2019-09-06 16:08:59 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.