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.xmlEditor.tools.XMLStructureTool;
20  
21  /***
22   * @author Tomáš Studva 6.8.2006
23   */
24  public class ActivateStructureTool extends Action {
25  
26          private final EditDomain domain;
27  
28          public ActivateStructureTool(EditDomain domain) {
29                  super("Structure selection tool.", IAction.AS_RADIO_BUTTON);
30                  this.domain = domain;
31                  setImageDescriptor(ImageDescriptor.createFromFile(
32                                  ActivateTextTool.class,
33                                  "/icons/SelectionTool.gif")); 
34                  setToolTipText("Structure selection tool.");
35  
36                  setChecked(this.domain.getActiveTool() instanceof XMLStructureTool);
37          }
38  
39          @Override
40          public void run() {
41                  this.domain.setActiveTool(new XMLStructureTool());
42          }
43  
44  }