Skip to main content



      Home
Home » Modeling » GMF (Graphical Modeling Framework) » programatically set editpart selection
programatically set editpart selection [message #106554] Fri, 23 February 2007 19:13 Go to next message
Eclipse UserFriend
given an editpart how do you programatically set that as the selected
item on the diagram, having the diagram show the editpart as selected
and the properties view show the appropriate info?
Re: programatically set editpart selection [message #106583 is a reply to message #106554] Fri, 23 February 2007 20:01 Go to previous message
Eclipse UserFriend
Originally posted by: vcciubot.uwaterloo.ca

On Fri, 23 Feb 2007 17:13:15 -0700, John Yotka wrote:

> given an editpart how do you programatically set that as the selected
> item on the diagram, having the diagram show the editpart as selected
> and the properties view show the appropriate info?

Here's an example you could adapt:

private void selectViews(List views) {
IDiagramGraphicalViewer viewer = ((IDiagramWorkbenchPart) getWorkbenchPart())
.getDiagramGraphicalViewer();
if (viewer != null && views != null && !views.isEmpty()) {

List editparts = new ArrayList();
for (Iterator iter = views.iterator(); iter.hasNext();) {
Object view = iter.next();
if (view instanceof View) {
Object ep = viewer.getEditPartRegistry().get(view);
if (ep != null) {
editparts.add(ep);
}
}
}

if (!editparts.isEmpty()) {
viewer.setSelection(new StructuredSelection(editparts));
}
}
}
Previous Topic:How to make an attribute not appear in the properties window?
Next Topic:Strange thing about View.getChildren
Goto Forum:
  


Current Time: Sun Jul 13 21:25:17 EDT 2025

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

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

Back to the top