Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » e(fx)clipse » Tool Control needs part access
Tool Control needs part access [message #1699682] Thu, 25 June 2015 19:06 Go to next message
Sebastian Lehmann is currently offline Sebastian LehmannFriend
Messages: 8
Registered: January 2014
Junior Member
Hello,

I have a problem with a tool control in a part with a TableView. The toolcontrol contains a textfield which should update the tableview.
That's why I need to notify the part.

In a former e4 swt app this works fine: I accesed the Part implementation in the control through: MPart.getObject().
But now in e(fx)clipse this is null.

Then I tried to set in the part the filter object in the context:
eclipseContext.set(FilterContainer.class, filter);

But the inject in the toolcontrol delivers also null.

Then I realized that the Toolcontrol class is created after the Part class. That does not seem to be the case in e4 SWT.

OK, as workaround I could send the text through IEventBroker but the FilterContainer would also be nice for init and model update.

I use e(fx)clipse 2.0 nightly.

Thanks
Sebastian
Re: Tool Control needs part access [message #1699712 is a reply to message #1699682] Fri, 26 June 2015 06:16 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
Hi,

so the toolcontrol is part of the MParts Toolbar? I just tried that and
for me things work just file!

> package org.eclipse.fx.testcases.e4.parts;
>
> import javax.annotation.PostConstruct;
>
> import org.eclipse.e4.ui.model.application.ui.basic.MPart;
>
> import javafx.scene.Group;
> import javafx.scene.control.Button;
>
> public class PartToolcontrol {
> @PostConstruct
> void init(MPart part, Group g) {
> Button e = new Button("Hello");
> e.setOnAction( ev -> {
> System.err.println("========> " +part.getObject());
> });
> g.getChildren().add(e);
> }
> }

Please provide a reproduceable sample so that we can look into it.

Tom

On 25.06.15 21:06, Sebastian Lehmann wrote:
> Hello,
>
> I have a problem with a tool control in a part with a TableView. The
> toolcontrol contains a textfield which should update the tableview.
> That's why I need to notify the part.
>
> In a former e4 swt app this works fine: I accesed the Part
> implementation in the control through: MPart.getObject().
> But now in e(fx)clipse this is null.
> Then I tried to set in the part the filter object in the context:
> eclipseContext.set(FilterContainer.class, filter);
>
> But the inject in the toolcontrol delivers also null.
>
> Then I realized that the Toolcontrol class is created after the Part
> class. That does not seem to be the case in e4 SWT.
>
> OK, as workaround I could send the text through IEventBroker but the
> FilterContainer would also be nice for init and model update.
>
> I use e(fx)clipse 2.0 nightly.
>
> Thanks
> Sebastian
Re: Tool Control needs part access [message #1699719 is a reply to message #1699712] Fri, 26 June 2015 07:36 Go to previous messageGo to next message
Sebastian Lehmann is currently offline Sebastian LehmannFriend
Messages: 8
Registered: January 2014
Junior Member
Yes, if getObject() is later (Action) called, I get the part.
But not, when it is called immediately in the constructor.
void init(MPart part, Group g) {
System.err.println("========> " +part.getObject());
Button e = new Button("Hello");

But this is most likely no error because the JavaDoc says:
"This is the DI created instance of the class implementing the logic for the element.
It will only be non-null if the element has been rendered into the presentation."

Sorry, my mistake.
Re: Tool Control needs part access [message #1699723 is a reply to message #1699719] Fri, 26 June 2015 07:57 Go to previous message
Sebastian Lehmann is currently offline Sebastian LehmannFriend
Messages: 8
Registered: January 2014
Junior Member
with swt renderer the object is already in the constr. set, but that must not be the case according to JavaDoc, I think.

I can solve my problem otherwise, also the little problem that eclipseContext.set(FilterContainer.class, filter); setted in part, is not available in ToolControl Field or constructor inject.
Previous Topic:l10n files generate a gitignore file ?
Next Topic:the dimensions of the window after setting content
Goto Forum:
  


Current Time: Tue Apr 16 08:33:17 GMT 2024

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

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

Back to the top