selecting multiple editParts in editor [message #225649] |
Wed, 01 November 2006 07:56  |
Eclipse User |
|
|
|
Originally posted by: neerajkarandikar.gmail.com
Hi all,
I am facing problem while selecting multiple components programmatically.
I have overridden setSelected(int value) method for an edit part as follows:
@Override
public void setSelected(int value) {
super.setSelected(value);
for ( Iterator iter = this.getChildren().iterator();
iter.hasNext(); ){
AbstractEditPart child = (AbstractEditPart) iter.next();
child.setSelected(value);
}
}
I want all the children for current edit part to be selected on the editor
as soon as parent editPart is set selected.
but i get only the parent selected on the editor.
Can someone please help me out with this?
Thanks in advance,
Neeraj
|
|
|
Re: selecting multiple editParts in editor [message #225835 is a reply to message #225649] |
Thu, 02 November 2006 13:11  |
Eclipse User |
|
|
|
Hi Neeraj,
Do you have some sort of a selection edit policy installed on your edit
parts? I'm assuming since you see that parent is selected (i.e. focus
border is drawn around it) it's installed on the parent edit part, but not
installed on children.
When you call setSelected() on the edit part and the selection state does
change, this selection changed event is fired across the listeners. By
default selection edit policy listens to this event and responds to it by
drawing some kind of a selection visual feedback (i.e. focus border). If
you're missing selection edit policy on children edit parts, you can't see
the selection on them, although their selected state is correct. Neeraj,
please check this.
Aside:
You could do the selection of children through edit part listeners
org.eclipse.gef.EditPartListener. Extend
org.eclipse.gef.EditPartListener.Stub class by overriding method
selectedStateChanged(EditPart part). Install this listener on the parent
edit part. This way child edit part will be aware of the parent's
selection state.
However, I'd suggest to do this through the selection edit policy (not
edit part). If it's installed on your edit parts, i.e. install listeners
to parent edit part's selection state on children selection edit policies
and drive the selection of children edit parts from their selection edit
policies.
|
|
|
Powered by
FUDForum. Page generated in 0.03306 seconds