Search in sources :

Example 21 with TreeItem

use of org.eclipse.swt.widgets.TreeItem in project translationstudio8 by heartsome.

the class PluginHelpDialog method searchText.

private void searchText() {
    HelpSearchDialog searchDialog = new HelpSearchDialog(getShell());
    if (searchDialog.open() == IDialogConstants.OK_ID) {
        String text = searchDialog.getText();
        boolean sensitive = searchDialog.isSensitive();
        if (!sensitive) {
            text = text.toLowerCase();
        }
        try {
            isFound = false;
            //$NON-NLS-1$
            File f = new File("searchresult.html");
            fosSearch = new FileOutputStream(f);
            f.deleteOnExit();
            writeString("<html>\n");
            writeString("<head>\n");
            writeString("<title>" + Messages.getString("dialog.PluginHelpDialog.searchTitle") + "</title>\n");
            writeString("</head>\n");
            writeString("<body>\n");
            ProgressDialog progressDialog = new ProgressDialog(getShell(), Messages.getString("dialog.PluginHelpDialog.progressDialogTitle"), Messages.getString("dialog.PluginHelpDialog.progressMessage"), ProgressDialog.SINGLE_BAR);
            progressDialog.open();
            Enumeration<TreeItem> keys = hashTable.keys();
            int count = hashTable.size();
            int i = 0;
            while (keys.hasMoreElements()) {
                String url = hashTable.get(keys.nextElement());
                //$NON-NLS-1$
                String file = url.substring(url.lastIndexOf("/"));
                progressDialog.updateProgressMessage(file);
                searchFile(url, text, sensitive);
                progressDialog.updateProgress((i * 100) / count);
                i++;
            }
            progressDialog.close();
            if (!isFound) {
                //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
                writeString("<p><b>" + Messages.getString("dialog.PluginHelpDialog.searchNone") + "</b></p>");
            }
            //$NON-NLS-1$
            writeString("</body>\n");
            //$NON-NLS-1$
            writeString("</html>");
            fosSearch.close();
            browser.setUrl(f.toURI().toURL().toString());
        } catch (Exception e) {
        }
    }
}
Also used : TreeItem(org.eclipse.swt.widgets.TreeItem) FileOutputStream(java.io.FileOutputStream) File(java.io.File) IOException(java.io.IOException) ParserConfigurationException(javax.xml.parsers.ParserConfigurationException) SAXException(org.xml.sax.SAXException) UnsupportedEncodingException(java.io.UnsupportedEncodingException)

Example 22 with TreeItem

use of org.eclipse.swt.widgets.TreeItem in project otertool by wuntee.

the class Test method createContents.

/**
	 * Create contents of the window.
	 */
protected void createContents() {
    shell = new Shell();
    shell.setSize(450, 300);
    shell.setText("SWT Application");
    shell.setLayout(new GridLayout(1, false));
    CTabFolder tabFolder = new CTabFolder(shell, SWT.BORDER);
    tabFolder.setSimple(false);
    tabFolder.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
    tabFolder.setSelectionBackground(Display.getCurrent().getSystemColor(SWT.COLOR_TITLE_INACTIVE_BACKGROUND_GRADIENT));
    CTabItem tabItem = new CTabItem(tabFolder, SWT.NONE);
    tabItem.setText("New Item");
    tree = new Tree(tabFolder, SWT.BORDER);
    tabItem.setControl(tree);
    trtmTestTreeItem = new TreeItem(tree, SWT.NONE);
    trtmTestTreeItem.setText("test tree item");
    trtmNewTreeitem = new TreeItem(trtmTestTreeItem, SWT.NONE);
    trtmNewTreeitem.setText("New TreeItem");
    trtmTestTreeItem.setExpanded(true);
}
Also used : Shell(org.eclipse.swt.widgets.Shell) GridLayout(org.eclipse.swt.layout.GridLayout) CTabFolder(org.eclipse.swt.custom.CTabFolder) TreeItem(org.eclipse.swt.widgets.TreeItem) GridData(org.eclipse.swt.layout.GridData) Tree(org.eclipse.swt.widgets.Tree) CTabItem(org.eclipse.swt.custom.CTabItem)

Example 23 with TreeItem

use of org.eclipse.swt.widgets.TreeItem in project yyl_example by Relucent.

the class TableTreeTest method hideControlInTableTreeItem.

private void hideControlInTableTreeItem(TreeItem treeItem, boolean pVisible) {
    TreeItem parentItem = treeItem.getParentItem();
    boolean visible = pVisible && (parentItem == null || parentItem.getExpanded());
    setVisibilityTreeEditor(treeItem, visible);
    for (int len = treeItem.getItemCount(), i = 0; i < len; i++) {
        hideControlInTableTreeItem(treeItem.getItem(i), visible);
    }
}
Also used : TreeItem(org.eclipse.swt.widgets.TreeItem)

Example 24 with TreeItem

use of org.eclipse.swt.widgets.TreeItem in project yyl_example by Relucent.

the class DispelTreeEditorBug method hideControlInTableTreeItem.

private void hideControlInTableTreeItem(TreeItem treeItem, boolean pVisible) {
    TreeItem parentItem = treeItem.getParentItem();
    boolean visible = pVisible && (parentItem == null || parentItem.getExpanded());
    setVisibilityTreeEditor(treeItem, visible);
    for (int len = treeItem.getItemCount(), i = 0; i < len; i++) {
        hideControlInTableTreeItem(treeItem.getItem(i), visible);
    }
}
Also used : TreeItem(org.eclipse.swt.widgets.TreeItem)

Example 25 with TreeItem

use of org.eclipse.swt.widgets.TreeItem in project tdi-studio-se by Talend.

the class TreePopulator method populateTreeItems.

/**
     * populate tree items.
     * 
     * @param tree
     * @param node
     */
private void populateTreeItems(Object tree, Node element, int level, String parentXPath) {
    level++;
    if (level > 10) {
        return;
    } else {
        NodeList nodeList = element.getChildNodes();
        // Object[] chidrenTreeNode = aTreeNode.getChildren();
        for (int i = 0; i < nodeList.getLength(); i++) {
            final Node subNode = nodeList.item(i);
            if (subNode.getNodeName().equals(TEXT_CONST)) {
                continue;
            }
            TreeItem treeItem;
            if (tree instanceof Tree) {
                treeItem = new TreeItem((Tree) tree, 0);
            } else {
                treeItem = new TreeItem((TreeItem) tree, 0);
            }
            TreeNodeData treeNodeData = storeNodeAttrData(subNode);
            treeItem.setData(treeNodeData);
            treeItem.setText(subNode.getNodeName());
            //$NON-NLS-1$
            String currentTreePath = parentXPath + "/" + treeItem.getText();
            treeNodeData.setTreePath(currentTreePath);
            treeNodeData.setTreeNode(ATreeNodeUtil.getTreeNodeByPath(currentTreePath));
            if (subNode.getChildNodes() != null && subNode.getChildNodes().getLength() > 0) {
                populateTreeItems(treeItem, subNode, level, currentTreePath);
            }
            setExpanded(treeItem);
        }
    }
}
Also used : TreeItem(org.eclipse.swt.widgets.TreeItem) NodeList(org.w3c.dom.NodeList) Node(org.w3c.dom.Node) Tree(org.eclipse.swt.widgets.Tree)

Aggregations

TreeItem (org.eclipse.swt.widgets.TreeItem)150 Tree (org.eclipse.swt.widgets.Tree)36 SelectionEvent (org.eclipse.swt.events.SelectionEvent)23 GridData (org.eclipse.swt.layout.GridData)23 Point (org.eclipse.swt.graphics.Point)21 ArrayList (java.util.ArrayList)20 TreeColumn (org.eclipse.swt.widgets.TreeColumn)18 GridLayout (org.eclipse.swt.layout.GridLayout)17 TreeViewer (org.eclipse.jface.viewers.TreeViewer)16 Composite (org.eclipse.swt.widgets.Composite)14 TableItem (org.eclipse.swt.widgets.TableItem)14 SelectionListener (org.eclipse.swt.events.SelectionListener)13 Group (org.eclipse.swt.widgets.Group)13 Button (org.eclipse.swt.widgets.Button)12 Table (org.eclipse.swt.widgets.Table)12 Event (org.eclipse.swt.widgets.Event)11 List (java.util.List)10 Label (org.eclipse.swt.widgets.Label)10 CubridGroupNode (com.cubrid.common.ui.spi.model.CubridGroupNode)9 AUndertaking (edu.cmu.cs.hcii.cogtool.model.AUndertaking)9