Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » Reference toolbar from part definition in e4xmi (How can I reference a shared toolbar from a part defined in e4xmi?)
Reference toolbar from part definition in e4xmi [message #1636497] Thu, 26 February 2015 08:06 Go to next message
Uwe San is currently offline Uwe SanFriend
Messages: 119
Registered: January 2012
Senior Member
Hi all,

is there a way to statically (in the e4xmi file) reference a toolbar defined in the shared elements of my E4 application from a part? Maybe using a placeholder element?

I would like to use the same toolbar in multiple parts and I would like to avoid a programmatic solution as described here.

Thanks,
Uwe
Re: Reference toolbar from part definition in e4xmi [message #1636700 is a reply to message #1636497] Thu, 26 February 2015 10:20 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6364
Registered: July 2009
Senior Member
Hi,

I don't think this is possible because MPlaceholder can not be put into
MPart#toolbar because MPlaceholder only implements MUIElement,
MPartSashContainerElement, MStackElement.

Still there's a general solution. You could contribute a fragment to
multiple parents (the fragment merger would clone the fragment into all
locations).

Once more in theory we designed the whole fragment stuff so that you
could come up with a custom fragment definition who e.g. uses an xpath
so you might find https://bugs.eclipse.org/bugs/show_bug.cgi?id=324954
interesting which would allow in pseudo code do the following:

<fragments xsi:type="custom:XPathFragment"
xpath="//MPart[@elementId~='view.*']" featurename="toolbar">
<toolbar>
<toolbarItem label="T1">
<toolbarItem label="T2">
</toolbar>
</fragments>

the merge would contribute a copy of the fragment to any MPart whose
elementId would start with "view" (I don't know if the xpath expression
is correct but you should get the point).

A really cool thing is that the current merger delegates the merge to
the model element so you could plug in your own system. The best
solution would be if someone would sponsor the development of this as
part of the platform.

Tom

On 26.02.15 09:06, Uwe San wrote:
> Hi all,
>
> is there a way to statically (in the e4xmi file) reference a toolbar
> defined in the shared elements of my E4 application from a part? Maybe
> using a placeholder element?
>
> I would like to use the same toolbar in multiple parts and I would like
> to avoid a programmatic solution as described
> http://stackoverflow.com/questions/23471620/eclipse-4-reuse-toolbar-for-different-parts.
>
>
> Thanks,
> Uwe
Re: Reference toolbar from part definition in e4xmi [message #1637228 is a reply to message #1636700] Thu, 26 February 2015 16:00 Go to previous message
Uwe San is currently offline Uwe SanFriend
Messages: 119
Registered: January 2012
Senior Member
Thanks for your reply, Tom. I think I will try to contribute a fragment to multiple parents as you described. The XPath solution sounds interesting but might be a bit overkill for my use case.
Previous Topic:Moved to a new computer. Eclipse won't open
Next Topic:Using Resteasy Proxy Framework within an OSGI service ?
Goto Forum:
  


Current Time: Tue Dec 12 02:55:07 GMT 2017

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

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