use of org.rstudio.studio.client.common.synctex.model.PdfLocation in project rstudio by rstudio.
the class PDFViewer method onCompilePdfCompleted.
@Override
public void onCompilePdfCompleted(CompilePdfCompletedEvent event) {
// only handle PDF compile events when we're the preferred viewer
if (!prefs_.pdfPreview().getValue().equals(UIPrefs.PDF_PREVIEW_RSTUDIO))
return;
// only handle successful compiles
final CompilePdfResult result = event.getResult();
if (!result.getSucceeded())
return;
// when the PDF is finished rendering, optionally navigate to the desired
// location, or set and restore the current location
final PdfLocation pdfLocation = result.getPdfLocation();
if (pdfLocation != null) {
executeOnPdfLoad_ = new Operation() {
@Override
public void execute() {
PdfJsWindow.navigateTo(pdfJsWindow_, pdfLocation);
}
};
}
lastSuccessfulPdfPath_ = result.getPdfPath();
openPdfUrl(result.getViewPdfUrl(), result.isSynctexAvailable(), pdfLocation == null);
}
use of org.rstudio.studio.client.common.synctex.model.PdfLocation in project rstudio by rstudio.
the class Synctex method doForwardSearch.
private void doForwardSearch(String rootDocument, JavaScriptObject sourceLocationObject) {
SourceLocation sourceLocation = sourceLocationObject.cast();
final ProgressIndicator indicator = getSyncProgress();
server_.synctexForwardSearch(rootDocument, sourceLocation, new ServerRequestCallback<PdfLocation>() {
@Override
public void onResponseReceived(PdfLocation location) {
indicator.onCompleted();
if (location != null)
eventBus_.fireEvent(new SynctexViewPdfEvent(location));
}
@Override
public void onError(ServerError error) {
indicator.onError(error.getUserMessage());
}
});
}
use of org.rstudio.studio.client.common.synctex.model.PdfLocation in project rstudio by rstudio.
the class Synctex method doInverseSearch.
private void doInverseSearch(JavaScriptObject pdfLocationObject) {
PdfLocation pdfLocation = pdfLocationObject.cast();
final ProgressIndicator indicator = getSyncProgress();
server_.synctexInverseSearch(pdfLocation, new ServerRequestCallback<SourceLocation>() {
@Override
public void onResponseReceived(SourceLocation location) {
indicator.onCompleted();
if (location != null)
goToSourceLocation(location);
}
@Override
public void onError(ServerError error) {
indicator.onError(error.getUserMessage());
}
});
}
Aggregations