1
2
3
4
5
6
7
8
9
10
11
12 package sk.uniba.euromath.editor.textEditor.actions;
13
14 import org.eclipse.gef.EditDomain;
15 import org.eclipse.jface.action.Action;
16 import org.eclipse.jface.action.IAction;
17 import org.eclipse.jface.resource.ImageDescriptor;
18
19 import sk.uniba.euromath.editor.textEditor.CaretManager;
20 import sk.uniba.euromath.editor.textEditor.tools.TextTool;
21
22 /***
23 * @author Tomáš Studva 6.8.2006
24 */
25 public class ActivateTextTool extends Action {
26
27 private final EditDomain domain;
28
29 private final CaretManager cManager;
30
31 public ActivateTextTool(EditDomain domain, CaretManager cManager) {
32 super("Text edit/select tool.", IAction.AS_RADIO_BUTTON);
33 this.domain = domain;
34 this.cManager = cManager;
35 setImageDescriptor(ImageDescriptor.createFromFile(ActivateTextTool.class,
36 "/icons/TextTool.gif"));
37 setToolTipText("Text edit/select tool.");
38
39 setChecked(this.domain.getActiveTool() instanceof TextTool);
40 }
41
42 @Override
43 public void run() {
44 this.domain.setActiveTool(new TextTool(cManager));
45 }
46
47 }