1 /* 2 * The contents of this file are subject to the terms of the Common Development 3 * and Distribution License (the License). You may not use this file except in 4 * compliance with the License. 5 * 6 * You can obtain a copy of the License at http://www.netbeans.org/cddl.html 7 * or http://www.netbeans.org/cddl.txt. 8 * 9 * When distributing Covered Code, include this CDDL Header Notice in each file 10 * and include the License file at http://www.netbeans.org/cddl.txt. 11 * If applicable, add the following below the CDDL Header, with the fields 12 * enclosed by brackets [] replaced by your own identifying information: 13 * "Portions Copyrighted [year] [name of copyright owner]" 14 * 15 * The Original Software is NetBeans. The Initial Developer of the Original 16 * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun 17 * Microsystems, Inc. All Rights Reserved. 18 */ 19 20 package org.openide.windows; 21 22 import java.awt.datatransfer.DataFlavor; 23 import java.awt.dnd.DropTargetDragEvent; 24 import java.awt.dnd.DropTargetDropEvent; 25 26 /** 27 * When an implementation of this class is available in the global Lookup and 28 * an object is being dragged over some parts of the main window of the IDE then 29 * the window system may call methods of this class to decide whether it can 30 * accept or reject the drag operation. And when the object is actually dropped 31 * into the IDE then this class will be asked to handle the drop. 32 * 33 * @since 6.7 34 * 35 * @author S. Aubrecht 36 */ 37 public abstract class ExternalDropHandler { 38 39 /** 40 * @return True if the dragged object can be dropped into the IDE, false 41 * if the DataFlavor(s) are not supported. 42 */ 43 public abstract boolean canDrop( DropTargetDragEvent e ); 44 45 /** 46 * This method is called when the dragged object is already dropped to decide 47 * whether the drop can be accepted. 48 * 49 * @return True if the dropped object is supported (i.e. handleDrop method 50 * can process the object), false otherwise. 51 */ 52 public abstract boolean canDrop( DropTargetDropEvent e ); 53 54 /** 55 * When an object is dropped into the IDE this method must process it (e.g. 56 * open the dropped file in a new editor tab). 57 * 58 * @return True if the dropped object was processed successfully, false otherwise. 59 */ 60 public abstract boolean handleDrop( DropTargetDropEvent e ); 61 } 62