use of org.rstudio.studio.client.workbench.views.source.SourceWindowManager in project rstudio by rstudio.
the class Shell method onExecutePendingInput.
@Override
public void onExecutePendingInput(ConsoleExecutePendingInputEvent event) {
// take it if we are focused and we have a command to enter
if (view_.getInputEditorDisplay().isFocused() && (view_.getInputEditorDisplay().getText().length() > 0)) {
processCommandEntry();
} else // otherwise delegate back to the source view. we do this via
// executing a command which is a bit of hack but it's a clean
// way to call code within the "current editor" (an event would
// go to all editors). another alternative would be to
// call a method on the SourceShim
{
AppCommand command = commands_.getCommandById(event.getCommandId());
// the current editor may be in another window; if one of our source
// windows was last focused, use that one instead
SourceWindowManager manager = RStudioGinjector.INSTANCE.getSourceWindowManager();
if (!StringUtil.isNullOrEmpty(manager.getLastFocusedSourceWindowId())) {
RStudioGinjector.INSTANCE.getSatelliteManager().dispatchCommand(command, SourceSatellite.NAME_PREFIX + manager.getLastFocusedSourceWindowId());
} else {
command.execute();
}
}
}
use of org.rstudio.studio.client.workbench.views.source.SourceWindowManager in project rstudio by rstudio.
the class TextEditingTarget method syncLocalSourceDb.
/**
* Push the current contents and state of the text editor into the local
* copy of the source database
*/
public void syncLocalSourceDb() {
SourceWindowManager manager = RStudioGinjector.INSTANCE.getSourceWindowManager();
JsArray<SourceDocument> docs = manager.getSourceDocs();
for (int i = 0; i < docs.length(); i++) {
if (docs.get(i).getId() == getId()) {
docs.get(i).getNotebookDoc().setChunkDefs(docDisplay_.getChunkDefs());
docs.get(i).setContents(docDisplay_.getCode());
docs.get(i).setDirty(dirtyState_.getValue());
break;
}
}
}
Aggregations