Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[e4-dev] PartService: Strings or MParts? Collections or arrays?

Hi all,

It became obvious while trying to write some tests that we did not have any client API for standard workbench operations like "show this view" or "activate this part" so we're hoping to resolve this with a new (E)PartService API.
https://bugs.eclipse.org/bugs/show_bug.cgi?id=295003

-----------------

So I figured I'd first define the methods I personally needed like showPart and activate but it then struck me that it was not clear to me what parameters it should take...

showPart(String)

showPart(MPart)

In the first case we would be mandating that every single MPart had an id. From our current code base it doesn't seem like this restriction is actually enforced. The photo demo it self is devoid of ids. I added them locally on my own xmi file because I had to find them but that's about it. Having an id is a 3.x requirement though it's not clear to me if it's going to be brought back at the moment.

In the second case, having an MPart parameter assumes that the developer actually has an MPart lying around. This is all well and good if it was actually on the window and I can use recursion and find it, but what if it's not? If I just install a new plug-in then of course that view isn't going to be in my window the next time I boot up the workbench, but I'm pretty darn sure I want to be able to bring that new view up when I need it.

So which makes more sense, a String or an MPart? Or maybe EPartService should expose both? Or maybe something totally different? As an aside, it might be good to also provide an overloaded method that takes an Map<String, Object> for injection purposes into the shown MPart, ooooooo.

-----------------

Since the functionality that (E)PartService will expose will be quite similar to 3.x's IWorkbenchPage, I figured I'd take a look at that interface and see what methods we might want in the e4 world. I noticed it has getViewReferences() which seem pretty handy but then I noticed that it returns an IViewReference[]. In e4, would we want to return a Collection<MPart> (or List<MPart>) or an MPart[]? Perhaps Collection<MPart> would make more sense as it would align with the API that we currently expose in the model, i.e. MApplication has a getChildren() method and it returns a List<MWindow>. It looks like this was discussed briefly in bug 289000 comment 24 and down.
https://bugs.eclipse.org/bugs/show_bug.cgi?id=289000#c24

Regards,
Remy

----------
Remy Suen
Eclipse Platform/UI Committer, Rational Team Concert Developer
IBM Ottawa
613-356-5162


Back to the top