Setting the selection of child node to parent node. [message #158752] |
Thu, 08 November 2007 06:23 |
Eclipse User |
|
|
|
Originally posted by: biju_gopinathan.rediffmail.com
Hi all,
How can we change the selection on clicking a child node to its
parent node. So that I can view the properties of the parent node in the
property view even on selecting child node(which is my requirement).
Thanks, Biju
|
|
|
Re: Setting the selection of child node to parent node. [message #158760 is a reply to message #158752] |
Thu, 08 November 2007 06:26 |
Eclipse User |
|
|
|
Originally posted by: biju_gopinathan.rediffmail.com
Hi all,
Got it, I did it by adding a selection listener and changing the
selection in the child edit part, as follows.I am calling the following
method from the createDefaultEditPolicies() function of my child edit
part.
Thanks, Biju
private void addSelectionListener() {
this.getViewer().addSelectionChangedListener(new
ISelectionChangedListener(){
@Override
public void selectionChanged(SelectionChangedEvent selectionEvent) {
if(selectionEvent.getSelection() instanceof StructuredSelection){
StructuredSelection selection=(StructuredSelection)
selectionEvent.getSelection();
if(selection.getFirstElement() instanceof ConveyorSlotEditPart){
getViewer().setSelection(new
StructuredSelection(((ConveyorSlotEditPart)selection.getFirs tElement()).getParent()));
}
}
}
});
}
biju wrote:
> Hi all,
>
> How can we change the selection on clicking a child node to its
> parent node. So that I can view the properties of the parent node in the
> property view even on selecting child node(which is my requirement).
>
>
> Thanks, Biju
|
|
|
Re: Setting the selection of child node to parent node. [message #158864 is a reply to message #158760] |
Thu, 08 November 2007 11:42 |
Boris Blajer Messages: 217 Registered: July 2009 |
Senior Member |
|
|
Hi Biju,
You may use isSelectable() method to control selectability of the node.
If the node is not selectable, the node underneath will get selected
(and normally, it is the parent node).
Another solution is to override method getTargetEditPart in your
(non-)resizable edit policy to return getHost().getParent() as the
target edit part for the REQ_SELECTION request.
Your solution is also ok, but seems to leak deleted edit parts for the
lifetime of the graphical viewer.
Best regards,
Boris
biju wrote:
> Hi all,
>
> Got it, I did it by adding a selection listener and changing the
> selection in the child edit part, as follows.I am calling the following
> method from the createDefaultEditPolicies() function of my child edit
> part.
>
> Thanks, Biju
>
> private void addSelectionListener() {
> this.getViewer().addSelectionChangedListener(new
> ISelectionChangedListener(){
> @Override
> public void selectionChanged(SelectionChangedEvent
> selectionEvent) {
> if(selectionEvent.getSelection() instanceof
> StructuredSelection){
> StructuredSelection selection=(StructuredSelection)
> selectionEvent.getSelection();
> if(selection.getFirstElement() instanceof
> ConveyorSlotEditPart){
> getViewer().setSelection(new
> StructuredSelection(((ConveyorSlotEditPart)selection.getFirs tElement()).getParent()));
>
> }
> }
> }
> });
> }
> biju wrote:
>> Hi all,
>>
>> How can we change the selection on clicking a child node to
>> its parent node. So that I can view the properties of the parent node
>> in the property view even on selecting child node(which is my
>> requirement).
>>
>>
>> Thanks, Biju
|
|
|
|
Re: Setting the selection of child node to parent node. [message #158970 is a reply to message #158864] |
Thu, 08 November 2007 13:20 |
Eclipse User |
|
|
|
Originally posted by: biju_gopinathan.rediffmail.com
Hi Boris Blajer,
Thanks for your Idea,
Its working better, and is simple, I just override the
isSelectable() of child edit part to return false.
Thanks, Biju
Boris Blajer wrote:
> Hi Biju,
>
> You may use isSelectable() method to control selectability of the node.
> If the node is not selectable, the node underneath will get selected
> (and normally, it is the parent node).
>
> Another solution is to override method getTargetEditPart in your
> (non-)resizable edit policy to return getHost().getParent() as the
> target edit part for the REQ_SELECTION request.
>
> Your solution is also ok, but seems to leak deleted edit parts for the
> lifetime of the graphical viewer.
>
> Best regards,
> Boris
>
> biju wrote:
>> Hi all,
>>
>> Got it, I did it by adding a selection listener and changing
>> the selection in the child edit part, as follows.I am calling the
>> following method from the createDefaultEditPolicies() function of my
>> child edit part.
>>
>> Thanks, Biju
>>
>> private void addSelectionListener() {
>> this.getViewer().addSelectionChangedListener(new
>> ISelectionChangedListener(){
>> @Override
>> public void selectionChanged(SelectionChangedEvent
>> selectionEvent) {
>> if(selectionEvent.getSelection() instanceof
>> StructuredSelection){
>> StructuredSelection
>> selection=(StructuredSelection) selectionEvent.getSelection();
>> if(selection.getFirstElement() instanceof
>> ConveyorSlotEditPart){
>> getViewer().setSelection(new
>> StructuredSelection(((ConveyorSlotEditPart)selection.getFirs tElement()).getParent()));
>>
>> }
>> }
>> }
>> });
>> }
>> biju wrote:
>>> Hi all,
>>>
>>> How can we change the selection on clicking a child node to
>>> its parent node. So that I can view the properties of the parent node
>>> in the property view even on selecting child node(which is my
>>> requirement).
>>>
>>>
>>> Thanks, Biju
|
|
|
Powered by
FUDForum. Page generated in 2.37750 seconds