@Override
public void actionPerformed(ActionEvent e) {
// Get the compiler, text-to-speech engine, and Windows controls
org.sodbeans.compiler.api.Compiler compiler =
Lookup.getDefault().lookup(org.sodbeans.compiler.api.Compiler.class);
TextToSpeech speech = TextToSpeechFactory.getDefaultTextToSpeech();
// If debugger is active, stop it
if (compiler.isDebuggerActive()) {
compiler.stopDebugger(true);
// windowService.localVariableWindowStop();
}
// Get the project the user is referencing
Project proj = getAppropriateProject(isMainMenuRequest(e));
MainFileProvider provider = getMainFile(proj);
if(!isProjectSetupCorrectly(provider)) {
return;
}
FileObject docs = provider.getDocumentsDirectory();
compiler.setDocumenationFolder(FileUtil.toFile(docs));
if(compiler.document()) {
//speak some kind of message saying that documentation was generated
if (TextToSpeechOptions.isScreenReading())
speech.speak("Documentation was built successfully", SpeechPriority.HIGH);
}
else {
if (TextToSpeechOptions.isScreenReading())
speech.speak("Error while building documentation", SpeechPriority.HIGH);
}
}