use of org.rstudio.studio.client.workbench.views.source.editors.EditingTarget 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.EditingTarget in project rstudio by rstudio.
the class Source method getNextDefaultName.
private String getNextDefaultName(String defaultNamePrefix) {
if (StringUtil.isNullOrEmpty(defaultNamePrefix)) {
defaultNamePrefix = "Untitled";
}
int max = 0;
for (EditingTarget target : editors_) {
String name = target.getName().getValue();
max = Math.max(max, getUntitledNum(name, defaultNamePrefix));
}
return defaultNamePrefix + (max + 1);
}
Aggregations