Search in sources :

Example 1 with EditorModeChangedEvent

use of org.rstudio.studio.client.workbench.views.source.editors.text.events.EditorModeChangedEvent in project rstudio by rstudio.

the class TextEditingTargetIdleMonitor method beginMonitoring.

public void beginMonitoring() {
    endMonitoring();
    monitors_.add(display_.addEditorModeChangedHandler(new EditorModeChangedEvent.Handler() {

        @Override
        public void onEditorModeChanged(EditorModeChangedEvent event) {
            Scheduler.get().scheduleDeferred(new ScheduledCommand() {

                @Override
                public void execute() {
                    refreshCommands();
                }
            });
        }
    }));
    monitors_.add(display_.addCursorChangedHandler(new CursorChangedHandler() {

        @Override
        public void onCursorChanged(CursorChangedEvent event) {
            mouseMovedLast_ = false;
            timer_.schedule(DELAY_MS);
        }
    }));
    monitors_.add(display_.addAttachHandler(new AttachEvent.Handler() {

        @Override
        public void onAttachOrDetach(AttachEvent event) {
            if (!event.isAttached())
                onDetach();
        }
    }));
}
Also used : EditorModeChangedEvent(org.rstudio.studio.client.workbench.views.source.editors.text.events.EditorModeChangedEvent) ScheduledCommand(com.google.gwt.core.client.Scheduler.ScheduledCommand) AttachEvent(com.google.gwt.event.logical.shared.AttachEvent) CursorChangedHandler(org.rstudio.studio.client.workbench.views.source.editors.text.events.CursorChangedHandler) NativePreviewHandler(com.google.gwt.user.client.Event.NativePreviewHandler) CursorChangedHandler(org.rstudio.studio.client.workbench.views.source.editors.text.events.CursorChangedHandler) CursorChangedEvent(org.rstudio.studio.client.workbench.views.source.editors.text.events.CursorChangedEvent)

Aggregations

ScheduledCommand (com.google.gwt.core.client.Scheduler.ScheduledCommand)1 AttachEvent (com.google.gwt.event.logical.shared.AttachEvent)1 NativePreviewHandler (com.google.gwt.user.client.Event.NativePreviewHandler)1 CursorChangedEvent (org.rstudio.studio.client.workbench.views.source.editors.text.events.CursorChangedEvent)1 CursorChangedHandler (org.rstudio.studio.client.workbench.views.source.editors.text.events.CursorChangedHandler)1 EditorModeChangedEvent (org.rstudio.studio.client.workbench.views.source.editors.text.events.EditorModeChangedEvent)1