MCPcopy Create free account
hub / github.com/GateNLP/gate-core / createTransferable

Method createTransferable

src/main/java/gate/gui/MainFrame.java:635–655  ·  view source on GitHub ↗
(JComponent c)

Source from the content-addressed store, hash-verified

633 return COPY;
634 }
635 @Override
636 protected Transferable createTransferable(JComponent c) {
637 TreePath[] paths = resourcesTree.getSelectionPaths();
638 if(paths == null) { return new StringSelection(""); }
639 Handle handle;
640 List<String> documentsNames = new ArrayList<String>();
641 for(TreePath path : paths) {
642 if(path != null) {
643 Object value = path.getLastPathComponent();
644 value = ((DefaultMutableTreeNode)value).getUserObject();
645 if(value instanceof Handle) {
646 handle = (Handle)value;
647 if(handle.getTarget() instanceof Document) {
648 documentsNames.add(((Document)handle.getTarget()).getName());
649 }
650 }
651 }
652 }
653 return new StringSelection("ResourcesTree"
654 + Arrays.toString(documentsNames.toArray()));
655 }
656 @Override
657 protected void exportDone(JComponent c, Transferable data, int action) {
658 }

Callers

nothing calls this directly

Calls 6

getTargetMethod · 0.95
getLastPathComponentMethod · 0.80
addMethod · 0.65
getNameMethod · 0.65
toStringMethod · 0.65
toArrayMethod · 0.45

Tested by

no test coverage detected