How to access diagram from a tabbar extenstion [message #1723483] |
Tue, 16 February 2016 00:15 |
Nikolay Manolov Messages: 24 Registered: June 2012 |
Junior Member |
|
|
I was able to make a tabbar button In accordance with these instructions https://www.eclipse.org/sirius/doc/developer/extensions-provide_tabbar_extensions.html
I want this button to perform some kind of action. I have not decided exactly what ,but it will be related to the diagram and the semantic model. The problem I have is that I have no clue how to get to the diagram from the handler-class that is associated with the button.
This is what it looks like
public class ShowBaseHandler implements IHandler {
@Override
public void addHandlerListener(IHandlerListener handlerListener) {
}
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
return null;
}
... other methods left out
}
Can I get the diagram via the *event* parameter or is there a way through the active editor/input?
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor().getEditorInput()
Cheers,
Nik
[Updated on: Tue, 16 February 2016 00:16] Report message to a moderator
|
|
|
Re: How to access diagram from a tabbar extenstion [message #1724213 is a reply to message #1723483] |
Mon, 22 February 2016 10:27 |
|
Hi Nik,
you can retrieve the current diagram editor from the current active page:
currentPage.getActivePart()
if the active part is an instance of
org.eclipse.gmf.runtime.diagram.ui.parts.IDiagramWorkbenchPart, you can
get either the GMF Diagram or the Diagram edit part.
regards,
Florian
On 02/16/2016 01:15 AM, Nikolay Manolov wrote:
> I was able to make a tabbar button In accordance with these instructions
> https://www.eclipse.org/sirius/doc/developer/extensions-provide_tabbar_extensions.html
>
>
> I want this button to perform some kind of action. I have not decided
> exactly what ,but it will be related to the diagram and the semantic
> model. The problem I have is that I have no clue how to get to the
> diagram from the handler-class that is associated with the button.
>
> This is what it looks like
> public class ShowBaseHandler implements IHandler {
>
> @Override
> public void addHandlerListener(IHandlerListener handlerListener) {
> }
>
> @Override
> public Object execute(ExecutionEvent event) throws
> ExecutionException {
> return null;
> }
> ... other methods left out
> }
>
> Can I get the diagram via the *event* parameter or is there a way
> through the active editor/inpout?
> PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor().getEditorInput()
>
>
> Cheers,
> Nik
--
Florian - Obeo
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
|
|
|
Powered by
FUDForum. Page generated in 0.17502 seconds