App

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- File List
- File Members

SelectToolCommand.java
Go to the documentation of this file.
1 package mhr.appcore.commands.toolcommands;
2
3 import mhr.appcore.AppCore;
4 import mhr.appcore.commands.AppCommand;
5 import mhr.appcore.tools.Tool;
9 public class SelectToolCommand extends AppCommand{
10
11 protected Tool tool;
12
17 public SelectToolCommand(Tool tool) {
18 this.tool = tool;
19 }
20
21 @Override
22 public void action(AppCore target) {
23 synchronized (this) {
24 target.getRenderer().susepnd(this);
25 try {
26 this.wait();
27 } catch (InterruptedException e) {
28 }
29 try {
30 target.setTool(tool);
31 } finally {
32 target.getRenderer().wake(this);
33 target.getRenderer().render();
34 }
35 }
36 }
37
38 @Override
39 public void dispose() {
40 if (tool != null) {
41 tool.dispose();
42 tool = null;
43 }
44 }
45
46 }