Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Sirius » How to access diagram from a tabbar extenstion
How to access diagram from a tabbar extenstion [message #1723483] Tue, 16 February 2016 00:15 Go to next message
Nikolay Manolov is currently offline Nikolay ManolovFriend
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 Go to previous message
Florian Barbin is currently offline Florian BarbinFriend
Messages: 270
Registered: August 2010
Senior Member
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
Previous Topic:Layers contribute to same container mapping (reuse/import)
Next Topic:Problems with self referencing objects
Goto Forum:
  


Current Time: Fri Mar 29 05:10:26 GMT 2024

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

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

Back to the top