當前位置: 首頁>>代碼示例>>Java>>正文


Java TreeItem.getData方法代碼示例

本文整理匯總了Java中org.eclipse.swt.widgets.TreeItem.getData方法的典型用法代碼示例。如果您正苦於以下問題:Java TreeItem.getData方法的具體用法?Java TreeItem.getData怎麽用?Java TreeItem.getData使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.eclipse.swt.widgets.TreeItem的用法示例。


在下文中一共展示了TreeItem.getData方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: shouldCreateToolTip

import org.eclipse.swt.widgets.TreeItem; //導入方法依賴的package包/類
@Override
protected boolean shouldCreateToolTip(final Event e) {
	this.lastDescriptor = null;
	if (e.widget instanceof Tree) {
		final Tree tree = (Tree) e.widget;
		final TreeItem item = tree.getItem(new Point(e.x, e.y));

		if (null != item && item.getData() instanceof ResultNode) {
			final ResultNode node = (ResultNode) item.getData();
			if (node.getElement() instanceof TestCase) {
				final URI uri = ((TestCase) node.getElement()).getURI();
				if (null != uri) {
					final StyledTextDescriptor descriptor = getDescriptor(uri);
					if (null != descriptor) {
						this.lastDescriptor = descriptor;
					}
				}
			}
		}
	}

	return null != this.lastDescriptor;
}
 
開發者ID:eclipse,項目名稱:n4js,代碼行數:24,代碼來源:TestResultsView.java

示例2: fillCheckedList

import org.eclipse.swt.widgets.TreeItem; //導入方法依賴的package包/類
private void fillCheckedList(TreeItem parent, List<String> csSourceData) {
	if (csSourceData != null && !csSourceData.isEmpty()) {
		TreeItem[] items = null;
		
		if (parent == null) {
			items = checkboxTreeViewer.getTree().getItems();
		}
		else {
			items = parent.getItems();
			
			TVObject tvo = (TVObject) parent.getData();
			String tvoSourceData = tvo.getSourceData();
			if (csSourceData.contains(tvoSourceData)) {
				int index = csSourceData.indexOf(tvoSourceData);
				if (index == 0)
					checkedList.add(0,tvo);
				else
					checkedList.add(tvo);
			}
		}
		
		for (int i=0; i<items.length; i++) {
			fillCheckedList(items[i], csSourceData);
		}
	}
}
 
開發者ID:convertigo,項目名稱:convertigo-eclipse,代碼行數:27,代碼來源:MobilePickerComposite.java

示例3: findModelItem

import org.eclipse.swt.widgets.TreeItem; //導入方法依賴的package包/類
private TVObject findModelItem(TreeItem parent, String modelPath) {
	if (modelPath != null && !modelPath.isEmpty()) {
		TreeItem[] items = null;
		
		items = parent == null ? modelTreeViewer.getTree().getItems() : parent.getItems();
		for (int i=0; i<items.length; i++) {
			TreeItem treeItem = items[i];
			TVObject tvo = (TVObject) treeItem.getData();
			if (tvo != null) {
				String tvoSourcePath = tvo.getSourcePath().replaceAll("\\?\\.", ".");
				if (modelPath.startsWith(tvoSourcePath.replaceFirst("root", ""))) {
					if (modelPath.equals(tvoSourcePath.replaceFirst("root", ""))) {
						return tvo;
					}
					return findModelItem(items[i], modelPath);
				}
			}
		}
	}
	return null;
}
 
開發者ID:convertigo,項目名稱:convertigo-eclipse,代碼行數:22,代碼來源:MobilePickerComposite.java

示例4: changeCurrentFormat

import org.eclipse.swt.widgets.TreeItem; //導入方法依賴的package包/類
/**
 * Change the current format and refresh the display.
 */
protected void changeCurrentFormat(int newFormat) {
	TreeItem selection = directoryTree.getSelection()[0];
	Object data = selection.getData();
	DirectoryEntry directory = (DirectoryEntry) data;
	List<FileEntry> fileList = directory.getFiles();
	
	formatChanged = (currentFormat != newFormat);
	if (formatChanged || !fileList.equals(currentFileList)) {
		preserveColumnWidths();	// must be done before assigning newFormat
		currentFormat = newFormat;
		fillFileTable(fileList);

		// Ensure that the control buttons are set appropriately.
		// Primarly required for keyboard interface.
		standardFormatToolItem.setSelection(
			currentFormat == FormattedDisk.FILE_DISPLAY_STANDARD);
		nativeFormatToolItem.setSelection(
			currentFormat == FormattedDisk.FILE_DISPLAY_NATIVE);
		detailFormatToolItem.setSelection(
			currentFormat == FormattedDisk.FILE_DISPLAY_DETAIL);
	}
}
 
開發者ID:AppleCommander,項目名稱:AppleCommander,代碼行數:26,代碼來源:DiskExplorerTab.java

示例5: updateChildrenItems

import org.eclipse.swt.widgets.TreeItem; //導入方法依賴的package包/類
/**
 * Updates the check state of all created children
 */
private void updateChildrenItems(TreeItem parent) {
    boolean state = parent.getChecked();
    
    // do not implicitly check children, only uncheck
    if(state) {
        return;
    }
    
    Item[] children = getChildren(parent);
    
    for (int i = 0; i < children.length; i++) {
        TreeItem curr = (TreeItem) children[i];
        if (curr.getData() != null
                && ((curr.getChecked() != state) || curr.getGrayed())) {
            curr.setChecked(state);
            curr.setGrayed(false);
            updateChildrenItems(curr);
        }
    }
}
 
開發者ID:pgcodekeeper,項目名稱:pgcodekeeper,代碼行數:24,代碼來源:CheckedTreeViewer.java

示例6: changeCurrentFormat

import org.eclipse.swt.widgets.TreeItem; //導入方法依賴的package包/類
/**
 * Change the current format and refresh the display.
 */
protected void changeCurrentFormat(int newFormat) {
	TreeItem selection = directoryTree.getSelection()[0];
	Object data = selection.getData();
	DirectoryEntry directory = (DirectoryEntry) data;
	List fileList = directory.getFiles();
	
	formatChanged = (currentFormat != newFormat);
	if (formatChanged || !fileList.equals(currentFileList)) {
		preserveColumnWidths();	// must be done before assigning newFormat
		currentFormat = newFormat;
		fillFileTable(fileList);

		// Ensure that the control buttons are set appropriately.
		// Primarly required for keyboard interface.
		standardFormatToolItem.setSelection(
			currentFormat == FormattedDisk.FILE_DISPLAY_STANDARD);
		nativeFormatToolItem.setSelection(
			currentFormat == FormattedDisk.FILE_DISPLAY_NATIVE);
		detailFormatToolItem.setSelection(
			currentFormat == FormattedDisk.FILE_DISPLAY_DETAIL);
	}
}
 
開發者ID:marvinmalkowskijr,項目名稱:applecommander,代碼行數:26,代碼來源:DiskExplorerTab.java

示例7: visitTreeItem

import org.eclipse.swt.widgets.TreeItem; //導入方法依賴的package包/類
protected void visitTreeItem(TreeItem treeItem, NodeStats stats) {		
	SchemaNode node = (SchemaNode) treeItem.getData();
	if (node != null) {
		stats.count(node.getAvroNode());
		TreeItem[] items = treeItem.getItems();
		for (TreeItem item : items) {
			visitTreeItem(item, stats);
		}
	}
}
 
開發者ID:Talend,項目名稱:avro-schema-editor,代碼行數:11,代碼來源:CountTreeItemsHandler.java

示例8: 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);
	}
}
 
開發者ID:wwu-pi,項目名稱:tap17-muggl-javaee,代碼行數:59,代碼來源:FileSelectionComposite.java


注:本文中的org.eclipse.swt.widgets.TreeItem.getData方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。