use of jetbrains.communicator.core.transport.GetVFileContentsXmlMessage in project intellij-plugins by JetBrains.
the class Helper method fillVFileContent.
public static void fillVFileContent(final Transport transport, final User user, final VFile vFile, IDEFacade ideFacade) {
if (user.isOnline()) {
try {
UIUtil.run(ideFacade, StringUtil.getMsg("GetVFileContents.title"), new Runnable() {
@Override
public void run() {
final Semaphore semaphore = new Semaphore(1);
try {
semaphore.acquire();
transport.sendXmlMessage(user, new GetVFileContentsXmlMessage(vFile) {
@Override
public void processResponse(Element responseElement) {
super.processResponse(responseElement);
semaphore.release();
}
});
semaphore.tryAcquire(getWaitTimeout(), TimeUnit.MILLISECONDS);
} catch (InterruptedException ignored) {
// noop
}
}
});
} catch (CanceledException e) {
LOG.info(e.getMessage(), e);
}
if (vFile.getContents() == null) {
String secondParamForFailMessage = user.getDisplayName();
String address = transport.getAddressString(user);
if (!com.intellij.openapi.util.text.StringUtil.isEmptyOrSpaces(address)) {
secondParamForFailMessage += " from " + address;
}
ideFacade.showMessage(StringUtil.FAILED_TITLE, StringUtil.getMsg("GetVFileContents.fail", vFile.getDisplayName(), secondParamForFailMessage));
}
}
}
Aggregations