Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [albireo-dev] Old SAS code interaction with Albireo project code

Hi Jon,

Thank you for your feedback.

> I'm currently evaluating the latest Albireo code within our app.  I'm
> using Eclipse 3.4 M6.

Now that Eclipse 3.4 is released, we will soon drop support for the various
3.4 milestones and assume that everyone has either upgraded to 3.4 or is
staying with 3.3.

> 1.	 Opening up a Swing dialog in any of the views and then closing
> it causes a SWTException due to the SWTInputBlocker#open() trying to set
> the focus back to the parent shell, but it is null.
> 		
> org.eclipse.swt.SWTException: Widget is disposed
> 	at org.eclipse.swt.SWT.error(SWT.java:3716)
> 	at org.eclipse.swt.SWT.error(SWT.java:3634)
> 	at org.eclipse.swt.SWT.error(SWT.java:3605)
> 	at org.eclipse.swt.widgets.Widget.error(Widget.java:442)
> 	at org.eclipse.swt.widgets.Widget.checkWidget(Widget.java:335)
> 	at org.eclipse.swt.widgets.Shell.forceActive(Shell.java:806)
> 	at org.eclipse.albireo.internal.SwtInputBlocker.open(Unknown Source)
> 	at org.eclipse.albireo.internal.SwtInputBlocker.block(Unknown Source)
> 	at org.eclipse.albireo.internal.AwtDialogListener$2.run(Unknown Source)
> 	at org.eclipse.albireo.core.ThreadingHandler$1.run(Unknown Source)

The parent shell is disposed at this moment. I'm applying the attached
changed; it should fix this exception.

> 2.	I also notice that resources, such as icons, in the other views
> that do not implement the new Albireo code are not found causing
> NullPointerExceptions...not sure why the Albireo code would influence
> that.  These control causing issues is a Swing JIDE control.  When I
> remove the Albireo code usage, the resources are found.

Albireo does not deal with resources. Your description sounds like a timing
problem: as if the resources were being fetched too early, probably due
to the implicit switch between threads that occurs when you use SwingControl.
You can try overriding the method afterComponentCreatedAWTThread() or
afterComponentCreatedSWTThread(), whichever is appropriate.

> 3.	I'm also noticing focus issues that are intermittent.  I.E. On
> opening the perspective for the first time, occasionally My view using
> the Albireo code can't get the focus on any Swing control within it.  I
> have to restart the app.  Trying to reopen just the view can cause the
> app to lock up.

Whenever you see a lock-up, please try to provide a stack trace of all
threads. If you are running your app under the Eclipse debugger, simply
stop all threads all copy&paste the thread stacks. Otherwise, you can
get a stack trace of all threads by using the 'jps' and 'jstack' commands
(Linux: JDK 1.5 or newer; Windows: JDK 1.6 or newer).

Focus issues are hard to debug. If you say that your app mixes old SAS code,
new Albireo code, and moreover has 4 different views, it's basically
untractable. Can you
  1) ensure that you only use Albireo for your embedded Swing views,
  2) try to minimize the set of views to 1 or 2,
  3) then, provide a detailed description of how to reproduce the
     problem (as detailed as in
     http://wiki.eclipse.org/Albireo_Focus_Management_Test_Cases),
then we can try to look into it, with some reasonable expectations.

> The contents of this e-mail are intended for the named addressee only.
> It contains information that may be confidential. Unless you are the
> named addressee or an authorized designee, you may not copy or use it,
> or disclose it to anyone else. If you received it in error please notify
> us immediately and then destroy it.    

Such a footer is void when you write to a mailing list with publicly
accessible list archives.

Greetings,
                    Bruno


Index: src/org/eclipse/albireo/internal/SwtInputBlocker.java
===================================================================
RCS file: /cvsroot/technology/org.eclipse.albireo/org.eclipse.albireo.core/src/org/eclipse/albireo/internal/SwtInputBlocker.java,v
retrieving revision 1.7
diff -c -3 -r1.7 SwtInputBlocker.java
*** src/org/eclipse/albireo/internal/SwtInputBlocker.java	27 Jun 2008 13:31:35 -0000	1.7
--- src/org/eclipse/albireo/internal/SwtInputBlocker.java	27 Jun 2008 13:48:30 -0000
***************
*** 11,16 ****
--- 11,18 ----
   *******************************************************************************/
  package org.eclipse.albireo.internal;
  
+ import java.util.Stack;
+ 
  import org.eclipse.albireo.core.ThreadingHandler;
  import org.eclipse.swt.SWT;
  import org.eclipse.swt.events.FocusAdapter;
***************
*** 36,41 ****
--- 38,44 ----
      private Shell shell;
      private final AwtDialogListener dialogListener;
      private Shell parentShell;
+     private Stack /* of Shell */ shellsWithActivateListener;
      
      private Listener activateListener = new Listener() {
          public void handleEvent(Event event) {
***************
*** 82,90 ****
--- 85,95 ----
              // Under GTK, focus events are not available to detect this condition, 
              // so use the activate event. 
              // TODO: is it necessary to do this for all parents?
+             shellsWithActivateListener = new Stack();
              Shell shell = parentShell;
              while (shell != null) {
                  shell.addListener(SWT.Activate, activateListener);
+                 shellsWithActivateListener.push(shell);
                  Composite composite = shell.getParent();
                  shell = (composite != null) ? composite.getShell() : null;
              }
***************
*** 104,122 ****
          
          // If windows from other applications have been opened while SWT was being blocked, 
          // the original parent shell can get lost under those windows after the blocking
!         // is stopped. Force the parent shell back to the front here. 
!         parentShell.forceActive();
      }
  
      private void close() {
          assert shell != null;
          
          if (Platform.isGtk()) {
!             Shell shell = parentShell;
!             while (shell != null) {
!                 shell.removeListener(SWT.Activate, activateListener);
!                 Composite composite = shell.getParent();
!                 shell = (composite != null) ? composite.getShell() : null;
              }
          }
          shell.dispose();
--- 109,127 ----
          
          // If windows from other applications have been opened while SWT was being blocked, 
          // the original parent shell can get lost under those windows after the blocking
!         // is stopped. Force the parent shell back to the front here.
!         if (!parentShell.isDisposed())
!             parentShell.forceActive();
      }
  
      private void close() {
          assert shell != null;
          
          if (Platform.isGtk()) {
!             while (!shellsWithActivateListener.isEmpty()) {
!                 Shell shell = (Shell) shellsWithActivateListener.pop();
!                 if (!shell.isDisposed())
!                     shell.removeListener(SWT.Activate, activateListener);
              }
          }
          shell.dispose();


Back to the top