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) {
}
}
}
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);
}
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);
}
}
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);
}
}
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);
}
}
}
Aggregations