Search in sources :

Example 1 with ResizingWrapper

use of com.intellij.ui.roots.ResizingWrapper in project intellij-community by JetBrains.

the class ContentRootPanel method createHeader.

private JComponent createHeader() {
    final JPanel panel = new JPanel(new GridBagLayout());
    final JLabel headerLabel = new JLabel(toDisplayPath(getContentEntry().getUrl()));
    headerLabel.setFont(headerLabel.getFont().deriveFont(Font.BOLD));
    headerLabel.setOpaque(false);
    if (getContentEntry().getFile() == null) {
        headerLabel.setForeground(JBColor.RED);
    }
    final IconActionComponent deleteIconComponent = new IconActionComponent(AllIcons.Modules.DeleteContentRoot, AllIcons.Modules.DeleteContentRootRollover, ProjectBundle.message("module.paths.remove.content.tooltip"), () -> myCallback.deleteContentEntry());
    final ResizingWrapper wrapper = new ResizingWrapper(headerLabel);
    panel.add(wrapper, new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 1.0, 1.0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, JBUI.insetsLeft(2), 0, 0));
    panel.add(deleteIconComponent, new GridBagConstraints(1, GridBagConstraints.RELATIVE, 1, 1, 0.0, 1.0, GridBagConstraints.EAST, GridBagConstraints.NONE, JBUI.insetsRight(5), 0, 0));
    FilePathClipper.install(headerLabel, wrapper);
    return panel;
}
Also used : ResizingWrapper(com.intellij.ui.roots.ResizingWrapper) IconActionComponent(com.intellij.ui.roots.IconActionComponent)

Aggregations

IconActionComponent (com.intellij.ui.roots.IconActionComponent)1 ResizingWrapper (com.intellij.ui.roots.ResizingWrapper)1