Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [albireo-dev] inhibitSizePropagationToAWT

To ease debugging, I'm adding one more size-related listener:

Index: src/org/eclipse/albireo/core/SwingControl.java
===================================================================
RCS file: /cvsroot/technology/org.eclipse.albireo/org.eclipse.albireo.core/src/org/eclipse/albireo/core/SwingControl.java,v
retrieving revision 1.29
diff -c -3 -r1.29 SwingControl.java
*** src/org/eclipse/albireo/core/SwingControl.java	13 Feb 2008 19:19:04 -0000	1.29
--- src/org/eclipse/albireo/core/SwingControl.java	13 Feb 2008 19:33:26 -0000
***************
*** 26,31 ****
--- 26,32 ----
  import javax.swing.plaf.FontUIResource;
  
  import org.eclipse.albireo.internal.CleanResizeListener;
+ import org.eclipse.albireo.internal.ComponentDebugging;
  import org.eclipse.albireo.internal.FocusDebugging;
  import org.eclipse.albireo.internal.Platform;
  import org.eclipse.swt.SWT;
***************
*** 160,165 ****
--- 161,168 ----
  
          frame = SWT_AWT.new_Frame(this);
  
+         if (verboseSizeLayout)
+             ComponentDebugging.addComponentSizeDebugListeners(frame);
          if (verboseFocusEvents)
              FocusDebugging.addFocusDebugListeners(this, frame);
      }
============================ ComponentDebugging.java =========================
/*******************************************************************************
 * Copyright (c) 2007-2008 SAS Institute Inc., ILOG S.A.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     SAS Institute Inc. - initial API and implementation
 *     ILOG S.A. - initial API and implementation
 *******************************************************************************/
package org.eclipse.albireo.internal;

import java.awt.Component;
import java.awt.event.ComponentEvent;
import java.awt.event.ComponentListener;

/**
 * This class contains utility functions for debugging issues at Component
 * level, relating to the SWT_AWT bridge.
 */
public class ComponentDebugging {

    /**
     * Adds a listener for debugging size at Component events.
     */
    public static void addComponentSizeDebugListeners(final Component comp) {
        comp.addComponentListener(
            new ComponentListener() {
                private void log(ComponentEvent event) {
                    System.err.println("Size: "+comp.getWidth()+" x "+comp.getHeight()+" after "+event);
                }
                public void componentHidden(ComponentEvent event) {
                    log(event);
                }
                public void componentMoved(ComponentEvent event) {
                    log(event);
                }
                public void componentResized(ComponentEvent event) {
                    log(event);
                }
                public void componentShown(ComponentEvent event) {
                    log(event);
                }
            });
    }
}


Back to the top