Skip to main content



      Home
Home » Modeling » Papyrus » Traverse model explorer
Traverse model explorer [message #1392470] Wed, 02 July 2014 07:39 Go to next message
Eclipse UserFriend
Hey,

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 07:47 Go to previous message
Eclipse UserFriend
Hi,

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

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


Current Time: Wed Jul 16 00:05:28 EDT 2025

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

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

Back to the top