Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » Force to access contributor immediately, after setting the ContributorURI?
Force to access contributor immediately, after setting the ContributorURI? [message #985933] Fri, 16 November 2012 17:56 Go to next message
Alex Kipling is currently offline Alex KiplingFriend
Messages: 260
Registered: July 2012
Senior Member
I have a main-application and a plugin.
Main-application sets the ContributorURI for a Part at some point.
Here is the class, which the ContributorURI points to:

public class TestPart {
    @Inject
    private MApplication application;

    @PostConstruct
    public void createControls(Composite parent) {
        application.getContext().set(Composite.class, parent);
    }
}


After setting the ContributorURI I trigger the plugin, which should do something with Composite.class in context.

This is the only way I found to switch from E4 MPart.. to the SWT Composite API and to pass it to the plugin.

Problem:
The problem is, that after setting the ContributorURI the above class is not immediately triggered, so that the plugin wont find the Composite it depends on.

Question:
How can I force the Platform to trigger createControls immediately, after setting ContributorURI?
Re: Force to access contributor immediately, after setting the ContributorURI? [message #985962 is a reply to message #985933] Fri, 16 November 2012 21:09 Go to previous messageGo to next message
Eclipse UserFriend
ContextInjectionFactory.make(TestPart.class, context); will instantiate, run the injections and call the postconstruct.
Re: Force to access contributor immediately, after setting the ContributorURI? [message #986006 is a reply to message #985962] Sat, 17 November 2012 11:20 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
And do not put Composite.class into the root context, this can lead to
strange effects.

Tom

Am 16.11.12 22:09, schrieb Sopot Cela:
> ContextInjectionFactory.make(TestPart.class, context); will instantiate,
> run the injections and call the postconstruct.
Re: Force to access contributor immediately, after setting the ContributorURI? [message #986150 is a reply to message #986006] Mon, 19 November 2012 08:31 Go to previous messageGo to next message
Alex Kipling is currently offline Alex KiplingFriend
Messages: 260
Registered: July 2012
Senior Member
My Problem is, that I need the Part-implementation, which should be linked to it's Part.
The only way I know to link a partimplemntation with its Part - is by doing Part.setContributionURI().

Offcourse the part implementation should be allready initialized, when I am using it,
but if I initialize it manually (by creating an instance by ContextInjectionFactory.make(TestPart.class, context)) - I can not connect the implementation with its Part, because it only works with the URI.
If I just set the URI to connect the part with the implementation - then the part is connected with it's implementation, but it is not immediately initialized.

Question:
So, how can I connect a part with it's implementation, if I instantiated the implementation by ContextInjectionFactory.make(TestPart.class, context))

OR

how can I retrieve the instance of part-implementation, if the Part implementation was set by URI (Part.setContributionURI())

[Updated on: Mon, 19 November 2012 11:49]

Report message to a moderator

Re: Force to access contributor immediately, after setting the ContributorURI? [message #986201 is a reply to message #986150] Mon, 19 November 2012 12:36 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
Ahm I'm just reading that your call setContributorURI which is wrong and
should be *setContributionURI*!!

Tom

Am 19.11.12 09:31, schrieb Alex Kipling:
> My Problem is, that I need the Part-implementation, which should be
> linked to it's Part.
> The only way I know to link a partimplemntation with its Part - is by
> doing Part.setContributorURI().
>
> Offcourse the Partimplementation should be allready initialized, when I
> am using it,
> but if I initialize it manually (by craeating an instance by
> ContextInjectionFactory.make(TestPart.class, context)) - I can not
> connect the implementation with its Part, because it only works with the
> URI.
> If I just set the URI to connect the Part with the implementation - then
> the Part is connected with it's implementation, but it is not
> immediately initialized.
>
> How can I connect the Part with it's implementation AND initialize it
> immediately?
>
Re: Force to access contributor immediately, after setting the ContributorURI? [message #986205 is a reply to message #986201] Mon, 19 November 2012 13:07 Go to previous messageGo to next message
Alex Kipling is currently offline Alex KiplingFriend
Messages: 260
Registered: July 2012
Senior Member
Thnx Tom, allready got that. But Whats about the instantiation?
Re: Force to access contributor immediately, after setting the ContributorURI? [message #986209 is a reply to message #986205] Mon, 19 November 2012 13:27 Go to previous messageGo to next message
Eclipse UserFriend
I'm not sure I understand your post but I think what you need to do

Mpart#setObject(IContributionFactory#create(String uriString, IEclipseContext context));

to link the part with the contribution object.

You can have those interfaces by injection.
Re: Force to access contributor immediately, after setting the ContributorURI? [message #986212 is a reply to message #986209] Mon, 19 November 2012 13:43 Go to previous messageGo to next message
Alex Kipling is currently offline Alex KiplingFriend
Messages: 260
Registered: July 2012
Senior Member
Thanx - thats it!
Re: Force to access contributor immediately, after setting the ContributorURI? [message #986249 is a reply to message #986212] Mon, 19 November 2012 15:56 Go to previous message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
This is done normally by the renderer so I'm not sure what you are doing
with the MPart.

Tom

Am 19.11.12 14:43, schrieb Alex Kipling:
> Thanx - thats it!
Previous Topic:Theme for Eclipse Juno - Images
Next Topic:Where to register central event redistributor?
Goto Forum:
  


Current Time: Sat Apr 20 00:57:47 GMT 2024

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

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

Back to the top