new tab: suggested and applicable refactorings
diff --git a/org.eclipse.emf.refactor.smells.eraser/bin/org/eclipse/emf/refactor/smells/eraser/ui/RelationsPropertyPage.class b/org.eclipse.emf.refactor.smells.eraser/bin/org/eclipse/emf/refactor/smells/eraser/ui/RelationsPropertyPage.class
index 9b805fe..1ab25ca 100644
--- a/org.eclipse.emf.refactor.smells.eraser/bin/org/eclipse/emf/refactor/smells/eraser/ui/RelationsPropertyPage.class
+++ b/org.eclipse.emf.refactor.smells.eraser/bin/org/eclipse/emf/refactor/smells/eraser/ui/RelationsPropertyPage.class
Binary files differ
diff --git a/org.eclipse.emf.refactor.smells.eraser/bin/org/eclipse/emf/refactor/smells/eraser/ui/SuggestionDialog$1$1.class b/org.eclipse.emf.refactor.smells.eraser/bin/org/eclipse/emf/refactor/smells/eraser/ui/SuggestionDialog$1$1.class
index 610541d..7937437 100644
--- a/org.eclipse.emf.refactor.smells.eraser/bin/org/eclipse/emf/refactor/smells/eraser/ui/SuggestionDialog$1$1.class
+++ b/org.eclipse.emf.refactor.smells.eraser/bin/org/eclipse/emf/refactor/smells/eraser/ui/SuggestionDialog$1$1.class
Binary files differ
diff --git a/org.eclipse.emf.refactor.smells.eraser/bin/org/eclipse/emf/refactor/smells/eraser/ui/SuggestionDialog$1.class b/org.eclipse.emf.refactor.smells.eraser/bin/org/eclipse/emf/refactor/smells/eraser/ui/SuggestionDialog$1.class
index b510755..48dc6bd 100644
--- a/org.eclipse.emf.refactor.smells.eraser/bin/org/eclipse/emf/refactor/smells/eraser/ui/SuggestionDialog$1.class
+++ b/org.eclipse.emf.refactor.smells.eraser/bin/org/eclipse/emf/refactor/smells/eraser/ui/SuggestionDialog$1.class
Binary files differ
diff --git a/org.eclipse.emf.refactor.smells.eraser/bin/org/eclipse/emf/refactor/smells/eraser/ui/SuggestionDialog.class b/org.eclipse.emf.refactor.smells.eraser/bin/org/eclipse/emf/refactor/smells/eraser/ui/SuggestionDialog.class
index 45106b2..f058474 100644
--- a/org.eclipse.emf.refactor.smells.eraser/bin/org/eclipse/emf/refactor/smells/eraser/ui/SuggestionDialog.class
+++ b/org.eclipse.emf.refactor.smells.eraser/bin/org/eclipse/emf/refactor/smells/eraser/ui/SuggestionDialog.class
Binary files differ
diff --git a/org.eclipse.emf.refactor.smells.eraser/bin/org/eclipse/emf/refactor/smells/eraser/utils/SetSorter.class b/org.eclipse.emf.refactor.smells.eraser/bin/org/eclipse/emf/refactor/smells/eraser/utils/SetSorter.class
index 2647c21..2295752 100644
--- a/org.eclipse.emf.refactor.smells.eraser/bin/org/eclipse/emf/refactor/smells/eraser/utils/SetSorter.class
+++ b/org.eclipse.emf.refactor.smells.eraser/bin/org/eclipse/emf/refactor/smells/eraser/utils/SetSorter.class
Binary files differ
diff --git a/org.eclipse.emf.refactor.smells.eraser/src/org/eclipse/emf/refactor/smells/eraser/ui/RelationsPropertyPage.java b/org.eclipse.emf.refactor.smells.eraser/src/org/eclipse/emf/refactor/smells/eraser/ui/RelationsPropertyPage.java
index 2e568f2..cc70087 100644
--- a/org.eclipse.emf.refactor.smells.eraser/src/org/eclipse/emf/refactor/smells/eraser/ui/RelationsPropertyPage.java
+++ b/org.eclipse.emf.refactor.smells.eraser/src/org/eclipse/emf/refactor/smells/eraser/ui/RelationsPropertyPage.java
@@ -47,7 +47,7 @@
 	private static final String SMELLS_TAB_LABEL = "Usable Refactorings to erase Smell";

 	private static final String REFACTORINGS_TAB_LABEL = "Smells possibly caused by Refactoring";

 	private static final String METAMODEL_LABEL = "Metamodel:";

-	private static final String HEADER_TEXT = "Please set the relations between model smells and model refactorings\n as defined in this project.";

+	private static final String HEADER_TEXT = "Please set the relations between model smells and model refactorings.";

 	private static final String NO_PLUGIN_NATURE_ERROR_MESSAGE = "The project you selected is not a plugin project!";

 	IProject project;

 	List<Table> tables;

@@ -225,7 +225,7 @@
 		int i = 0;

 		for(ModelSmellStub smellStub : SetSorter.sortSmellStubSet(smellStubs)){ //SetSorter.sortSmellSet(EraseManager.getAllInstalledSmellsForMetamodel(metamodelURI))){

 			smellCombo.setData("" + i, smellStub);

-			smellCombo.add(smellStub.getName() + "(" + smellStub.getId() + ")", i);

+			smellCombo.add(smellStub.getName(), i);// + "(" + smellStub.getId() + ")", i);

 			i++;

 		}

 		smellCombo.addListener(SWT.Selection, new Listener() {

@@ -242,7 +242,7 @@
 		i = 0;

 		for(ModelRefactoringStub refactoringStub : SetSorter.sortRefactoringStubSet(refactoringStubs)){

 			refactoringCombo.setData("" + i, refactoringStub);

-			refactoringCombo.add(refactoringStub.getName() + "(" + refactoringStub.getId() + ")", i);

+			refactoringCombo.add(refactoringStub.getName(), i);// + "(" + refactoringStub.getId() + ")", i);

 			i++;

 		}

 		refactoringCombo.addListener(SWT.Selection, new Listener() {

@@ -337,7 +337,7 @@
 			TableItem item = new TableItem(smellToRefactoringsTable, SWT.NONE);

 			boolean checked = entries.getFixingRefactorings(smellStub) != null && entries.getFixingRefactorings(smellStub).contains(refactoringStub);

 			item.setData(refactoringStub);

-			item.setText(1, refactoringStub.getName() + "(" + refactoringStub.getId() + ")");

+			item.setText(1, refactoringStub.getName());// + "(" + refactoringStub.getId() + ")");

 			item.setText(2, refactoringStub.getId());

 			item.setChecked(checked);

 		}

@@ -354,7 +354,7 @@
 			TableItem item = new TableItem(refactoringToSmellsTable, SWT.NONE);

 			item.setData(smellStub);

 			boolean checked = entries.getCausedSmells(refactoringStub) != null && entries.getCausedSmells(refactoringStub).contains(smellStub);

-			item.setText(1, smellStub.getName() + "(" + smellStub.getId() + ")");

+			item.setText(1, smellStub.getName());// + "(" + smellStub.getId() + ")");

 			item.setText(2, smellStub.getDescription());

 			item.setChecked(checked);

 		}

diff --git a/org.eclipse.emf.refactor.smells.eraser/src/org/eclipse/emf/refactor/smells/eraser/ui/SuggestionDialog.java b/org.eclipse.emf.refactor.smells.eraser/src/org/eclipse/emf/refactor/smells/eraser/ui/SuggestionDialog.java
index 8d43c1e..66fa2da 100644
--- a/org.eclipse.emf.refactor.smells.eraser/src/org/eclipse/emf/refactor/smells/eraser/ui/SuggestionDialog.java
+++ b/org.eclipse.emf.refactor.smells.eraser/src/org/eclipse/emf/refactor/smells/eraser/ui/SuggestionDialog.java
@@ -2,6 +2,7 @@
 

 import java.util.ArrayList;

 import java.util.Arrays;

+import java.util.HashMap;

 import java.util.List;

 import java.util.Map;

 import java.util.Set;

@@ -46,6 +47,7 @@
 	

 	private static final String APPLICABLE_REFACTORINGS_TAB_LABEL = "Applicable Refactorings";

 	private static final String SUGGESTED_REFACTORINGS_TAB_LABEL = "Suggested Refactorings";

+	private static final String SUGGESTED_APPLICABLE_REFACTORINGS_TAB_LABEL = "Suggested and Applicable Refactorings";

 	private static final String CONTEXT_OBJECTS = "contextObjects";

 	private static final String SELECTED_CONTEXT_OBJECT = "selectedContextObject";

 	private static final String POSSIBLE_SMELLS_COLUMNL_LABEL = "Possible Smells";

@@ -67,19 +69,20 @@
 	private final Map<Refactoring, Set<ModelSmell>> relationMap;

 	private final EObjectGroup eObjects;

 	private final Map<Refactoring, Set<EObject>> dynamicallyCalculatedRefactorings;

+	private Map<Refactoring, Set<EObject>> suggestedApplicableRefactorings;

 	

 	private Refactoring selectedRefactoring = null;

 	private EObject selectedContextObject = null;

 	private TableItem selectedItem = null;

 	private Table staticTable;

 	private Table dynamicTable;

+	private Table suggestedApplicableTable;

 	

 	public SuggestionDialog(Shell parentShell, Map<Refactoring, Set<ModelSmell>> relationMap, EObjectGroup eObjects) {

 		super(parentShell);

 		this.relationMap = relationMap;

 		this.eObjects = eObjects;

 		this.dynamicallyCalculatedRefactorings = EraseManager.getInstance().getApplicableRefactoringsDynamically(eObjects);

-		

 	}

 	

 	protected void configureShell(Shell shell) {

@@ -90,14 +93,14 @@
 	@Override

 	protected Control createContents(Composite parent) {

 		

-		parent.setLayout(new GridLayout(1, true));

-		

+		parent.setLayout(new GridLayout(1, true));		

 		

 		TabFolder tabs = new TabFolder(parent, SWT.NULL);

 		GridData gridData = new GridData(GridData.FILL_BOTH);

 		gridData.horizontalAlignment = GridData.FILL;

 		tabs.setLayoutData(gridData);

 		

+		// static definitions		

 		TabItem staticDefinitionsTab = new TabItem(tabs, SWT.NULL);

 		staticDefinitionsTab.setText(SUGGESTED_REFACTORINGS_TAB_LABEL);

 		Composite staticComposite = new Composite(tabs, SWT.NULL);

@@ -119,6 +122,7 @@
 		staticTable.setHeaderVisible(true);

 		staticTable.setLinesVisible(true);

 		

+		// applicable refactorings

 		TabItem dynamicRelationsTab = new TabItem(tabs, SWT.NULL);

 		dynamicRelationsTab.setText(APPLICABLE_REFACTORINGS_TAB_LABEL);

 		Composite dynamicComposite = new Composite(tabs, SWT.NULL);

@@ -136,9 +140,42 @@
 		dynamicTable.setHeaderVisible(true);

 		dynamicTable.setLinesVisible(true);

 		

+		// applicable static relations

+		TabItem dynamicApplicablesTab = new TabItem(tabs, SWT.NULL);

+		dynamicApplicablesTab.setText(SUGGESTED_APPLICABLE_REFACTORINGS_TAB_LABEL);

+		Composite dynamicApplicableComposite = new Composite(tabs, SWT.NULL);

+		dynamicApplicableComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

+		dynamicApplicablesTab.setControl(dynamicApplicableComposite);

+		GridLayout dynamicApplicableLayout = new GridLayout();

+		dynamicApplicableComposite.setLayout(dynamicApplicableLayout);

+		

+		suggestedApplicableTable = new Table(dynamicApplicableComposite, SWT.SINGLE

+				| SWT.FULL_SELECTION | SWT.BORDER | SWT.V_SCROLL);

+		createRelationTableColumns(suggestedApplicableTable);

+		

+		fillSuggestedApplicableRefactorings();		

+		fillDynamicRelationsTable(suggestedApplicableRefactorings, suggestedApplicableTable);

+		

+		suggestedApplicableTable.setHeaderVisible(true);

+		suggestedApplicableTable.setLinesVisible(true);

+		

+		

 		return super.createContents(parent);

 	}

 	

+	private void fillSuggestedApplicableRefactorings() {

+		suggestedApplicableRefactorings = new HashMap<Refactoring, Set<EObject>>();

+		Refactoring[] staticRefactorings = {};

+		staticRefactorings = relationMap.keySet().toArray(staticRefactorings);

+		Arrays.sort(staticRefactorings);

+		Set<Refactoring> dynamicRefactorings = dynamicallyCalculatedRefactorings.keySet();

+		for (Refactoring refactoring : staticRefactorings) {

+			if (dynamicRefactorings.contains(refactoring)) {

+				suggestedApplicableRefactorings.put(refactoring, dynamicallyCalculatedRefactorings.get(refactoring));

+			}

+		}

+	}

+

 	/*

 	 * fills the table contained in the tab for applicable refactorings

 	 */

@@ -146,6 +183,7 @@
 			Map<Refactoring, Set<EObject>> dynamicMap,

 			Table dynamicTable) {

 		for(Refactoring refactoring : SetSorter.sortRefactoringSet(dynamicMap.keySet())){

+//		for(Refactoring refactoring : dynamicMap.keySet()) {

 				String causedSmells = buildCausedSmellsTableEntry(refactoring);

 				TableItem tableItem = new TableItem(dynamicTable, SWT.LEFT);

 				tableItem.setText(0, refactoring.getName());

diff --git a/org.eclipse.emf.refactor.smells.eraser/src/org/eclipse/emf/refactor/smells/eraser/utils/SetSorter.java b/org.eclipse.emf.refactor.smells.eraser/src/org/eclipse/emf/refactor/smells/eraser/utils/SetSorter.java
index b20eee2..2d4c68e 100644
--- a/org.eclipse.emf.refactor.smells.eraser/src/org/eclipse/emf/refactor/smells/eraser/utils/SetSorter.java
+++ b/org.eclipse.emf.refactor.smells.eraser/src/org/eclipse/emf/refactor/smells/eraser/utils/SetSorter.java
@@ -30,7 +30,7 @@
 		if(array.length > 1){

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

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

-					if(array[i].getName().compareTo(array[j].getName()) > 0){

+					if(array[i].getName().compareTo(array[j].getName()) < 0){

 						swap(array, i, j);

 					}

 				}

@@ -58,7 +58,7 @@
 		if(array.length > 1){

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

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

-					if(array[i].getName().compareTo(array[j].getName()) > 0){

+					if(array[i].getName().compareTo(array[j].getName()) < 0){

 						swap(array, i, j);

 					}

 				}

@@ -95,7 +95,7 @@
 		if(array.length > 1){

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

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

-					if(array[i].getName().compareTo(array[j].getName()) > 0){

+					if(array[i].getName().compareTo(array[j].getName()) < 0){

 						swap(array, i, j);

 					}

 				}

@@ -123,7 +123,7 @@
 		if(array.length > 1){

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

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

-					if(array[i].getName().compareTo(array[j].getName()) > 0){

+					if(array[i].getName().compareTo(array[j].getName()) < 0){

 						swap(array, i, j);

 					}

 				}