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);
}
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);
}
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);
}
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();
}
});
}
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();
}
});
}
Aggregations