Example usage for com.intellij.openapi.ui.popup.util PopupUtil showBalloonForComponent

List of usage examples for com.intellij.openapi.ui.popup.util PopupUtil showBalloonForComponent

Introduction

In this page you can find the example usage for com.intellij.openapi.ui.popup.util PopupUtil showBalloonForComponent.

Prototype

public static void showBalloonForComponent(@NotNull Component component, @NotNull final String message,
            final MessageType type, final boolean atTop, @Nullable final Disposable disposable) 

Source Link

Usage

From source file:com.intellij.dvcs.push.ui.RepositoryWithBranchPanel.java

License:Apache License

public RepositoryWithBranchPanel(@NotNull final Project project, @NotNull String repoName,
        @NotNull String sourceName, @NotNull PushTargetPanel<T> destPushTargetPanelComponent) {
    super();//  w w w  .j  av a2 s  . c o m
    setLayout(new BorderLayout());
    myRepositoryCheckbox = new JBCheckBox();
    myRepositoryCheckbox.setFocusable(false);
    myRepositoryCheckbox.setOpaque(false);
    myRepositoryCheckbox.setBorder(null);
    myRepositoryCheckbox.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(@NotNull ActionEvent e) {
            fireOnSelectionChange(myRepositoryCheckbox.isSelected());
        }
    });
    myRepositoryLabel = new JLabel(repoName);
    myLocalBranch = new JBLabel(sourceName);
    myArrowLabel = new JLabel(" " + UIUtil.rightArrow() + " ");
    myDestPushTargetPanelComponent = destPushTargetPanelComponent;
    myTextRenderer = new ColoredTreeCellRenderer() {
        public void customizeCellRenderer(@NotNull JTree tree, Object value, boolean selected, boolean expanded,
                boolean leaf, int row, boolean hasFocus) {

        }
    };
    myTextRenderer.setOpaque(false);
    layoutComponents();

    setInputVerifier(new InputVerifier() {
        @Override
        public boolean verify(JComponent input) {
            ValidationInfo error = myDestPushTargetPanelComponent.verify();
            if (error != null) {
                //noinspection ConstantConditions
                PopupUtil.showBalloonForComponent(error.component, error.message, MessageType.WARNING, false,
                        project);
            }
            return error == null;
        }
    });

    JCheckBox emptyBorderCheckBox = new JCheckBox();
    emptyBorderCheckBox.setBorder(null);
    Dimension size = emptyBorderCheckBox.getPreferredSize();
    myCheckBoxWidth = size.width;
    myCheckBoxHeight = size.height;
    myLoadingIcon = LoadingIcon.create(myCheckBoxWidth, size.height);
    myCheckBoxLoadingIconGapH = myCheckBoxWidth - myLoadingIcon.getIconWidth();
    myCheckBoxLoadingIconGapV = size.height - myLoadingIcon.getIconHeight();
}