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

Method findHandleForResource

src/main/java/gate/gui/MainFrame.java:432–448  ·  view source on GitHub ↗

Locates the handle for a given resource. @param res the resource for which the handle is sought. @return the Handle for the resource, if it it was found.

(Resource res)

Source from the content-addressed store, hash-verified

430 * @return the {@link Handle} for the resource, if it it was found.
431 */
432 protected Handle findHandleForResource(Resource res){
433 Handle handle = null;
434 // go through all the nodes
435 Enumeration<?> nodesEnum = resourcesTreeRoot.breadthFirstEnumeration();
436 while(nodesEnum.hasMoreElements() && handle == null) {
437 Object node = nodesEnum.nextElement();
438 if(node instanceof DefaultMutableTreeNode) {
439 DefaultMutableTreeNode dmtNode = (DefaultMutableTreeNode)node;
440 if(dmtNode.getUserObject() instanceof Handle) {
441 if(((Handle)dmtNode.getUserObject()).getTarget() == res) {
442 handle = (Handle)dmtNode.getUserObject();
443 }
444 }
445 }
446 }
447 return handle;
448 }
449
450 /**
451 * Selects a resource if loaded in the system and not invisible.

Callers 2

selectMethod · 0.95
runMethod · 0.95

Calls 1

getTargetMethod · 0.65

Tested by

no test coverage detected