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


Java TreeItem類代碼示例

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


TreeItem類屬於org.eclipse.swt.widgets包,在下文中一共展示了TreeItem類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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: tearDown

import org.eclipse.swt.widgets.TreeItem; //導入依賴的package包/類
@Override
public void tearDown() throws Exception {
	super.tearDown();
	broker.resetState();
	waitForIdleState();

	final TreeItem[] treeItems = commonViewer.getTree().getItems();
	assertTrue("Expected empty Project Explorer. Input was: " + Arrays.toString(treeItems),
			Arrays2.isEmpty(treeItems));
	assertFalse("Expected projects as top level elements in navigator.", broker.isWorkingSetTopLevel());
	assertNull(
			"Select working set drop down contribution was visible when projects are configured as top level elements.",
			getWorkingSetDropDownContribution());

	IContributionItem showHiddenWorkingSetsItem = from(
			Arrays.asList(projectExplorer.getViewSite().getActionBars().getToolBarManager().getItems()))
					.firstMatch(i -> ShowHiddenWorkingSetsDropDownAction.class.getName().equals(i.getId()))
					.orNull();

	assertNull(
			"Show hidden working set drop down contribution was visible when projects are configured as top level elements.",
			showHiddenWorkingSetsItem);
}
 
開發者ID:eclipse,項目名稱:n4js,代碼行數:24,代碼來源:GHOLD_101_WorkingSetsTest_PluginUITest.java

示例3: testWorkingSetIsTheSingleRootInNavaigator

import org.eclipse.swt.widgets.TreeItem; //導入依賴的package包/類
/***/
@Test
public void testWorkingSetIsTheSingleRootInNavaigator() {
	activateWorkingSetManager(ManualAssociationAwareWorkingSetManager.class);

	final TreeItem[] treeItems = commonViewer.getTree().getItems();
	assertTrue("Expected exactly one item in the Project Explorer. Input was: " + Arrays.toString(treeItems),
			treeItems.length == 1);

	final Object data = treeItems[0].getData();
	assertTrue("Expected " + WorkingSet.class + " input in navigator. Was " + data,
			data instanceof WorkingSet);

	final WorkingSet workingSet = (WorkingSet) treeItems[0].getData();
	assertTrue("Expected working set with ID: " + OTHERS_WORKING_SET_ID + ". Was " + workingSet.getId(),
			OTHERS_WORKING_SET_ID.equals(workingSet.getId()));

}
 
開發者ID:eclipse,項目名稱:n4js,代碼行數:19,代碼來源:GHOLD_101_WorkingSetsTest_PluginUITest.java

示例4: 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

示例5: findStepInTree

import org.eclipse.swt.widgets.TreeItem; //導入依賴的package包/類
private TreeItem findStepInTree(Object parent, long priority) {
	TreeItem[] items = null;
	
	if (parent == null) {
		items = tree.getItems();
	}
	else {
		DatabaseObject databaseObject = (DatabaseObject)((TreeItem)parent).getData();
		if (databaseObject instanceof Step) {
			if ((databaseObject).priority == priority) {
				return (TreeItem)parent;
			}
		}
		items = ((TreeItem)parent).getItems();
	}
	
	for (int i=0; i<items.length; i++) {
		TreeItem tItem = findStepInTree(items[i],priority);
		if (tItem != null) return tItem;
	}
	return null;
}
 
開發者ID:convertigo,項目名稱:convertigo-eclipse,代碼行數:23,代碼來源:StepSourceEditorComposite.java

示例6: displaySelectionXpathWithAnchor

import org.eclipse.swt.widgets.TreeItem; //導入依賴的package包/類
public void displaySelectionXpathWithAnchor(TwsDomTree tree, String anchor, String xpath) {
	TreeItem[] items;
	
	items = findTreeItems(anchor);
	if (items.length > 0) stepSourceEditorComposite.selectItemsInTree(items);
	setXpathText(anchor);
	setAnchor(true);
	
	if (!xpath.equals("")) {
		xpath = xpath.replaceFirst("\\.", anchor);
		items = findTreeItems(xpath);
		if (items.length > 0) {
			stepSourceEditorComposite.selectItemsInTree(items);
		}
		setXpathText(xpath);
	}
}
 
開發者ID:convertigo,項目名稱:convertigo-eclipse,代碼行數:18,代碼來源:StepXpathEvaluatorComposite.java

示例7: 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

示例8: 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

示例9: 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

示例10: computeAndDisplayStats

import org.eclipse.swt.widgets.TreeItem; //導入依賴的package包/類
protected void computeAndDisplayStats(AvroSchemaEditor editor) {
	
	SchemaViewer masterViewer = editor.getContentPart().getSchemaViewer(AvroContext.Kind.MASTER);
	TreeViewer treeViewer = masterViewer.getTreeViewer();
	AvroNode inputNode = (AvroNode) treeViewer.getInput();
	NodeType inputType = inputNode.getType();
	String name = AttributeUtil.getNameFromAttribute(inputNode);
	
	NodeStats stats = new NodeStats("Compute stats of " + inputType.toString().toLowerCase() 
			+ " " + name + " from editor " + editor.getName());
	stats.start();
	
	Tree tree = treeViewer.getTree();
	
	TreeItem[] items = tree.getItems();
	for (TreeItem item : items) {
		visitTreeItem(item, stats);
	}
	
	stats.finish();
	AvroSchemaLogger.logStats(stats, false);
	
}
 
開發者ID:Talend,項目名稱:avro-schema-editor,代碼行數:24,代碼來源:CountTreeItemsHandler.java

示例11: initialize

import org.eclipse.swt.widgets.TreeItem; //導入依賴的package包/類
private void initialize() {
	if (parentObject instanceof Project) {
		Project project = (Project)parentObject;
		List<String> projectList = new ArrayList<String>();
		projectList.add(project.getName());
		List<Reference> references = project.getReferenceList();
		for (Reference reference: references) {
			if (reference instanceof ProjectSchemaReference) {
				projectList.add(((ProjectSchemaReference)reference).getProjectName());
			}
		}
		
		String[] projects = Engine.theApp.databaseObjectsManager.getAllProjectNamesArray();
		for (String name: projects) {
			if (!projectList.contains(name)) {
				TreeItem branch = new TreeItem(tree, SWT.NONE);
				branch.setText(name);
			}
		}
		tree.setVisible(true);
	}
	else
		tree.setVisible(false);
}
 
開發者ID:convertigo,項目名稱:convertigo-eclipse,代碼行數:25,代碼來源:ProjectSchemaWizardPage.java

示例12: buildContextMenu

import org.eclipse.swt.widgets.TreeItem; //導入依賴的package包/類
private void buildContextMenu(MouseEvent e) {
	Point point = new Point(e.x, e.y);
	TreeItem  treeItem = getTree().getItem(point);
	Menu menu = new Menu((Control)e.getSource());
	Iterator<MenuMaker> i = menuMakers.iterator();
	int cpt = 0;
	while(i.hasNext()) {
		i.next().makeMenu(this, treeItem, e, menu);
		if (i.hasNext() && menu.getItemCount() != cpt) {
			new MenuItem(menu, SWT.SEPARATOR);
			cpt = menu.getItemCount();
		}
	}
	if (menu.getItemCount() > 0) {
		menu.setVisible(true);
	} else {
		menu.dispose();
	}
}
 
開發者ID:convertigo,項目名稱:convertigo-eclipse,代碼行數:20,代碼來源:TwsDomTree.java

示例13: 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);
			}
		}
	}
}
 
開發者ID:bsteker,項目名稱:bdf2,代碼行數:22,代碼來源:SelectClassPage.java

示例14: drop

import org.eclipse.swt.widgets.TreeItem; //導入依賴的package包/類
@Override
public void drop(DropTargetEvent event) {
	
	IStructuredSelection structuredSelection = (IStructuredSelection) LocalSelectionTransfer
               .getTransfer().getSelection();
	
	if (structuredSelection.size() == 1) {

		AvroNode sourceNode = (AvroNode) structuredSelection.getFirstElement();
		TreeItem item = (TreeItem) event.item;
		if (item != null) {
			AvroNode targetNode = nodeConverter.convertToAvroNode(item.getData());
			dropPolicy.drop(sourceNode, targetNode, position);
		}
		
	}
	
}
 
開發者ID:Talend,項目名稱:avro-schema-editor,代碼行數:19,代碼來源:DnDTargetListener.java

示例15: removeItem

import org.eclipse.swt.widgets.TreeItem; //導入依賴的package包/類
public String removeItem(TreeItem selItem, String parent, String content) throws JAXBException {
	Unmarshaller unmarshaller = JAXBContext.newInstance(ServiceDefinition.class).createUnmarshaller();
	MarshallerImpl marshaller = (MarshallerImpl) JAXBContext.newInstance(ServiceDefinition.class).createMarshaller();
	marshaller.setProperty(MarshallerImpl.JAXB_FORMATTED_OUTPUT, true);
	marshaller.setProperty("com.sun.xml.internal.bind.namespacePrefixMapper", new NamespacePrefixMapper());
	ServiceDefinition sDef = (ServiceDefinition) unmarshaller.unmarshal(new StringReader(editorText));
	ArrayList<Operation> ops = new ArrayList<Operation>();
	ops.addAll(sDef.getOperations().getDataOrEventOrRequestresponse());
	int i = 0;
	for (Object obj : sDef.getOperations().getDataOrEventOrRequestresponse()) {
		if (obj instanceof Data && parent.equalsIgnoreCase("Data")) {
			if (((Data) obj).getName().equalsIgnoreCase(selItem.getText()))
				ops.remove(i);
		} else if (obj instanceof Event && parent.equalsIgnoreCase("Event")) {
			if (((Event) obj).getName().equalsIgnoreCase(selItem.getText()))
				ops.remove(i);
		} else if (obj instanceof RequestResponse && parent.equalsIgnoreCase("Request Response")) {
			if (((RequestResponse) obj).getName().equalsIgnoreCase(selItem.getText()))
				ops.remove(i);
		}
		i++;
	}
	sDef.getOperations().getDataOrEventOrRequestresponse().clear();
	sDef.getOperations().getDataOrEventOrRequestresponse().addAll(ops);
	StringWriter writer = new StringWriter();
	marshaller.marshal(sDef, writer);
	return ParseUtil.removeEmptyTags(writer.toString(), ServiceDefinition.class);
}
 
開發者ID:dstl,項目名稱:Open_Source_ECOA_Toolset_AS5,代碼行數:29,代碼來源:ServicesUtil.java


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