Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Implementing some actions for my own Navigator
Implementing some actions for my own Navigator [message #233768] Tue, 16 June 2009 08:38
Javier is currently offline JavierFriend
Messages: 57
Registered: July 2009
Hello guys,

I have an application in which I need some extra functionality in my
Navigator view for the model resource. For example I can create model
elements through some actions in context menus (these model elements
will appear randomly located in the diagram). I also need this viewer to
access the undo/redo mechanism in the Edit menu.

To achieve this, I implemented my own CommonActionProvider and it is
being used from the Navigator. I followed the code I found for the
ProjectExplorer of Eclipse and I tried to modify it, telling the
UndoRedo actions to use the IUndoContext of my diagram. This is part of
the code:

public void init(ICommonActionExtensionSite anActionSite) {
IUndoContext context = ((DiagramEditor)PlatformUI.
getDiagramEditDomain().getDiagramCommandStack(). getUndoContext();

IWorkbenchPartSite site = ((DiagramEditor)PlatformUI.

undoRedoGroup = new UndoRedoActionGroup(site,
workspaceContext, true);

public void dispose() {

public void fillActionBars(IActionBars actionBars) {
(ActionFactory.UNDO.getId(), new
GlobalUndoAction(((DiagramEditor)PlatformUI.getWorkbench().g etActiveWorkbenchWindow().getActivePage().getActiveEditor()) ));

But this code is not working as I would like, since if I made changes in
the diagram and afterwards I put the focus on my navigator viewer, the
Undo/Redo shows nothing. Instead, if from the package explorer I move a
file from one folder to another, and then I go back and select one of
the elements that enables my ActionProvider, in the undo/redo I can undo
the moved element. But for example, doing this:

public void fillContextMenu(IMenuManager menu) {
GlobalUndoAction(((DiagramEditor)PlatformUI.getWorkbench().g etActiveWorkbenchWindow().getActivePage().getActiveEditor()) ));


I do get the UndoAction working properly in the context menu.

Any hint on how to get this behavior working in the ActionBars?

Thank u!
Previous Topic:shouldProceed Changing the Text of Message Dialog
Next Topic:Enumeration class
Goto Forum:

Current Time: Tue Mar 02 21:36:21 GMT 2021

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

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

Back to the top