当前位置: 首页>>代码示例>>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;未经允许,请勿转载。