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