19
19
import org .contextmapper .dsl .generator .exception .GeneratorInputException ;
20
20
import org .contextmapper .dsl .ui .handler .wizard .GenerateContextMapContext ;
21
21
import org .contextmapper .dsl .ui .handler .wizard .GenerateContextMapWizard ;
22
+ import org .contextmapper .dsl .ui .internal .DslActivator ;
22
23
import org .eclipse .core .commands .ExecutionEvent ;
24
+ import org .eclipse .core .runtime .IStatus ;
25
+ import org .eclipse .core .runtime .Status ;
23
26
import org .eclipse .emf .ecore .resource .Resource ;
24
27
import org .eclipse .jface .dialogs .MessageDialog ;
25
28
import org .eclipse .jface .wizard .WizardDialog ;
26
29
import org .eclipse .swt .widgets .Display ;
27
30
import org .eclipse .ui .handlers .HandlerUtil ;
31
+ import org .eclipse .ui .statushandlers .StatusManager ;
28
32
import org .eclipse .xtext .generator .GeneratorContext ;
29
33
import org .eclipse .xtext .generator .IFileSystemAccess2 ;
30
34
import org .eclipse .xtext .generator .IGenerator2 ;
@@ -43,10 +47,18 @@ protected IGenerator2 getGenerator() {
43
47
44
48
@ Override
45
49
protected void runGeneration (Resource resource , ExecutionEvent event , IFileSystemAccess2 fsa ) {
46
- if (!generator .isGraphvizInstalled ()) {
47
- MessageDialog .openInformation (HandlerUtil .getActiveShell (event ), "Graphviz installation not found" ,
48
- "Graphviz has not been found on your system. Ensure it is installed and the binaries are part of your PATH environment variable." );
49
- return ;
50
+ try {
51
+ if (!generator .isGraphvizInstalled ()) {
52
+ MessageDialog .openInformation (HandlerUtil .getActiveShell (event ), "Graphviz installation not found" ,
53
+ "Graphviz has not been found on your system. Ensure it is installed and the binaries are part of your PATH environment variable." );
54
+ return ;
55
+ }
56
+ } catch (Exception e ) {
57
+ String message = e .getMessage () != null && !"" .equals (e .getMessage ()) ? e .getMessage () : e .getClass ().getName () + " occurred in " + this .getClass ().getName ();
58
+ Status status = new Status (IStatus .ERROR , DslActivator .PLUGIN_ID , message , e );
59
+ StatusManager .getManager ().handle (status );
60
+ MessageDialog .openInformation (HandlerUtil .getActiveShell (event ), "Graphviz installation check" ,
61
+ "Your PATH variable could not be parsed to check if Graphviz is installed. The generator may not work if Graphviz is not available." );
50
62
}
51
63
52
64
GenerateContextMapContext context = new GenerateContextMapContext ();
0 commit comments