Java Code Examples for org.openide.nodes.Node#canDestroy()
The following examples show how to use
org.openide.nodes.Node#canDestroy() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PropertiesDataNode.java From netbeans with Apache License 2.0 | 6 votes |
@Override public void createPasteTypes(Transferable transferable, List<PasteType> types) { super.createPasteTypes(transferable, types); Element.ItemElem item; Node node = NodeTransfer.node(transferable, NodeTransfer.MOVE); if (node != null && node.canDestroy()) { item = node.getCookie(Element.ItemElem.class); if (item == null) { return; } Node itemNode = getChildren().findChild(item.getKey()); if (node.equals(itemNode)) { return; } types.add(new EntryPasteType(item, node)); } else { item = NodeTransfer.cookie(transferable, NodeTransfer.COPY, Element.ItemElem.class); if (item != null) { types.add(new EntryPasteType(item, null)); } } }
Example 2
Source File: PropertiesLocaleNode.java From netbeans with Apache License 2.0 | 5 votes |
/** Creates paste types for this node. Overrides superclass method. */ @Override protected void createPasteTypes(Transferable t, List<PasteType> s) { super.createPasteTypes(t, s); Element.ItemElem item; Node n = NodeTransfer.node(t, NodeTransfer.MOVE); // cut if (n != null && n.canDestroy ()) { item = n.getCookie(Element.ItemElem.class); if (item != null) { // are we pasting into the same node Node n2 = getChildren().findChild(item.getKey()); if (n == n2) { return; } s.add(new KeyPasteType(item, n, KeyPasteType.MODE_PASTE_WITH_VALUE)); s.add(new KeyPasteType(item, n, KeyPasteType.MODE_PASTE_WITHOUT_VALUE)); return; } } // copy else { item = NodeTransfer.cookie(t, NodeTransfer.COPY, Element.ItemElem.class); if (item != null) { s.add(new KeyPasteType(item, null, KeyPasteType.MODE_PASTE_WITH_VALUE)); s.add(new KeyPasteType(item, null, KeyPasteType.MODE_PASTE_WITHOUT_VALUE)); return; } } }