comparison improved
diff --git a/org.eclipse.emf.refactor.refactoring.analyzer/bin/.gitignore b/org.eclipse.emf.refactor.refactoring.analyzer/bin/.gitignore
deleted file mode 100644
index 571ee51..0000000
--- a/org.eclipse.emf.refactor.refactoring.analyzer/bin/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/org
diff --git a/org.eclipse.emf.refactor.refactoring.analyzer/bin/org/eclipse/emf/refactor/refactoring/analyzer/core/CompareResult.class b/org.eclipse.emf.refactor.refactoring.analyzer/bin/org/eclipse/emf/refactor/refactoring/analyzer/core/CompareResult.class
index 40c48bd..6b8b704 100644
--- a/org.eclipse.emf.refactor.refactoring.analyzer/bin/org/eclipse/emf/refactor/refactoring/analyzer/core/CompareResult.class
+++ b/org.eclipse.emf.refactor.refactoring.analyzer/bin/org/eclipse/emf/refactor/refactoring/analyzer/core/CompareResult.class
Binary files differ
diff --git a/org.eclipse.emf.refactor.refactoring.analyzer/bin/org/eclipse/emf/refactor/refactoring/analyzer/core/StatisticsButtonCreator$1.class b/org.eclipse.emf.refactor.refactoring.analyzer/bin/org/eclipse/emf/refactor/refactoring/analyzer/core/StatisticsButtonCreator$1.class
index beca167..4854c98 100644
--- a/org.eclipse.emf.refactor.refactoring.analyzer/bin/org/eclipse/emf/refactor/refactoring/analyzer/core/StatisticsButtonCreator$1.class
+++ b/org.eclipse.emf.refactor.refactoring.analyzer/bin/org/eclipse/emf/refactor/refactoring/analyzer/core/StatisticsButtonCreator$1.class
Binary files differ
diff --git a/org.eclipse.emf.refactor.refactoring.analyzer/bin/org/eclipse/emf/refactor/refactoring/analyzer/core/StatisticsButtonCreator.class b/org.eclipse.emf.refactor.refactoring.analyzer/bin/org/eclipse/emf/refactor/refactoring/analyzer/core/StatisticsButtonCreator.class
index 600f4c1..77ad3d2 100644
--- a/org.eclipse.emf.refactor.refactoring.analyzer/bin/org/eclipse/emf/refactor/refactoring/analyzer/core/StatisticsButtonCreator.class
+++ b/org.eclipse.emf.refactor.refactoring.analyzer/bin/org/eclipse/emf/refactor/refactoring/analyzer/core/StatisticsButtonCreator.class
Binary files differ
diff --git a/org.eclipse.emf.refactor.refactoring.analyzer/src/org/eclipse/emf/refactor/refactoring/analyzer/core/CompareResult.java b/org.eclipse.emf.refactor.refactoring.analyzer/src/org/eclipse/emf/refactor/refactoring/analyzer/core/CompareResult.java
index 0432d61..fa0ac94 100644
--- a/org.eclipse.emf.refactor.refactoring.analyzer/src/org/eclipse/emf/refactor/refactoring/analyzer/core/CompareResult.java
+++ b/org.eclipse.emf.refactor.refactoring.analyzer/src/org/eclipse/emf/refactor/refactoring/analyzer/core/CompareResult.java
@@ -18,10 +18,29 @@
 	private final HashMap<ModelSmell, Integer> occurencesInChangedModel;

 	

 	CompareResult(HashMap<ModelSmell, Integer> occurencesInOriginalModel, HashMap<ModelSmell, Integer> occurencesInChangedModel){

-		this.occurencesInOriginalModel = occurencesInOriginalModel;

+		this.occurencesInOriginalModel = sort(occurencesInOriginalModel);

 		this.occurencesInChangedModel = occurencesInChangedModel;

 	}

 

+	private HashMap<ModelSmell, Integer> sort(HashMap<ModelSmell, Integer> map) {

+		ModelSmell[] smells = new ModelSmell[0];

+		smells = map.keySet().toArray(smells);

+		for(int i = 0; i < smells.length; i++) {

+			for(int j = 0; j < smells.length; j++) {

+				if(map.get(smells[i]) > map.get(smells[j])) {

+					ModelSmell temp = smells[i];

+					smells[i] = smells[j];

+					smells[j] = temp;

+				}

+			}

+		}		

+		HashMap<ModelSmell, Integer> result = new HashMap<ModelSmell, Integer>();

+		for (ModelSmell smell : smells) {

+			result.put(smell, map.get(smell));

+		}

+		return result;

+	}

+

 	/**

 	 * Getter for the field occurencesInOriginalModel

 	 * 

@@ -40,6 +59,26 @@
 		return occurencesInChangedModel;

 	}

 	

+	public int getTotalNumberInOriginalModel() {

+		int number = 0;

+		for(ModelSmell smell : occurencesInOriginalModel.keySet()){

+			Integer numberInOriginal = occurencesInOriginalModel.get(smell);

+			number += numberInOriginal;

+			

+		}

+		return number;

+	}

+	

+	public int getTotalNumberInChangedModel() {

+		int number = 0;

+		for(ModelSmell smell : occurencesInChangedModel.keySet()){

+			Integer numberInOriginal = occurencesInChangedModel.get(smell);

+			number += numberInOriginal;

+			

+		}

+		return number;

+	}

+	

 	/**

 	 * Compares the numbers of occurences in the original model and the changed model

 	 * and returns the differences as a map

diff --git a/org.eclipse.emf.refactor.refactoring.analyzer/src/org/eclipse/emf/refactor/refactoring/analyzer/core/StatisticsButtonCreator.java b/org.eclipse.emf.refactor.refactoring.analyzer/src/org/eclipse/emf/refactor/refactoring/analyzer/core/StatisticsButtonCreator.java
index 765dc9b..c1f9426 100644
--- a/org.eclipse.emf.refactor.refactoring.analyzer/src/org/eclipse/emf/refactor/refactoring/analyzer/core/StatisticsButtonCreator.java
+++ b/org.eclipse.emf.refactor.refactoring.analyzer/src/org/eclipse/emf/refactor/refactoring/analyzer/core/StatisticsButtonCreator.java
@@ -5,6 +5,7 @@
 

 import org.eclipse.core.resources.IFile;

 import org.eclipse.core.runtime.CoreException;

+import org.eclipse.core.runtime.IProgressMonitor;

 import org.eclipse.core.runtime.NullProgressMonitor;

 import org.eclipse.core.runtime.OperationCanceledException;

 import org.eclipse.emf.ecore.EObject;

@@ -52,10 +53,11 @@
 						boolean applicable = status.isOK(); 

 						if(applicable) {

 							RefactoringChange c = (RefactoringChange) processor.createChange(new NullProgressMonitor());

+							c.perform(new NullProgressMonitor());

 //							c.getModelCompareInput();

 							EObject rootAfterRefactoring = (EObject) c.getModifiedElement();

-							EObject rootBeforeRefactoring = (EObject) c.getModifiedElement();

-							String path = rootBeforeRefactoring.eResource().getURI().toPlatformString(false);

+							EObject rootBeforeRefactoring = (EObject) c.getRootCopy();

+							String path = rootAfterRefactoring.eResource().getURI().toPlatformString(false);

 							IFile iFile = (IFile)org.eclipse.core.resources.ResourcesPlugin.getWorkspace().getRoot().findMember(path);

 							List<Result> smellResultsBefore = ModelSmellFinder.findModelSmells(ConfigurationManager.getSelectedModelSmells(iFile.getProject()), rootBeforeRefactoring);

 							List<Result> smellResultsAfter = ModelSmellFinder.findModelSmells(ConfigurationManager.getSelectedModelSmells(iFile.getProject()), rootAfterRefactoring);

@@ -79,27 +81,38 @@
 			 * Creates the message for the dialog called by the created button.

 			 */

 			private String buildStatisticsMessage(CompareResult result) {

-				String message = "Following model smell occurences are found before\n applying refactoring '" + controller.getParent().getName() + "':\n\n";

+				

 				Map<ModelSmell, Integer> originalSmells = result.getOccurencesInOriginalModel();

+				Map<ModelSmell, Integer> changedSmells = result.getOccurencesInChangedModel();

+				Map<ModelSmell, Integer> differences = result.getDifferences();

+				

+				String message = "Following model smell occurences are found before\n "

+						+ "applying refactoring '" + controller.getParent().getName() + "': Total " 

+						+ result.getTotalNumberInOriginalModel() + "\n\n";

+				

 				for(ModelSmell smell : originalSmells.keySet()){

 					if(originalSmells.get(smell) != 0){

 						message += smell.getName() + ": " + originalSmells.get(smell) + "\n";

 					}

 				}

-				message += "\n\nFollowing model smells are found after\n applying refactoring '" + controller.getParent().getName() + "':\n\n";

-				Map<ModelSmell, Integer> changedSmells = result.getOccurencesInChangedModel();

+				

+				message += "\n\nFollowing model smells are found after\n "

+						+ "applying refactoring '" + controller.getParent().getName() + "': Total " 

+						+ result.getTotalNumberInChangedModel() + "\n\n";

 				for(ModelSmell smell : changedSmells.keySet()){

 					if(changedSmells.get(smell) != 0){

 						message += smell.getName() + ": " + changedSmells.get(smell) + "\n";

 					}

 				}

-				message += "\n\nFollowing model smell occurrences will change when\napplying refactoring '" + controller.getParent().getName() + "':\n\n";

-				Map<ModelSmell, Integer> differences = result.getDifferences();

-				for(ModelSmell smell : differences.keySet()){

+								

+				message += "\n\nFollowing model smell occurrences will change when\n "

+						+ "applying refactoring '" + controller.getParent().getName() + "':\n\n";

+								for(ModelSmell smell : differences.keySet()){

 					if(differences.get(smell) != 0){

 						message += smell.getName() + ": " + differences.get(smell) + "\n";

 					}

 				}

+								

 				return message;

 			}