use of com.intellij.ui.components.JBLabel in project go-lang-idea-plugin by go-lang-plugin-org.
the class GoMultiplePackagesQuickFix method invoke.
@Override
public void invoke(@NotNull Project project, @NotNull PsiFile file, @Nullable("is null when called from inspection") Editor editor, @NotNull PsiElement startElement, @NotNull PsiElement endElement) {
if (editor == null || myTestingPackageName != null) {
renamePackagesInDirectory(project, file.getContainingDirectory(), myTestingPackageName != null ? myTestingPackageName : myPackageName);
return;
}
JBList list = new JBList(myPackages);
list.installCellRenderer(o -> {
JBLabel label = new JBLabel(o.toString());
label.setBorder(IdeBorderFactory.createEmptyBorder(2, 4, 2, 4));
return label;
});
JBPopupFactory.getInstance().createListPopupBuilder(list).setTitle("Choose package name").setItemChoosenCallback(() -> {
String name = (String) list.getSelectedValue();
if (name != null) {
renamePackagesInDirectory(project, file.getContainingDirectory(), name);
}
}).createPopup().showInBestPositionFor(editor);
}
use of com.intellij.ui.components.JBLabel in project go-lang-idea-plugin by go-lang-plugin-org.
the class GoSdkConfigurable method createUIComponents.
private void createUIComponents() {
myVersionLabel = new JBLabel();
myDefaultLabelColor = myVersionLabel.getForeground();
myVersionPanel = new JPanel(new JBCardLayout());
JPanel gettingVersionPanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 5, 0));
AsyncProcessIcon gettingVersionIcon = new AsyncProcessIcon("Getting Go version");
gettingVersionPanel.add(gettingVersionIcon);
gettingVersionPanel.add(new JLabel("Getting..."));
myVersionPanel.add(gettingVersionPanel, VERSION_GETTING);
myVersionPanel.add(myVersionLabel, VERSION_RESULT);
setVersion(null);
}
use of com.intellij.ui.components.JBLabel in project intellij-community by JetBrains.
the class HgBookmarkDialog method createCenterPanel.
@Override
@NotNull
protected JComponent createCenterPanel() {
JPanel contentPanel = new JPanel(new GridBagLayout());
GridBag g = new GridBag().setDefaultInsets(new Insets(0, 0, DEFAULT_VGAP, DEFAULT_HGAP)).setDefaultAnchor(GridBagConstraints.LINE_START).setDefaultFill(GridBagConstraints.HORIZONTAL);
JLabel icon = new JLabel(UIUtil.getQuestionIcon(), SwingConstants.LEFT);
myBookmarkName = new JBTextField(13);
myBookmarkName.getDocument().addDocumentListener(new DocumentAdapter() {
@Override
public void textChanged(DocumentEvent e) {
validateFields();
}
});
JBLabel bookmarkLabel = new JBLabel("Bookmark name:");
bookmarkLabel.setLabelFor(myBookmarkName);
myActiveCheckbox = new JBCheckBox("Inactive", false);
contentPanel.add(icon, g.nextLine().next().coverColumn(3).pady(DEFAULT_HGAP));
contentPanel.add(bookmarkLabel, g.next().fillCellNone().insets(new Insets(0, 6, DEFAULT_VGAP, DEFAULT_HGAP)));
contentPanel.add(myBookmarkName, g.next().coverLine().setDefaultWeightX(1));
contentPanel.add(myActiveCheckbox, g.nextLine().next().next().coverLine(2));
return contentPanel;
}
use of com.intellij.ui.components.JBLabel in project intellij-community by JetBrains.
the class DesignerEditorPanel method addErrorMessage.
protected void addErrorMessage(final FixableMessageInfo message, Icon icon) {
if (message.myLinkText.length() > 0 || message.myAfterLinkText.length() > 0) {
HyperlinkLabel warnLabel = new HyperlinkLabel();
warnLabel.setOpaque(false);
warnLabel.setHyperlinkText(message.myBeforeLinkText, message.myLinkText, message.myAfterLinkText);
warnLabel.setIcon(icon);
if (message.myQuickFix != null) {
warnLabel.addHyperlinkListener(new HyperlinkListener() {
public void hyperlinkUpdate(final HyperlinkEvent e) {
if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
message.myQuickFix.run();
}
}
});
}
myErrorMessages.add(warnLabel);
} else {
JBLabel warnLabel = new JBLabel();
warnLabel.setOpaque(false);
warnLabel.setText("<html><body>" + message.myBeforeLinkText.replace("\n", "<br>") + "</body></html>");
warnLabel.setIcon(icon);
myErrorMessages.add(warnLabel);
}
if (message.myAdditionalFixes != null && message.myAdditionalFixes.size() > 0) {
JPanel fixesPanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 5, 0));
fixesPanel.setBorder(IdeBorderFactory.createEmptyBorder(3, 0, 10, 0));
fixesPanel.setOpaque(false);
fixesPanel.add(Box.createHorizontalStrut(icon.getIconWidth()));
for (Pair<String, Runnable> pair : message.myAdditionalFixes) {
HyperlinkLabel fixLabel = new HyperlinkLabel();
fixLabel.setOpaque(false);
fixLabel.setHyperlinkText(pair.getFirst());
final Runnable fix = pair.getSecond();
fixLabel.addHyperlinkListener(new HyperlinkListener() {
@Override
public void hyperlinkUpdate(HyperlinkEvent e) {
if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
fix.run();
}
}
});
fixesPanel.add(fixLabel);
}
myErrorMessages.add(fixesPanel);
}
}
use of com.intellij.ui.components.JBLabel in project intellij-community by JetBrains.
the class PyDebuggerConfigurable method createUIComponents.
private void createUIComponents() {
warningIcon = new JBLabel(AllIcons.General.BalloonWarning);
IdeTooltipManager.getInstance().setCustomTooltip(warningIcon, new TooltipWithClickableLinks.ForBrowser(warningIcon, DEBUGGER_WARNING_MESSAGE));
}
Aggregations