/** Obtain a cookie instance from the copied node in a transferable. * <P> * First of all it checks whether the given transferable contains * a node and then asks for the cookie. * <p>If you wish to specially support multiple-node transfers, please use {@link #nodes} * and manually check for the desired combination of cookies. * * @param t transferable to check in * @param cookie cookie representation class to look for * @param action the action which was used to store the node * * @return cookie or <code>null</code> if it does not exist */ public static <T extends Node.Cookie> T cookie(Transferable t, int action, Class<T> cookie) { Node n = node(t, action); return (n == null) ? null : n.getCookie(cookie); }
/** Obtain a cookie instance from the copied node in a transferable. * <P> * First of all it checks whether the given transferable contains * a node and then asks for the cookie. * <p>If you wish to specially support multiple-node transfers, please use {@link #nodes} * and manually check for the desired combination of cookies. * * @param t transferable to check in * @param cookie cookie representation class to look for * @param action the action which was used to store the node * * @return cookie or <code>null</code> if it does not exist */ public static Node.Cookie cookie (Transferable t, int action, Class cookie) { Node n = node (t, action); return n == null ? null : n.getCookie (cookie); }
/** Obtain a cookie instance from the copied node in a transferable. * <P> * First of all it checks whether the given transferable contains * a node and then asks for the cookie. * <p>If you wish to specially support multiple-node transfers, please use {@link #nodes} * and manually check for the desired combination of cookies. * * @param t transferable to check in * @param cookie cookie representation class to look for * @param action the action which was used to store the node * * @return cookie or <code>null</code> if it does not exist */ public static Node.Cookie cookie (Transferable t, int action, Class cookie) { Node n = node (t, action); return n == null ? null : n.getCookie (cookie); }
@Override public PasteType getDropType(final Transferable t, int action, int index) { if (category == null || !category.equals(FiltersExplorer.QUERIES)) { return null; } final Node dropNode = NodeTransfer.node(t, DnDConstants.ACTION_COPY_OR_MOVE); if (dropNode != null && dropNode instanceof QueryNode) { return new PasteType() { @Override public Transferable paste() throws IOException { QueryNode queryNode = (QueryNode) dropNode; FilterController filterController = Lookup.getDefault().lookup(FilterController.class); FilterLibrary library = filterController.getModel().getLibrary(); library.saveQuery(queryNode.getQuery()); return null; } }; } return null; }
protected FileObject getNodeFileObject(Transferable transferable) { Node node = NodeTransfer.node(transferable, NodeTransfer.DND_COPY_OR_MOVE); if (node == null) return null; DataObject dataObject = (DataObject) node.getLookup().lookup(DataObject.class); if (dataObject == null) return null; FileObject file = dataObject.getPrimaryFile(); return file; }
@Override public PasteType getDropType(final Transferable t, int action, int index) { final Node dropNode = NodeTransfer.node(t, DnDConstants.ACTION_COPY_OR_MOVE); if (dropNode != null && dropNode instanceof QueryNode) { Query q = ((QueryNode) dropNode).getQuery();
protected void handleCreatePasteTypes (Transferable t, java.util.List s) { // These should only accept single-node transfers, since they require dialogs. Node node = NodeTransfer.node (t, NodeTransfer.CLIPBOARD_COPY); // lastly try special cookies if (node != null) { try { InstanceCookie cookie = (InstanceCookie)node.getCookie (InstanceCookie.class); if (cookie != null && java.io.Serializable.class.isAssignableFrom (cookie.instanceClass ())) { s.add (new DataTransferSupport.SerializePaste (DataFolder.this, cookie)); s.add (new DataTransferSupport.InstantiatePaste (DataFolder.this, cookie)); } } catch (IOException e) { } catch (ClassNotFoundException e) { } } } }
@Override public PasteType getDropType(Transferable t, int action, int index) { final Node dropNode = NodeTransfer.node(t, DnDConstants.ACTION_COPY_OR_MOVE);
final Node dropNode = NodeTransfer.node(t, DnDConstants.ACTION_COPY_OR_MOVE + NodeTransfer.CLIPBOARD_CUT);
@Override public PasteType getDropType(final Transferable t, int action, int index) { final Node node = NodeTransfer.node(t, NodeTransfer.DND_COPY); if (node == null){ return null;