本文整理汇总了Java中org.eclipse.swt.widgets.TreeItem.setText方法的典型用法代码示例。如果您正苦于以下问题:Java TreeItem.setText方法的具体用法?Java TreeItem.setText怎么用?Java TreeItem.setText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.swt.widgets.TreeItem
的用法示例。
在下文中一共展示了TreeItem.setText方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initialize
import org.eclipse.swt.widgets.TreeItem; //导入方法依赖的package包/类
private void initialize() {
if (parentObject instanceof Project) {
Project project = (Project)parentObject;
List<String> projectList = new ArrayList<String>();
projectList.add(project.getName());
List<Reference> references = project.getReferenceList();
for (Reference reference: references) {
if (reference instanceof ProjectSchemaReference) {
projectList.add(((ProjectSchemaReference)reference).getProjectName());
}
}
String[] projects = Engine.theApp.databaseObjectsManager.getAllProjectNamesArray();
for (String name: projects) {
if (!projectList.contains(name)) {
TreeItem branch = new TreeItem(tree, SWT.NONE);
branch.setText(name);
}
}
tree.setVisible(true);
}
else
tree.setVisible(false);
}
示例2: loadRootsIntoDirectoryTree
import org.eclipse.swt.widgets.TreeItem; //导入方法依赖的package包/类
/**
* Load the root directories of the file system into the directory tree,
* priorly removing any entries.
*/
public void loadRootsIntoDirectoryTree() {
this.directoryTree.removeAll();
File[] roots = File.listRoots();
for (int a = 0; a < roots.length; a++) {
/*
* Skip drive A if it is not explicitly wanted - no one needs it nowadays and it slows
* initialization down.
*/
if (!Options.getInst().hideDrivesAB
|| (!roots[a].getPath().startsWith("A:") && !roots[a].getPath()
.startsWith("B:"))) {
String rootEntry = roots[a].toString();
if (rootEntry.endsWith("\\")) rootEntry = rootEntry.substring(0, rootEntry.length() - 1);
TreeItem root = new TreeItem(this.directoryTree, 0);
root.setText(rootEntry);
root.setData(roots[a]);
new TreeItem(root, 0);
}
}
}
示例3: refreshDetails
import org.eclipse.swt.widgets.TreeItem; //导入方法依赖的package包/类
void refreshDetails() {
configDetails.removeAll();
Map webseeds = wizard.webseeds;
Iterator iter = webseeds.entrySet().iterator();
while(iter.hasNext()) {
Map.Entry entry = (Map.Entry)iter.next();
TreeItem itemRoot = new TreeItem(configDetails,SWT.NULL);
itemRoot.setText((String)entry.getKey());
Iterator iter2 = ((List)entry.getValue()).iterator();
while(iter2.hasNext()) {
String url = (String) iter2.next();
new TreeItem(itemRoot,SWT.NULL).setText(url);
}
itemRoot.setExpanded(true);
}
}
示例4: getInHeritedScreenClass
import org.eclipse.swt.widgets.TreeItem; //导入方法依赖的package包/类
public void getInHeritedScreenClass(ScreenClass screenClass, TreeItem branch) {
TreeItem leaf = new TreeItem(branch, SWT.NONE);
leaf.setText(screenClass.getName());
List<ScreenClass> screenClasses = screenClass.getInheritedScreenClasses();
for (ScreenClass sC : screenClasses) {
getInHeritedScreenClass(sC, leaf);
}
}
示例5: addDirectoriesToTree
import org.eclipse.swt.widgets.TreeItem; //导入方法依赖的package包/类
/**
* Helper function for building fileTree.
*/
protected void addDirectoriesToTree(TreeItem directoryItem, DirectoryEntry directoryEntry) {
Iterator files = directoryEntry.getFiles().iterator();
while (files.hasNext()) {
final FileEntry entry = (FileEntry) files.next();
if (entry.isDirectory()) {
TreeItem item = new TreeItem(directoryItem, SWT.BORDER);
item.setText(entry.getFilename());
item.setData(entry);
addDirectoriesToTree(item, (DirectoryEntry)entry);
}
}
}
示例6: addAnnotation
import org.eclipse.swt.widgets.TreeItem; //导入方法依赖的package包/类
/**
* Add annotations as sub items to the supplied node.
*
* @param root The TreeItem that is the root node for the new items.
* @param annotations The Annotation array to process.
* @param constantPool The required constant_pool.
*/
private void addAnnotation(TreeItem root, Annotation[] annotations, Constant[] constantPool) {
for (int a = 0; a < annotations.length; a++) {
TreeItem item = new TreeItem(root, 0);
int numElementValuePairs = annotations[a].getNumElementValuePairs();
item.setText(StaticGuiSupport.getFormatedIndexNumberByMaximumNumber(a,
annotations.length, true)
+ constantPool[annotations[a].getTypeIndex()].getStringValue()
+ " with "
+ numElementValuePairs + " element value pairs");
ElementValuePair[] elementValuePairs = annotations[a].getElementValuePairs();
addElementValuePairs(item, elementValuePairs, constantPool);
}
}
示例7: addParameterAnnotation
import org.eclipse.swt.widgets.TreeItem; //导入方法依赖的package包/类
/**
* Add parameter annotations as sub items to the supplied node.
*
* @param root The TreeItem that is the root node for the new items.
* @param parameterAnnotations The ParameterAnnotation array to process.
* @param constantPool The required constant_pool.
*/
private void addParameterAnnotation(TreeItem root, ParameterAnnotation[] parameterAnnotations,
Constant[] constantPool) {
for (int a = 0; a < parameterAnnotations.length; a++) {
TreeItem item = new TreeItem(root, 0);
int numAnnotations = parameterAnnotations[a].getNumAnnotations();
item.setText(StaticGuiSupport.getFormatedIndexNumberByMaximumNumber(a,
parameterAnnotations.length, true)
+ " with " + numAnnotations + " annotations");
addAnnotation(item, parameterAnnotations[a].getAnnotations(), constantPool);
}
}
示例8: addElementValuePairs
import org.eclipse.swt.widgets.TreeItem; //导入方法依赖的package包/类
/**
* Add element values pairs as sub items to the supplied node.
*
* @param root The TreeItem that is the root node for the new items.
* @param elementValuePairs The ElementValuePair array to process.
* @param constantPool The required constant_pool.
*/
private void addElementValuePairs(TreeItem root, ElementValuePair[] elementValuePairs, Constant[] constantPool) {
for (int a = 0; a < elementValuePairs.length; a++) {
TreeItem item = new TreeItem(root, 0);
item.setText(StaticGuiSupport.getFormatedIndexNumberByMaximumNumber(a,
elementValuePairs.length, true)
+ constantPool[elementValuePairs[a].getElementNameIndex()].getStringValue()
+ " with type "
+ getElementValueText(item, elementValuePairs[a].getElementValues(),
constantPool));
}
}
示例9: addNodeInTree
import org.eclipse.swt.widgets.TreeItem; //导入方法依赖的package包/类
/**
* Adds a node in the visual tree. This method is used by the @see fillDomTree method
*
* @param parent the parent (Can be the tree or a parent TreeItem)
* @param node the node to be added
*/
public boolean addNodeInTree(Object parent, Node node, IProgressMonitor monitor) {
TreeItem tItem = (TreeItem) parent;
String[] values = new String[2];
tItem.setData(node);
// calc the node text according to the node type
switch (node.getNodeType()) {
case Node.ELEMENT_NODE :
int dec = 0;
if (node.hasAttributes()) {// add a fake first node for 'Attributes' item
tItem.setData("dec", new Integer(dec = 1));
}
Node[] childs = XMLUtils.toNodeArray(node.getChildNodes());
tItem.setData("childs", childs);
tItem.setItemCount(childs.length + dec);
values[0] = node.getNodeName();
values[1] = getTextValue(node);
tItem.setText(values);
tItem.setImage(imageNode);
break;
case Node.TEXT_NODE :
tItem.setImage(imageText);
tItem.setText(node.getNodeValue().trim());
break;
case Node.ATTRIBUTE_NODE:
tItem.setImage(imageAttrib);
String str = node.getNodeName() + "=\"" + node.getNodeValue() + "\"";
tItem.setText(new String[] {str, str});
break;
case Node.ENTITY_NODE:
tItem.setText("[Entity]");
break;
case Node.ENTITY_REFERENCE_NODE :
tItem.setText("[Entityref]");
break;
case Node.PROCESSING_INSTRUCTION_NODE :
tItem.setText("[Pi]");
break;
case Node.COMMENT_NODE :
tItem.setText("[Comment]");
break;
case Node.DOCUMENT_FRAGMENT_NODE :
tItem.setText("[Docfgmt]");
break;
case Node.DOCUMENT_TYPE_NODE :
tItem.setText("[Doctype]");
break;
case Node.NOTATION_NODE :
tItem.setText("[Notation]");
break;
default: break;
}
return true;
}
示例10: getElementValueText
import org.eclipse.swt.widgets.TreeItem; //导入方法依赖的package包/类
/**
* Get a String representation of an element_value and add sub items if necessary.
*
* @param root The TreeItem that is the root node for the new items.
* @param elementValue The ElementValue to process.
* @param constantPool The required constant_pool.
* @return A String representation of an element_value.
*/
private String getElementValueText(TreeItem root, ElementValue elementValue, Constant[] constantPool) {
switch (elementValue.getTag()) {
case 'B':
return "byte and value \"" + elementValue.getStringValue() + "\"";
case 'C':
return "char and value \"" + elementValue.getStringValue() + "\"";
case 'D':
return "double and value \"" + elementValue.getStringValue() + "\"";
case 'F':
return "float and value \"" + elementValue.getStringValue() + "\"";
case 'I':
return "int and value \"" + elementValue.getStringValue() + "\"";
case 'J':
return "long and value \"" + elementValue.getStringValue() + "\"";
case 'S':
return "short and value \"" + elementValue.getStringValue() + "\"";
case 'Z':
return "boolean and value \"" + elementValue.getStringValue() + "\"";
case 's':
return "String and value \"" + elementValue.getStringValue() + "\"";
case 'e':
return "enum " + elementValue.getStringValue();
case 'c':
return "class " + elementValue.getStringValue();
case '@':
Annotation annotation = ((ElementValueAnnotation) elementValue).getAnnotation();
TreeItem item = new TreeItem(root, 0);
int numElementValuePairs = annotation.getNumElementValuePairs();
ElementValuePair[] elementValuePairs = annotation.getElementValuePairs();
addElementValuePairs(item , elementValuePairs, constantPool);
return constantPool[annotation.getTypeIndex()].getStringValue()
+ " with " + numElementValuePairs + " element value pairs";
case '[':
ElementValue[] elementValues = ((ElementValueArray) elementValue).getElementValues();
for (int a = 0; a < elementValues.length; a++) {
TreeItem item2 = new TreeItem(root, 0);
item2.setText(StaticGuiSupport.getFormatedIndexNumberByMaximumNumber(a,
elementValues.length, true) + " " + getElementValueText(item2, elementValues[a], constantPool));
}
return "array of " + ((ElementValueArray) elementValue).getNumValues() + " element values";
}
// This cannot be reached for semantic reasons.
return null;
}