Search in sources :

Example 1 with DataEditingTarget

use of org.rstudio.studio.client.workbench.views.source.editors.data.DataEditingTarget in project rstudio by rstudio.

the class Source method onShowData.

public void onShowData(ShowDataEvent event) {
    // ignore if we're a satellite
    if (!SourceWindowManager.isMainSourceWindow())
        return;
    DataItem data = event.getData();
    for (int i = 0; i < editors_.size(); i++) {
        String path = editors_.get(i).getPath();
        if (path != null && path.equals(data.getURI())) {
            ((DataEditingTarget) editors_.get(i)).updateData(data);
            ensureVisible(false);
            view_.selectTab(i);
            return;
        }
    }
    ensureVisible(true);
    server_.newDocument(FileTypeRegistry.DATAFRAME.getTypeId(), null, (JsObject) data.cast(), new SimpleRequestCallback<SourceDocument>("Show Data Frame") {

        @Override
        public void onResponseReceived(SourceDocument response) {
            addTab(response, OPEN_INTERACTIVE);
        }
    });
}
Also used : DataEditingTarget(org.rstudio.studio.client.workbench.views.source.editors.data.DataEditingTarget) DataItem(org.rstudio.studio.client.workbench.views.source.model.DataItem) SourceDocument(org.rstudio.studio.client.workbench.views.source.model.SourceDocument) JSONString(com.google.gwt.json.client.JSONString) JsArrayString(com.google.gwt.core.client.JsArrayString)

Aggregations

JsArrayString (com.google.gwt.core.client.JsArrayString)1 JSONString (com.google.gwt.json.client.JSONString)1 DataEditingTarget (org.rstudio.studio.client.workbench.views.source.editors.data.DataEditingTarget)1 DataItem (org.rstudio.studio.client.workbench.views.source.model.DataItem)1 SourceDocument (org.rstudio.studio.client.workbench.views.source.model.SourceDocument)1