List of usage examples for org.eclipse.jface.viewers TreeViewer getTree
public Tree getTree()
From source file:edu.harvard.i2b2.eclipse.plugins.ontology.views.find.NodeBrowser.java
License:Open Source License
private List getSchemeNodes(VocabRequestType vocabData, Display theDisplay, final TreeViewer theViewer) { OntologyResponseMessage msg = new OntologyResponseMessage(); StatusType procStatus = null;/*from w w w .j a v a 2 s .c om*/ try { while (procStatus == null || !procStatus.getType().equals("DONE")) { String response = OntServiceDriver.getCodeInfo(vocabData, "FIND"); procStatus = msg.processResult(response); if (procStatus.getValue().equals("MAX_EXCEEDED")) { log.debug("MAX_EXCEEDED"); theDisplay.syncExec(new Runnable() { public void run() { MessageBox mBox = new MessageBox(theViewer.getTree().getShell(), SWT.ICON_QUESTION | SWT.YES | SWT.NO); mBox.setText("Please Note ..."); mBox.setMessage("Max number of terms exceeded please try with a more specific query.\n" + "Populating the query results will be slow\n" + "Do you want to continue?"); result = mBox.open(); } }); if (result == SWT.NO) { procStatus.setType("DONE"); } else { vocabData.setMax(null); response = OntServiceDriver.getCodeInfo(vocabData, "FIND"); procStatus = msg.processResult(response); } } // other error cases USER INVALID, TABLE ACCESS DENIED, DATABASE ERROR else if (procStatus.getType().equals("ERROR")) { System.setProperty("statusMessage", procStatus.getValue()); theDisplay.syncExec(new Runnable() { public void run() { MessageBox mBox = new MessageBox(theViewer.getTree().getShell(), SWT.ICON_INFORMATION | SWT.OK); mBox.setText("Please Note ..."); mBox.setMessage("Server reports: " + System.getProperty("statusMessage")); int result = mBox.open(); } }); this.stopRunning = true; return null; } else procStatus.setType("DONE"); } } catch (AxisFault e) { theDisplay.syncExec(new Runnable() { public void run() { // e.getMessage() == Incoming message input stream is null -- for the case of connection down. MessageBox mBox = new MessageBox(theViewer.getTree().getShell(), SWT.ICON_INFORMATION | SWT.OK); mBox.setText("Please Note ..."); mBox.setMessage("Unable to make a connection to the remote server\n" + "This is often a network error, please try again"); int result = mBox.open(); } }); this.stopRunning = true; return null; } catch (Exception e) { theDisplay.syncExec(new Runnable() { public void run() { // e.getMessage() == Incoming message input stream is null -- for the case of connection down. MessageBox mBox = new MessageBox(theViewer.getTree().getShell(), SWT.ICON_INFORMATION | SWT.OK); mBox.setText("Please Note ..."); mBox.setMessage("Error message delivered from the remote server\n" + "You may wish to retry your last action"); int result = mBox.open(); } }); this.stopRunning = true; return null; } ConceptsType allConcepts = msg.doReadConcepts(); List concepts = allConcepts.getConcept(); return concepts; }
From source file:edu.harvard.i2b2.eclipse.plugins.ontology.views.find.NodeBrowser.java
License:Open Source License
private List getModifierNodes(String type, VocabRequestType vocabData, Display theDisplay, final TreeViewer theViewer) { OntologyResponseMessage msg = new OntologyResponseMessage(); StatusType procStatus = null;// w ww.ja va2 s. c om try { while (procStatus == null || !procStatus.getType().equals("DONE")) { String response = OntServiceDriver.getNameInfo(vocabData, "FIND"); procStatus = msg.processResult(response); ; if (procStatus.getValue().equals("MAX_EXCEEDED")) { log.info("MAX_EXCEEDED"); theDisplay.syncExec(new Runnable() { public void run() { MessageBox mBox = new MessageBox(theViewer.getTree().getShell(), SWT.ICON_QUESTION | SWT.YES | SWT.NO); mBox.setText("Please Note ..."); mBox.setMessage("Max number of terms exceeded please try with a more specific query.\n" + "Populating the query results will be slow\n" + "Do you want to continue?"); result = mBox.open(); } }); if (result == SWT.NO) { procStatus.setType("DONE"); } else { vocabData.setMax(null); if (type.equals("name")) response = OntServiceDriver.getModifierNameInfo(vocabData, "FIND"); else response = OntServiceDriver.getModifierCodeInfo(vocabData, "FIND"); procStatus = msg.processResult(response); } } else if (procStatus.getType().equals("ERROR")) { System.setProperty("statusMessage", procStatus.getValue()); theDisplay.syncExec(new Runnable() { public void run() { MessageBox mBox = new MessageBox(theViewer.getTree().getShell(), SWT.ICON_INFORMATION | SWT.OK); mBox.setText("Please Note ..."); mBox.setMessage("Server reports: " + System.getProperty("statusMessage")); int result = mBox.open(); } }); this.stopRunning = true; return null; } else procStatus.setType("DONE"); } } catch (AxisFault e) { theDisplay.syncExec(new Runnable() { public void run() { MessageBox mBox = new MessageBox(theViewer.getTree().getShell(), SWT.ICON_INFORMATION | SWT.OK); mBox.setText("Please Note ..."); mBox.setMessage("Unable to make a connection to the remote server\n" + "This is often a network error, please try again"); int result = mBox.open(); } }); this.stopRunning = true; return null; } catch (Exception e) { theDisplay.syncExec(new Runnable() { public void run() { // e.getMessage() == Incoming message input stream is null -- for the case of connection down. MessageBox mBox = new MessageBox(theViewer.getTree().getShell(), SWT.ICON_INFORMATION | SWT.OK); mBox.setText("Please Note ..."); mBox.setMessage("Error message delivered from the remote server\n" + "You may wish to retry your last action"); int result = mBox.open(); } }); this.stopRunning = true; return null; } ModifiersType allModifiers = msg.doReadModifiers(); if (allModifiers == null) return null; List modifiers = allModifiers.getModifier(); return modifiers; }
From source file:edu.harvard.i2b2.eclipse.plugins.ontology.views.find.TreeNode.java
License:Open Source License
public void updateChildren(final Display theDisplay, final TreeViewer theViewer) { try {//from w w w . j a va 2 s. c om GetChildrenType parentType = new GetChildrenType(); parentType.setMax(Integer.parseInt(System.getProperty("OntFindMax"))); parentType.setHiddens(Boolean.parseBoolean(System.getProperty("OntFindHiddens"))); parentType.setSynonyms(Boolean.parseBoolean(System.getProperty("OntFindSynonyms"))); parentType.setType("core"); parentType.setParent(this.getData().getKey()); OntologyResponseMessage msg = new OntologyResponseMessage(); StatusType procStatus = null; while (procStatus == null || !procStatus.getType().equals("DONE")) { String response = OntServiceDriver.getChildren(parentType, "FIND"); procStatus = msg.processResult(response); if (procStatus.getValue().equals("MAX_EXCEEDED")) { theDisplay.syncExec(new Runnable() { public void run() { MessageBox mBox = new MessageBox(theViewer.getTree().getShell(), SWT.ICON_QUESTION | SWT.YES | SWT.NO); mBox.setText("Please Note ..."); mBox.setMessage("Max number of terms exceeded please try with a more specific query.\n" + "Populating the node will be slow\n" + "Do you want to continue?"); result = mBox.open(); } }); if (result == SWT.NO) { TreeNode node = (TreeNode) this.getChildren().get(0); node.getData().setName("Over maximum number of child nodes"); procStatus.setType("DONE"); } else { parentType.setMax(null); response = OntServiceDriver.getChildren(parentType, "FIND"); procStatus = msg.processResult(response); } } // / else -- other error codes // TABLE_ACCESS_DENIED and USER_INVALID, DATABASE ERROR else if (procStatus.getType().equals("ERROR")) { System.setProperty("statusMessage", procStatus.getValue()); theDisplay.syncExec(new Runnable() { public void run() { MessageBox mBox = new MessageBox(theViewer.getTree().getShell(), SWT.ICON_INFORMATION | SWT.OK); mBox.setText("Please Note ..."); mBox.setMessage("Server reports: " + System.getProperty("statusMessage")); int result = mBox.open(); } }); return; } } ConceptsType allConcepts = msg.doReadConcepts(); List concepts = allConcepts.getConcept(); getChildren().clear(); getNodesFromXMLString(concepts); } catch (AxisFault e) { theDisplay.syncExec(new Runnable() { public void run() { MessageBox mBox = new MessageBox(theViewer.getTree().getShell(), SWT.ICON_INFORMATION | SWT.OK); mBox.setText("Please Note ..."); mBox.setMessage("Unable to make a connection to the remote server\n" + "This is often a network error, please try again"); int result = mBox.open(); } }); } catch (Exception e) { theDisplay.syncExec(new Runnable() { public void run() { // e.getMessage() == Incoming message input stream is null -- for the case of connection down. MessageBox mBox = new MessageBox(theViewer.getTree().getShell(), SWT.ICON_INFORMATION | SWT.OK); mBox.setText("Please Note ..."); mBox.setMessage("Error message delivered from the remote server\n" + "You may wish to retry your last action"); int result = mBox.open(); } }); } }
From source file:edu.harvard.i2b2.eclipse.plugins.ontology.views.find.TreeNode.java
License:Open Source License
public void updateCategories(final Display theDisplay, final TreeViewer theViewer) { try {/* ww w.ja v a 2s .c om*/ // GetReturnType request = new GetReturnType(); // request.setType("limited"); GetCategoriesType request = new GetCategoriesType(); request.setType("core"); request.setHiddens(false); request.setSynonyms(false); OntologyResponseMessage msg = new OntologyResponseMessage(); StatusType procStatus = null; while (procStatus == null || !procStatus.getType().equals("DONE")) { String response = OntServiceDriver.getCategories(request, "FIND"); procStatus = msg.processResult(response); // if other error codes // TABLE_ACCESS_DENIED and USER_INVALID if (procStatus.getType().equals("ERROR")) { System.setProperty("statusMessage", procStatus.getValue()); theDisplay.syncExec(new Runnable() { public void run() { MessageBox mBox = new MessageBox(theViewer.getTree().getShell(), SWT.ICON_INFORMATION | SWT.OK); mBox.setText("Please Note ..."); mBox.setMessage("Server reports: " + System.getProperty("statusMessage")); int result = mBox.open(); } }); return; } procStatus.setType("DONE"); } ConceptsType allConcepts = msg.doReadConcepts(); List concepts = allConcepts.getConcept(); getNodesFromXMLString(concepts); } catch (AxisFault e) { theDisplay.syncExec(new Runnable() { public void run() { MessageBox mBox = new MessageBox(theViewer.getTree().getShell(), SWT.ICON_INFORMATION | SWT.OK); mBox.setText("Please Note ..."); mBox.setMessage("Unable to make a connection to the remote server\n" + "This is often a network error, please try again"); int result = mBox.open(); } }); } catch (Exception e) { theDisplay.syncExec(new Runnable() { public void run() { // e.getMessage() == Incoming message input stream is null -- for the case of connection down. MessageBox mBox = new MessageBox(theViewer.getTree().getShell(), SWT.ICON_INFORMATION | SWT.OK); mBox.setText("Please Note ..."); mBox.setMessage("Error message delivered from the remote server\n" + "You may wish to retry your last action"); int result = mBox.open(); } }); } }
From source file:edu.harvard.i2b2.eclipse.plugins.ontology.views.find.TreeNode.java
License:Open Source License
public void updateModifierChildren(final Display theDisplay, final TreeViewer theViewer) { GetModifierChildrenType parentType = new GetModifierChildrenType(); parentType.setHiddens(Boolean.parseBoolean(System.getProperty("OntHiddens"))); parentType.setSynonyms(Boolean.parseBoolean(System.getProperty("OntSynonyms"))); parentType.setBlob(false);//from ww w . j a va 2 s . co m parentType.setType("core"); parentType.setParent(this.getData().getModifier().getKey()); parentType.setAppliedPath(this.getData().getModifier().getAppliedPath()); parentType.setAppliedConcept(this.getData().getFullName()); GetModifierChildrenResponseMessage msg = new GetModifierChildrenResponseMessage(); StatusType procStatus = null; while (procStatus == null || !procStatus.getType().equals("DONE")) { String response = OntServiceDriver.getModifierChildren(parentType, "FIND"); procStatus = msg.processResult(response); // else if other error codes // TABLE_ACCESS_DENIED and USER_INVALID and DATABASE ERRORS if (procStatus.getType().equals("ERROR")) { System.setProperty("errorMessage", procStatus.getValue()); theDisplay.syncExec(new Runnable() { public void run() { MessageBox mBox = new MessageBox(theViewer.getTree().getShell(), SWT.ICON_INFORMATION | SWT.OK); mBox.setText("Please Note ..."); mBox.setMessage("Server reports: " + System.getProperty("errorMessage")); int result = mBox.open(); } }); getChildren().clear(); return; } } getChildren().clear(); ModifiersType allModifiers = msg.doReadModifiers(); ConceptsType concepts = new ConceptsType(); if (allModifiers != null) { // convert list of modifiers to list of concepts List<ModifierType> modifiers = allModifiers.getModifier(); if (!modifiers.isEmpty()) { Iterator<ModifierType> it = modifiers.iterator(); while (it.hasNext()) { ConceptType concept = this.getData(); TreeData data = new TreeData(concept); data.setModifier((ModifierType) it.next()); concepts.getConcept().add(data); } } List<DataType> counts = null; getModifiersFromXMLString(concepts.getConcept(), counts); } }
From source file:edu.harvard.i2b2.eclipse.plugins.ontology.views.TreeNode.java
License:Open Source License
public void updateModifiers(final Display theDisplay, final TreeViewer theViewer) { String path = StringUtil.getPath(this.getData().getKey()); String tableCd = StringUtil.getTableCd(this.getData().getKey()); getChildren().clear();/*from w w w .ja v a 2 s.c om*/ // while (path.length()>2){ GetModifiersType nodeType = new GetModifiersType(); nodeType.setBlob(false); nodeType.setSelf("\\\\" + tableCd + path); nodeType.setType("core"); nodeType.setMax(Integer.parseInt(System.getProperty("OntMax"))); nodeType.setHiddens(Boolean.parseBoolean(System.getProperty("OntHiddens"))); nodeType.setSynonyms(Boolean.parseBoolean(System.getProperty("OntSynonyms"))); GetModifiersResponseMessage msg = new GetModifiersResponseMessage(); StatusType procStatus = null; while (procStatus == null || !procStatus.getType().equals("DONE")) { String response = OntServiceDriver.getModifiers(nodeType, "ONT"); // case where server is at pre-1.6 version // ignore the response and continue if (response == null) { getChildren().clear(); return; } procStatus = msg.processResult(response); // else if other error codes // TABLE_ACCESS_DENIED and USER_INVALID and DATABASE ERRORS if (procStatus.getType().equals("ERROR")) { System.setProperty("errorMessage", procStatus.getValue()); theDisplay.syncExec(new Runnable() { public void run() { MessageBox mBox = new MessageBox(theViewer.getTree().getShell(), SWT.ICON_INFORMATION | SWT.OK); mBox.setText("Please Note ..."); mBox.setMessage("Server reports: " + System.getProperty("errorMessage")); int result = mBox.open(); } }); getChildren().clear(); return; } } // getChildren().clear(); ModifiersType allModifiers = msg.doReadModifiers(); ConceptsType concepts = new ConceptsType(); if (allModifiers != null) { // convert list of modifiers to list of concepts List<ModifierType> modifiers = allModifiers.getModifier(); if (!modifiers.isEmpty()) { Iterator<ModifierType> it = modifiers.iterator(); while (it.hasNext()) { ConceptType concept = this.getData(); TreeData data = new TreeData(concept); data.setModifier((ModifierType) it.next()); concepts.getConcept().add(data); } } List<DataType> counts = null; getModifiersFromXMLString(concepts.getConcept(), counts); } /* if(path.endsWith("%")){ path = path.substring(0, path.length()-2); // log.debug("INTERMED modifier path is " + path); path = path.substring(0, path.lastIndexOf("\\") + 1) + "%"; // log.debug("NEW modifier path is " + path); } else path = path + "%"; } */ }
From source file:edu.harvard.i2b2.eclipse.plugins.ontology.views.TreeNode.java
License:Open Source License
public void updateChildren(final Display theDisplay, final TreeViewer theViewer) { try {/* www .j a v a2s . c o m*/ GetChildrenType parentType = new GetChildrenType(); parentType.setMax(Integer.parseInt(System.getProperty("OntMax"))); parentType.setHiddens(Boolean.parseBoolean(System.getProperty("OntHiddens"))); parentType.setSynonyms(Boolean.parseBoolean(System.getProperty("OntSynonyms"))); // log.info("sent : " + parentType.getMax() + System.getProperty("OntMax") + System.getProperty("OntHiddens") // + System.getProperty("OntSynonyms") ); // parentType.setMax(150); parentType.setBlob(false); parentType.setType("core"); parentType.setParent(this.getData().getKey()); GetChildrenResponseMessage msg = new GetChildrenResponseMessage(); StatusType procStatus = null; while (procStatus == null || !procStatus.getType().equals("DONE")) { String response = OntServiceDriver.getChildren(parentType, "ONT"); procStatus = msg.processResult(response); if (procStatus.getValue().equals("MAX_EXCEEDED")) { theDisplay.syncExec(new Runnable() { public void run() { MessageBox mBox = new MessageBox(theViewer.getTree().getShell(), SWT.ICON_QUESTION | SWT.YES | SWT.NO); mBox.setText("Please Note ..."); mBox.setMessage("Max number of terms exceeded please try with a more specific query.\n" + "Populating the node will be slow\n" + "Do you want to continue?"); result = mBox.open(); } }); if (result == SWT.NO) { TreeNode node = (TreeNode) this.getChildren().get(0); node.getData().setName("Over maximum number of child nodes"); procStatus.setType("DONE"); } else { parentType.setMax(null); response = OntServiceDriver.getChildren(parentType, "ONT"); procStatus = msg.processResult(response); } } // else if other error codes // TABLE_ACCESS_DENIED and USER_INVALID and DATABASE ERRORS else if (procStatus.getType().equals("ERROR")) { System.setProperty("errorMessage", procStatus.getValue()); theDisplay.syncExec(new Runnable() { public void run() { MessageBox mBox = new MessageBox(theViewer.getTree().getShell(), SWT.ICON_INFORMATION | SWT.OK); mBox.setText("Please Note ..."); mBox.setMessage("Server reports: " + System.getProperty("errorMessage")); int result = mBox.open(); } }); getChildren().clear(); return; } } ConceptsType allConcepts = msg.doReadConcepts(); if (allConcepts != null) { List concepts = allConcepts.getConcept(); List<DataType> counts = null; //if(System.getProperty("getPatientCount").equals("true")){ // counts = getCounts(parentType); //} // getChildren().clear(); getNodesFromXMLString(concepts, counts); } } catch (AxisFault e) { log.error(e.getMessage()); theDisplay.syncExec(new Runnable() { public void run() { // e.getMessage() == Incoming message input stream is null -- for the case of connection down. MessageBox mBox = new MessageBox(theViewer.getTree().getShell(), SWT.ICON_INFORMATION | SWT.OK); mBox.setText("Please Note ..."); mBox.setMessage("Unable to make a connection to the remote server\n" + "This is often a network error, please try again"); int result = mBox.open(); } }); getChildren().clear(); } catch (I2B2Exception e) { log.error(e.getMessage()); theDisplay.syncExec(new Runnable() { public void run() { // e.getMessage() == Incoming message input stream is null -- for the case of connection down. MessageBox mBox = new MessageBox(theViewer.getTree().getShell(), SWT.ICON_INFORMATION | SWT.OK); mBox.setText("Please Note ..."); mBox.setMessage( "Your system does not have enough memory \n to display the contents of this folder."); int result = mBox.open(); } }); getChildren().clear(); } catch (Exception e) { log.error(e.getMessage()); // disableCountButton(); theDisplay.syncExec(new Runnable() { public void run() { // e.getMessage() == Incoming message input stream is null -- for the case of connection down. MessageBox mBox = new MessageBox(theViewer.getTree().getShell(), SWT.ICON_INFORMATION | SWT.OK); mBox.setText("Please Note ..."); mBox.setMessage("Error message delivered from the remote server\n" + "You may wish to retry your last action"); int result = mBox.open(); } }); getChildren().clear(); } }
From source file:edu.harvard.i2b2.eclipse.plugins.ontology.views.TreeNode.java
License:Open Source License
public void updateModifierChildren(final Display theDisplay, final TreeViewer theViewer) { // try { GetModifierChildrenType parentType = new GetModifierChildrenType(); parentType.setHiddens(Boolean.parseBoolean(System.getProperty("OntHiddens"))); parentType.setSynonyms(Boolean.parseBoolean(System.getProperty("OntSynonyms"))); // log.info("sent : " + parentType.getMax() + System.getProperty("OntMax") + System.getProperty("OntHiddens") // + System.getProperty("OntSynonyms") ); // parentType.setMax(150); parentType.setBlob(false);//from w ww . ja va 2s .c o m parentType.setType("core"); parentType.setParent(this.getData().getModifier().getKey()); parentType.setAppliedPath(this.getData().getModifier().getAppliedPath()); parentType.setAppliedConcept(this.getData().getFullName()); GetModifierChildrenResponseMessage msg = new GetModifierChildrenResponseMessage(); StatusType procStatus = null; while (procStatus == null || !procStatus.getType().equals("DONE")) { String response = OntServiceDriver.getModifierChildren(parentType, "ONT"); procStatus = msg.processResult(response); // else if other error codes // TABLE_ACCESS_DENIED and USER_INVALID and DATABASE ERRORS if (procStatus.getType().equals("ERROR")) { System.setProperty("errorMessage", procStatus.getValue()); theDisplay.syncExec(new Runnable() { public void run() { MessageBox mBox = new MessageBox(theViewer.getTree().getShell(), SWT.ICON_INFORMATION | SWT.OK); mBox.setText("Please Note ..."); mBox.setMessage("Server reports: " + System.getProperty("errorMessage")); int result = mBox.open(); } }); getChildren().clear(); return; } } getChildren().clear(); ModifiersType allModifiers = msg.doReadModifiers(); ConceptsType concepts = new ConceptsType(); if (allModifiers != null) { // convert list of modifiers to list of concepts List<ModifierType> modifiers = allModifiers.getModifier(); if (!modifiers.isEmpty()) { Iterator<ModifierType> it = modifiers.iterator(); while (it.hasNext()) { ConceptType concept = this.getData(); TreeData data = new TreeData(concept); data.setModifier((ModifierType) it.next()); concepts.getConcept().add(data); } } List<DataType> counts = null; getModifiersFromXMLString(concepts.getConcept(), counts); } /* } catch (AxisFault e) { log.error(e.getMessage()); theDisplay.syncExec(new Runnable() { public void run() { // e.getMessage() == Incoming message input stream is null -- for the case of connection down. MessageBox mBox = new MessageBox(theViewer.getTree().getShell(), SWT.ICON_INFORMATION | SWT.OK); mBox.setText("Please Note ..."); mBox.setMessage("Unable to make a connection to the remote server\n" + "This is often a network error, please try again"); int result = mBox.open(); } }); getChildren().clear(); } catch (I2B2Exception e) { log.error(e.getMessage()); theDisplay.syncExec(new Runnable() { public void run() { // e.getMessage() == Incoming message input stream is null -- for the case of connection down. MessageBox mBox = new MessageBox(theViewer.getTree().getShell(), SWT.ICON_INFORMATION | SWT.OK); mBox.setText("Please Note ..."); mBox.setMessage("Your system does not have enough memory \n to display the contents of this folder."); int result = mBox.open(); } }); getChildren().clear(); } catch (Exception e) { log.error(e.getMessage()); // disableCountButton(); theDisplay.syncExec(new Runnable() { public void run() { // e.getMessage() == Incoming message input stream is null -- for the case of connection down. MessageBox mBox = new MessageBox(theViewer.getTree().getShell(), SWT.ICON_INFORMATION | SWT.OK); mBox.setText("Please Note ..."); mBox.setMessage("Error message delivered from the remote server\n" + "You may wish to retry your last action"); int result = mBox.open(); } }); getChildren().clear(); }*/ }
From source file:edu.harvard.i2b2.eclipse.plugins.ontology.views.TreeNode.java
License:Open Source License
public Thread expandFindTree(TreeViewer viewer, String[] parts, String parent) { final TreeNode theNode = this; final TreeViewer theViewer = viewer; final String[] theParts = parts; final Display theDisplay = PlatformUI.getWorkbench().getDisplay(); return new Thread() { @Override//from ww w.j a v a 2 s . c o m public void run() { try { // String parent = theParent; TreeNode treeNode = theNode; String compare = "\\"; for (int i = 1; i < theParts.length; i++) { compare += theParts[i] + "\\"; List<TreeNode> nodes = treeNode.getChildren(); Iterator<TreeNode> it = nodes.iterator(); while (it.hasNext()) { TreeNode node = (TreeNode) it.next(); if (StringUtil.getPath(node.getData().getFullName()).equals(compare)) { treeNode = node; RefreshNode.getInstance().setRefreshNode(treeNode); RefreshNode.getInstance().setLevel(i); if ((node.getChildren().isEmpty()) || (node.getChildren().get(0).getData().getName().equals("working..."))) { // node.setOpen(true); node.getChildren().clear(); treeNode.updateModifiers(theDisplay, theViewer); treeNode.updateChildren(theDisplay, theViewer); } break; } } } } catch (Exception e) { // TODO Auto-generated catch block // System.setProperty("statusMessage", e.getMessage()); } theDisplay.syncExec(new Runnable() { public void run() { theViewer.collapseAll(); theViewer.expandToLevel(RefreshNode.getInstance().getRefreshNode(), 1); theViewer.setSelection(new StructuredSelection(RefreshNode.getInstance().getRefreshNode()), true); theViewer.getTree().setEnabled(true); } }); } }; }
From source file:edu.harvard.i2b2.eclipse.plugins.workplace.views.find.FindViewNodeBrowser.java
License:Open Source License
private List getNodes(FindByChildType vocabData, Display theDisplay, final TreeViewer theViewer) { WorkplaceResponseMessage msg = new WorkplaceResponseMessage(); StatusType procStatus = null;// w w w. j a va 2 s . co m try { while (procStatus == null || !procStatus.getType().equals("DONE")) { String response = WorkplaceServiceDriver.getNameInfo(vocabData); //////////testing -- using get children of "wp1"/////// //GetChildrenType parentType = new GetChildrenType(); //parentType.setBlob(true); //parentType.setParent("\\\\demo"+"\\Kmx3tsrijobZ9DnYN4Od"); //String response = WorkplaceServiceDriver.getChildren(parentType); ///////////////// procStatus = msg.processResult(response); ; if (procStatus.getValue().equals("MAX_EXCEEDED")) { log.info("MAX_EXCEEDED"); theDisplay.syncExec(new Runnable() { public void run() { MessageBox mBox = new MessageBox(theViewer.getTree().getShell(), SWT.ICON_QUESTION | SWT.YES | SWT.NO); mBox.setText("Please Note ..."); mBox.setMessage("Max number of terms exceeded please try with a more specific query.\n" + "Populating the query results will be slow\n" + "Do you want to continue?"); result = mBox.open(); } }); if (result == SWT.NO) { procStatus.setType("DONE"); } else { vocabData.setMax(null); response = WorkplaceServiceDriver.getNameInfo(vocabData); //////////testing -- using get children of "wp1"/////// //parentType = new GetChildrenType(); //parentType.setBlob(true); //parentType.setParent("\\\\demo"+"\\Kmx3tsrijobZ9DnYN4Od"); //response = WorkplaceServiceDriver.getChildren(parentType); ///////////////// procStatus = msg.processResult(response); } } else if (procStatus.getType().equals("ERROR")) { System.setProperty("statusMessage", procStatus.getValue()); theDisplay.syncExec(new Runnable() { public void run() { MessageBox mBox = new MessageBox(theViewer.getTree().getShell(), SWT.ICON_INFORMATION | SWT.OK); mBox.setText("Please Note ..."); mBox.setMessage("Server reports: " + System.getProperty("statusMessage")); int result = mBox.open(); } }); this.stopRunning = true; return null; } else procStatus.setType("DONE"); } } catch (AxisFault e) { theDisplay.syncExec(new Runnable() { public void run() { MessageBox mBox = new MessageBox(theViewer.getTree().getShell(), SWT.ICON_INFORMATION | SWT.OK); mBox.setText("Please Note ..."); mBox.setMessage("Unable to make a connection to the remote server\n" + "This is often a network error, please try again"); int result = mBox.open(); } }); this.stopRunning = true; return null; } catch (Exception e) { theDisplay.syncExec(new Runnable() { public void run() { // e.getMessage() == Incoming message input stream is null -- for the case of connection down. MessageBox mBox = new MessageBox(theViewer.getTree().getShell(), SWT.ICON_INFORMATION | SWT.OK); mBox.setText("Please Note ..."); mBox.setMessage("Error message delivered from the remote server\n" + "You may wish to retry your last action"); int result = mBox.open(); } }); this.stopRunning = true; return null; } FoldersType folders = msg.doReadFolders(); if (folders == null) return null; List nodes = folders.getFolder(); return nodes;////concepts; }