本文整理匯總了Java中com.intellij.openapi.ui.popup.Balloon.show方法的典型用法代碼示例。如果您正苦於以下問題:Java Balloon.show方法的具體用法?Java Balloon.show怎麽用?Java Balloon.show使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.intellij.openapi.ui.popup.Balloon
的用法示例。
在下文中一共展示了Balloon.show方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: showIncomingChatInvitation
import com.intellij.openapi.ui.popup.Balloon; //導入方法依賴的package包/類
public void showIncomingChatInvitation(@NotNull ChatInvitation chatInvitation, @NotNull IncomingChatInvitationNotification notification) {
IncomingChatInvitationPopup.Model popupModel = IdeaSamebugPlugin.getInstance().conversionService.convertIncomingChatInvitationPopup(chatInvitation);
IncomingChatInvitationPopup popup = new IncomingChatInvitationPopup(popupModel);
IncomingChatInvitationPopupListener incomingChatInvitationPopupListener = new IncomingChatInvitationPopupListener(this, chatInvitation);
ListenerService.putListenerToComponent(popup, IIncomingChatInvitationPopup.Listener.class, incomingChatInvitationPopupListener);
BalloonBuilder balloonBuilder = JBPopupFactory.getInstance().createBalloonBuilder(popup);
balloonBuilder.setFillColor(ColorService.forCurrentTheme(ColorService.Background));
balloonBuilder.setContentInsets(new Insets(40, 0, 40, 0));
balloonBuilder.setBorderInsets(new Insets(0, 0, 0, 0));
balloonBuilder.setBorderColor(ColorService.forCurrentTheme(ColorService.Background));
balloonBuilder.setShadow(true);
IdeFrame window = (IdeFrame) NotificationsManagerImpl.findWindowForBalloon(myProject);
RelativePoint pointToShowPopup = null;
if (window != null) pointToShowPopup = RelativePoint.getSouthEastOf(window.getComponent());
Balloon balloon = balloonBuilder.createBalloon();
balloon.show(pointToShowPopup, Balloon.Position.atLeft);
TrackingService.trace(SwingRawEvent.notificationShow(popup));
}
示例2: showIncomingChatInvitation
import com.intellij.openapi.ui.popup.Balloon; //導入方法依賴的package包/類
public void showIncomingChatInvitation(@NotNull IncomingAnswer incomingTip, @NotNull IncomingTipNotification notification) {
IIncomingTipPopup.Model popupModel = IdeaSamebugPlugin.getInstance().conversionService.convertIncomingTipPopup(incomingTip);
IncomingTipPopup popup = new IncomingTipPopup(popupModel);
DataService.putData(popup, TrackingKeys.Location, new Locations.TipAnswerNotification(incomingTip.getSolution().getId()));
BalloonBuilder balloonBuilder = JBPopupFactory.getInstance().createBalloonBuilder(popup);
balloonBuilder.setFillColor(ColorService.forCurrentTheme(ColorService.Background));
balloonBuilder.setContentInsets(new Insets(40, 0, 40, 0));
balloonBuilder.setBorderInsets(new Insets(0, 0, 0, 0));
balloonBuilder.setBorderColor(ColorService.forCurrentTheme(ColorService.Background));
balloonBuilder.setShadow(true);
IdeFrame window = (IdeFrame) NotificationsManagerImpl.findWindowForBalloon(myProject);
RelativePoint pointToShowPopup = null;
if (window != null) pointToShowPopup = RelativePoint.getSouthEastOf(window.getComponent());
Balloon balloon = balloonBuilder.createBalloon();
data.put(popup, incomingTip);
notifications.put(popup, notification);
balloons.put(popup, balloon);
balloon.show(pointToShowPopup, Balloon.Position.atLeft);
TrackingService.trace(SwingRawEvent.notificationShow(popup));
}
示例3: showIncomingHelpRequest
import com.intellij.openapi.ui.popup.Balloon; //導入方法依賴的package包/類
public void showIncomingHelpRequest(@NotNull IncomingHelpRequest helpRequest, @NotNull IncomingHelpRequestNotification notification) {
IHelpRequestPopup.Model popupModel = IdeaSamebugPlugin.getInstance().conversionService.convertHelpRequestPopup(helpRequest);
HelpRequestPopup popup = new HelpRequestPopup(popupModel);
DataService.putData(popup, TrackingKeys.Location, new Locations.HelpRequestNotification(helpRequest.getMatch().getHelpRequest().getId()));
DataService.putData(popup, TrackingKeys.WriteTipTransaction, Funnels.newTransactionId());
HelpRequestPopupListener helpRequestPopupListener = new HelpRequestPopupListener(this);
ListenerService.putListenerToComponent(popup, IHelpRequestPopup.Listener.class, helpRequestPopupListener);
BalloonBuilder balloonBuilder = JBPopupFactory.getInstance().createBalloonBuilder(popup);
balloonBuilder.setFillColor(ColorService.forCurrentTheme(ColorService.Background));
balloonBuilder.setContentInsets(new Insets(40, 0, 40, 0));
balloonBuilder.setBorderInsets(new Insets(0, 0, 0, 0));
balloonBuilder.setBorderColor(ColorService.forCurrentTheme(ColorService.Background));
balloonBuilder.setShadow(true);
IdeFrame window = (IdeFrame) NotificationsManagerImpl.findWindowForBalloon(myProject);
RelativePoint pointToShowPopup = null;
if (window != null) pointToShowPopup = RelativePoint.getSouthEastOf(window.getComponent());
Balloon balloon = balloonBuilder.createBalloon();
data.put(popup, helpRequest);
notifications.put(popup, notification);
balloons.put(popup, balloon);
balloon.show(pointToShowPopup, Balloon.Position.atLeft);
TrackingService.trace(SwingRawEvent.notificationShow(popup));
}
示例4: reportException
import com.intellij.openapi.ui.popup.Balloon; //導入方法依賴的package包/類
private void reportException(final String htmlContent) {
Runnable balloonShower = new Runnable() {
@Override
public void run() {
Balloon balloon = JBPopupFactory.getInstance().createHtmlTextBalloonBuilder(htmlContent, MessageType.WARNING, null).
setShowCallout(false).setHideOnClickOutside(true).setHideOnAction(true).setHideOnFrameResize(true).setHideOnKeyOutside(true).
createBalloon();
final Rectangle rect = myPanel.getPanel().getBounds();
final Point p = new Point(rect.x + rect.width - 100, rect.y + 50);
final RelativePoint point = new RelativePoint(myPanel.getPanel(), p);
balloon.show(point, Balloon.Position.below);
Disposer.register(myProject != null ? myProject : ApplicationManager.getApplication(), balloon);
}
};
ApplicationManager.getApplication().invokeLater(balloonShower, new Condition() {
@Override
public boolean value(Object o) {
return !(myProject == null || myProject.isDefault()) && ((!myProject.isOpen()) || myProject.isDisposed());
}
}
);
}
示例5: showBalloonForComponent
import com.intellij.openapi.ui.popup.Balloon; //導入方法依賴的package包/類
public static void showBalloonForComponent(@NotNull Component component, @NotNull final String message, final MessageType type,
final boolean atTop, @Nullable final Disposable disposable) {
final JBPopupFactory popupFactory = JBPopupFactory.getInstance();
if (popupFactory == null) return;
BalloonBuilder balloonBuilder = popupFactory.createHtmlTextBalloonBuilder(message, type, null);
balloonBuilder.setDisposable(disposable == null ? ApplicationManager.getApplication() : disposable);
Balloon balloon = balloonBuilder.createBalloon();
Dimension size = component.getSize();
Balloon.Position position;
int x;
int y;
if (size == null) {
x = y = 0;
position = Balloon.Position.above;
}
else {
x = Math.min(10, size.width / 2);
y = size.height;
position = Balloon.Position.below;
}
balloon.show(new RelativePoint(component, new Point(x, y)), position);
}
示例6: showBalloon
import com.intellij.openapi.ui.popup.Balloon; //導入方法依賴的package包/類
/**
* Asks to show balloon that contains information related to the given component.
*
* @param component component for which we want to show information
* @param messageType balloon message type
* @param message message to show
*/
public static void showBalloon(@NotNull JComponent component, @NotNull MessageType messageType, @NotNull String message) {
final BalloonBuilder builder = JBPopupFactory.getInstance().createHtmlTextBalloonBuilder(message, messageType, null)
.setDisposable(ApplicationManager.getApplication())
.setFadeoutTime(BALLOON_FADEOUT_TIME);
Balloon balloon = builder.createBalloon();
Dimension size = component.getSize();
Balloon.Position position;
int x;
int y;
if (size == null) {
x = y = 0;
position = Balloon.Position.above;
}
else {
x = Math.min(10, size.width / 2);
y = size.height;
position = Balloon.Position.below;
}
balloon.show(new RelativePoint(component, new Point(x, y)), position);
}
示例7: showNotification
import com.intellij.openapi.ui.popup.Balloon; //導入方法依賴的package包/類
private static void showNotification(@NotNull DiffViewerBase viewer, @NotNull Notification notification) {
JComponent component = viewer.getComponent();
Window window = UIUtil.getWindow(component);
if (window instanceof IdeFrame && NotificationsManagerImpl.findWindowForBalloon(viewer.getProject()) == window) {
notification.notify(viewer.getProject());
return;
}
Balloon balloon = NotificationsManagerImpl.createBalloon(component, notification, false, true);
Disposer.register(viewer, balloon);
Dimension componentSize = component.getSize();
Dimension balloonSize = balloon.getPreferredSize();
int width = Math.min(balloonSize.width, componentSize.width);
int height = Math.min(balloonSize.height, componentSize.height);
// top-right corner, 20px to the edges
RelativePoint point = new RelativePoint(component, new Point(componentSize.width - 20 - width / 2, 20 + height / 2));
balloon.show(point, Balloon.Position.above);
}
示例8: addConfiguration
import com.intellij.openapi.ui.popup.Balloon; //導入方法依賴的package包/類
private void addConfiguration(RunnerAndConfigurationSettings configuration) {
if (!ProjectStartupRunner.canBeRun(configuration)) {
final String message = "Can not add Run Configuration '" + configuration.getName() + "' to Startup Tasks," +
" since it can not be started with 'Run' action.";
final Balloon balloon = JBPopupFactory.getInstance()
.createHtmlTextBalloonBuilder(message, MessageType.ERROR, null)
.setHideOnClickOutside(true)
.setFadeoutTime(3000)
.setCloseButtonEnabled(true)
.createBalloon();
final RelativePoint rp = new RelativePoint(myDecorator.getActionsPanel(), new Point(5, 5));
balloon.show(rp, Balloon.Position.atLeft);
return;
}
myModel.addConfiguration(configuration);
refreshDataUpdateSelection(configuration);
}
示例9: showBalloon
import com.intellij.openapi.ui.popup.Balloon; //導入方法依賴的package包/類
/**
* Asks to show balloon that contains information related to the given component.
*
* @param component component for which we want to show information
* @param messageType balloon message type
* @param message message to show
*/
public static void showBalloon(@NotNull JComponent component, @NotNull MessageType messageType, @NotNull String message) {
final BalloonBuilder builder = JBPopupFactory.getInstance().createHtmlTextBalloonBuilder(message, messageType, null)
.setDisposable(ApplicationManager.getApplication())
.setFadeoutTime(TimeUnit.SECONDS.toMillis(1));
Balloon balloon = builder.createBalloon();
Dimension size = component.getSize();
Balloon.Position position;
int x;
int y;
if (size == null) {
x = y = 0;
position = Balloon.Position.above;
}
else {
x = Math.min(10, size.width / 2);
y = size.height;
position = Balloon.Position.below;
}
balloon.show(new RelativePoint(component, new Point(x, y)), position);
}
示例10: showSuccessPopup
import com.intellij.openapi.ui.popup.Balloon; //導入方法依賴的package包/類
public static void showSuccessPopup(@Nonnull String message,
@Nonnull RelativePoint point,
@Nonnull Disposable disposable,
@javax.annotation.Nullable Runnable hyperlinkHandler) {
HyperlinkListener listener = null;
if (hyperlinkHandler != null) {
listener = new HyperlinkAdapter() {
@Override
protected void hyperlinkActivated(HyperlinkEvent e) {
hyperlinkHandler.run();
}
};
}
Color bgColor = MessageType.INFO.getPopupBackground();
Balloon balloon = JBPopupFactory.getInstance()
.createHtmlTextBalloonBuilder(message, null, bgColor, listener)
.setAnimationCycle(200)
.createBalloon();
balloon.show(point, Balloon.Position.below);
Disposer.register(disposable, balloon);
}
示例11: showBalloon
import com.intellij.openapi.ui.popup.Balloon; //導入方法依賴的package包/類
/**
* Asks to show balloon that contains information related to the given component.
*
* @param component component for which we want to show information
* @param messageType balloon message type
* @param message message to show
*/
public static void showBalloon(@Nonnull JComponent component, @Nonnull MessageType messageType, @Nonnull String message) {
final BalloonBuilder builder = JBPopupFactory.getInstance().createHtmlTextBalloonBuilder(message, messageType, null)
.setDisposable(ApplicationManager.getApplication())
.setFadeoutTime(BALLOON_FADEOUT_TIME);
Balloon balloon = builder.createBalloon();
Dimension size = component.getSize();
Balloon.Position position;
int x;
int y;
if (size == null) {
x = y = 0;
position = Balloon.Position.above;
}
else {
x = Math.min(10, size.width / 2);
y = size.height;
position = Balloon.Position.below;
}
balloon.show(new RelativePoint(component, new Point(x, y)), position);
}
示例12: showNotification
import com.intellij.openapi.ui.popup.Balloon; //導入方法依賴的package包/類
private static void showNotification(@Nonnull DiffViewerBase viewer, @Nonnull Notification notification) {
JComponent component = viewer.getComponent();
Window window = UIUtil.getWindow(component);
if (window instanceof IdeFrame && NotificationsManagerImpl.findWindowForBalloon(viewer.getProject()) == window) {
notification.notify(viewer.getProject());
return;
}
Balloon balloon = NotificationsManagerImpl.createBalloon(component, notification, false, true, null, viewer);
Dimension componentSize = component.getSize();
Dimension balloonSize = balloon.getPreferredSize();
int width = Math.min(balloonSize.width, componentSize.width);
int height = Math.min(balloonSize.height, componentSize.height);
// top-right corner, 20px to the edges
RelativePoint point = new RelativePoint(component, new Point(componentSize.width - 20 - width / 2, 20 + height / 2));
balloon.show(point, Balloon.Position.above);
}
示例13: handleTyping
import com.intellij.openapi.ui.popup.Balloon; //導入方法依賴的package包/類
@NotNull
private static Result handleTyping(Project project, Editor editor, PsiFile file, boolean showBaloon) {
if (!StudyUtils.isStudyProject(project)) {
return Result.CONTINUE;
}
TaskFile taskFile = StudyUtils.getTaskFile(project, file.getVirtualFile());
if (taskFile == null || !(taskFile.getTask() instanceof TaskWithSubtasks)) {
return Result.CONTINUE;
}
int offset = editor.getCaretModel().getOffset();
if (CCUtils.isCourseCreator(project)) {
AnswerPlaceholder placeholder = StudyUtils.getAnswerPlaceholder(offset, taskFile.getAnswerPlaceholders());
if (placeholder == null || placeholder.isActive()) {
return Result.CONTINUE;
}
if (showBaloon) {
Integer toSubtask = Collections.max(placeholder.getSubtaskInfos().keySet().stream()
.filter(k -> k < ((TaskWithSubtasks)taskFile.getTask()).getActiveSubtaskIndex())
.collect(Collectors.toList()));
int userVisibleSubtaskNum = toSubtask + 1;
String text = String
.format("<html>To edit this placeholder <a href=\"%s\">activate</a> it or <a href=\"%s\">switch to subtask %d</a></html>",
ACTIVATE,
SWITCH, userVisibleSubtaskNum);
MyHyperlinkAdapter listener = new MyHyperlinkAdapter(taskFile, placeholder, file, editor, project, toSubtask);
Balloon balloon =
JBPopupFactory.getInstance().createHtmlTextBalloonBuilder(text, null, MessageType.WARNING.getPopupBackground(), listener)
.setHideOnLinkClick(true).createBalloon();
balloon.show(JBPopupFactory.getInstance().guessBestPopupLocation(editor), Balloon.Position.below);
}
return Result.STOP;
}
boolean insidePlaceholder = taskFile.getAnswerPlaceholder(offset) != null;
if (!insidePlaceholder) {
HintManager.getInstance().showInformationHint(editor, "Text outside of placeholders is not editable in this task");
}
return insidePlaceholder ? Result.CONTINUE : Result.STOP;
}
示例14: show
import com.intellij.openapi.ui.popup.Balloon; //導入方法依賴的package包/類
public void show(RelativePoint point, Balloon.Position position) {
final GotItPanel panel = new GotItPanel();
panel.myTitle.setText(myTitle);
panel.myMessage.setText(myMessage);
if (myHyperlinkListener != null) {
panel.myMessage.addHyperlinkListener(myHyperlinkListener);
}
panel.myButton.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
final BalloonBuilder builder = JBPopupFactory.getInstance().createBalloonBuilder(panel.myRoot);
if (myDisposable != null) {
builder.setDisposable(myDisposable);
}
final Balloon balloon = builder
.setFillColor(UIUtil.getListBackground())
.setHideOnClickOutside(false)
.setHideOnAction(false)
.setHideOnFrameResize(false)
.setHideOnKeyOutside(false)
.setShowCallout(myShowCallout)
.setBlockClicksThroughBalloon(true)
.createBalloon();
panel.myButton.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
balloon.hide();
if (myCallback != null) {
myCallback.run();
}
}
});
balloon.show(point, position);
}
示例15: add
import com.intellij.openapi.ui.popup.Balloon; //導入方法依賴的package包/類
@Override
public void add(final Balloon balloon) {
myBalloons.add(balloon);
Disposer.register(balloon, new Disposable() {
public void dispose() {
myBalloons.remove(balloon);
queueRelayout();
}
});
relayout();
balloon.show(myLayeredPane);
}