Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » e(fx)clipse » Howto pass parameter to contribution class(Passing parameter to dynamically created MToolControl)
Howto pass parameter to contribution class [message #1698369] Mon, 15 June 2015 07:12 Go to next message
Krzysztof Szymanek is currently offline Krzysztof SzymanekFriend
Messages: 9
Registered: June 2015
Junior Member
I dynamically add MToolControl to toolbar using below code. I try to use transient data to pass some custom parameter to "presentation class".

        MToolControl toolCtr = MMenuFactory.INSTANCE.createToolControl();
        String classUri = "bundleclass://psiwsm.e4fx.app/de.psi.pjf.wsm.bar.BarItemWidget";
        toolCtr.setContributionURI( classUri );
        toolCtr.getTransientData().put( BarItemWidget.KEY_WIDGET, aWidget );
        toolCtr.setVisible( true );
        toolCtr.setToBeRendered( true );
        // toolCtr.setParent( (MElementContainer<MUIElement>) toolbar );
        mbar.getChildren().add( toolCtr );


Since I have no means to access MToolControl from my presentation class (pointed by ContributionUri) I cannot access my parameter

public class BarItemWidget
{
    /**
     * Used in {@link MToolControl#getTransientData()} to store {@link WidgetBarCtrDesc}
     */
    public static final String KEY_WIDGET = "widget";
    @Inject
    @Optional
    private MToolControl modelElement;
    
    @PostConstruct
    public void createGui( Group group )
    {
        group.getChildren().add( new Label( "BarItemWidget" ) );
    }

}


Is there another way of passing parameter? I would be grateful for any help.

Re: Howto pass parameter to contribution class [message #1698463 is a reply to message #1698369] Mon, 15 June 2015 19:19 Go to previous message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
No but I just fixed the bug so in 2.0 you can get access to the
MToolControl!

Tom

On 15.06.15 20:02, Krzysztof Szymanek wrote:
> I dynamically add MToolControl to toolbar using below code. I try to use
> transient data to pass some custom parameter to "presentation class".
>
>
> MToolControl toolCtr = MMenuFactory.INSTANCE.createToolControl();
> String classUri =
> "bundleclass://psiwsm.e4fx.app/de.psi.pjf.wsm.bar.BarItemWidget";
> toolCtr.setContributionURI( classUri );
> toolCtr.getTransientData().put( BarItemWidget.KEY_WIDGET, aWidget );
> toolCtr.setVisible( true );
> toolCtr.setToBeRendered( true );
> // toolCtr.setParent( (MElementContainer<MUIElement>) toolbar );
> mbar.getChildren().add( toolCtr );
>
>
> Since I have no means to access MToolControl from my presentation class
> (pointed by ContributionUri) I cannot access my parameter
>
>
> public class BarItemWidget
> {
> /**
> * Used in {@link MToolControl#getTransientData()} to store {@link
> WidgetBarCtrDesc}
> */
> public static final String KEY_WIDGET = "widget";
> @Inject
> @Optional
> private MToolControl modelElement;
> @PostConstruct
> public void createGui( Group group )
> {
> group.getChildren().add( new Label( "BarItemWidget" ) );
> }
>
> }
>
> Is there another way of passing parameter? I would be grateful for any
> help.
>
>
Previous Topic:initModality in PartDescriptor (for new window)
Next Topic:MUIElement from wrong Context passed to control
Goto Forum:
  


Current Time: Sat Jan 25 03:53:51 GMT 2025

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

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

Back to the top