當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。