use of org.contextmapper.dsl.ui.handler.wizard.GenerateContextMapContext in project context-mapper-dsl by ContextMapper.
the class ContextMapGenerationHandler method runGeneration.
@Override
protected void runGeneration(Resource resource, ExecutionEvent event, IFileSystemAccess2 fsa) {
try {
if (!generator.isGraphvizInstalled()) {
MessageDialog.openInformation(HandlerUtil.getActiveShell(event), "Graphviz installation not found", "Graphviz has not been found on your system. Ensure it is installed and the binaries are part of your PATH environment variable.");
return;
}
} catch (Exception e) {
String message = e.getMessage() != null && !"".equals(e.getMessage()) ? e.getMessage() : e.getClass().getName() + " occurred in " + this.getClass().getName();
Status status = new Status(IStatus.ERROR, DslActivator.PLUGIN_ID, message, e);
StatusManager.getManager().handle(status);
MessageDialog.openInformation(HandlerUtil.getActiveShell(event), "Graphviz installation check", "Your PATH variable could not be parsed to check if Graphviz is installed. The generator may not work if Graphviz is not available.");
}
GenerateContextMapContext context = createContext(event);
new WizardDialog(HandlerUtil.getActiveShell(event), new GenerateContextMapWizard(context, executionContext -> {
persistContext(event, executionContext);
generator.setContextMapFormats(context.getFormats().toArray(new ContextMapFormat[context.getFormats().size()]));
generator.setLabelSpacingFactor(context.getLabelSpacingFactor());
generator.clusterTeams(context.clusterTeams());
if (context.isFixWidth())
generator.setWidth(context.getWidth());
else if (context.isFixHeight())
generator.setHeight(context.getHeight());
generator.printAdditionalLabels(context.generateAdditionalLabels());
Display.getDefault().asyncExec(new Runnable() {
@Override
public void run() {
try {
getGenerator().doGenerate(resource, fsa, new GeneratorContext());
} catch (GeneratorInputException e) {
MessageDialog.openInformation(HandlerUtil.getActiveShell(event), "Model Input", e.getMessage());
}
}
});
return true;
})).open();
}
Aggregations