Lines 50-55
Link Here
|
50 |
import org.openide.nodes.AbstractNode; |
50 |
import org.openide.nodes.AbstractNode; |
51 |
import org.openide.nodes.Children; |
51 |
import org.openide.nodes.Children; |
52 |
import org.openide.nodes.Index; |
52 |
import org.openide.nodes.Index; |
|
|
53 |
import org.openide.util.Lookup; |
53 |
import org.openide.util.datatransfer.ExTransferable; |
54 |
import org.openide.util.datatransfer.ExTransferable; |
54 |
|
55 |
|
55 |
/** |
56 |
/** |
Lines 102-107
Link Here
|
102 |
assertTrue( handler.canDrop( cat.getLookup(), flavors, DnDConstants.ACTION_COPY_OR_MOVE ) ); |
103 |
assertTrue( handler.canDrop( cat.getLookup(), flavors, DnDConstants.ACTION_COPY_OR_MOVE ) ); |
103 |
|
104 |
|
104 |
flavors = new DataFlavor[] { new DataFlavor( "text/xml" ) }; |
105 |
flavors = new DataFlavor[] { new DataFlavor( "text/xml" ) }; |
|
|
106 |
assertFalse( handler.canDrop( cat.getLookup(), flavors, DnDConstants.ACTION_COPY_OR_MOVE ) ); |
107 |
} |
108 |
|
109 |
public void testCanDropText() throws Exception { |
110 |
PaletteActions actions = new DummyActions(); |
111 |
PaletteController pc = PaletteFactory.createPalette( getRootFolderName(), actions ); |
112 |
Model model = pc.getModel(); |
113 |
|
114 |
Category cat = model.getCategories()[0]; |
115 |
|
116 |
DragAndDropHandler handler = new TextDragAndDropHandler(); |
117 |
|
118 |
DataFlavor[] flavors = new DataFlavor[] { new DataFlavor( "text/xml" ) }; |
119 |
assertTrue( handler.canDrop( cat.getLookup(), flavors, DnDConstants.ACTION_COPY_OR_MOVE ) ); |
120 |
|
121 |
flavors = new DataFlavor[] { new DataFlavor( "text/html" ) }; |
122 |
assertTrue( handler.canDrop( cat.getLookup(), flavors, DnDConstants.ACTION_COPY_OR_MOVE ) ); |
123 |
|
124 |
flavors = new DataFlavor[] { new DataFlavor( "unsupported/mimetype" ) }; |
105 |
assertFalse( handler.canDrop( cat.getLookup(), flavors, DnDConstants.ACTION_COPY_OR_MOVE ) ); |
125 |
assertFalse( handler.canDrop( cat.getLookup(), flavors, DnDConstants.ACTION_COPY_OR_MOVE ) ); |
106 |
} |
126 |
} |
107 |
|
127 |
|
Lines 217-220
Link Here
|
217 |
return super.getCookie(type); |
237 |
return super.getCookie(type); |
218 |
} |
238 |
} |
219 |
} |
239 |
} |
|
|
240 |
|
241 |
private static class TextDragAndDropHandler extends DragAndDropHandler { |
242 |
public TextDragAndDropHandler() { |
243 |
super( true ); |
244 |
} |
245 |
|
246 |
@Override |
247 |
public void customize(ExTransferable t, Lookup item) { |
248 |
} |
249 |
} |
220 |
} |
250 |
} |