linking views and editors [message #324561] |
Sat, 26 January 2008 06:41 |
Eclipse User |
|
|
|
Originally posted by: vlad.herocraft.com
Hi,
I'm working on my first Eclipse application and completly stuck with
synchronizing selection of my custom editor with other views (Outliner
and Properties view). This editor displays some objects (sprites in my
case) and user can select/move/rotate them. The problem is when I select
sprites in Outliner everything works fine - property page displays
properties of this sprite. But when I select sprites in my editor -
property and outliner views doesn't respond. It shows selection done
only when i SWITCH to another view and then return focus BACK to editor.
My editor implements ISelectionProvider ('cos i can't use standart
TreeView or TableView for this purpose). Outliner also listenes for
SelectionChangeEvents.
Probably there is something more I should do than just register this
view as ISelectionProvider ? And may be there is better way to build
such custom editors which work with graphics objects ?
I spend 3 days trying to make this little thing work. So any help will
be appreciated. :)
Also here is some souce code...
My OutlinePage is listening for a selection:
<code>
ISelectionService ss = PlatformUI...getSelectionService();
ss.addSelectionListener(new ISelectionListener() {
public void selectionChanged(IWorkbenchPart part, ISelection sel) {
if( part.getClass().equals(SpriteEditor.class) ) {
System.out.println("1");
treeViewer.setSelection(selection);
System.out.println("2");
}
}
});
</code>
It receives events and prints: "1", but not "2".
|
|
|
Powered by
FUDForum. Page generated in 0.03240 seconds