use of org.rstudio.studio.client.workbench.views.source.editors.text.TextEditingTarget in project rstudio by rstudio.
the class Source method withTarget.
private void withTarget(String id, CommandWithArg<TextEditingTarget> command, Command onFailure) {
EditingTarget target = StringUtil.isNullOrEmpty(id) ? activeEditor_ : getEditingTargetForId(id);
if (target == null) {
if (onFailure != null)
onFailure.execute();
return;
}
if (!(target instanceof TextEditingTarget)) {
if (onFailure != null)
onFailure.execute();
return;
}
command.execute((TextEditingTarget) target);
}
use of org.rstudio.studio.client.workbench.views.source.editors.text.TextEditingTarget in project rstudio by rstudio.
the class Source method pasteFileContentsAtCursor.
private void pasteFileContentsAtCursor(final String path, final String encoding) {
if (activeEditor_ != null && activeEditor_ instanceof TextEditingTarget) {
final TextEditingTarget target = (TextEditingTarget) activeEditor_;
server_.getFileContents(path, encoding, new ServerRequestCallback<String>() {
@Override
public void onResponseReceived(String content) {
target.insertCode(content, false);
}
@Override
public void onError(ServerError error) {
Debug.logError(error);
}
});
}
}
use of org.rstudio.studio.client.workbench.views.source.editors.text.TextEditingTarget in project rstudio by rstudio.
the class Source method reindent.
private void reindent() {
if (activeEditor_ != null && activeEditor_ instanceof TextEditingTarget) {
TextEditingTarget editor = (TextEditingTarget) activeEditor_;
editor.getDocDisplay().reindent();
}
}
Aggregations