2
* This file is part of Zaluum
4
* Zaluum is free software: you can redistribute it and/or modify
5
* it under the terms of the GNU Lesser General Public License as published by
6
* the Free Software Foundation, either version 3 of the License, or
7
* (at your option) any later version.
9
* Zaluum is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU Lesser General Public License for more details.
14
* You should have received a copy of the GNU Lesser General Public License
15
* along with Zaluum. If not, see <http://www.gnu.org/licenses/>.
17
* Copyright 2008,2009 Frederic Perez Ordeig
18
* Copyright 2008,2009 Elias Hortas Garcia
20
package org.zaluum.boxes.fsm.editor;
22
import org.eclipse.gef.commands.Command;
23
import org.zaluum.model.basicbox.State;
24
import org.zaluum.model.basicbox.Transition;
30
public class CreateTransitionCommand extends Command {
33
private final State source;
34
private Transition trans;
36
public CreateTransitionCommand(State stateModel) {
37
this.source = stateModel;
40
public void setTarget(State stateModel) {
41
this.target = stateModel;
44
public boolean canExecute() {
45
return !source.equals(target);
48
public void execute() {
54
trans = Transition.create(source,target);
59
source.removeSourceTransition(trans);
60
target.removeTargetTransition(trans);