Selection Listener [message #1100758] |
Tue, 03 September 2013 14:56 |
Thomas Thonhofer Messages: 25 Registered: July 2013 |
Junior Member |
|
|
Hello
In my Graphiti editor I have a view, that should open, when a certain Shape is selected and change, when the user selects a different Shape. It should be similar to the behavior of a property sheet, but I cannot use a normal property sheet.
I tried to implement a selection Listener to achieve this. It looks like this:
private ISelectionListener listener = new ISelectionListener() {
public void selectionChanged(IWorkbenchPart sourcepart, ISelection selection) {
StructuredSelection structuredSelection = (StructuredSelection) selection;
Object firstElement = structuredSelection.getFirstElement();
if (firstElement instanceof ContainerShapeEditPart){
if(((ContainerShapeEditPart)firstElement).getPictogramElement() instanceof ContainerShape){
CustomContext cc = new CustomContext();
ContainerShape cs = (ContainerShape) ((ContainerShapeEditPart)firstElement).getPictogramElement();
PictogramElement[] pic = new PictogramElement[1];
pic[0] = cs;
cc.setPictogramElements(pic);
...
}
}
}
};
For opening the View, this solution works.
The problem is: Apparently the Listener only reacts, when a different EditPart is selected. All my PictogramElements have the same EditPart, so nothing happens when selecting a different Shape.
Is there any kind of listener, provided by Graphiti, to achieve this?
I hope someone can help me find a way to solve this problem.
Thank you
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.02926 seconds