本文整理匯總了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);
}
}