Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » SWT.Deactivate in Eclipse 3.4
SWT.Deactivate in Eclipse 3.4 [message #492328] Tue, 20 October 2009 02:46 Go to next message
Irum Godil is currently offline Irum GodilFriend
Messages: 35
Registered: July 2009
Member
Hi,

I have some Eclipse code that was working perfectly with SWT.Deactivate listener on a shell till Eclipse 3.2. The Deactivate listener does not get invoked in Eclipse 3.4.

Has there been any known changes, or does anyone know an alternative to this?

I will appreciate your response.

Thanks,
Irum.
Re: SWT.Deactivate in Eclipse 3.4 [message #492333 is a reply to message #492328] Tue, 20 October 2009 02:56 Go to previous messageGo to next message
Remy Suen is currently offline Remy SuenFriend
Messages: 462
Registered: July 2009
Senior Member
On Mon, 19 Oct 2009 22:46:51 -0400, Irum Godil wrote:
> I have some Eclipse code that was working perfectly with SWT.Deactivate
> listener on a shell till Eclipse 3.2. The Deactivate listener does not
> get invoked in Eclipse 3.4.
>
> Has there been any known changes, or does anyone know an alternative to
> this?

Could be bug 257188.
https://bugs.eclipse.org/bugs/show_bug.cgi?id=257188

Regards,
Remy
Re: SWT.Deactivate in Eclipse 3.4 [message #492467 is a reply to message #492328] Tue, 20 October 2009 14:01 Go to previous messageGo to next message
Grant Gayed is currently offline Grant GayedFriend
Messages: 2151
Registered: July 2009
Senior Member
I just tried with 3.4.2 on Windows 2000 and RHEL4, and I see
Activate/Deactive events. Which platform(s) do you see this on? Which
Shell style(s)? Any more info?

Grant


"Irum Godil" <irum@ca.ibm.com> wrote in message
news:hbj8au$qlq$1@build.eclipse.org...
> Hi,
>
> I have some Eclipse code that was working perfectly with SWT.Deactivate
listener on a shell till Eclipse 3.2. The Deactivate listener does not get
invoked in Eclipse 3.4.
>
> Has there been any known changes, or does anyone know an alternative to
this?
>
> I will appreciate your response.
>
> Thanks,
> Irum.
Re: SWT.Deactivate in Eclipse 3.4 [message #492471 is a reply to message #492467] Tue, 20 October 2009 14:49 Go to previous messageGo to next message
Irum Godil is currently offline Irum GodilFriend
Messages: 35
Registered: July 2009
Member
Hi,

I am on WinXP. I also added a Activate event and even that is not being triggered.

This is how I create the shell and listeners:

shell = new Shell(parentShell, SWT.NONE);


if( null != helpContextID )
PlatformUI.getWorkbench().getHelpSystem().setHelp(shell, helpContextID);


shell.addListener(SWT.Deactivate, new Listener() {
public void handleEvent(Event e) {
hide();

}
});

shell.addListener(SWT.Activate, new Listener() {
public void handleEvent(Event e) {
hide();

}
});
Re: SWT.Deactivate in Eclipse 3.4 [message #492732 is a reply to message #492471] Wed, 21 October 2009 14:43 Go to previous messageGo to next message
Grant Gayed is currently offline Grant GayedFriend
Messages: 2151
Registered: July 2009
Senior Member
I've made a snippet based on the code you've provided and I still see these
events (tried swt 3.4.2 on XP). Does the snippet below work for you? The
snippet has the setHelp() invocation commented out, does commenting this out
in your app change anything? There must be more happening to make the
problem happen than what's here, but I can't know what else your app is
doing, so you may need to dig a bit to determine what other conditions are
required to make this happen.

public static void main(String[] args) {
final Display display = new Display();
Shell parentShell = new Shell(display); // <-- would should style be?
parentShell.setBounds(10,10,200,200);
parentShell.setText("parent shell");
Shell shell = new Shell(parentShell, SWT.NONE);
shell.setBounds(300,300,200,200);
shell.setText("child shell");
// if( null != helpContextID )
// PlatformUI.getWorkbench().getHelpSystem().setHelp(shell,
helpContextID);
Listener activateListener = new Listener() {
public void handleEvent(Event event) {
System.out.println("activate received: " +
((Shell)event.widget).getText());
}
};
Listener deactivateListener = new Listener() {
public void handleEvent(Event event) {
System.out.println("deactivate received: " +
((Shell)event.widget).getText());
}
};
shell.addListener(SWT.Deactivate, deactivateListener);
shell.addListener(SWT.Activate, activateListener);
parentShell.addListener(SWT.Deactivate, deactivateListener);
parentShell.addListener(SWT.Activate, activateListener);
parentShell.open();
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) display.sleep();
}
display.dispose();
}
}

Grant


"Irum Godil" <irum@ca.ibm.com> wrote in message
news:hbkimh$9df$1@build.eclipse.org...
> Hi,
>
> I am on WinXP. I also added a Activate event and even that is not being
triggered.
>
> This is how I create the shell and listeners:
>
> shell = new Shell(parentShell, SWT.NONE);
>
>
> if( null != helpContextID )
> PlatformUI.getWorkbench().getHelpSystem().setHelp(shell, helpContextID);
>
>
> shell.addListener(SWT.Deactivate, new Listener() {
> public void handleEvent(Event e) {
> hide();
>
> }
> });
>
> shell.addListener(SWT.Activate, new Listener() {
> public void handleEvent(Event e) {
> hide();
>
> }
> });
Re: SWT.Deactivate in Eclipse 3.4 [message #492772 is a reply to message #492732] Wed, 21 October 2009 16:39 Go to previous messageGo to next message
Irum Godil is currently offline Irum GodilFriend
Messages: 35
Registered: July 2009
Member
Hi Grant,

Thanks for following up on this. I checked your code and it does work fine. However, in my code I am creating a Tooltip ultimately inside the shell. When I did the same in your code, the shell does not de-activate. I have attached the code below.

Please note that I do not do a Shell.open() anywhere, I did not do in Eclipse 3.2 either and everything worked as it is. Please let me know what you think.

Thanks.

public static void main(String[] args) {
final Display display = new Display();


Shell parentShell = new Shell(display); // <-- would should style be?
parentShell.setBounds(10,10,200,200);
parentShell.setText("parent shell");
Shell shell = new Shell(parentShell, SWT.NONE);
shell.setBounds(300,300,200,200);
shell.setText("child shell");
// if( null != helpContextID )
// PlatformUI.getWorkbench().getHelpSystem().setHelp(shell,
// helpContextID);
Listener activateListener = new Listener() {
public void handleEvent(Event event) {
System.out.println("activate received: " + ((Shell)event.widget).getText());
}
};

Listener deactivateListener = new Listener() {
public void handleEvent(Event event) {
System.out.println("deactivate received: " + ((Shell)event.widget).getText());
}
};
shell.addListener(SWT.Deactivate, deactivateListener);
shell.addListener(SWT.Activate, activateListener);
parentShell.addListener(SWT.Deactivate, deactivateListener);
parentShell.addListener(SWT.Activate, activateListener);

ToolTip tooltip = new org.eclipse.swt.widgets.ToolTip(shell, SWT.ICON_INFORMATION| SWT.BALLOON );

tooltip.setVisible(true);

while (!shell.isDisposed()) {
if (!display.readAndDispatch()) display.sleep();
}
display.dispose();
}
Re: SWT.Deactivate in Eclipse 3.4 [message #492786 is a reply to message #492772] Wed, 21 October 2009 17:19 Go to previous messageGo to next message
Grant Gayed is currently offline Grant GayedFriend
Messages: 2151
Registered: July 2009
Senior Member
Are you saying that Activate/Deactivate used to be sent for a Shell that was
never opened? If so then this does not seem right, and the change was
likely a bug fix. You'll probably have to change your code that was
expecting this. What are you trying to do?

Grant


"Irum Godil" <irum@ca.ibm.com> wrote in message
news:hbndgj$s54$1@build.eclipse.org...
> Hi Grant,
>
> Thanks for following up on this. I checked your code and it does work
fine. However, in my code I am creating a Tooltip ultimately inside the
shell. When I did the same in your code, the shell does not de-activate. I
have attached the code below.
>
> Please note that I do not do a Shell.open() anywhere, I did not do in
Eclipse 3.2 either and everything worked as it is. Please let me know what
you think.
>
> Thanks.
>
> public static void main(String[] args) {
> final Display display = new Display();
>
>
> Shell parentShell = new Shell(display); // <-- would should style be?
> parentShell.setBounds(10,10,200,200);
> parentShell.setText("parent shell");
> Shell shell = new Shell(parentShell, SWT.NONE);
> shell.setBounds(300,300,200,200);
> shell.setText("child shell");
> // if( null != helpContextID )
> // PlatformUI.getWorkbench().getHelpSystem().setHelp(shell,
> // helpContextID);
> Listener activateListener = new Listener() {
> public void handleEvent(Event event) {
> System.out.println("activate received: " +
((Shell)event.widget).getText());
> }
> };
>
> Listener deactivateListener = new Listener() {
> public void handleEvent(Event event) {
> System.out.println("deactivate received: " +
((Shell)event.widget).getText());
> }
> };
> shell.addListener(SWT.Deactivate, deactivateListener);
> shell.addListener(SWT.Activate, activateListener);
> parentShell.addListener(SWT.Deactivate, deactivateListener);
> parentShell.addListener(SWT.Activate, activateListener);
>
> ToolTip tooltip = new org.eclipse.swt.widgets.ToolTip(shell,
SWT.ICON_INFORMATION| SWT.BALLOON );
>
> tooltip.setVisible(true);
>
> while (!shell.isDisposed()) {
> if (!display.readAndDispatch()) display.sleep();
> }
> display.dispose();
> }
Re: SWT.Deactivate in Eclipse 3.4 [message #492790 is a reply to message #492772] Wed, 21 October 2009 17:38 Go to previous message
Irum Godil is currently offline Irum GodilFriend
Messages: 35
Registered: July 2009
Member
Thanks Grant. I have caught the root cause of my issue. We had the line shell.open () commented out recently for some other defect fix. That prevented the shell to receive events.

Thanks for your help.
Irum.
Previous Topic:Tableviewer Scrollbars
Next Topic:Drawing focus ring on mac
Goto Forum:
  


Current Time: Sat Aug 24 06:44:55 GMT 2019

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

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

Back to the top