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.printing.ui.internal.editor.policies;
18:
19: import net.refractions.udig.printing.model.Box;
20: import net.refractions.udig.printing.model.Page;
21: import net.refractions.udig.printing.ui.internal.editor.commands.DeleteCommand;
22:
23: import org.eclipse.gef.commands.Command;
24: import org.eclipse.gef.editpolicies.ComponentEditPolicy;
25: import org.eclipse.gef.requests.GroupRequest;
26:
27: /**
28: * Provides ...TODO summary sentence
29: * <p>
30: * TODO Description
31: * </p><p>
32: * Responsibilities:
33: * <ul>
34: * <li>
35: * <li>
36: * </ul>
37: * </p><p>
38: * Example Use:<pre><code>
39: * PageElementEditPolicy x = new PageElementEditPolicy( ... );
40: * TODO code example
41: * </code></pre>
42: * </p>
43: * @author Richard Gould
44: * @since 0.3
45: */
46: public class PageElementEditPolicy extends ComponentEditPolicy {
47:
48: protected Command createDeleteCommand(GroupRequest deleteRequest) {
49: Object parent = getHost().getParent().getModel();
50: DeleteCommand deleteCmd = new DeleteCommand();
51: deleteCmd.setParent((Page) parent);
52: deleteCmd.setChild((Box) getHost().getModel());
53: return deleteCmd;
54: }
55: }
|