use of com.intellij.openapi.ui.popup.JBPopupFactory in project intellij-community by JetBrains.
the class GotoCustomRegionAction method notifyCustomRegionsUnavailable.
private static void notifyCustomRegionsUnavailable(@NotNull Editor editor, @NotNull Project project) {
final JBPopupFactory popupFactory = JBPopupFactory.getInstance();
Balloon balloon = popupFactory.createHtmlTextBalloonBuilder(IdeBundle.message("goto.custom.region.message.unavailable"), MessageType.INFO, null).setFadeoutTime(2000).setHideOnClickOutside(true).setHideOnKeyOutside(true).createBalloon();
Disposer.register(project, balloon);
balloon.show(popupFactory.guessBestPopupLocation(editor), Balloon.Position.below);
}
use of com.intellij.openapi.ui.popup.JBPopupFactory in project intellij-community by JetBrains.
the class InplaceRefactoring method showBalloon.
protected void showBalloon() {
final JComponent component = getComponent();
if (component == null)
return;
if (ApplicationManager.getApplication().isHeadlessEnvironment())
return;
final BalloonBuilder balloonBuilder = JBPopupFactory.getInstance().createDialogBalloonBuilder(component, null).setSmallVariant(true);
myBalloon = balloonBuilder.createBalloon();
Disposer.register(myProject, myBalloon);
Disposer.register(myBalloon, new Disposable() {
@Override
public void dispose() {
releaseIfNotRestart();
myEditor.putUserData(PopupFactoryImpl.ANCHOR_POPUP_POSITION, null);
}
});
EditorUtil.disposeWithEditor(myEditor, myBalloon);
myEditor.getScrollingModel().scrollToCaret(ScrollType.MAKE_VISIBLE);
final JBPopupFactory popupFactory = JBPopupFactory.getInstance();
myBalloon.show(new PositionTracker<Balloon>(myEditor.getContentComponent()) {
@Override
public RelativePoint recalculateLocation(Balloon object) {
if (myTarget != null && !popupFactory.isBestPopupLocationVisible(myEditor)) {
return myTarget;
}
if (myCaretRangeMarker != null && myCaretRangeMarker.isValid()) {
myEditor.putUserData(PopupFactoryImpl.ANCHOR_POPUP_POSITION, myEditor.offsetToVisualPosition(myCaretRangeMarker.getStartOffset()));
}
final RelativePoint target = popupFactory.guessBestPopupLocation(myEditor);
final Point screenPoint = target.getScreenPoint();
int y = screenPoint.y;
if (target.getPoint().getY() > myEditor.getLineHeight() + myBalloon.getPreferredSize().getHeight()) {
y -= myEditor.getLineHeight();
}
myTarget = new RelativePoint(new Point(screenPoint.x, y));
return myTarget;
}
}, Balloon.Position.above);
}
use of com.intellij.openapi.ui.popup.JBPopupFactory in project intellij-community by JetBrains.
the class NavigateToTestDataAction method actionPerformed.
@Override
public void actionPerformed(AnActionEvent e) {
final DataContext dataContext = e.getDataContext();
final Project project = e.getProject();
List<String> fileNames = findTestDataFiles(dataContext);
if (fileNames == null || fileNames.isEmpty()) {
String testData = guessTestData(dataContext);
if (testData == null) {
String message = "Cannot find testdata files for class";
final Notification notification = new Notification("testdata", "Found no testdata files", message, NotificationType.INFORMATION);
Notifications.Bus.notify(notification, project);
return;
}
fileNames = Collections.singletonList(testData);
}
final Editor editor = e.getData(CommonDataKeys.EDITOR);
final JBPopupFactory popupFactory = JBPopupFactory.getInstance();
final RelativePoint point = editor != null ? popupFactory.guessBestPopupLocation(editor) : popupFactory.guessBestPopupLocation(dataContext);
TestDataNavigationHandler.navigate(point, fileNames, project);
}
use of com.intellij.openapi.ui.popup.JBPopupFactory in project intellij-community by JetBrains.
the class ListenerNavigateButton method showNavigatePopup.
public static void showNavigatePopup(final RadComponent component, final boolean showIfEmpty) {
final DefaultActionGroup actionGroup = prepareActionGroup(component);
if (actionGroup != null && actionGroup.getChildrenCount() == 0 && showIfEmpty) {
actionGroup.add(new MyNavigateAction(UIDesignerBundle.message("navigate.to.listener.empty"), null));
}
if (actionGroup != null && actionGroup.getChildrenCount() > 0) {
final DataContext context = DataManager.getInstance().getDataContext(component.getDelegee());
final JBPopupFactory factory = JBPopupFactory.getInstance();
final ListPopup popup = factory.createActionGroupPopup(UIDesignerBundle.message("navigate.to.listener.title"), actionGroup, context, JBPopupFactory.ActionSelectionAid.NUMBERING, true);
FormEditingUtil.showPopupUnderComponent(popup, component);
}
}
use of com.intellij.openapi.ui.popup.JBPopupFactory in project android by JetBrains.
the class FlatComboAction method createPopup.
protected JBPopup createPopup(Runnable onDispose, DataContext context) {
DefaultActionGroup group = createPopupActionGroup();
JBPopupFactory factory = JBPopupFactory.getInstance();
ListPopup popup = factory.createActionGroupPopup(null, group, context, true, onDispose, getMaxRows());
popup.setMinimumSize(new Dimension(getMinWidth(), getMinHeight()));
return popup;
}
Aggregations