highlighting angle added
diff --git a/org.eclipse.emf.refactor.smells.runtime/src/org/eclipse/emf/refactor/smells/runtime/core/ModelSmellFinder.java b/org.eclipse.emf.refactor.smells.runtime/src/org/eclipse/emf/refactor/smells/runtime/core/ModelSmellFinder.java
index d8edc6e..ca6b691 100644
--- a/org.eclipse.emf.refactor.smells.runtime/src/org/eclipse/emf/refactor/smells/runtime/core/ModelSmellFinder.java
+++ b/org.eclipse.emf.refactor.smells.runtime/src/org/eclipse/emf/refactor/smells/runtime/core/ModelSmellFinder.java
@@ -41,6 +41,7 @@
LinkedList<Result> results = new LinkedList<Result>();
for(ModelSmell smell : smells){
if(smell.getMetamodel().equals(nsUri))
+ System.out.println("find smell: " + smell.getName());
results.add(findModelSmell(smell));
}
return results;
@@ -48,6 +49,7 @@
private static Result findModelSmell(ModelSmell smell) {
LinkedList<LinkedList<EObject>> modelelements = smell.getFinderClass().findSmell(rootElement);
+ System.out.println("found: " + modelelements.size());
return new Result(smell, modelelements);
}
diff --git a/org.eclipse.emf.refactor.smells.runtime/src/org/eclipse/emf/refactor/smells/runtime/managers/RuntimeManager.java b/org.eclipse.emf.refactor.smells.runtime/src/org/eclipse/emf/refactor/smells/runtime/managers/RuntimeManager.java
index 9e65d0a..ea58c0a 100644
--- a/org.eclipse.emf.refactor.smells.runtime/src/org/eclipse/emf/refactor/smells/runtime/managers/RuntimeManager.java
+++ b/org.eclipse.emf.refactor.smells.runtime/src/org/eclipse/emf/refactor/smells/runtime/managers/RuntimeManager.java
@@ -12,6 +12,7 @@
import org.eclipse.emf.refactor.smells.core.MetricBasedModelSmellFinderClass;
import org.eclipse.emf.refactor.smells.core.ModelSmell;
import org.eclipse.emf.refactor.smells.core.ModelSmellLoader;
+import org.eclipse.emf.refactor.smells.interfaces.IHighlighting;
import org.eclipse.emf.refactor.smells.runtime.core.ModelSmellFinder;
import org.eclipse.emf.refactor.smells.runtime.core.Result;
import org.eclipse.emf.refactor.smells.runtime.core.ResultModel;
@@ -39,6 +40,7 @@
private static LinkedList<ModelSmell> allSmells=null;
private static LinkedList<ResultModel> resultModels = new LinkedList<ResultModel>();
private static List<Action> additionalActions = new ArrayList<Action>();
+ private static List<IHighlighting> additionalHighlightings = new ArrayList<IHighlighting>();
private static ResultModelTreeViewer resultModelViewer;
private static IEditorPart editorPart = null;
@@ -77,6 +79,16 @@
return instance;
}
+ public static RuntimeManager getInstance(IHighlighting highlighting) {
+ if (instance == null) {
+ instance = new RuntimeManager();
+ additionalHighlightings.add(highlighting);
+ } else {
+ additionalHighlightings.add(highlighting);
+ }
+ return instance;
+ }
+
public static void clearResultModels(){
resultModels = new LinkedList<ResultModel>();
resultModelViewer.setInput(resultModels);
@@ -129,6 +141,7 @@
try {
page.showView(ResultModelTreeView.MENU_ID);
setAdditionalActionsToView(getSmellView());
+ setAdditionalHightightingsToView(getSmellView());
} catch (PartInitException e) {
e.printStackTrace();
}
@@ -150,6 +163,7 @@
ResultModelTreeView view = getSmellView();
if (view != null) {
setAdditionalActionsToView(view);
+ setAdditionalHightightingsToView(getSmellView());
return true;
}
return false;
@@ -163,6 +177,13 @@
view.addActionsToMenu();
}
+ private static void setAdditionalHightightingsToView(ResultModelTreeView view) {
+ for (IHighlighting highlighting : additionalHighlightings) {
+ System.out.println("RuntimeManager: add highlighting '" + highlighting + "' to view!");
+ view.addHighlighting(highlighting);
+ }
+ }
+
/**
* Loads a LinkedList of all smell plugins (wrapped into <i>ModelSmell</i> objects)
* <br>- currently installed in the Eclipse instance.
diff --git a/org.eclipse.emf.refactor.smells.runtime/src/org/eclipse/emf/refactor/smells/runtime/ui/ResultModelTreeView.java b/org.eclipse.emf.refactor.smells.runtime/src/org/eclipse/emf/refactor/smells/runtime/ui/ResultModelTreeView.java
index cdc98da..d324753 100644
--- a/org.eclipse.emf.refactor.smells.runtime/src/org/eclipse/emf/refactor/smells/runtime/ui/ResultModelTreeView.java
+++ b/org.eclipse.emf.refactor.smells.runtime/src/org/eclipse/emf/refactor/smells/runtime/ui/ResultModelTreeView.java
@@ -10,6 +10,7 @@
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.emf.refactor.smells.interfaces.IHighlighting;
import org.eclipse.emf.refactor.smells.runtime.core.EObjectGroup;
import org.eclipse.emf.refactor.smells.runtime.core.ResultModel;
import org.eclipse.emf.refactor.smells.runtime.managers.RuntimeManager;
@@ -57,6 +58,7 @@
private SaveAction saveAction;
private ClearAction clearAction;
private List<Action> additionalActions = new ArrayList<Action>();
+ private List<IHighlighting> additionalHighlightings = new ArrayList<IHighlighting>();
private static IMenuManager barMM;
private static IToolBarManager toolbarMM;
@@ -101,6 +103,7 @@
setSelectionInModel((IViewerProvider)editorPart, (IStructuredSelection)event.getSelection());
// ((IViewerProvider)editorPart).getViewer().setSelection(event.getSelection(), true);
}
+ doAdditionalHighlightings();
}
private void setSelectionInModel(IViewerProvider provider, IStructuredSelection selection){
@@ -201,6 +204,12 @@
contributeToActionBars();
}
+ protected void doAdditionalHighlightings() {
+ for (IHighlighting highlighting : additionalHighlightings) {
+ highlighting.highlight();
+ }
+ }
+
private void hookContextMenu() {
MenuManager menuMgr = new MenuManager("#PopupMenu");
menuMgr.setRemoveAllWhenShown(true);
@@ -324,5 +333,9 @@
}
additionalActions.clear();
}
+
+ public void addHighlighting(IHighlighting highlighting) {
+ additionalHighlightings.add(highlighting);
+ }
}