in src/main/java/org/jetbrains/uncrustify/settings/UncrustifySettingsComponent.java [230:281]
public void verifyDocument() {
try {
if (getDocument().getLength() <= 0) {
setPathIsEmpty();
} else {
setDocumentIsBeingChecked();
String documentText = getDocument().getText(0, getDocument().getLength());
if (!FileUtil.exists(documentText)) {
setPathIsInvalid(UncrustifyBundle.message("uncrustify.settings.fileDoesNotExist"));
return;
}
if (!isExecutablePathValid()) {
setCouldNotVerify(UncrustifyBundle.message("uncrustify.settings.configStatus.couldNotVerify"));
return;
}
String executablePath = getExecutablePath();
UncrustifyConfigFile.verify(
executablePath,
documentText,
new UncrustifyConfigFile.VerificationListener() {
@Override
public void onInvalid(String output) {
setPathIsInvalidWithLink(UncrustifyBundle.message("uncrustify.settings.configStatus.fail"));
hyperlinkListener = () -> {
DialogBuilder dialogBuilder = new DialogBuilder(myConfigCheckField);
JTextArea textArea = new JTextArea(output, 20, 80);
dialogBuilder.setCenterPanel(ScrollPaneFactory.createScrollPane(textArea));
dialogBuilder.setPreferredFocusComponent(textArea);
dialogBuilder.setTitle(UncrustifyBundle.message("uncrustify.process.output.title"));
dialogBuilder.addCloseButton();
dialogBuilder.show();
};
}
@Override
public void onValid() {
setPathIsValid();
}
},
false);
}
} catch (BadLocationException ex) {
log.error(ex);
} catch (ExecutionException ex) {
setCouldNotVerify(UncrustifyBundle.message("uncrustify.settings.configStatus.couldNotVerify"));
}
}