blob: eb3f3df020f697f62868b50d7f4d40dd8e2f8145 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
/*******************************************************************************
* Copyright (c) 2011 AtoS
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Anass RADOUANI (AtoS)
*******************************************************************************/
package org.eclipse.papyrus.navigation.handlers;
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.emf.edit.domain.EditingDomain;
import org.eclipse.emf.transaction.TransactionalEditingDomain;
import org.eclipse.papyrus.core.editor.CoreMultiDiagramEditor;
import org.eclipse.papyrus.core.services.ServiceException;
import org.eclipse.papyrus.sasheditor.contentprovider.IPageMngr;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.handlers.HandlerUtil;
/**
* handler for Up command
*
*/
public class BackNavigateHandler extends AbstractHandler {
private IEditorPart editor;
private IPageMngr pageMngr;
public Object execute(ExecutionEvent event) throws ExecutionException {
editor = HandlerUtil.getActiveEditor(event);
if(editor instanceof CoreMultiDiagramEditor) {
CoreMultiDiagramEditor papyrusEditor = (CoreMultiDiagramEditor)editor;
EditingDomain editingDomain = papyrusEditor.getEditingDomain();
if(editingDomain instanceof TransactionalEditingDomain) {
try {
pageMngr = papyrusEditor.getServicesRegistry().getService(IPageMngr.class);
pageMngr.openPrevious();
} catch (ServiceException e) {
e.printStackTrace();
}
}
}
return null;
}
}
|