Home » Eclipse Projects » Eclipse 4 » AddOn gets the wrong shell
AddOn gets the wrong shell [message #548859] |
Fri, 23 July 2010 06:18  |
Eclipse User |
|
|
|
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 07:02   |
Eclipse User |
|
|
|
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 08:35   |
Eclipse User |
|
|
|
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 #579210 is a reply to message #548859] |
Fri, 23 July 2010 07:02  |
Eclipse User |
|
|
|
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 08:35  |
Eclipse User |
|
|
|
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
>>
>
|
|
| |
Goto Forum:
Current Time: Tue Jul 22 15:21:02 EDT 2025
Powered by FUDForum. Page generated in 0.03805 seconds
|