use of com.google.gwt.user.client.ui.PopupPanel.PositionCallback in project rstudio by rstudio.
the class SVNReviewPanel method showContextMenu.
@Override
public void showContextMenu(final int clientX, final int clientY) {
final ToolbarPopupMenu menu = new ToolbarPopupMenu();
menu.addItem(commands_.vcsAddFiles().createMenuItem(false));
menu.addItem(commands_.vcsRemoveFiles().createMenuItem(false));
menu.addSeparator();
menu.addItem(commands_.vcsRevert().createMenuItem(false));
menu.addItem(commands_.vcsIgnore().createMenuItem(false));
menu.addSeparator();
menu.addItem(commands_.vcsResolve().createMenuItem(false));
menu.addSeparator();
menu.addItem(commands_.vcsOpen().createMenuItem(false));
menu.setPopupPositionAndShow(new PositionCallback() {
@Override
public void setPosition(int offsetWidth, int offsetHeight) {
menu.setPopupPosition(clientX, clientY);
}
});
}
use of com.google.gwt.user.client.ui.PopupPanel.PositionCallback in project rstudio by rstudio.
the class GitPane method showContextMenu.
@Override
public void showContextMenu(final int clientX, final int clientY) {
final ToolbarPopupMenu menu = new ToolbarPopupMenu();
menu.addItem(commands_.vcsDiff().createMenuItem(false));
menu.addSeparator();
menu.addItem(commands_.vcsRevert().createMenuItem(false));
menu.addItem(commands_.vcsIgnore().createMenuItem(false));
menu.addSeparator();
menu.addItem(commands_.vcsOpen().createMenuItem(false));
menu.setPopupPositionAndShow(new PositionCallback() {
@Override
public void setPosition(int offsetWidth, int offsetHeight) {
menu.setPopupPosition(clientX, clientY);
}
});
}
use of com.google.gwt.user.client.ui.PopupPanel.PositionCallback in project rstudio by rstudio.
the class GitReviewPanel method showContextMenu.
@Override
public void showContextMenu(final int clientX, final int clientY, Command openSelectedCommand) {
final ToolbarPopupMenu menu = new ToolbarPopupMenu();
MenuItem stageMenu = new MenuItem(AppCommand.formatMenuLabel(new ImageResource2x(RES.stage2x()), "Stage", ""), true, new Command() {
@Override
public void execute() {
stageFilesButton_.click();
}
});
if (stageFilesButton_.isEnabled()) {
menu.addItem(stageMenu);
menu.addSeparator();
}
MenuItem revertMenu = new MenuItem(AppCommand.formatMenuLabel(new ImageResource2x(RES.discard2x()), "Revert...", ""), true, new Command() {
@Override
public void execute() {
revertFilesButton_.click();
}
});
if (revertFilesButton_.isEnabled())
menu.addItem(revertMenu);
MenuItem ignoreMenu = new MenuItem(AppCommand.formatMenuLabel(new ImageResource2x(RES.ignore2x()), "Ignore...", ""), true, new Command() {
@Override
public void execute() {
ignoreButton_.click();
}
});
if (ignoreButton_.isEnabled())
menu.addItem(ignoreMenu);
menu.addSeparator();
MenuItem openMenu = new MenuItem(AppCommand.formatMenuLabel(null, "Open File", ""), true, openSelectedCommand);
menu.addItem(openMenu);
menu.setPopupPositionAndShow(new PositionCallback() {
@Override
public void setPosition(int offsetWidth, int offsetHeight) {
menu.setPopupPosition(clientX, clientY);
}
});
}
use of com.google.gwt.user.client.ui.PopupPanel.PositionCallback in project gerrit by GerritCodeReview.
the class ShowHelpCommand method onKeyPress.
@Override
public void onKeyPress(final KeyPressEvent event) {
if (current != null) {
// Already open? Close the dialog.
//
current.hide();
return;
}
final KeyHelpPopup help = new KeyHelpPopup();
help.addCloseHandler(new CloseHandler<PopupPanel>() {
@Override
public void onClose(final CloseEvent<PopupPanel> event) {
current = null;
BUS.fireEvent(new FocusEvent() {
});
}
});
current = help;
help.setPopupPositionAndShow(new PositionCallback() {
@Override
public void setPosition(final int pWidth, final int pHeight) {
final int left = (Window.getClientWidth() - pWidth) >> 1;
final int wLeft = Window.getScrollLeft();
final int wTop = Window.getScrollTop();
help.setPopupPosition(wLeft + left, wTop + 50);
}
});
}
Aggregations