Example usage for org.eclipse.jface.viewers TreeViewer getTree

List of usage examples for org.eclipse.jface.viewers TreeViewer getTree

Introduction

In this page you can find the example usage for org.eclipse.jface.viewers TreeViewer getTree.

Prototype

public Tree getTree() 

Source Link

Document

Returns this tree viewer's tree control.

Usage

From source file:edu.harvard.i2b2.eclipse.plugins.workplace.views.find.TreeNode.java

License:Open Source License

public void updateChildren(final Display theDisplay, final TreeViewer theViewer) {
    try {//from w w  w .  j  a v  a2  s.c o m
        GetChildrenType parentType = new GetChildrenType();
        parentType.setBlob(true);
        parentType.setParent("\\\\" + this.getData().getTableCd() + "\\" + this.getData().getIndex());

        //      log.info(parentType.getParent());
        //      log.info(this.getData().getHierarchy());

        GetChildrenResponseMessage msg = new GetChildrenResponseMessage();
        StatusType procStatus = null;
        while (procStatus == null || !procStatus.getType().equals("DONE")) {
            String response = WorkplaceServiceDriver.getChildren(parentType);

            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("The node has exceeded maximum number of children\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 = WorkplaceServiceDriver.getChildren(parentType);
                    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();
                    }
                });
                return;
            }
        }
        FoldersType allFolders = msg.doReadFolders();
        if (allFolders != null) {
            List folders = allFolders.getFolder();
            getChildren().clear();
            getNodesFromXMLString(folders);
        }

    } 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();
            }
        });
    } 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();
            }
        });
    }

}

From source file:edu.harvard.i2b2.eclipse.plugins.workplace.views.find.TreeNode.java

License:Open Source License

public void delete(final Display theDisplay, final TreeViewer theViewer) {
    try {/*from  ww w.ja  va2 s  .c o m*/
        DeleteChildType childType = new DeleteChildType();

        //         childType.setNode(this.getData().getHierarchy());   
        childType.setNode("\\\\" + this.getData().getTableCd() + "\\" + this.getData().getIndex());

        DeleteChildResponseMessage msg = new DeleteChildResponseMessage();
        StatusType procStatus = null;
        while (procStatus == null || !procStatus.getType().equals("DONE")) {
            String response = WorkplaceServiceDriver.deleteChild(childType);

            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();
                    }
                });
                return;
            }
        }
        ((TreeNode) (this.getParent())).getChildren().remove(this);
        //      theViewer.refresh(this.getParent());   

    } 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();
            }
        });
    } 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();
            }
        });
    }
}

From source file:edu.harvard.i2b2.eclipse.plugins.workplace.views.find.TreeNode.java

License:Open Source License

public void move(final Display theDisplay, final TreeViewer theViewer) {
    try {// ww w.j  av a2s  .c om
        ChildType childType = new ChildType();
        childType.setNode("\\\\" + this.getData().getTableCd() + "\\" + this.getData().getIndex());
        childType.setParent(this.getData().getParentIndex());

        MoveChildResponseMessage msg = new MoveChildResponseMessage();
        StatusType procStatus = null;
        while (procStatus == null || !procStatus.getType().equals("DONE")) {
            String response = WorkplaceServiceDriver.moveChild(childType);

            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();
                    }
                });
                return;
            }
        }

    } 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();
            }
        });
    } 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();
            }
        });
    }
}

From source file:edu.harvard.i2b2.eclipse.plugins.workplace.views.find.TreeNode.java

License:Open Source License

public void rename(final Display theDisplay, final TreeViewer theViewer, final String theNewName) {
    XmlValueType newWorkXml = null;//from  w ww.  ja va2 s .  c om
    try {
        RenameChildResponseMessage msg = new RenameChildResponseMessage();
        StatusType procStatus = null;
        while (procStatus == null || !procStatus.getType().equals("DONE")) {

            RenameChildType childType = new RenameChildType();
            childType.setNode("\\\\" + this.getData().getTableCd() + "\\" + this.getData().getIndex());
            childType.setName(theNewName);
            newWorkXml = updateWorkXml(theNewName);
            childType.setWorkXml(newWorkXml);
            String response = WorkplaceServiceDriver.renameChild(childType);

            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();
                    }
                });
                return;
            }
        }
        this.getData().setName(theNewName);
        if (newWorkXml != null)
            this.getData().setWorkXml(newWorkXml);
        /*  old code before rename fix
         * if((this.getData().getWorkXmlI2B2Type().equals("CONCEPT"))) {
           Element rootElement = this.getData().getWorkXml().getAny().get(0);
           NodeList nameElements = rootElement.getElementsByTagName("name");
           nameElements.item(0).setTextContent(theNewName);      
                
           NodeList synonymElements = rootElement.getElementsByTagName("synonym_cd");
           if(synonymElements.item(0) != null)
              synonymElements.item(0).setTextContent("Y");
        }
         */
    } 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();
            }
        });

    } 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();
            }
        });
    }
}

From source file:edu.harvard.i2b2.eclipse.plugins.workplace.views.find.TreeNode.java

License:Open Source License

public void export(final Display theDisplay, final TreeViewer theViewer, final String thexmlFilename,
        TreeNode theNode) {/*from ww w.  j  a v a2  s . c o  m*/
    try {

        org.w3c.dom.Element dndElement = theNode.getData().getWorkXml().getAny().get(0);
        org.jdom.input.DOMBuilder builder = new DOMBuilder();
        org.jdom.Element jdomElement = builder.build(dndElement);
        String myXmldata = (new XMLOutputter()).outputString(jdomElement);

        if (myXmldata.contains("<ns4:query_master")) {
            String qmid = myXmldata.substring(myXmldata.indexOf("<query_master_id>") + 17,
                    myXmldata.indexOf("</query_master_id>"));
            ExportChildResponseMessage msg = new ExportChildResponseMessage();
            StatusType procStatus = null;
            while (procStatus == null || !procStatus.getType().equals("DONE")) {

                ExportChildType childType = new ExportChildType();
                childType.setNode(qmid);
                childType.setType("QM");
                //childType.setNode("\\\\" + this.getData().getTableCd() +  "\\" + this.getData().getIndex());
                String response = WorkplaceServiceDriver.exportChild(childType);

                procStatus = msg.processResult(response);

                myXmldata = msg.processBody(response);
                //myXmldata = response;
                //myXmldata = msg.processBody(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();
                        }
                    });
                    return;
                }
            }
            //myXmldata = XmlUtil.getInstance().writeQueryXML(myXmldata);

        } else if (myXmldata.contains("<ns4:query_result_instance")) {
            String qmid = myXmldata.substring(myXmldata.indexOf("<result_instance_id>") + 20,
                    myXmldata.indexOf("</result_instance_id>"));
            ExportChildResponseMessage msg = new ExportChildResponseMessage();
            StatusType procStatus = null;
            while (procStatus == null || !procStatus.getType().equals("DONE")) {

                ExportChildType childType = new ExportChildType();
                childType.setNode(qmid);
                childType.setType("QR");
                //childType.setNode("\\\\" + this.getData().getTableCd() +  "\\" + this.getData().getIndex());
                String response = WorkplaceServiceDriver.exportChild(childType);

                procStatus = msg.processResult(response);

                myXmldata = msg.processBody(response);
                //myXmldata = msg.processBody(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();
                        }
                    });
                    return;
                }
            }
            //myXmldata = XmlUtil.getInstance().writeQueryXML(myXmldata);

        }
        //this.getData().setTooltip(theNewTooltip);

        FileWriter outFile = new FileWriter(thexmlFilename);
        PrintWriter out = new PrintWriter(outFile);
        out.println(myXmldata);
        out.close();

    } 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();
            }
        });

    } 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();
            }
        });
    }
}

From source file:edu.harvard.i2b2.eclipse.plugins.workplace.views.find.TreeNode.java

License:Open Source License

public void annotate(final Display theDisplay, final TreeViewer theViewer, final String theNewTooltip) {
    try {/*from w  ww . j a  v a  2  s .c  o  m*/
        AnnotateChildResponseMessage msg = new AnnotateChildResponseMessage();
        StatusType procStatus = null;
        while (procStatus == null || !procStatus.getType().equals("DONE")) {

            AnnotateChildType childType = new AnnotateChildType();
            //            childType.setNode(this.getData().getHierarchy());
            childType.setNode("\\\\" + this.getData().getTableCd() + "\\" + this.getData().getIndex());
            childType.setTooltip(theNewTooltip);
            String response = WorkplaceServiceDriver.annotateChild(childType);

            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();
                    }
                });
                return;
            }
        }
        this.getData().setTooltip(theNewTooltip);

    } 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();
            }
        });

    } 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();
            }
        });
    }
}

From source file:edu.harvard.i2b2.eclipse.plugins.workplace.views.find.TreeNode.java

License:Open Source License

public void add(final Display theDisplay, final TreeViewer theViewer) {
    try {//w w w .  j a  v a2  s .co m
        WorkplaceResponseMessage msg = new WorkplaceResponseMessage();
        StatusType procStatus = null;
        while (procStatus == null || !procStatus.getType().equals("DONE")) {

            FolderType childType = new FolderType();
            //         childType.setHierarchy(this.getData().getHierarchy());
            childType.setName(this.getData().getName());
            childType.setGroupId(this.getData().getGroupId());
            //         childType.setHlevel(this.getData().getHlevel());
            childType.setIndex(this.getData().getIndex());
            childType.setParentIndex(
                    "\\\\" + this.getData().getTableCd() + "\\" + this.getData().getParentIndex());
            //   childType.setParentIndex(this.getData().getParentIndex());
            childType.setTooltip(this.getData().getTooltip());
            childType.setUserId(this.getData().getUserId());
            childType.setVisualAttributes(this.getData().getVisualAttributes());
            childType.setWorkXml(this.getData().getWorkXml());
            childType.setWorkXmlI2B2Type(this.getData().getWorkXmlI2B2Type());
            childType.setShareId(this.getData().getShareId());
            childType.setWorkXmlSchema(this.getData().getWorkXmlSchema());
            childType.setEntryDate(null);
            childType.setChangeDate(null);
            childType.setStatusCd(null);

            String response = WorkplaceServiceDriver.addChild(childType);

            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();
                    }
                });
                return;
            }
        }
    } 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();
            }
        });

    } 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();
            }
        });
    }
}

From source file:edu.harvard.i2b2.eclipse.plugins.workplace.views.TreeNode.java

License:Open Source License

public void protect(final Display theDisplay, final TreeViewer theViewer) {
    XmlValueType newWorkXml = null;/*from  w  w w  .  ja v  a  2s .c  o m*/
    //String theNewName = new String("test_protected_access");
    try {
        ProtectResponseMessage msg = new ProtectResponseMessage();
        StatusType procStatus = null;
        while (procStatus == null || !procStatus.getType().equals("DONE")) {

            ProtectedType childType = new ProtectedType();
            childType.setIndex("\\\\" + this.getData().getTableCd() + "\\" + this.getData().getIndex());
            //childType.setName(theNewName);
            //newWorkXml = updateWorkXml(theNewName);
            //childType.setWorkXml(newWorkXml);
            if (this.getData().getProtectedAccess().equalsIgnoreCase("Y")) {
                childType.setProtectedAccess("false");
            } else {
                childType.setProtectedAccess("true");
            }
            String response = WorkplaceServiceDriver.protectChild(childType);

            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();
                    }
                });
                return;
            }
        }
        //this.getData().setName(theNewName);
        //this.getData().protected_access(true);
        if (this.getData().getProtectedAccess().equalsIgnoreCase("Y")) {
            this.getData().setProtectedAccess("N");
        } else {
            this.getData().setProtectedAccess("Y");
        }
        if (newWorkXml != null)
            this.getData().setWorkXml(newWorkXml);
        /*  old code before rename fix
         * if((this.getData().getWorkXmlI2B2Type().equals("CONCEPT"))) {
           Element rootElement = this.getData().getWorkXml().getAny().get(0);
           NodeList nameElements = rootElement.getElementsByTagName("name");
           nameElements.item(0).setTextContent(theNewName);      
                
           NodeList synonymElements = rootElement.getElementsByTagName("synonym_cd");
           if(synonymElements.item(0) != null)
              synonymElements.item(0).setTextContent("Y");
        }
         */
    } 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();
            }
        });

    } 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();
            }
        });
    }
}

From source file:es.cv.gvcase.emf.ui.common.composites.SelectModelComposite.java

License:Open Source License

protected TreeViewer createTree(Composite parent) {
    historyTableProvider = new LocalFileHistoryTableProvider();
    TreeViewer viewer = historyTableProvider.createTree(parent);
    Rectangle bounds = viewer.getTree().getBounds();
    // hack to not show horizontal scroll bar
    viewer.getTree().setBounds(bounds.x, bounds.y, 100, bounds.height);
    viewer.setContentProvider(new LocalHistoryContentProvider());
    return viewer;
}

From source file:eu.aniketos.wp1.ststool.analysis.ui.ResultView.java

License:Open Source License

/**
 * Create contents of the view part.//from  w w  w . ja  v  a  2s .c o  m
 * 
 * @param parent
 */
@Override
public void createPartControl(Composite parent) {

    parent.addDisposeListener(this);
    Composite container = toolkit.createComposite(parent, SWT.NONE);
    toolkit.paintBordersFor(container);

    container.setLayout(new FormLayout());

    Composite compositeResults = new Composite(container, SWT.NONE);
    FormData fd_composite = new FormData();
    fd_composite.left = new FormAttachment(0);
    fd_composite.top = new FormAttachment(0);
    fd_composite.bottom = new FormAttachment(100, -30);
    fd_composite.right = new FormAttachment(100);
    compositeResults.setLayoutData(fd_composite);
    compositeResults.setLayout(new FillLayout());

    Composite compositeStatusBar = new Composite(container, SWT.BORDER);
    FormData fd_composite_1 = new FormData();
    fd_composite_1.right = new FormAttachment(100);
    fd_composite_1.left = new FormAttachment(0);
    fd_composite_1.bottom = new FormAttachment(100);
    fd_composite_1.top = new FormAttachment(compositeResults);
    compositeStatusBar.setLayoutData(fd_composite_1);
    compositeStatusBar.setLayout(new FormLayout());

    SashForm sashForm = new SashForm(compositeResults, SWT.SMOOTH | SWT.VERTICAL);
    sashForm.setSashWidth(2);
    toolkit.paintBordersFor(sashForm);

    TreeViewer treeViewer = new TreeViewer(sashForm, SWT.BORDER | SWT.FULL_SELECTION);
    treeViewer.addPostSelectionChangedListener(this);
    Tree tree = treeViewer.getTree();
    tree.setLinesVisible(true);
    tree.setHeaderVisible(true);
    tree.setSortDirection(SWT.UP);
    toolkit.paintBordersFor(tree);

    Composite composite_1 = new Composite(sashForm, SWT.NONE);
    composite_1.setLayout(new FormLayout());

    Label lblDescription = new Label(composite_1, SWT.NONE);
    FormData fd_lblDescription = new FormData();
    fd_lblDescription.right = new FormAttachment(100, -10);
    fd_lblDescription.top = new FormAttachment(0, 10);
    fd_lblDescription.left = new FormAttachment(0, 10);
    lblDescription.setLayoutData(fd_lblDescription);
    lblDescription.setText("Description:");

    Composite composite_2 = new Composite(composite_1, SWT.NONE);
    FormData fd_composite_2 = new FormData();
    fd_composite_2.bottom = new FormAttachment(100, -10);
    fd_composite_2.right = new FormAttachment(100, -10);
    fd_composite_2.top = new FormAttachment(lblDescription, 6);
    fd_composite_2.left = new FormAttachment(0, 10);
    composite_2.setLayoutData(fd_composite_2);

    composite_2.setLayout(new FormLayout());
    composite_2.addPaintListener(new BorderPainter());

    descriptionText = new Text(composite_2, SWT.NONE | SWT.WRAP | SWT.V_SCROLL);
    descriptionText.setBackground(descriptionText.getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
    FormData fd_text = new FormData();
    int x = 3;
    fd_text.bottom = new FormAttachment(100, -x);
    fd_text.right = new FormAttachment(100, -x);
    fd_text.top = new FormAttachment(0, x);
    fd_text.left = new FormAttachment(0, x);
    descriptionText.setLayoutData(fd_text);
    descriptionText.setEditable(false);

    sashForm.setWeights(new int[] { 55, 45 });

    TreeViewerColumn treeViewerColumn = new TreeViewerColumn(treeViewer, SWT.CENTER);
    treeViewerColumn.getColumn().setText(getMessage(ResultView_Column_1_Titile));
    treeViewerColumn.getColumn().setWidth(700);

    TreeViewerColumn treeViewerColumn2 = new TreeViewerColumn(treeViewer, SWT.LEFT);
    treeViewerColumn2.getColumn().setText(getMessage(ResultView_Column_2_Titile));
    treeViewerColumn2.getColumn().setWidth(500);

    statusLabel = new Label(compositeStatusBar, SWT.HORIZONTAL | SWT.SHADOW_NONE);
    FormData fd_lblNewLabel = new FormData();
    fd_lblNewLabel.right = new FormAttachment(100, -3);
    fd_lblNewLabel.top = new FormAttachment(0, 6);
    fd_lblNewLabel.left = new FormAttachment(3);
    statusLabel.setLayoutData(fd_lblNewLabel);
    statusLabel.setForeground(ColorConstants.red);

    container.addControlListener(new TableCompositeAdapter(container, treeViewer.getTree(),
            treeViewerColumn.getColumn(), treeViewerColumn2.getColumn()));
    new ResultViewDataProvider(treeViewer, treeViewerColumn, treeViewerColumn2, statusLabel);

    createActions();
    initializeToolBar();
    initializeMenu();
}