~fredericp/zaluum/wip-ide

« back to all changes in this revision

Viewing changes to org.zaluum.ide.editor/src/org/zaluum/ide/editor/parts/fsm/CreateStateCommand.java

  • Committer: Frederic Perez Ordeig
  • Date: 2009-12-17 16:27:19 UTC
  • Revision ID: frederic@zaluum.com-20091217162719-wplg8lm7zbr1jfgu
Refactored box cloning
Port name acts as an id and cannot be duplicated.

Show diffs side-by-side

added added

removed removed

Lines of Context:
34
34
 
35
35
        private final FSMBox currentBox;
36
36
        private final Rectangle bounds;
37
 
        private final State state;
 
37
        private State state;
38
38
        /**
39
39
         * @param currentBox
40
40
         * @param rect
43
43
                this.currentBox = currentBox;
44
44
                this.bounds = rect;
45
45
                //TODO: Take grid distance
46
 
                bounds.setLocation(new Point(bounds.x-24,bounds.y-36));
 
46
                bounds.setLocation(new Point(bounds.x-24,bounds.y-36));         
 
47
        }
 
48
        @Override
 
49
        public void execute() {
47
50
                this.state = new State("state",GraphicUtils.draw2dToModel(bounds.getTopLeft()),currentBox);
48
51
        }
49
 
        @Override
50
 
        public void execute() {
51
 
                redo(); 
52
 
        }
53
52
        
54
53
        @Override
55
54
        public void redo() {
56
 
                currentBox.addState(state);
 
55
                currentBox.restoreState(state);
57
56
        }
58
57
 
59
58
        @Override