use of com.google.gwt.user.client.ui.PopupPanel.PositionCallback in project rstudio by rstudio.
the class DiagnosticsBackgroundPopup method showPopup.
private void showPopup(String text, Range range) {
hidePopup();
popup_ = new DiagnosticsPopupPanel(text, range);
final Rectangle coords = editor_.toScreenCoordinates(range);
popup_.setTitle("Diagnostics");
popup_.setPopupPositionAndShow(new PositionCallback() {
@Override
public void setPosition(int offsetWidth, int offsetHeight) {
popup_.setPopupPosition(coords.getRight() + 10, coords.getBottom());
}
});
}
use of com.google.gwt.user.client.ui.PopupPanel.PositionCallback in project rstudio by rstudio.
the class ManipulatorManager method showManipulatorPopup.
private void showManipulatorPopup() {
// show it if necessary
if (!manipulatorPopup_.isShowing()) {
// state of the manipulator existing below the workbench
if (plotsSurface_.getOffsetHeight() == 0)
return;
manipulatorPopup_.recordPreviouslyFocusedElement();
manipulatorPopup_.setPopupPositionAndShow(new PositionCallback() {
@Override
public void setPosition(int offsetWidth, int offsetHeight) {
// position the manipulator to the right if necessary
int xPos = plotsSurface_.getAbsoluteLeft() - offsetWidth + 20;
if (xPos < 0) {
xPos = plotsSurface_.getAbsoluteLeft() + plotsSurface_.getOffsetWidth() - 20;
}
manipulatorPopup_.setPopupPosition(xPos, plotsSurface_.getAbsoluteTop() - 6);
manipulatorPopup_.focusFirstControl();
}
});
}
}
use of com.google.gwt.user.client.ui.PopupPanel.PositionCallback in project rstudio by rstudio.
the class SignatureToolTipManager method setTooltipPosition.
private void setTooltipPosition(Position position) {
final Rectangle bounds = docDisplay_.getPositionBounds(position);
tooltipPosition_ = position;
toolTip_.setPopupPositionAndShow(new PositionCallback() {
@Override
public void setPosition(int offsetWidth, int offsetHeight) {
int left = bounds.getLeft();
boolean verticalOverflow = bounds.getBottom() + offsetHeight >= Window.getClientHeight() - 20;
int top = verticalOverflow ? bounds.getTop() - offsetHeight - 10 : bounds.getBottom() + 10;
toolTip_.setPopupPosition(left, top);
}
});
}
use of com.google.gwt.user.client.ui.PopupPanel.PositionCallback in project rstudio by rstudio.
the class ChunkContextToolbar method initChangeChunkEngine.
@SuppressWarnings("unused")
private void initChangeChunkEngine(String engine) {
chunkTypeLabel_.setText(engine);
DOM.sinkEvents(chunkTypePanel_.getElement(), Event.ONCLICK);
DOM.setEventListener(chunkTypePanel_.getElement(), new EventListener() {
@Override
public void onBrowserEvent(Event event) {
if (DOM.eventGetType(event) == Event.ONCLICK) {
Commands commands = RStudioGinjector.INSTANCE.getCommands();
String engineLabel = chunkTypeLabel_.getText();
final ToolbarPopupMenu switchChunksMenu = new ToolbarPopupMenu();
if (engineLabel != "r") {
switchChunksMenu.addItem(createMenuItemForType(commands.switchToChunkR(), "r"));
switchChunksMenu.addSeparator();
}
if (!BrowseCap.isWindowsDesktop() && engineLabel != "bash") {
switchChunksMenu.addItem(createMenuItemForType(commands.switchToChunkBash(), "bash"));
}
if (engineLabel != "python") {
switchChunksMenu.addItem(createMenuItemForType(commands.switchToChunkPython(), "python"));
}
if (engineLabel != "rcpp") {
switchChunksMenu.addItem(createMenuItemForType(commands.switchToChunkRCPP(), "rcpp"));
}
if (engineLabel != "sql") {
switchChunksMenu.addItem(createMenuItemForType(commands.switchToChunkSQL(), "sql"));
}
if (engineLabel != "stan") {
switchChunksMenu.addItem(createMenuItemForType(commands.switchToChunkStan(), "stan"));
}
switchChunksMenu.setPopupPositionAndShow(new PositionCallback() {
@Override
public void setPosition(int offsetWidth, int offsetHeight) {
switchChunksMenu.setPopupPosition(chunkTypePanel_.getAbsoluteLeft() + chunkTypePanel_.getOffsetWidth() - offsetWidth + 15, chunkTypePanel_.getAbsoluteTop() + chunkTypePanel_.getOffsetHeight());
}
});
}
}
});
}
use of com.google.gwt.user.client.ui.PopupPanel.PositionCallback in project rstudio by rstudio.
the class SVNPane 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_.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);
}
});
}
Aggregations