01: /* uDig - User Friendly Desktop Internet GIS client
02: * http://udig.refractions.net
03: * (C) 2004, Refractions Research Inc.
04: *
05: * This library is free software; you can redistribute it and/or
06: * modify it under the terms of the GNU Lesser General Public
07: * License as published by the Free Software Foundation;
08: * version 2.1 of the License.
09: *
10: * This library is distributed in the hope that it will be useful,
11: * but WITHOUT ANY WARRANTY; without even the implied warranty of
12: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13: * Lesser General Public License for more details.
14: */
15: package net.refractions.udig.tools.edit.commands;
16:
17: import net.refractions.udig.project.command.AbstractCommand;
18: import net.refractions.udig.project.command.UndoableMapCommand;
19: import net.refractions.udig.tool.edit.internal.Messages;
20: import net.refractions.udig.tools.edit.support.EditGeom;
21:
22: import org.eclipse.core.runtime.IProgressMonitor;
23:
24: /**
25: * Sets the changed state of the editGeom
26: * @author jones
27: * @since 1.1.0
28: */
29: public class SetEditGeomChangedStateCommand extends AbstractCommand
30: implements UndoableMapCommand {
31:
32: private boolean newState;
33: private EditGeom geom;
34: private boolean oldState;
35:
36: /**
37: * @param currentGeom
38: * @param newState
39: */
40: public SetEditGeomChangedStateCommand(EditGeom currentGeom,
41: boolean newState) {
42: this .geom = currentGeom;
43: this .newState = newState;
44: }
45:
46: public void run(IProgressMonitor monitor) throws Exception {
47: this .oldState = geom.isChanged();
48: geom.setChanged(newState);
49: }
50:
51: public String getName() {
52: return Messages.SetEditGeomChangedStateCommand_name;
53: }
54:
55: public void rollback(IProgressMonitor monitor) throws Exception {
56: geom.setChanged(oldState);
57: }
58:
59: }
|