Test BehaviorSection and workbench copy paste actions [message #98951] |
Tue, 22 May 2007 09:18  |
Eclipse User |
|
|
|
Hi,
I would like to add copy paste actions for test elements in the behavior
section of the test suite editor to the workbench menu.
Is it right, to register the actions via the ViewSite interface?
If yes, how do I get access to the ViewSite interface from
BehaviorSection classes?
Thanks in advance,
Holger
|
|
|
Re: Test BehaviorSection and workbench copy paste actions [message #99163 is a reply to message #98951] |
Thu, 24 May 2007 08:41   |
Eclipse User |
|
|
|
Hi Holger,
Holger Machens wrote:
> I would like to add copy paste actions for test elements in the behavior
> section of the test suite editor to the workbench menu.
> Is it right, to register the actions via the ViewSite interface?
> If yes, how do I get access to the ViewSite interface from
> BehaviorSection classes?
Yes, I think you are right, the right way would be to set a global handler
using the IActionBars instance returned by the IEditorSite (we are not in
a view but in an editor).
Well, to get the editor site you need to use the following methods chain:
BehaviorSection.getHyadesEditorPart() (method defined in its ancestor
EditorSection) which returns a IHyadesEditorPart, then call
getEditorPart() to retrieve the Eclipse IEditorPart instance, then you can
get the IEditorSite by getEditorSite() and finally getActionBars().
BehaviorSection section = .....
IActionBars bars =
section.getHyadesEditorPart().getEditorPart().getEditorSite( ).getActionBars();
bars.setGlobalActionHandler(ActionFactory.COPY.getId(), ....);
Note for copying elements in the behavior section:
You need to keep in mind that invocations have IDs that should be unique.
So when copying such elements you need to produce unique new IDs for
copies.
Do not hesitate to suggest your work as a TPTP contribution.
Jerome
|
|
|
Re: Test BehaviorSection and workbench copy paste actions [message #103149 is a reply to message #99163] |
Thu, 05 July 2007 08:43  |
Eclipse User |
|
|
|
Hi Jerome,
Thank you, for your help!
We will think about contribution, but I think this work is too special.
Greetings
Holger
Jerome Gout schrieb:
> Hi Holger,
>
> Holger Machens wrote:
>
>> I would like to add copy paste actions for test elements in the behavior
>> section of the test suite editor to the workbench menu.
>> Is it right, to register the actions via the ViewSite interface?
>> If yes, how do I get access to the ViewSite interface from
>> BehaviorSection classes?
>
> Yes, I think you are right, the right way would be to set a global
> handler using the IActionBars instance returned by the IEditorSite (we
> are not in a view but in an editor).
>
> Well, to get the editor site you need to use the following methods chain:
>
> BehaviorSection.getHyadesEditorPart() (method defined in its ancestor
> EditorSection) which returns a IHyadesEditorPart, then call
> getEditorPart() to retrieve the Eclipse IEditorPart instance, then you
> can get the IEditorSite by getEditorSite() and finally getActionBars().
>
> BehaviorSection section = .....
> IActionBars bars =
> section.getHyadesEditorPart().getEditorPart().getEditorSite( ).getActionBars();
>
> bars.setGlobalActionHandler(ActionFactory.COPY.getId(), ....);
>
> Note for copying elements in the behavior section:
> You need to keep in mind that invocations have IDs that should be
> unique. So when copying such elements you need to produce unique new IDs
> for copies.
>
> Do not hesitate to suggest your work as a TPTP contribution.
>
> Jerome
>
|
|
|
Powered by
FUDForum. Page generated in 0.03879 seconds