use of org.rstudio.studio.client.server.VoidServerRequestCallback in project rstudio by rstudio.
the class Presentation method onTutorialFeedback.
@Handler
void onTutorialFeedback() {
EditDialog editDialog = new EditDialog("Provide Feedback", "Submit", "", false, true, new Size(450, 300), new ProgressOperationWithInput<String>() {
@Override
public void execute(String input, ProgressIndicator indicator) {
if (input == null) {
indicator.onCompleted();
return;
}
indicator.onProgress("Saving feedback...");
server_.tutorialFeedback(input, new VoidServerRequestCallback(indicator));
}
});
editDialog.showModal();
}
use of org.rstudio.studio.client.server.VoidServerRequestCallback in project rstudio by rstudio.
the class Presentation method onPresentationSaveAsStandalone.
@Handler
void onPresentationSaveAsStandalone() {
// determine the default file name
if (saveAsStandaloneDefaultPath_ == null) {
FileSystemItem presFilePath = FileSystemItem.createFile(currentState_.getFilePath());
saveAsStandaloneDefaultPath_ = FileSystemItem.createFile(presFilePath.getParentPath().completePath(presFilePath.getStem() + ".html"));
}
fileDialogs_.saveFile("Save Presentation As", fileSystemContext_, saveAsStandaloneDefaultPath_, ".html", false, new ProgressOperationWithInput<FileSystemItem>() {
@Override
public void execute(final FileSystemItem targetFile, ProgressIndicator indicator) {
if (targetFile == null) {
indicator.onCompleted();
return;
}
indicator.onProgress("Saving Presentation...");
server_.createStandalonePresentation(targetFile.getPath(), new VoidServerRequestCallback(indicator) {
@Override
public void onSuccess() {
saveAsStandaloneDefaultPath_ = targetFile;
}
});
}
});
}
use of org.rstudio.studio.client.server.VoidServerRequestCallback in project rstudio by rstudio.
the class Source method onNewRPresentationDoc.
@Handler
public void onNewRPresentationDoc() {
dependencyManager_.withRMarkdown("Authoring R Presentations", new Command() {
@Override
public void execute() {
fileDialogs_.saveFile("New R Presentation", fileContext_, workbenchContext_.getDefaultFileDialogDir(), ".Rpres", true, new ProgressOperationWithInput<FileSystemItem>() {
@Override
public void execute(final FileSystemItem input, final ProgressIndicator indicator) {
if (input == null) {
indicator.onCompleted();
return;
}
indicator.onProgress("Creating Presentation...");
server_.createNewPresentation(input.getPath(), new VoidServerRequestCallback(indicator) {
@Override
public void onSuccess() {
openFile(input, FileTypeRegistry.RPRESENTATION, new CommandWithArg<EditingTarget>() {
@Override
public void execute(EditingTarget arg) {
server_.showPresentationPane(input.getPath(), new VoidServerRequestCallback());
}
});
}
});
}
});
}
});
}
use of org.rstudio.studio.client.server.VoidServerRequestCallback in project rstudio by rstudio.
the class Source method onTabReorder.
@Override
public void onTabReorder(TabReorderEvent event) {
syncTabOrder();
// valid location
if (event.getOldPos() < 0 || event.getOldPos() >= tabOrder_.size() || event.getNewPos() < 0 || event.getNewPos() >= tabOrder_.size()) {
return;
}
// remove the tab from its old position
int idx = tabOrder_.get(event.getOldPos());
// force type box
tabOrder_.remove(new Integer(idx));
// add it to its new position
tabOrder_.add(event.getNewPos(), idx);
// sort the document IDs and send to the server
ArrayList<String> ids = new ArrayList<String>();
for (int i = 0; i < tabOrder_.size(); i++) {
ids.add(editors_.get(tabOrder_.get(i)).getId());
}
server_.setDocOrder(ids, new VoidServerRequestCallback());
// activate the tab
setPhysicalTabIndex(event.getNewPos());
fireDocTabsChanged();
}
use of org.rstudio.studio.client.server.VoidServerRequestCallback in project rstudio by rstudio.
the class Source method closeTabIndex.
private void closeTabIndex(int idx, boolean closeDocument) {
EditingTarget target = editors_.remove(idx);
tabOrder_.remove(new Integer(idx));
for (int i = 0; i < tabOrder_.size(); i++) {
if (tabOrder_.get(i) > idx) {
tabOrder_.set(i, tabOrder_.get(i) - 1);
}
}
target.onDismiss(closeDocument ? EditingTarget.DISMISS_TYPE_CLOSE : EditingTarget.DISMISS_TYPE_MOVE);
if (activeEditor_ == target) {
activeEditor_.onDeactivate();
activeEditor_ = null;
}
if (closeDocument) {
events_.fireEvent(new DocTabClosedEvent(target.getId()));
server_.closeDocument(target.getId(), new VoidServerRequestCallback());
}
manageCommands();
fireDocTabsChanged();
if (view_.getTabCount() == 0) {
sourceNavigationHistory_.clear();
events_.fireEvent(new LastSourceDocClosedEvent());
}
}
Aggregations