use of com.intellij.ui.components.labels.LinkLabel in project intellij-community by JetBrains.
the class InfoAndProgressPanel method buildInProcessCount.
private void buildInProcessCount() {
removeAll();
setLayout(new BorderLayout());
final JPanel progressCountPanel = new JPanel(new BorderLayout(0, 0));
progressCountPanel.setOpaque(false);
String processWord = myOriginals.size() == 1 ? " process" : " processes";
final LinkLabel label = new LinkLabel(myOriginals.size() + processWord + " running...", null, new LinkListener() {
@Override
public void linkSelected(final LinkLabel aSource, final Object aLinkData) {
triggerPopupShowing();
}
});
if (SystemInfo.isMac)
label.setFont(JBUI.Fonts.label(11));
label.setOpaque(false);
final Wrapper labelComp = new Wrapper(label);
labelComp.setOpaque(false);
progressCountPanel.add(labelComp, BorderLayout.CENTER);
//myProgressIcon.setBorder(new IdeStatusBarImpl.MacStatusBarWidgetBorder());
progressCountPanel.add(myProgressIcon, BorderLayout.WEST);
add(myRefreshAndInfoPanel, BorderLayout.CENTER);
progressCountPanel.setBorder(JBUI.Borders.emptyRight(4));
add(progressCountPanel, BorderLayout.EAST);
revalidate();
repaint();
}
use of com.intellij.ui.components.labels.LinkLabel in project intellij-community by JetBrains.
the class PackageChooserDialog method setupPathComponent.
private void setupPathComponent(final JPanel northPanel) {
northPanel.add(new TextFieldAction() {
@Override
public void linkSelected(LinkLabel aSource, Object aLinkData) {
toggleShowPathComponent(northPanel, this);
}
}, BorderLayout.EAST);
myPathEditor = new EditorTextField(JavaReferenceEditorUtil.createDocument("", myProject, false), myProject, StdFileTypes.JAVA);
myPathEditor.addDocumentListener(new DocumentAdapter() {
@Override
public void documentChanged(DocumentEvent e) {
myAlarm.cancelAllRequests();
myAlarm.addRequest(() -> updateTreeFromPath(), 300);
}
});
myPathEditor.setBorder(BorderFactory.createEmptyBorder(0, 0, 2, 0));
northPanel.add(myPathEditor, BorderLayout.SOUTH);
}
use of com.intellij.ui.components.labels.LinkLabel in project intellij-community by JetBrains.
the class NotificationsManagerImpl method createMergeAction.
private static void createMergeAction(@NotNull final BalloonLayoutData layoutData, @NotNull JPanel panel) {
StringBuilder title = new StringBuilder().append(layoutData.mergeData.count).append(" more");
String shortTitle = NotificationParentGroup.getShortTitle(layoutData.groupId);
if (shortTitle != null) {
title.append(" from ").append(shortTitle);
}
LinkLabel<BalloonLayoutData> action = new LinkLabel<BalloonLayoutData>(title.toString(), null, new LinkListener<BalloonLayoutData>() {
@Override
public void linkSelected(LinkLabel aSource, BalloonLayoutData layoutData) {
EventLog.showNotification(layoutData.project, layoutData.groupId, layoutData.getMergeIds());
}
}, layoutData) {
@Override
protected boolean isInClickableArea(Point pt) {
return true;
}
@Override
protected Color getTextColor() {
return new JBColor(0x666666, 0x8C8C8C);
}
};
action.setFont(FontUtil.minusOne(action.getFont()));
action.setHorizontalAlignment(SwingConstants.CENTER);
action.setPaintUnderline(false);
AbstractLayoutManager layout = new AbstractLayoutManager() {
@Override
public Dimension preferredLayoutSize(Container parent) {
return new Dimension(parent.getWidth(), JBUI.scale(20) + 2);
}
@Override
public void layoutContainer(Container parent) {
parent.getComponent(0).setBounds(2, 1, parent.getWidth() - 4, JBUI.scale(20));
}
};
JPanel mergePanel = new NonOpaquePanel(layout) {
@Override
protected void paintComponent(Graphics g) {
super.paintComponent(g);
g.setColor(new JBColor(0xE3E3E3, 0x3A3C3D));
((Graphics2D) g).fill(new Rectangle2D.Double(1.5, 1, getWidth() - 2.5, getHeight() - 2));
g.setColor(new JBColor(0xDBDBDB, 0x353738));
if (SystemInfo.isMac) {
((Graphics2D) g).draw(new Rectangle2D.Double(2, 0, getWidth() - 3.5, 0.5));
} else if (SystemInfo.isWindows) {
((Graphics2D) g).draw(new Rectangle2D.Double(1.5, 0, getWidth() - 3, 0.5));
} else {
((Graphics2D) g).draw(new Rectangle2D.Double(1.5, 0, getWidth() - 2.5, 0.5));
}
}
};
mergePanel.add(action);
panel.add(BorderLayout.SOUTH, mergePanel);
}
use of com.intellij.ui.components.labels.LinkLabel in project intellij-community by JetBrains.
the class ConfigurableEditor method createDefaultContent.
private JComponent createDefaultContent(Configurable configurable) {
JComponent content = new JPanel(new BorderLayout());
content.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
String key = configurable == null ? null : ConfigurableVisitor.ByID.getID(configurable) + ".settings.description";
String description = key == null ? null : getString(configurable, key);
if (description == null) {
description = "Select configuration element in the tree to edit its settings";
content.add(BorderLayout.CENTER, new JLabel(description, SwingConstants.CENTER));
content.setPreferredSize(JBUI.size(800, 600));
} else {
content.add(BorderLayout.NORTH, new JLabel(description));
if (configurable instanceof Configurable.Composite) {
Configurable.Composite composite = (Configurable.Composite) configurable;
JPanel panel = new JPanel();
panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
content.add(BorderLayout.CENTER, panel);
panel.add(Box.createVerticalStrut(10));
for (Configurable current : composite.getConfigurables()) {
LinkLabel label = LinkLabel.create(current.getDisplayName(), () -> openLink(current));
label.setBorder(BorderFactory.createEmptyBorder(1, 17, 3, 1));
panel.add(label);
}
}
}
return content;
}
use of com.intellij.ui.components.labels.LinkLabel in project intellij-community by JetBrains.
the class InspectionViewNavigationPanel method resetChildrenNavigation.
private void resetChildrenNavigation() {
final int currentChildrenCount = myNode.getChildCount();
if (myShownChildrenCount != currentChildrenCount) {
myLinks.removeAll();
myLinks.add(Box.createVerticalStrut(JBUI.scale(10)));
for (int i = 0; i < currentChildrenCount; i++) {
final TreeNode child = myNode.getChildAt(i);
final LinkLabel link = new LinkLabel(child.toString(), null) {
@Override
public void doClick() {
TreeUtil.selectInTree((DefaultMutableTreeNode) child, true, myTree);
}
};
link.setBorder(IdeBorderFactory.createEmptyBorder(1, 17, 3, 1));
myLinks.add(link);
}
myShownChildrenCount = currentChildrenCount;
}
}
Aggregations