Search in sources :

Example 86 with ScheduledCommand

use of com.google.gwt.core.client.Scheduler.ScheduledCommand in project rstudio by rstudio.

the class TextEditingTargetWidget method onActivate.

public void onActivate() {
    editor_.onActivate();
    Scheduler.get().scheduleDeferred(new ScheduledCommand() {

        @Override
        public void execute() {
            manageToolbarSizes();
        }
    });
}
Also used : ScheduledCommand(com.google.gwt.core.client.Scheduler.ScheduledCommand)

Example 87 with ScheduledCommand

use of com.google.gwt.core.client.Scheduler.ScheduledCommand in project rstudio by rstudio.

the class AceEditorBackgroundLinkHighlighter method refreshHighlighters.

private void refreshHighlighters(String mode) {
    clearAllMarkers();
    Scheduler.get().scheduleDeferred(new ScheduledCommand() {

        @Override
        public void execute() {
            TextFileType fileType = editor_.getFileType();
            highlighters_.clear();
            highlighters_.add(webLinkHighlighter());
            if (fileType != null && (fileType.isMarkdown() || fileType.isRmd()))
                highlighters_.add(markdownLinkHighlighter());
            nextHighlightStart_ = 0;
            timer_.schedule(700);
        }
    });
}
Also used : ScheduledCommand(com.google.gwt.core.client.Scheduler.ScheduledCommand) TextFileType(org.rstudio.studio.client.common.filetypes.TextFileType)

Example 88 with ScheduledCommand

use of com.google.gwt.core.client.Scheduler.ScheduledCommand in project rstudio by rstudio.

the class SVNCommitDialog method onLoad.

@Override
protected void onLoad() {
    super.onLoad();
    Scheduler.get().scheduleDeferred(new ScheduledCommand() {

        @Override
        public void execute() {
            message_.setFocus(true);
        }
    });
}
Also used : ScheduledCommand(com.google.gwt.core.client.Scheduler.ScheduledCommand)

Example 89 with ScheduledCommand

use of com.google.gwt.core.client.Scheduler.ScheduledCommand in project rstudio by rstudio.

the class DesktopExport method export.

public static void export(final ExportPlotSizeEditor sizeEditor, final OperationWithInput<Rectangle> exporter, final Operation onCompleted) {
    sizeEditor.prepareForExport(new Command() {

        @Override
        public void execute() {
            // hide gripper
            sizeEditor.setGripperVisible(false);
            // get zoom level
            double zoomLevel = BrowseCap.isMacintoshDesktop() ? getSafariZoomFactor() : Desktop.getFrame().getZoomLevel();
            // get the preview iframe rect
            ElementEx iframe = sizeEditor.getPreviewIFrame().<ElementEx>cast();
            final Rectangle viewerRect = new Rectangle((int) Math.ceil(zoomLevel * iframe.getClientLeft()), (int) Math.ceil(zoomLevel * iframe.getClientTop()), (int) Math.ceil(zoomLevel * iframe.getClientWidth()), (int) Math.ceil(zoomLevel * iframe.getClientHeight())).inflate(-1);
            // perform the export
            Scheduler.get().scheduleDeferred(new ScheduledCommand() {

                @Override
                public void execute() {
                    exporter.execute(viewerRect);
                    // show gripper
                    sizeEditor.setGripperVisible(true);
                    // call onCompleted
                    if (onCompleted != null)
                        onCompleted.execute();
                }
            });
        }
    });
}
Also used : ScheduledCommand(com.google.gwt.core.client.Scheduler.ScheduledCommand) Command(com.google.gwt.user.client.Command) ScheduledCommand(com.google.gwt.core.client.Scheduler.ScheduledCommand) ElementEx(org.rstudio.core.client.dom.ElementEx) Rectangle(org.rstudio.core.client.Rectangle)

Example 90 with ScheduledCommand

use of com.google.gwt.core.client.Scheduler.ScheduledCommand in project rstudio by rstudio.

the class ChunkOptionsPopupPanel method makeInputBox.

private TextBox makeInputBox(final String option, final boolean enquote) {
    final TextBox box = new TextBox();
    box.getElement().setAttribute("placeholder", "Default");
    box.setWidth("40px");
    DomUtils.addKeyHandlers(box, new NativeEventHandler() {

        @Override
        public void onNativeEvent(NativeEvent event) {
            Scheduler.get().scheduleDeferred(new ScheduledCommand() {

                @Override
                public void execute() {
                    String text = box.getText().trim();
                    boolean isEmpty = StringUtil.isNullOrEmpty(text);
                    if (enquote && !isEmpty) {
                        text = StringUtil.ensureQuoted(text);
                        text = text.replaceAll("\\\\", "\\\\\\\\");
                    }
                    if (isEmpty)
                        unset(option);
                    else
                        set(option, text);
                    synchronize();
                }
            });
        }
    });
    return box;
}
Also used : ScheduledCommand(com.google.gwt.core.client.Scheduler.ScheduledCommand) NativeEventHandler(org.rstudio.core.client.dom.DomUtils.NativeEventHandler) TextBox(com.google.gwt.user.client.ui.TextBox) NativeEvent(com.google.gwt.dom.client.NativeEvent)

Aggregations

ScheduledCommand (com.google.gwt.core.client.Scheduler.ScheduledCommand)105 Position (org.rstudio.studio.client.workbench.views.source.editors.text.ace.Position)7 Element (com.google.gwt.dom.client.Element)6 Range (org.rstudio.studio.client.workbench.views.source.editors.text.ace.Range)6 JsArray (com.google.gwt.core.client.JsArray)5 Command (com.google.gwt.user.client.Command)5 ServerError (org.rstudio.studio.client.server.ServerError)5 JsArrayString (com.google.gwt.core.client.JsArrayString)4 ArrayList (java.util.ArrayList)4 Test (org.junit.Test)4 FileSystemItem (org.rstudio.core.client.files.FileSystemItem)4 RepeatingCommand (com.google.gwt.core.client.Scheduler.RepeatingCommand)3 ClickEvent (com.google.gwt.event.dom.client.ClickEvent)3 Event (com.google.gwt.user.client.Event)3 NativePreviewHandler (com.google.gwt.user.client.Event.NativePreviewHandler)3 Timer (com.google.gwt.user.client.Timer)3 WindowEx (org.rstudio.core.client.dom.WindowEx)3 SourcePosition (org.rstudio.studio.client.workbench.views.source.model.SourcePosition)3 ErrorDialog (com.google.gerrit.client.ErrorDialog)2 OnEditEnabler (com.google.gerrit.client.ui.OnEditEnabler)2