use of org.rstudio.studio.client.workbench.views.source.model.CodeBrowserContents in project rstudio by rstudio.
the class CodeBrowserEditingTarget method initialize.
@Override
public void initialize(SourceDocument document, FileSystemContext fileContext, FileType type, Provider<String> defaultNameProvider) {
doc_ = document;
codeExecution_ = new EditingTargetCodeExecution(docDisplay_, getId());
view_ = new CodeBrowserEditingTargetWidget(commands_, globalDisplay_, events_, server_, docDisplay_);
TextEditingTarget.registerPrefs(releaseOnDismiss_, prefs_, docDisplay_, document);
TextEditingTarget.syncFontSize(releaseOnDismiss_, events_, view_, fontSizeManager_);
releaseOnDismiss_.add(prefs_.softWrapRFiles().addValueChangeHandler(new ValueChangeHandler<Boolean>() {
public void onValueChange(ValueChangeEvent<Boolean> evt) {
view_.adaptToFileType(FileTypeRegistry.R);
}
}));
// if we have contents then set them
CodeBrowserContents contents = getContents();
if (contents.getContext().length() > 0) {
ensureContext(contents.getContext(), new Command() {
@Override
public void execute() {
}
});
} else {
docDisplay_.setCode("", false);
}
}
use of org.rstudio.studio.client.workbench.views.source.model.CodeBrowserContents in project rstudio by rstudio.
the class CodeBrowserEditingTarget method showFunction.
public void showFunction(SearchPathFunctionDefinition functionDef) {
// set the current function
currentFunction_ = functionDef;
view_.showFunction(functionDef);
view_.scrollToLeft();
name_.setValue(functionDef.getName(), true);
// we only show the warning bar (for debug line matching) once per
// function; don't keep showing it if the user dismisses
shownWarningBar_ = false;
// update document properties if necessary
final CodeBrowserContents contents = CodeBrowserContents.create(getContext());
if (!contents.equalTo(getContents())) {
HashMap<String, String> props = new HashMap<String, String>();
contents.fillProperties(props);
server_.modifyDocumentProperties(doc_.getId(), props, new SimpleRequestCallback<Void>("Error") {
@Override
public void onResponseReceived(Void response) {
contents.fillProperties(doc_.getProperties());
}
});
}
}
Aggregations