Ignore:
Timestamp:
2016-03-02T22:54:34+01:00 (4 years ago)
Author:
Don-vip
Message:

ChangesetCacheManager: add unit tests

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/util/GuiHelper.java

    r9826 r9916  
    2727import java.lang.reflect.InvocationTargetException;
    2828import java.util.Enumeration;
     29import java.util.EventObject;
    2930import java.util.concurrent.Callable;
    3031import java.util.concurrent.ExecutionException;
     
    463464        return GraphicsEnvironment.isHeadless() ? null : Toolkit.getDefaultToolkit().getSystemSelection();
    464465    }
     466
     467    /**
     468     * Returns the first <code>Window</code> ancestor of event source, or
     469     * {@code null} if event source is not a component contained inside a <code>Window</code>.
     470     * @param e event object
     471     * @return a Window, or {@code null}
     472     * @since 9916
     473     */
     474    public static Window getWindowAncestorFor(EventObject e) {
     475        return e != null && e.getSource() instanceof Component ? SwingUtilities.getWindowAncestor((Component) e.getSource()) : null;
     476    }
    465477}
Note: See TracChangeset for help on using the changeset viewer.