01: /*
02: * uDig - User Friendly Desktop Internet GIS client
03: * http://udig.refractions.net
04: * (C) 2004, Refractions Research Inc.
05: *
06: * This library is free software; you can redistribute it and/or
07: * modify it under the terms of the GNU Lesser General Public
08: * License as published by the Free Software Foundation;
09: * version 2.1 of the License.
10: *
11: * This library is distributed in the hope that it will be useful,
12: * but WITHOUT ANY WARRANTY; without even the implied warranty of
13: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14: * Lesser General Public License for more details.
15: *
16: */
17: package net.refractions.udig.project.ui.internal.tool.display;
18:
19: import org.eclipse.core.commands.AbstractHandler;
20: import org.eclipse.core.commands.ExecutionEvent;
21:
22: /**
23: * The handler for tool commands.
24: *
25: * @author jeichar
26: * @since 0.9.0
27: */
28: public class ToolCommandHandler extends AbstractHandler {
29:
30: ModalToolCategory category;
31:
32: /**
33: * Construct <code>ToolCommandHandler</code>.
34: */
35: public ToolCommandHandler(ModalToolCategory category) {
36: this .category = category;
37: }
38:
39: /**
40: * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
41: */
42: public Object execute(ExecutionEvent event) {
43: if (category.getContribution().isChecked()) {
44: category.getContribution().incrementSelection();
45: }
46: category.getContribution().runCurrentTool();
47: return null;
48: }
49:
50: }
|