List of usage examples for org.eclipse.jface.viewers TreeViewer getTree
public Tree getTree()
From source file:DevDesigner.ActionGroupEditor.java
License:Open Source License
private void createEditArea(Composite parent) { parent.setLayout(new GridLayout(2, false)); Label label = new Label(parent, SWT.NONE); label.setText("Name:"); Text text = new Text(parent, SWT.BORDER); text.setText("View: TestExplorer"); text.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); Label ldesc = new Label(parent, SWT.None); ldesc.setText("Description:"); GridData gd = new GridData(); gd.horizontalSpan = 2;// w w w . ja v a 2 s . c om ldesc.setLayoutData(gd); Text desc = new Text(parent, SWT.BORDER | SWT.MULTI | SWT.WRAP); gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = 2; gd.minimumHeight = 100; desc.setLayoutData(gd); desc.setText( "Die Actiongroup TestExplorer stellt den linken Baum im Editor dar. Hier werden Testflle verwaltet. Diese knnen...."); Label actionL = new Label(parent, SWT.NORMAL); actionL.setText("Actions:"); gd = new GridData(); gd.horizontalSpan = 2; actionL.setLayoutData(gd); TreeViewer treeviewer = new TreeViewer(parent, SWT.BORDER | SWT.MULTI | SWT.WRAP); treeviewer.setContentProvider(new ITreeContentProvider() { @Override public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { // TODO Auto-generated method stub } @Override public void dispose() { // TODO Auto-generated method stub } @Override public boolean hasChildren(Object element) { if (element instanceof ProjectLib) return true; if (element instanceof LibGroup) return true; return false; } @Override public Object getParent(Object element) { return null; } @Override public Object[] getElements(Object inputElement) { return ((List<ProjectLib>) inputElement).toArray(); } @Override public Object[] getChildren(Object parentElement) { if (parentElement instanceof ProjectLib) { ProjectLib l = (ProjectLib) parentElement; return l.getLibGroups().toArray(); } if (parentElement instanceof LibGroup) { return ((LibGroup) parentElement).getElemnts().toArray(); } return null; } }); gd = new GridData(GridData.FILL_BOTH); gd.horizontalSpan = 2; treeviewer.getTree().setLayoutData(gd); List<Object> actions = new ArrayList<Object>(); LibGroup lib = new LibGroup("Menue"); actions.add(lib); lib.addChild("Datei -> Speichern"); lib.addChild("Bearbeiten -> kopieren"); lib.addChild("Bearbeiten -> ausschneiden"); lib.addChild("Bearbeiten -> einfgen"); lib.addChild("Coolbar -> minimieren"); lib.addChild("Coolbar -> maximierenh"); actions.add("Rechte Maustaste"); actions.add("Execute Test"); actions.add("Sende ShoutCut {param}"); LibGroup baum = new LibGroup("Widget: Baum"); baum.addChild("Waehle aus {param}"); baum.addChild("klicke auf {param}"); baum.addChild("Expandiere zu element {param}"); actions.add(baum); treeviewer.setInput(actions); treeviewer.expandAll(); }
From source file:DevDesigner.TechnicalBindingEditor.java
License:Open Source License
private void createEditArea(Composite parent) { parent.setLayout(new GridLayout(2, false)); Label label = new Label(parent, SWT.NONE); label.setText("Name:"); Text text = new Text(parent, SWT.BORDER); text.setText("wahle Wert aus Liste"); text.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); Label ldesc = new Label(parent, SWT.None); ldesc.setText("Description:"); GridData gd = new GridData(); gd.horizontalSpan = 2;//from w w w . j a va2s . c o m ldesc.setLayoutData(gd); Text desc = new Text(parent, SWT.BORDER | SWT.MULTI | SWT.WRAP); gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = 2; gd.minimumHeight = 100; desc.setLayoutData(gd); desc.setText("Das Element Eingabefeld ist fr die Eingabe von Daten zustndig. " + "Bei Services kann dies auch ein einfaches Feld sein was nicht in der UI ist, " + "sondern beispielweise ein XML Attrbiut fr einen Webservice."); Label fixtureL = new Label(parent, SWT.NORMAL); fixtureL.setText("Fixture:"); Text fixT = new Text(parent, SWT.BORDER); fixT.setText("SWTFixture.waehleAus(String wert, List liste)"); fixT.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); Label actionL = new Label(parent, SWT.NORMAL); actionL.setText("Parameter:"); gd = new GridData(); gd.horizontalSpan = 2; actionL.setLayoutData(gd); TreeViewer treeviewer = new TreeViewer(parent, SWT.BORDER | SWT.MULTI | SWT.WRAP); treeviewer.setContentProvider(new ITreeContentProvider() { @Override public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { // TODO Auto-generated method stub } @Override public void dispose() { // TODO Auto-generated method stub } @Override public boolean hasChildren(Object element) { if (element instanceof ProjectLib) return true; if (element instanceof LibGroup) return true; return false; } @Override public Object getParent(Object element) { return null; } @Override public Object[] getElements(Object inputElement) { return ((List<ProjectLib>) inputElement).toArray(); } @Override public Object[] getChildren(Object parentElement) { if (parentElement instanceof ProjectLib) { ProjectLib l = (ProjectLib) parentElement; return l.getLibGroups().toArray(); } if (parentElement instanceof LibGroup) { return ((LibGroup) parentElement).getElemnts().toArray(); } return null; } }); gd = new GridData(GridData.FILL_BOTH); gd.horizontalSpan = 2; treeviewer.getTree().setLayoutData(gd); List<Object> actions = new ArrayList<Object>(); actions.add("Wert"); actions.add("Liste"); treeviewer.setInput(actions); treeviewer.expandAll(); }
From source file:DevDesigner.WidgetEditor.java
License:Open Source License
private void createEditArea(Composite parent) { parent.setLayout(new GridLayout(2, false)); Label label = new Label(parent, SWT.NONE); label.setText("Name:"); Text text = new Text(parent, SWT.BORDER); text.setText("Eingabefeld"); text.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); Label ldesc = new Label(parent, SWT.None); ldesc.setText("Description:"); GridData gd = new GridData(); gd.horizontalSpan = 2;//from ww w .java 2s . com ldesc.setLayoutData(gd); Text desc = new Text(parent, SWT.BORDER | SWT.MULTI | SWT.WRAP); gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = 2; gd.minimumHeight = 100; desc.setLayoutData(gd); desc.setText("Das Element Eingabefeld ist fr die Eingabe von Daten zustndig. " + "Bei Services kann dies auch ein einfaches Feld sein was nicht in der UI ist, " + "sondern beispielweise ein XML Attrbiut fr einen Webservice."); Label actionL = new Label(parent, SWT.NORMAL); actionL.setText("Actions:"); gd = new GridData(); gd.horizontalSpan = 2; actionL.setLayoutData(gd); TreeViewer treeviewer = new TreeViewer(parent, SWT.BORDER | SWT.MULTI | SWT.WRAP); treeviewer.setContentProvider(new ITreeContentProvider() { @Override public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { // TODO Auto-generated method stub } @Override public void dispose() { // TODO Auto-generated method stub } @Override public boolean hasChildren(Object element) { if (element instanceof ProjectLib) return true; if (element instanceof LibGroup) return true; return false; } @Override public Object getParent(Object element) { return null; } @Override public Object[] getElements(Object inputElement) { return ((List<ProjectLib>) inputElement).toArray(); } @Override public Object[] getChildren(Object parentElement) { if (parentElement instanceof ProjectLib) { ProjectLib l = (ProjectLib) parentElement; return l.getLibGroups().toArray(); } if (parentElement instanceof LibGroup) { return ((LibGroup) parentElement).getElemnts().toArray(); } return null; } }); gd = new GridData(GridData.FILL_BOTH); gd.horizontalSpan = 2; treeviewer.getTree().setLayoutData(gd); List<Object> actions = new ArrayList<Object>(); actions.add("Eingabe {param}"); actions.add("Feld auswhlen"); actions.add("Prfe ob {param} drinne steht"); actions.add("lsche Inhalt"); treeviewer.setInput(actions); treeviewer.expandAll(); }
From source file:dslComponent.Snippet056BooleanCellEditor.java
License:Open Source License
public Snippet056BooleanCellEditor(final Shell shell) { final TreeViewer v = new TreeViewer(shell, SWT.BORDER | SWT.FULL_SELECTION); v.getTree().setLinesVisible(true); v.getTree().setHeaderVisible(true);//from w w w . j a v a2 s . co m FocusCellOwnerDrawHighlighter h = new FocusCellOwnerDrawHighlighter(v) { @Override protected Color getSelectedCellBackgroundColorNoFocus(ViewerCell cell) { return shell.getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND); } @Override protected Color getSelectedCellForegroundColorNoFocus(ViewerCell cell) { return shell.getDisplay().getSystemColor(SWT.COLOR_WIDGET_FOREGROUND); } }; TreeViewerFocusCellManager focusCellManager = new TreeViewerFocusCellManager(v, h); ColumnViewerEditorActivationStrategy actSupport = new ColumnViewerEditorActivationStrategy(v); int feature = ColumnViewerEditor.TABBING_HORIZONTAL | ColumnViewerEditor.TABBING_MOVE_TO_ROW_NEIGHBOR | ColumnViewerEditor.TABBING_VERTICAL | ColumnViewerEditor.KEYBOARD_ACTIVATION; TreeViewerEditor.create(v, focusCellManager, actSupport, feature); final TextCellEditor textCellEditor = new TextCellEditor(v.getTree()); final CheckboxCellEditor booleanCellEditor = new CheckboxCellEditor(v.getTree()); TreeViewerColumn column = createColumnFor(v, "Column 1"); column.setLabelProvider(new MyColumnLabelProvider("Column 1")); column.setEditingSupport(new MyEditingSupport(v, v, textCellEditor)); column = createColumnFor(v, "Column 2"); column.setLabelProvider(new ColumnLabelProvider() { @Override public String getText(Object element) { return ((MyModel) element).flag + ""; } }); column.setEditingSupport(new EditingSupport(v) { @Override protected boolean canEdit(Object element) { return true; } @Override protected CellEditor getCellEditor(Object element) { return booleanCellEditor; } @Override protected Object getValue(Object element) { return new Boolean(((MyModel) element).flag); } @Override protected void setValue(Object element, Object value) { ((MyModel) element).flag = ((Boolean) value).booleanValue(); v.update(element, null); } }); column = createColumnFor(v, "Column 3"); column.setLabelProvider(new MyColumnLabelProvider("Column 3")); column.setEditingSupport(new MyEditingSupport(v, v, textCellEditor)); v.setContentProvider(new MyContentProvider()); v.setInput(createModel()); }
From source file:edu.harvard.i2b2.eclipse.plugins.ontology.views.edit.ModifierComposite.java
License:Open Source License
public void addModifiers(TreeData node) { final TreeViewer theViewer = this.viewer; final Display theDisplay = Display.getCurrent(); String path = StringUtil.getPath(node.getKey()); String tableCd = StringUtil.getTableCd(node.getKey()); //rootNode.getChildren().clear(); clearTree();/*from ww w. j a v a2 s .c o m*/ TreeNode conceptTerm = new TreeNode(node); conceptTerm.setOpen(true); rootNode.addChild(conceptTerm); conceptNode = conceptTerm; // while (path.length()>2){ try { GetModifiersType modifiersType = new GetModifiersType(); modifiersType.setSynonyms(false); modifiersType.setHiddens(false); modifiersType.setMax(null); modifiersType.setBlob(true); modifiersType.setSelf("\\\\" + tableCd + path); findLabel.setVisible(true); GetModifiersResponseMessage msg = new GetModifiersResponseMessage(); StatusType procStatus = null; while (procStatus == null || !procStatus.getType().equals("DONE")) { String response = OntServiceDriver.getModifiers(modifiersType, "ONT"); response = response.replace("<ValueMetadata>", "<ns6:ValueMetadata xmlns:ns6=\"http://www.i2b2.org/xsd/cell/ont/1.1/\">"); response = response.replace("</ValueMetadata>", "</ns6:ValueMetadata>"); procStatus = msg.processResult(response); // 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(); } }); return; } } ModifiersType allModifiers = msg.doReadModifiers(); if (allModifiers != null) { List<ModifierType> modifiers = allModifiers.getModifier(); // rootNode.getNodesFromXMLString(modifiers, null); if (!modifiers.isEmpty()) { Iterator<ModifierType> it = modifiers.iterator(); while (it.hasNext()) { ConceptType child = rootNode.getData(); TreeData data = new TreeData(child); ModifierType mod = (ModifierType) it.next(); if (System.getProperty("OntEditConceptCode").equals("true")) { if ((mod.getBasecode() != null) && (mod.getBasecode().length() != 0)) mod.setTooltip(mod.getTooltip() + " - " + mod.getBasecode()); } data.setModifier(mod); TreeNode childNode = new TreeNode(data); // child.setModifier(data.getModifier()); if ((data.getModifier().getVisualattributes().startsWith("DA")) || (data.getModifier().getVisualattributes().startsWith("OA"))) { TreeNode placeholder = new TreeNode(child.getLevel() + 1, "working...", "working...", "RA"); placeholder.setOpen(true); ModifierType modifier = new ModifierType(); modifier.setName("working..."); modifier.setVisualattributes("RA"); placeholder.getData().setModifier(modifier); childNode.addChild(placeholder); // rootNode.addChild(childNode); conceptTerm.addChild(childNode); } else if ((data.getModifier().getVisualattributes().startsWith("DH")) || (data.getModifier().getVisualattributes().startsWith("OH"))) { TreeNode placeholder = new TreeNode(child.getLevel() + 1, "working...", "working...", "RH"); placeholder.setOpen(true); ModifierType modifier = new ModifierType(); modifier.setName("working..."); modifier.setVisualattributes("RA"); placeholder.getData().setModifier(modifier); childNode.addChild(placeholder); //rootNode.addChild(childNode); conceptTerm.addChild(childNode); } else if ((data.getModifier().getVisualattributes().startsWith("R"))) { // rootNode.addChild(childNode); conceptTerm.addChild(childNode); } } } } theViewer.expandToLevel(rootNode, 2); theViewer.refresh(rootNode); } catch (Exception 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("Error message delivered from the remote server\n" + "You may wish to retry your last action"); int result = mBox.open(); } }); } /* 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.edit.TreeNode.java
License:Open Source License
public void updateChildren(final Display theDisplay, final TreeViewer theViewer) { try {/*from ww w . ja va 2 s . c o m*/ GetChildrenType parentType = new GetChildrenType(); // parentType.setMax(Integer.parseInt(System.getProperty("OntMax"))); parentType.setMax(null); parentType.setHiddens(false); parentType.setSynonyms(false); parentType.setBlob(true); // parentType.setType("all"); parentType.setParent(this.getData().getKey()); GetChildrenResponseMessage msg = new GetChildrenResponseMessage(); StatusType procStatus = null; while (procStatus == null || !procStatus.getType().equals("DONE")) { String response = OntServiceDriver.getChildren(parentType, "EDIT"); response = response.replace("<ValueMetadata>", "<ns6:ValueMetadata xmlns:ns6=\"http://www.i2b2.org/xsd/cell/ont/1.1/\">"); response = response.replace("</ValueMetadata>", "</ns6:ValueMetadata>"); 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, "EDIT"); response = response.replace("<ValueMetadata>", "<ns6:ValueMetadata xmlns:ns6=\"http://www.i2b2.org/xsd/cell/ont/1.1/\">"); response = response.replace("</ValueMetadata>", "</ns6:ValueMetadata>"); 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(); getChildren().clear(); getNodesFromXMLString(concepts, null); } } 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.edit.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(true);/*from w ww . j a va2 s . c o m*/ parentType.setType("core"); parentType.setParent(this.getData().getModifier().getKey()); parentType.setAppliedPath(this.getData().getModifier().getAppliedPath()); parentType.setAppliedConcept(ModifierComposite.getInstance().getConceptNode().getData().getFullName()); GetModifierChildrenResponseMessage msg = new GetModifierChildrenResponseMessage(); StatusType procStatus = null; while (procStatus == null || !procStatus.getType().equals("DONE")) { String response = OntServiceDriver.getModifierChildren(parentType, "ONT"); response = response.replace("<ValueMetadata>", "<ns6:ValueMetadata xmlns:ns6=\"http://www.i2b2.org/xsd/cell/ont/1.1/\">"); response = response.replace("</ValueMetadata>", "</ns6:ValueMetadata>"); 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.find.ModifierComposite.java
License:Open Source License
private List getModifierNodes(String type, VocabRequestType vocabData, Display theDisplay, final TreeViewer theViewer) { OntologyResponseMessage msg = new OntologyResponseMessage(); StatusType procStatus = null;//from w w w.j a v a 2s.c om try { while (procStatus == null || !procStatus.getType().equals("DONE")) { String response = null; if (type.equals("name")) response = OntServiceDriver.getModifierNameInfo(vocabData, "FIND"); else response = OntServiceDriver.getModifierCodeInfo(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 (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.ModifierComposite.java
License:Open Source License
public void updateModifiers(final Display theDisplay, final TreeViewer theViewer) { String path = StringUtil.getPath(conceptNode.getData().getKey()); String tableCd = StringUtil.getTableCd(conceptNode.getData().getKey()); // getChildren().clear(); // while (path.length()>3){ GetModifiersType nodeType = new GetModifiersType(); nodeType.setBlob(false);/*from w ww . j a va2 s. co m*/ nodeType.setSelf("\\\\" + tableCd + path); nodeType.setType("core"); GetModifiersResponseMessage msg = new GetModifiersResponseMessage(); StatusType procStatus = null; while (procStatus == null || !procStatus.getType().equals("DONE")) { String response = OntServiceDriver.getModifiers(nodeType, "FIND"); // case where server is at pre-1.6 version // ignore the response and continue if (response == null) { rootNode.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(); } }); rootNode.getChildren().clear(); return; } } rootNode.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(); getModifierNodesFromXMLString(modifiers); } }
From source file:edu.harvard.i2b2.eclipse.plugins.ontology.views.find.NodeBrowser.java
License:Open Source License
private List getNodes(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.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); response = OntServiceDriver.getNameInfo(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; } ConceptsType allConcepts = msg.doReadConcepts(); if (allConcepts == null) return null; List concepts = allConcepts.getConcept(); return concepts; }