当前位置: 首页>>代码示例>>Java>>正文


Java TreeItem.getParentItem方法代码示例

本文整理汇总了Java中org.eclipse.swt.widgets.TreeItem.getParentItem方法的典型用法代码示例。如果您正苦于以下问题:Java TreeItem.getParentItem方法的具体用法?Java TreeItem.getParentItem怎么用?Java TreeItem.getParentItem使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.swt.widgets.TreeItem的用法示例。


在下文中一共展示了TreeItem.getParentItem方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: removeSelectedPackage

import org.eclipse.swt.widgets.TreeItem; //导入方法依赖的package包/类
private void removeSelectedPackage(SelectionEvent e, TreeViewer treeViewer) {
	Tree tree = getTree(e);
	if (tree == null) {
		return;
	}
	TreeItem[] selection = tree.getSelection();
	if (selection != null && selection.length > 0) {
		for (TreeItem item : selection) {
			TreeItem parent = item.getParentItem();
			if (parent == null) {
				removePackage(item);
				updatePageComplete(tree);
			} else {
				alert("请选择要删除的包!");
			}
		}
	} else {
		alert("请选择要删除的包!");
	}
}
 
开发者ID:bsteker,项目名称:bdf2,代码行数:21,代码来源:SelectClassPage.java

示例2: findTreeItems

import org.eclipse.swt.widgets.TreeItem; //导入方法依赖的package包/类
public TreeItem[] findTreeItems(String xpath) {
	TreeItem[] items = new TreeItem[]{};
	try {
		xpath = xpath.replaceAll(regexpForPredicates, "");
		
		NodeList nl = twsCachedXPathAPI.selectNodeList(currentDom, xpath);
		if (nl.getLength()>0) {
			TreeItem tItem = twsDomTree.findTreeItem(nl.item(0));
			List<TreeItem> v = new ArrayList<TreeItem>();
			while (tItem != null) {
				v.add(tItem);
				tItem = tItem.getParentItem();
			}
			items = v.toArray(new TreeItem[]{});
		}
	} catch (TransformerException e) {
		ConvertigoPlugin.logException(e, "Error while finding items in tree");
	}
	return items;
}
 
开发者ID:convertigo,项目名称:convertigo-eclipse,代码行数:21,代码来源:SourcePickerHelper.java

示例3: disableStepsInTree

import org.eclipse.swt.widgets.TreeItem; //导入方法依赖的package包/类
private void disableStepsInTree() {
	if (stepItem != null) {
		// disable parents 'XML' steps if needed
		if (step.isXml()) {
			TreeItem tItem = stepItem;
			while (tItem.getParentItem().getData() instanceof Step) {
				tItem = tItem.getParentItem();
				if (((Step) tItem.getData()).isXml()) {
					tItem.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_RED));
				}
			}
		}
	}
}
 
开发者ID:convertigo,项目名称:convertigo-eclipse,代码行数:15,代码来源:StepSourceEditorComposite.java

示例4: 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]);
		}
	}
}
 
开发者ID:wwu-pi,项目名称:tap17-muggl-javaee,代码行数:40,代码来源:FileSelectionComposite.java

示例5: selectAllParentItems

import org.eclipse.swt.widgets.TreeItem; //导入方法依赖的package包/类
private void selectAllParentItems(TreeItem selectedTreeItem) {
	TreeItem parentTreeItem = selectedTreeItem.getParentItem();
	// 当有一个未被选中的时候,取消父节点的选择,当全部选中,则父节点选中
	if (parentTreeItem != null) {
		TreeItem[] parentSubItems = parentTreeItem.getItems();
		boolean allChecked = true;
		boolean isGrayed = false;
		for (int i = 0; i < parentSubItems.length; i++) {
			allChecked = parentSubItems[i].getChecked();
			if (!allChecked) {
				break;
			}
		}
		for (int i = 0; i < parentSubItems.length; i++) {
			if (parentSubItems[i].getChecked()) {
				isGrayed = true;
				break;
			}
		}

		if (isGrayed && allChecked) {
			parentTreeItem.setChecked(allChecked);
			parentTreeItem.setGrayed(!isGrayed);
		}
		if (!allChecked) {
			parentTreeItem.setChecked(isGrayed);
			parentTreeItem.setGrayed(isGrayed);
		}
		selectAllParentItems(parentTreeItem);
	}
}
 
开发者ID:bsteker,项目名称:bdf2,代码行数:32,代码来源:SelectClassPage.java

示例6: level2Item

import org.eclipse.swt.widgets.TreeItem; //导入方法依赖的package包/类
private boolean level2Item(TreeItem check) {
	boolean ret = false;
	if (check.getParentItem() != null && check.getParentItem().getParentItem() == null)
		ret = true;
	return ret;
}
 
开发者ID:dstl,项目名称:Open_Source_ECOA_Toolset_AS5,代码行数:7,代码来源:TypesEditor.java

示例7: 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.getParentItem方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。