Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » AddOn gets the wrong shell
AddOn gets the wrong shell [message #548859] Fri, 23 July 2010 10:18 Go to next message
U. Geerds is currently offline U. GeerdsFriend
Messages: 10
Registered: July 2010
Junior Member
Hi anybody,

i recognized, that my AddOn-class gets the shell from the workbench, from where the app is started.

I added the following "AddOn" to my e4 app:

@PostConstruct
void hookListeners(Shell shell) {
shell.setText("Hooked");

After I recognized, the shell.setText doesn't works, I add the following code:

shell.setMaximized(true);
shell.addMouseMoveListener(new MouseMoveListener() {
@Override
public void mouseMove(MouseEvent e) {
System.out.println("move: " + e.x + ", " + e.y);
}
});

The mouse move is only called, if the mouse pointer is out of the app window.

I try it also with @Named(IServiceConstants.ACTIVE_SHELL) Shell shell. But the result is the same.

What should I do, to get underlaying Shell of my app?

I'm working on Mac with the following SDK;
e4 SDK 0.9.0.I20100718-2115

Greetings. Uwe
Re: AddOn gets the wrong shell [message #548873 is a reply to message #548859] Fri, 23 July 2010 11:02 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 5487
Registered: July 2009
Senior Member
Hi,

At the moment the Addons are processed before the rendering is done.

An application beside that doesn't have only one shell but multiple ones
so your first code is not really making a lot of sense anyway.

The real use for Addons is give you access to the EventBus and hook your
EventHandler.

If you are interested in every creation of a Shell then you'll register
for a topic like this:

---------8<---------
@Inject
IEventBroker eventBroker;

@PostConstruct
void hookListeners() {
String topic = UIEvents.buildTopic(UIEvents.UIElement.TOPIC,
UIEvents.UIElement.WIDGET);
eventBroker.subscribe(topic, null, installHook, false);
}

@PreDestroy
void unhookListeners() {
eventBroker.unsubscribe(installHook);
}
---------8<---------

You could probably track the ActiveShell using method injection but
definately NOT not in the @PostConstruct.

Tom

Am 23.07.10 12:18, schrieb U. Geerds:
> Hi anybody,
>
> i recognized, that my AddOn-class gets the shell from the workbench,
> from where the app is started.
>
> I added the following "AddOn" to my e4 app:
>
> @PostConstruct
> void hookListeners(Shell shell) {
> shell.setText("Hooked");
>
> After I recognized, the shell.setText doesn't works, I add the following
> code:
>
> shell.setMaximized(true);
> shell.addMouseMoveListener(new MouseMoveListener() {
> @Override
> public void mouseMove(MouseEvent e) {
> System.out.println("move: " + e.x + ", " + e.y);
> }
> });
> The mouse move is only called, if the mouse pointer is out of the app
> window.
>
> I try it also with @Named(IServiceConstants.ACTIVE_SHELL) Shell shell.
> But the result is the same.
>
> What should I do, to get underlaying Shell of my app?
>
> I'm working on Mac with the following SDK;
> e4 SDK 0.9.0.I20100718-2115
>
> Greetings. Uwe
>
Re: AddOn gets the wrong shell [message #548902 is a reply to message #548873] Fri, 23 July 2010 12:35 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 5487
Registered: July 2009
Senior Member
Just one more note! You should NOT call setText() on the shell because
then you assume that an SWT-Shell is used to renderer the concept of a
window.

It's better to call MWindow#setLabel() which is the model element!

Tom

Am 23.07.10 13:02, schrieb Tom Schindl:
> Hi,
>
> At the moment the Addons are processed before the rendering is done.
>
> An application beside that doesn't have only one shell but multiple ones
> so your first code is not really making a lot of sense anyway.
>
> The real use for Addons is give you access to the EventBus and hook your
> EventHandler.
>
> If you are interested in every creation of a Shell then you'll register
> for a topic like this:
>
> ---------8<---------
> @Inject
> IEventBroker eventBroker;
>
> @PostConstruct
> void hookListeners() {
> String topic = UIEvents.buildTopic(UIEvents.UIElement.TOPIC,
> UIEvents.UIElement.WIDGET);
> eventBroker.subscribe(topic, null, installHook, false);
> }
>
> @PreDestroy
> void unhookListeners() {
> eventBroker.unsubscribe(installHook);
> }
> ---------8<---------
>
> You could probably track the ActiveShell using method injection but
> definately NOT not in the @PostConstruct.
>
> Tom
>
> Am 23.07.10 12:18, schrieb U. Geerds:
>> Hi anybody,
>>
>> i recognized, that my AddOn-class gets the shell from the workbench,
>> from where the app is started.
>>
>> I added the following "AddOn" to my e4 app:
>>
>> @PostConstruct
>> void hookListeners(Shell shell) {
>> shell.setText("Hooked");
>>
>> After I recognized, the shell.setText doesn't works, I add the following
>> code:
>>
>> shell.setMaximized(true);
>> shell.addMouseMoveListener(new MouseMoveListener() {
>> @Override
>> public void mouseMove(MouseEvent e) {
>> System.out.println("move: " + e.x + ", " + e.y);
>> }
>> });
>> The mouse move is only called, if the mouse pointer is out of the app
>> window.
>>
>> I try it also with @Named(IServiceConstants.ACTIVE_SHELL) Shell shell.
>> But the result is the same.
>>
>> What should I do, to get underlaying Shell of my app?
>>
>> I'm working on Mac with the following SDK;
>> e4 SDK 0.9.0.I20100718-2115
>>
>> Greetings. Uwe
>>
>
Re: AddOn gets the wrong shell [message #549526 is a reply to message #548859] Tue, 27 July 2010 06:21 Go to previous message
U. Geerds is currently offline U. GeerdsFriend
Messages: 10
Registered: July 2010
Junior Member
Hi Tom,

It works fine.

Many thanks. Uwe
Re: AddOn gets the wrong shell [message #579210 is a reply to message #548859] Fri, 23 July 2010 11:02 Go to previous message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 5487
Registered: July 2009
Senior Member
Hi,

At the moment the Addons are processed before the rendering is done.

An application beside that doesn't have only one shell but multiple ones
so your first code is not really making a lot of sense anyway.

The real use for Addons is give you access to the EventBus and hook your
EventHandler.

If you are interested in every creation of a Shell then you'll register
for a topic like this:

---------8<---------
@Inject
IEventBroker eventBroker;

@PostConstruct
void hookListeners() {
String topic = UIEvents.buildTopic(UIEvents.UIElement.TOPIC,
UIEvents.UIElement.WIDGET);
eventBroker.subscribe(topic, null, installHook, false);
}

@PreDestroy
void unhookListeners() {
eventBroker.unsubscribe(installHook);
}
---------8<---------

You could probably track the ActiveShell using method injection but
definately NOT not in the @PostConstruct.

Tom

Am 23.07.10 12:18, schrieb U. Geerds:
> Hi anybody,
>
> i recognized, that my AddOn-class gets the shell from the workbench,
> from where the app is started.
>
> I added the following "AddOn" to my e4 app:
>
> @PostConstruct
> void hookListeners(Shell shell) {
> shell.setText("Hooked");
>
> After I recognized, the shell.setText doesn't works, I add the following
> code:
>
> shell.setMaximized(true);
> shell.addMouseMoveListener(new MouseMoveListener() {
> @Override
> public void mouseMove(MouseEvent e) {
> System.out.println("move: " + e.x + ", " + e.y);
> }
> });
> The mouse move is only called, if the mouse pointer is out of the app
> window.
>
> I try it also with @Named(IServiceConstants.ACTIVE_SHELL) Shell shell.
> But the result is the same.
>
> What should I do, to get underlaying Shell of my app?
>
> I'm working on Mac with the following SDK;
> e4 SDK 0.9.0.I20100718-2115
>
> Greetings. Uwe
>
Re: AddOn gets the wrong shell [message #579284 is a reply to message #548873] Fri, 23 July 2010 12:35 Go to previous message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 5487
Registered: July 2009
Senior Member
Just one more note! You should NOT call setText() on the shell because
then you assume that an SWT-Shell is used to renderer the concept of a
window.

It's better to call MWindow#setLabel() which is the model element!

Tom

Am 23.07.10 13:02, schrieb Tom Schindl:
> Hi,
>
> At the moment the Addons are processed before the rendering is done.
>
> An application beside that doesn't have only one shell but multiple ones
> so your first code is not really making a lot of sense anyway.
>
> The real use for Addons is give you access to the EventBus and hook your
> EventHandler.
>
> If you are interested in every creation of a Shell then you'll register
> for a topic like this:
>
> ---------8<---------
> @Inject
> IEventBroker eventBroker;
>
> @PostConstruct
> void hookListeners() {
> String topic = UIEvents.buildTopic(UIEvents.UIElement.TOPIC,
> UIEvents.UIElement.WIDGET);
> eventBroker.subscribe(topic, null, installHook, false);
> }
>
> @PreDestroy
> void unhookListeners() {
> eventBroker.unsubscribe(installHook);
> }
> ---------8<---------
>
> You could probably track the ActiveShell using method injection but
> definately NOT not in the @PostConstruct.
>
> Tom
>
> Am 23.07.10 12:18, schrieb U. Geerds:
>> Hi anybody,
>>
>> i recognized, that my AddOn-class gets the shell from the workbench,
>> from where the app is started.
>>
>> I added the following "AddOn" to my e4 app:
>>
>> @PostConstruct
>> void hookListeners(Shell shell) {
>> shell.setText("Hooked");
>>
>> After I recognized, the shell.setText doesn't works, I add the following
>> code:
>>
>> shell.setMaximized(true);
>> shell.addMouseMoveListener(new MouseMoveListener() {
>> @Override
>> public void mouseMove(MouseEvent e) {
>> System.out.println("move: " + e.x + ", " + e.y);
>> }
>> });
>> The mouse move is only called, if the mouse pointer is out of the app
>> window.
>>
>> I try it also with @Named(IServiceConstants.ACTIVE_SHELL) Shell shell.
>> But the result is the same.
>>
>> What should I do, to get underlaying Shell of my app?
>>
>> I'm working on Mac with the following SDK;
>> e4 SDK 0.9.0.I20100718-2115
>>
>> Greetings. Uwe
>>
>
Re: AddOn gets the wrong shell [message #579464 is a reply to message #548859] Tue, 27 July 2010 06:21 Go to previous message
U. Geerds is currently offline U. GeerdsFriend
Messages: 10
Registered: July 2010
Junior Member
Hi Tom,

It works fine.

Many thanks. Uwe
Previous Topic:Retrieving a child datacontext
Next Topic:How to add a ToolControl as a StatusLine who is filled horizontally?
Goto Forum:
  


Current Time: Mon Dec 22 10:35:41 GMT 2014

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

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