本文整理汇总了Java中org.eclipse.swt.widgets.TreeItem.getText方法的典型用法代码示例。如果您正苦于以下问题:Java TreeItem.getText方法的具体用法?Java TreeItem.getText怎么用?Java TreeItem.getText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.swt.widgets.TreeItem
的用法示例。
在下文中一共展示了TreeItem.getText方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getSelectedItems
import org.eclipse.swt.widgets.TreeItem; //导入方法依赖的package包/类
private void getSelectedItems(TreeItem[] items, List<Node> selectedItems) {
if (items == null) {
return;
}
for (TreeItem item : items) {
Node parent = new Node(item.getText(), true);
TreeItem[] children = item.getItems();
if (children != null) {
boolean selected = false;
for (TreeItem child : children) {
if (child.getChecked()) {
parent.addChild(new Node(child.getText(), false));
selected = true;
}
}
if (selected) {
nodeListManager.addSelectedNode(parent);
}
}
}
}
示例2: getSelectedPropertyDescriptor
import org.eclipse.swt.widgets.TreeItem; //导入方法依赖的package包/类
/**
* Gets the property descriptor of the selected property for this databaseObjectBeanInfo
* @param databaseObjectBeanInfo : BeanInfo of the selected databaseObject in the TreeExplorerView
* @return PropertyDescriptor
*/
public PropertyDescriptor getSelectedPropertyDescriptor(BeanInfo databaseObjectBeanInfo) {
PropertyDescriptor propertyDescriptor = null;
// gets the properties editor
PropertySheet view = ConvertigoPlugin.getDefault().getPropertiesView();
Tree tree = (Tree) view.getCurrentPage().getControl();
// gets the property selected in the property editor if one is selected
TreeItem[] items = tree.getSelection();
if (items.length > 0) {
TreeItem selectedItem = items[0];
// gets the local name of the selected property
String text = selectedItem.getText();
// gets the PropertyDescriptors of this databaseObject
PropertyDescriptor[] descriptors = databaseObjectBeanInfo.getPropertyDescriptors();
String displayName = null;
int i = 0;
// gets the PropertyDescriptor of the selected property
while (i < descriptors.length && propertyDescriptor == null) {
displayName = descriptors[i].getDisplayName();
if (displayName.equals(text))
propertyDescriptor = descriptors[i];
i++;
}
}
return propertyDescriptor;
}
示例3: classWasSelected
import org.eclipse.swt.widgets.TreeItem; //导入方法依赖的package包/类
/**
* Process the current class selection, refreshing the method list if desired.
* @param selection The selection String.
*/
protected void classWasSelected(String[] selection) {
if (selection != null && selection.length != 0) {
String currentClassSelected = selection[0];
if (getCurrentClassSelected() == null || !getCurrentClassSelected().equals(currentClassSelected)) {
setCurrentClassSelected(currentClassSelected);
getMethodList().removeAll();
}
changeFileInspectSelectButtonEnabled(true);
changeOptionsEnabled(false);
}
// Show the methods.
if (showMethods(false)) {
// Since the methods could be shown, add the ClassFile to the list of recently opened files.
addClassToRecentFileList();
} else {
// Remove the ClassFile of the list of recently opened files.
if (selection != null && selection.length != 0) {
String path = "";
TreeItem item = this.directoryTree.getSelection()[0];
while (item != null) {
String addToPath = item.getText();
if (JarFileEntry.isArchive(addToPath)) {
addToPath += "|";
} else {
addToPath += "/";
}
path = addToPath + path;
item = item.getParentItem();
}
// Make sure the entry is removed irrespective of the slashes.
Options.getInst().recentFilesPaths.remove(path + selection[0]);
Options.getInst().recentFilesPaths.remove(path.replace("/", "\\") + selection[0]);
}
}
}
示例4: getCurrentClassPath
import org.eclipse.swt.widgets.TreeItem; //导入方法依赖的package包/类
/**
* Get the basic class path and replace the first class path entry
* with it.
*/
protected void getCurrentClassPath() {
// Get the current class path.
if (this.directoryTree.getSelection().length > 0) {
String newEntry = "";
TreeItem item = this.directoryTree.getSelection()[0];
Object data = item.getData();
if (data instanceof JarFileEntry) {
// just add the jar file as the class path entry
JarFileEntry jfe = (JarFileEntry) data;
JarFile jf = jfe.getJarFile();
newEntry = jf.getName();
this.currentClassPackage = jfe.getFileName().replace("/", ".").replace("\\", ".");
} else if (data instanceof File && ((File) data).isFile()) {
// It is just a single file, so add the path to it.
newEntry = ((File) data).getPath();
this.currentClassPackage = "";
} else {
// Try to find out if we are somewhere in a structure with a root dir "bin". Otherwise just add the current dir.
String fullPath = "";
boolean resetClassPackage = true;
while (item != null) {
fullPath = item.getText() + "/" + fullPath;
if (item.getText().toLowerCase().equals("bin")) {
fullPath = fullPath.replace("/", ".").replace("\\", ".");
if (fullPath.contains(".")) {
fullPath = fullPath.substring(fullPath.indexOf(".") + 1);
}
this.currentClassPackage = fullPath;
resetClassPackage = false;
fullPath = "/bin"; // Forget where this leads to.
}
item = item.getParentItem();
}
if (resetClassPackage) {
this.currentClassPackage = "";
}
fullPath = fullPath.replace("\\/", "/");
fullPath = fullPath.replace("\\", "/");
fullPath = fullPath.replace("//", "/");
newEntry = fullPath;
if (!newEntry.substring(newEntry.length() - 1).equals("/")) newEntry += "/";
}
// Set the entry.
if (Options.getInst().classPathEntries.size() == 0) {
Options.getInst().classPathEntries.add(newEntry);
} else {
Options.getInst().classPathEntries.set(0, newEntry);
}
// Update the classLoader.
this.classLoader.updateClassPath(StaticGuiSupport.arrayList2StringArray(Options.getInst().classPathEntries), !Options.getInst().doNotClearClassLoaderCache);
}
}