Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Papyrus » Traverse model explorer
Traverse model explorer [message #1392470] Wed, 02 July 2014 11:39 Go to next message
Johan Norberg is currently offline Johan NorbergFriend
Messages: 5
Registered: April 2012
Location: Sweden
Junior Member

First, some background for my question.
I'm working with a project called ArCon, which is UML validation plugin for Eclipse, and we're currently developing it using Papyrus.
When there are error in the model, they are presented in two ways. One, as an error view and second, as small icons in the corner of the UML icons. Previously we used the object ModelElementItem.

Since the release of v1.0 the objects is now of a new type, EObjectTreeElement. Using this object in the same way as the previous works. But the problem is that I can only get the top element in this kind of type.
So my question is how to get sub-objects of the type EObjectTreeElement?

Code how I get the top node element:

for (TreeItem treeItem : treeViewer.getTree().getItems()) {
	Object object = treeItem.getData();
	if (object instanceof EObjectTreeElement) {
		model = (EObjectTreeElement) object;

treeViewer is found using following code:

IWorkbenchPart iWorkbenchPart = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().findView(MODEL_EXPLORER_PROVIDER);
if (iWorkbenchPart == null) {
	return null;
ModelExplorerPageBookView modelExplorerPageBookView = null;
if (iWorkbenchPart instanceof ModelExplorerPageBookView) {
	modelExplorerPageBookView = (ModelExplorerPageBookView) iWorkbenchPart;
treeViewer = ((ModelExplorerView) modelExplorerPageBookView.getAdapter(ModelExplorerView.class)).getCommonViewer();
Re: Traverse model explorer [message #1392478 is a reply to message #1392470] Wed, 02 July 2014 11:47 Go to previous message
Camille Letavernier is currently offline Camille LetavernierFriend
Messages: 935
Registered: February 2011
Senior Member

The TreeElement only knows its parent. Only the ContentProvider associated to the TreeViewer can return the children of a TreeElement (treeViewer.getContentProvider())


Camille Letavernier
Previous Topic:Question about the implementation of UML Constraints
Next Topic:Weird error when importing package
Goto Forum:

Current Time: Sun Jan 24 22:58:51 GMT 2021

Powered by FUDForum. Page generated in 0.02058 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top