Extended check for dot executable (included system variable GRAPHVIZ_DOT)
diff --git a/plugins/org.eclipse.app4mc.amalthea.visualization.runnabledependency/src/org/eclipse/app4mc/amalthea/visualization/runnabledependency/RunnableDependencyVisualization.java b/plugins/org.eclipse.app4mc.amalthea.visualization.runnabledependency/src/org/eclipse/app4mc/amalthea/visualization/runnabledependency/RunnableDependencyVisualization.java
index 7a1c2fb..568c861 100644
--- a/plugins/org.eclipse.app4mc.amalthea.visualization.runnabledependency/src/org/eclipse/app4mc/amalthea/visualization/runnabledependency/RunnableDependencyVisualization.java
+++ b/plugins/org.eclipse.app4mc.amalthea.visualization.runnabledependency/src/org/eclipse/app4mc/amalthea/visualization/runnabledependency/RunnableDependencyVisualization.java
@@ -85,15 +85,8 @@
this.graphvizGenerator = new GraphvizGenerator(config, true, true);
this.model = model;
- if (dotPath == null) {
- if (Platform.getOS().equals(Platform.OS_WIN32)) {
- this.dotPath = "dot.exe";
- } else {
- this.dotPath = "dot";
- }
- } else {
- this.dotPath = dotPath;
- }
+
+ setDotPath(dotPath);
Composite pane = new Composite(parent, SWT.NONE);
GridLayoutFactory.fillDefaults().applyTo(pane);
@@ -130,6 +123,28 @@
visualize();
}
+ private void setDotPath(String dotPathFromPreferences) {
+ // Check if preference GRAPHVIZ_PATH is set
+ if (dotPathFromPreferences != null && !dotPathFromPreferences.isEmpty()) {
+ this.dotPath = dotPathFromPreferences;
+ return;
+ }
+
+ // Check if environment variable GRAPHVIZ_DOT is set
+ String dotPath2 = System.getenv("GRAPHVIZ_DOT");
+ if (dotPath2 != null && !dotPath2.isEmpty()) {
+ this.dotPath = dotPath2;
+ return;
+ }
+
+ // Try with command only (works if included in PATH)
+ if (Platform.getOS().equals(Platform.OS_WIN32)) {
+ this.dotPath = "dot.exe";
+ } else {
+ this.dotPath = "dot";
+ }
+ }
+
/**
* Setup navigation to a selected element in the model viewer
*