Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » selecting multiple editParts in editor
selecting multiple editParts in editor [message #225649] Wed, 01 November 2006 12:56 Go to next message
Eclipse UserFriend
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 18:11 Go to previous message
Alex Boyko is currently offline Alex BoykoFriend
Messages: 200
Registered: July 2009
Senior Member
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.
Previous Topic:MultipageEditor and copy paste
Next Topic:Logic editor description - Using ContainerPolicy
Goto Forum:
  


Current Time: Fri Apr 26 00:45:20 GMT 2024

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

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

Back to the top