use of org.rstudio.studio.client.workbench.views.source.editors.codebrowser.CodeBrowserEditingTarget in project rstudio by rstudio.
the class Source method attemptSourceNavigation.
private void attemptSourceNavigation(final SourceNavigation navigation, final AppCommand retryCommand) {
// see if we can navigate by id
String docId = navigation.getDocumentId();
final EditingTarget target = getEditingTargetForId(docId);
if (target != null) {
// case execute the retry command
if ((target == activeEditor_) && target.isAtSourceRow(navigation.getPosition())) {
if (retryCommand.isEnabled())
retryCommand.execute();
} else {
suspendSourceNavigationAdding_ = true;
try {
view_.selectTab(target.asWidget());
target.restorePosition(navigation.getPosition());
} finally {
suspendSourceNavigationAdding_ = false;
}
}
} else // check for code browser navigation
if ((navigation.getPath() != null) && navigation.getPath().startsWith(CodeBrowserEditingTarget.PATH)) {
activateCodeBrowser(navigation.getPath(), false, new SourceNavigationResultCallback<CodeBrowserEditingTarget>(navigation.getPosition(), retryCommand));
} else // check for file path navigation
if ((navigation.getPath() != null) && !navigation.getPath().startsWith(DataItem.URI_PREFIX)) {
FileSystemItem file = FileSystemItem.createFile(navigation.getPath());
TextFileType fileType = fileTypeRegistry_.getTextTypeForFile(file);
// open the file and restore the position
openFile(file, fileType, new SourceNavigationResultCallback<EditingTarget>(navigation.getPosition(), retryCommand));
} else {
// couldn't navigate to this item, retry
if (retryCommand.isEnabled())
retryCommand.execute();
}
}
Aggregations