private void showDialog(final String initialPath,
String ignores,
final Strategy strategy)
{
final Display display = pDisplay_.get();
final ProgressIndicator indicator = display.progressIndicator();
display.setDialogCaption(strategy.getDialogCaption());
display.setIgnoresCaption(strategy.getIgnoresCaption());
display.setHelpLinkName(strategy.getHelpLinkName());
display.setCurrentPath(initialPath);
display.setIgnored(ignores);
display.scrollToBottom();
display.addPathChangedHandler(new ValueChangeHandler<String>() {
@Override
public void onValueChange(ValueChangeEvent<String> event)
{
display.setIgnored("");
indicator.onProgress("Getting ignored files for path...");
strategy.getIgnores(display.getCurrentPath(),
new ServerRequestCallback<ProcessResult>() {
@Override
public void onResponseReceived(final ProcessResult result)
{
indicator.clearProgress();
if (checkForProcessError(strategy.getDialogCaption(), result))
return;
display.setIgnored(result.getOutput());
display.focusIgnored();
}
@Override
public void onError(ServerError error)
{
indicator.onError(error.getUserMessage());
}});
}
});
display.saveButton().addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event)
{
indicator.onProgress("Setting ignored files for path...");
strategy.setIgnores(
display.getCurrentPath(),
display.getIgnored(),
new ServerRequestCallback<ProcessResult>() {
@Override
public void onResponseReceived(ProcessResult result)
{
indicator.onCompleted();
checkForProcessError(strategy.getDialogCaption(), result);
}
@Override
public void onError(ServerError error)
{
indicator.onError(error.getUserMessage());
}
});
}
});