Search in sources :

Example 6 with Handler

use of org.rstudio.core.client.command.Handler in project rstudio by rstudio.

the class HTMLPreviewPresenter method onSaveHtmlPreviewAs.

@Handler
public void onSaveHtmlPreviewAs() {
    if (lastSuccessfulPreview_ != null) {
        FileSystemItem defaultDir = savePreviewDir_ != null ? FileSystemItem.createDir(savePreviewDir_) : FileSystemItem.home();
        final FileSystemItem sourceFile = FileSystemItem.createFile(lastSuccessfulPreview_.getHtmlFile());
        FileSystemItem initialFilePath = FileSystemItem.createFile(defaultDir.completePath(sourceFile.getStem()));
        fileDialogs_.saveFile("Save File As", fileSystemContext_, initialFilePath, sourceFile.getExtension(), false, new ProgressOperationWithInput<FileSystemItem>() {

            @Override
            public void execute(FileSystemItem targetFile, ProgressIndicator indicator) {
                if (targetFile == null || sourceFile.equalTo(targetFile)) {
                    indicator.onCompleted();
                    return;
                }
                indicator.onProgress("Saving File...");
                server_.copyFile(sourceFile, targetFile, true, new VoidServerRequestCallback(indicator));
                savePreviewDir_ = targetFile.getParentPathString();
                session_.persistClientState();
            }
        });
    }
}
Also used : FileSystemItem(org.rstudio.core.client.files.FileSystemItem) ProgressIndicator(org.rstudio.core.client.widget.ProgressIndicator) VoidServerRequestCallback(org.rstudio.studio.client.server.VoidServerRequestCallback) ClickHandler(com.google.gwt.event.dom.client.ClickHandler) NativePreviewHandler(com.google.gwt.user.client.Event.NativePreviewHandler) CloseHandler(com.google.gwt.event.logical.shared.CloseHandler) Handler(org.rstudio.core.client.command.Handler)

Example 7 with Handler

use of org.rstudio.core.client.command.Handler in project rstudio by rstudio.

the class ProfilerEditingTarget method onGotoProfileSource.

@Handler
public void onGotoProfileSource() {
    FilePosition filePosition = FilePosition.create(selectedLine_, 0);
    fileTypeRegistry_.editFile(FileSystemItem.createFile(selectedPath_), filePosition);
}
Also used : FilePosition(org.rstudio.core.client.FilePosition) Handler(org.rstudio.core.client.command.Handler) EnsureHeightHandler(org.rstudio.core.client.events.EnsureHeightHandler) SelectionCommitHandler(org.rstudio.core.client.events.SelectionCommitHandler) EnsureVisibleHandler(org.rstudio.core.client.events.EnsureVisibleHandler) CloseHandler(com.google.gwt.event.logical.shared.CloseHandler)

Example 8 with Handler

use of org.rstudio.core.client.command.Handler 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();
}
Also used : EditDialog(org.rstudio.studio.client.workbench.views.edit.ui.EditDialog) Size(org.rstudio.core.client.Size) ProgressIndicator(org.rstudio.core.client.widget.ProgressIndicator) VoidServerRequestCallback(org.rstudio.studio.client.server.VoidServerRequestCallback) JSONString(com.google.gwt.json.client.JSONString) Handler(org.rstudio.core.client.command.Handler)

Example 9 with Handler

use of org.rstudio.core.client.command.Handler in project rstudio by rstudio.

the class Presentation method onPresentationFullscreen.

@Handler
void onPresentationFullscreen() {
    // clear the internal iframe so there is no conflict over handling
    // presentation events (we'll restore it on zoom close)
    view_.clear();
    // show the zoomed version of the presentation. after it closes
    // restore the inline version
    view_.zoom(session_.getSessionInfo().getPresentationName(), buildPresentationUrl("zoom"), new Command() {

        @Override
        public void execute() {
            view_.load(buildPresentationUrl(), currentState_.getFilePath());
        }
    });
}
Also used : Command(com.google.gwt.user.client.Command) TimeBufferedCommand(org.rstudio.core.client.TimeBufferedCommand) Handler(org.rstudio.core.client.command.Handler)

Example 10 with Handler

use of org.rstudio.core.client.command.Handler 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;
                }
            });
        }
    });
}
Also used : FileSystemItem(org.rstudio.core.client.files.FileSystemItem) ProgressIndicator(org.rstudio.core.client.widget.ProgressIndicator) VoidServerRequestCallback(org.rstudio.studio.client.server.VoidServerRequestCallback) Handler(org.rstudio.core.client.command.Handler)

Aggregations

Handler (org.rstudio.core.client.command.Handler)55 ChangeFontSizeHandler (org.rstudio.studio.client.application.events.ChangeFontSizeHandler)20 EnsureHeightHandler (org.rstudio.core.client.events.EnsureHeightHandler)19 EnsureVisibleHandler (org.rstudio.core.client.events.EnsureVisibleHandler)19 FileChangeHandler (org.rstudio.studio.client.workbench.views.files.events.FileChangeHandler)18 HideMessageHandler (org.rstudio.studio.client.workbench.views.source.editors.text.status.StatusBar.HideMessageHandler)18 RecordNavigationPositionHandler (org.rstudio.studio.client.workbench.views.source.events.RecordNavigationPositionHandler)18 JsArrayString (com.google.gwt.core.client.JsArrayString)12 ProgressIndicator (org.rstudio.core.client.widget.ProgressIndicator)12 ValueChangeHandler (com.google.gwt.event.logical.shared.ValueChangeHandler)11 FileSystemItem (org.rstudio.core.client.files.FileSystemItem)10 VoidServerRequestCallback (org.rstudio.studio.client.server.VoidServerRequestCallback)9 CloseHandler (com.google.gwt.event.logical.shared.CloseHandler)8 SelectionHandler (com.google.gwt.event.logical.shared.SelectionHandler)8 Command (com.google.gwt.user.client.Command)8 ServerError (org.rstudio.studio.client.server.ServerError)7 InputEditorPosition (org.rstudio.studio.client.workbench.views.console.shell.editor.InputEditorPosition)7 NativePreviewHandler (com.google.gwt.user.client.Event.NativePreviewHandler)6 Breakpoint (org.rstudio.studio.client.common.debugging.model.Breakpoint)6 Position (org.rstudio.studio.client.workbench.views.source.editors.text.ace.Position)6