/*
 * Perfclispe
 * 
 * 
 * Copyright (c) 2013 Jakub Knetl
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.perfclipse.ui.gef.commands;

import org.eclipse.gef.commands.Command;
import org.perfclipse.model.MessageModel;

/**
 * @author Jakub Knetl
 *
 */
public class EditMessageMultiplicityCommand extends Command {

	private MessageModel message;
	private int newValue;
	private int oldValue;

	public EditMessageMultiplicityCommand(MessageModel message, int newValue) {
		super("Edit multiplicity");
		this.message = message;
		this.newValue = newValue;
		this.oldValue = Integer.valueOf(message.getMessage().getMultiplicity());
	}

	@Override
	public void execute() {
		message.setMultiplicity(String.valueOf(newValue));
	}

	@Override
	public void undo() {
		message.setMultiplicity(String.valueOf(oldValue));
	}
}

@@ -877,19 +877,22 @@
 private 
+Str
 in
-t
+g
  newValu
@@ -903,19 +903,22 @@
 private 
+Str
 in
-t
+g
  oldValu
@@ -986,11 +986,14 @@
 ge, 
+Str
 in
-t
+g
  new
@@ -1107,24 +1107,8 @@
 e = 
-Integer.valueOf(
 mess
@@ -1141,17 +1141,16 @@
 licity()
-)
 ;%0A%09%7D%0A%0A%09@
@@ -1209,31 +1209,16 @@
 plicity(
-String.valueOf(
 newValue
@@ -1214,25 +1214,24 @@
 ty(newValue)
-)
 ;%0A%09%7D%0A%0A%09@Over
@@ -1287,23 +1287,8 @@
 ity(
-String.valueOf(
 oldV
@@ -1292,16 +1292,15 @@
 ldValue)
-)
 ;%0A%09%7D%0A%7D%0A

Fix multiplicity command