--- old/src/java.desktop/share/classes/java/awt/dnd/DropTargetContext.java 2015-03-25 18:23:25.632091600 +0400 +++ new/src/java.desktop/share/classes/java/awt/dnd/DropTargetContext.java 2015-03-25 18:23:25.413079000 +0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2004, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -39,6 +39,8 @@ import java.util.Arrays; import java.util.List; +import sun.awt.AWTAccessor; +import sun.awt.AWTAccessor.DropTargetContextAccessor; /** * A DropTargetContext is created @@ -58,6 +60,19 @@ private static final long serialVersionUID = -634158968993743371L; + static { + AWTAccessor.setDropTargetContextAccessor(new DropTargetContextAccessor() { + @Override + public void reset(DropTargetContext dtc) { + dtc.reset(); + } + @Override + public void setDropTargetContextPeer(DropTargetContext dtc, + DropTargetContextPeer dtcp) { + dtc.setDropTargetContextPeer(dtcp); + } + }); + } /** * Construct a DropTargetContext * given a specified DropTarget. @@ -90,20 +105,9 @@ public Component getComponent() { return dropTarget.getComponent(); } /** - * Called when associated with the DropTargetContextPeer. - * - * @param dtcp the DropTargetContextPeer - */ - - public void addNotify(DropTargetContextPeer dtcp) { - dropTargetContextPeer = dtcp; - } - - /** * Called when disassociated with the DropTargetContextPeer. */ - - public void removeNotify() { + void reset() { dropTargetContextPeer = null; transferable = null; } @@ -282,12 +286,18 @@ * * @return the platform peer */ - DropTargetContextPeer getDropTargetContextPeer() { return dropTargetContextPeer; } /** + * Sets the {@code DropTargetContextPeer} + */ + void setDropTargetContextPeer(final DropTargetContextPeer dtcp) { + dropTargetContextPeer = dtcp; + } + + /** * Creates a TransferableProxy to proxy for the specified * Transferable. * @@ -412,7 +422,7 @@ * * @serial */ - private DropTarget dropTarget; + private final DropTarget dropTarget; private transient DropTargetContextPeer dropTargetContextPeer;