Search in sources :

Example 16 with ScheduledCommand

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

the class ToolbarPopupMenu method insertItem.

public void insertItem(MenuItem menuItem, int beforeIndex) {
    ScheduledCommand command = menuItem.getScheduledCommand();
    if (command != null)
        menuItem.setScheduledCommand(new ToolbarPopupMenuCommand(command));
    menuBar_.insertItem(menuItem, beforeIndex);
}
Also used : ScheduledCommand(com.google.gwt.core.client.Scheduler.ScheduledCommand)

Example 17 with ScheduledCommand

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

the class ToolbarPopupMenu method addItem.

public void addItem(MenuItem menuItem) {
    ScheduledCommand command = menuItem.getScheduledCommand();
    if (command == null && menuItem instanceof AppMenuItem)
        command = ((AppMenuItem) menuItem).getScheduledCommand(true);
    if (command != null)
        menuItem.setScheduledCommand(new ToolbarPopupMenuCommand(command));
    menuBar_.addItem(menuItem);
}
Also used : ScheduledCommand(com.google.gwt.core.client.Scheduler.ScheduledCommand) AppMenuItem(org.rstudio.core.client.command.AppMenuItem)

Example 18 with ScheduledCommand

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

the class ToolbarPopupMenuButton method addMenuItem.

public void addMenuItem(final MenuItem item, final String value) {
    final ScheduledCommand cmd = item.getScheduledCommand();
    item.setScheduledCommand(new Command() {

        @Override
        public void execute() {
            setText(value);
            if (cmd != null)
                cmd.execute();
        }
    });
    getMenu().addItem(item);
}
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)

Example 19 with ScheduledCommand

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

the class AceEditorWidget method removeMarkersAtCursorPosition.

public void removeMarkersAtCursorPosition() {
    // Defer this so other event handling can update anchors etc.
    Scheduler.get().scheduleDeferred(new ScheduledCommand() {

        @Override
        public void execute() {
            Position cursor = editor_.getCursorPosition();
            JsArray<AceAnnotation> newAnnotations = JsArray.createArray().cast();
            for (int i = 0; i < annotations_.size(); i++) {
                AnchoredAceAnnotation annotation = annotations_.get(i);
                int markerId = annotation.getMarkerId();
                Marker marker = editor_.getSession().getMarker(markerId);
                // a previous action.
                if (marker == null)
                    continue;
                Range range = marker.getRange();
                if (!range.contains(cursor))
                    newAnnotations.push(annotation.asAceAnnotation());
                else
                    editor_.getSession().removeMarker(markerId);
            }
            editor_.getSession().setAnnotations(newAnnotations);
            editor_.getRenderer().renderMarkers();
        }
    });
}
Also used : JsArray(com.google.gwt.core.client.JsArray) ScheduledCommand(com.google.gwt.core.client.Scheduler.ScheduledCommand) Position(org.rstudio.studio.client.workbench.views.source.editors.text.ace.Position) Marker(org.rstudio.studio.client.workbench.views.source.editors.text.ace.Marker) Range(org.rstudio.studio.client.workbench.views.source.editors.text.ace.Range) AnchoredRange(org.rstudio.studio.client.workbench.views.source.editors.text.ace.AnchoredRange)

Example 20 with ScheduledCommand

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

the class SourcePane method onLoad.

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

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

Aggregations

ScheduledCommand (com.google.gwt.core.client.Scheduler.ScheduledCommand)104 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