blob: c9514c48a9385183da0ae1702d6fd1e95fc1767f (
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
|
package org.eclipse.emf.compare.ide.ui.internal.contentmergeviewer.util;
import org.eclipse.emf.common.command.Command;
import org.eclipse.emf.compare.domain.ICompareEditingDomain;
import org.eclipse.emf.edit.ui.EMFEditUIPlugin;
import org.eclipse.jface.action.Action;
/**
* An redo action is implemented by using the {@link org.eclipse.emf.common.command.CommandStack}.
*/
public class RedoAction extends Action {
protected ICompareEditingDomain domain;
public RedoAction(ICompareEditingDomain domain) {
super(EMFEditUIPlugin.INSTANCE.getString("_UI_Redo_menu_item", new Object[] {"" })); //$NON-NLS-1$ //$NON-NLS-2$
this.domain = domain;
update();
}
public RedoAction() {
super(EMFEditUIPlugin.INSTANCE.getString("_UI_Redo_menu_item", new Object[] {"" })); //$NON-NLS-1$ //$NON-NLS-2$
}
@Override
public void run() {
domain.getCommandStack().redo();
}
public void update() {
setEnabled(domain.getCommandStack().canRedo());
Command redoCommand = domain.getCommandStack().getRedoCommand();
if (redoCommand != null && redoCommand.getLabel() != null) {
setText(EMFEditUIPlugin.INSTANCE.getString("_UI_Redo_menu_item", new Object[] {redoCommand //$NON-NLS-1$
.getLabel() }));
} else {
setText(EMFEditUIPlugin.INSTANCE.getString("_UI_Redo_menu_item", new Object[] {"" })); //$NON-NLS-1$ //$NON-NLS-2$
}
if (redoCommand != null && redoCommand.getDescription() != null) {
setDescription(EMFEditUIPlugin.INSTANCE.getString("_UI_Redo_menu_item_description", //$NON-NLS-1$
new Object[] {redoCommand.getDescription() }));
} else {
setDescription(EMFEditUIPlugin.INSTANCE.getString("_UI_Redo_menu_item_simple_description")); //$NON-NLS-1$
}
}
}
|