final JLabel commandsLabel = new JBLabel(IgnoreBundle.message("dialog.untrackFiles.commands.label")); commandsLabel.setBorder(JBUI.Borders.empty(10, 0)); commandsPanel.add(commandsLabel, BorderLayout.NORTH);
private void initComboValues(@NotNull Module module) { if (!module.isDisposed()) { String sdkVersion = GoSdkService.getInstance(module.getProject()).getSdkVersion(module); if (!GoVendoringUtil.vendoringCanBeDisabled(sdkVersion)) { myErrorMessageLabel.setIcon(AllIcons.General.BalloonWarning); myErrorMessageLabel.setText("Go " + sdkVersion + " doesn't support disabling vendor experiment"); myErrorMessageLabel.setVisible(true); myVendoringEnabledCombo.setEnabled(false); } else if (!GoVendoringUtil.supportsVendoring(sdkVersion) && sdkVersion != null) { myErrorMessageLabel.setIcon(AllIcons.General.BalloonWarning); myErrorMessageLabel.setText("Go " + sdkVersion + " doesn't support vendor experiment"); myErrorMessageLabel.setVisible(true); myVendoringEnabledCombo.setEnabled(true); } else { myErrorMessageLabel.setVisible(false); myVendoringEnabledCombo.setEnabled(true); } myDefaultComboText = "Default for SDK (" + (GoVendoringUtil.supportsVendoringByDefault(sdkVersion) ? ENABLED : DISABLED) + ")"; //noinspection unchecked myVendoringEnabledComboModel.update(ContainerUtil.newArrayList(myDefaultComboText, ENABLED, DISABLED)); } }
@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); }
private void setVersion(@Nullable String version) { if (version == null) { myVersionLabel.setText("N/A"); myVersionLabel.setForeground(JBColor.RED); } else { myVersionLabel.setText(version); myVersionLabel.setForeground(myDefaultLabelColor); } ((CardLayout)myVersionPanel.getLayout()).show(myVersionPanel, VERSION_RESULT); }
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); }
pagination.setTotalDocuments(currentResults.getTotalDocumentNumber()); if (NbPerPage.ALL.equals(pagination.getNbPerPage())) { pageNumberLabel.setVisible(false); } else { pageNumberLabel.setText( String.format("Page %d/%d", pagination.getPageNumber(), pagination.getTotalPageNumber()) ); pageNumberLabel.setVisible(true);
infoMessage.setVisible(true); syncStashCheckbox.setVisible(false); syncStashCheckbox.addActionListener( event -> { if (syncStashCheckbox.isVisible()) { warningHeader.setVisible(!syncStashCheckbox.isSelected()); warningMessage.setVisible(!syncStashCheckbox.isSelected()); warningHeader.setVisible(false); warningHeader.setFont( new Font( warningHeader.getFont().getName(), Font.BOLD, warningHeader.getFont().getSize() - 1)); warningHeader.setForeground(JBColor.RED); warningMessage.setVisible(false); warningMessage.setFont( new Font( warningMessage.getFont().getName(), Font.PLAIN, warningHeader.getFont().getSize() - 1)); warningMessage.setText(StackdriverDebuggerBundle.getString("clouddebug.sourcedoesnotmatch")); infoMessage.setFont( new Font( warningMessage.getFont().getName(), Font.PLAIN, warningHeader.getFont().getSize() - 1)); Border paddingBorder = BorderFactory.createEmptyBorder(2, 0, 2, 0); infoMessage.setBorder(paddingBorder); checkSyncStashState(); } else { warningHeader.setVisible(false); warningMessage.setVisible(false);
@NotNull private JBLabel getLabel() { JBLabel label = new JBLabel(); label.setText(LABEL); label.setLabelFor(path); return label; }
if (copyable ^ myEditorPane != null) { if (myEditorPane == null) { final JLabel ellipsisLabel = new JBLabel("..."); myIconLabel = new JLabel(getIcon()); myEditorPane = new JEditorPane() { @Override updateStyle(myEditorPane); myEditorPane.setText(getText()); checkMultiline(); myEditorPane.setCaretPosition(0); updateLayout(); } else { removeAll(); myEditorPane = null; myIconLabel = null;
projectAccountSeparatorLabel = new JBLabel("/"); projectAccountSeparatorLabel.setVisible(false /* only visible when project is selected. */);
gc.setHSizePolicy(GridConstraints.SIZEPOLICY_FIXED); String displayName = getTranslated(translations, setting.getConfigTitle()); JBLabel label = new JBLabel(displayName); settingsPanel.add(label, gc); JComponent settingValueComponent = fieldModel.getComponent(); settingsPanel.add(settingValueComponent, gc); label.setLabelFor(settingValueComponent); fieldsBySettingKey.put(setting.getKey(), fieldModel); gc.setVSizePolicy(GridConstraints.FILL_VERTICAL); gc.setHSizePolicy(GridConstraints.SIZEPOLICY_FIXED); settingsPanel.add(new JBLabel(""), gc);
public void initialize(Container container) { JTextArea queryLabel = new JTextArea(originalQuery); queryLabel.setRows(3); queryLabel.setEditable(false); GraphQueryPlan graphQueryPlan = result.getPlan() .orElseThrow(() -> new ShouldNeverHappenException("Sergey Ishchenko", "GraphQueryPanel is initialized when explain or profile queries are executed")); ListTreeTableModelOnColumns model = createModel(graphQueryPlan, result.isProfilePlan()); treeTable = new TreeTableView(model); treeTable.setAutoCreateColumnsFromModel(true); treeTable.setRootVisible(true); treeTable.setCellSelectionEnabled(false); treeTable.setRowSelectionAllowed(true); treeTable.setAutoResizeMode(TreeTableView.AUTO_RESIZE_OFF); treeTable.getTree().setShowsRootHandles(true); DefaultTreeExpander expander = new DefaultTreeExpander(treeTable.getTree()); expander.expandAll(); initTreeCellRenderer(model); JBLabel infoLabel = new JBLabel(getStatusText(result)); infoLabel.setHorizontalAlignment(SwingConstants.LEFT); container.add(new JBScrollPane(queryLabel), BorderLayout.NORTH); // scroll pane is needed to correctly fit all the tree content and to show table header container.add(new JBScrollPane(treeTable, JBScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JBScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED), BorderLayout.CENTER); container.add(infoLabel, BorderLayout.SOUTH); new ColumnResizer(treeTable).resize(); }
@Override public void run(@NotNull ProgressIndicator indicator) { try { UIUtil.invokeLaterIfNeeded(() -> loadingDecorator.startLoading(false)); final MongoQueryOptions queryOptions = wayPoint.getQueryOptions(); if (!useCachedResults) { currentResults = mongoManager.findMongoDocuments( configuration, wayPoint.getCollection(), queryOptions); } UIUtil.invokeLaterIfNeeded(() -> { resultPanel.updateResultView(currentResults, pagination); rowCountLabel.setText(String.format("%s documents", currentResults.getDocuments().size())); initActions(resultPanel.resultTreeTableView); }); } catch (final Exception ex) { UIUtil.invokeLaterIfNeeded(() -> { errorPanel.invalidate(); errorPanel.removeAll(); errorPanel.add(new ErrorPanel(ex), BorderLayout.CENTER); errorPanel.validate(); errorPanel.setVisible(true); }); } finally { UIUtil.invokeLaterIfNeeded(loadingDecorator::stopLoading); } } });
private void updateEmptySelection() { projectNameLabel.setHyperlinkText( GoogleCloudCoreMessageBundle.getString("cloud.project.selector.no.selected.project")); accountInfoLabel.setHyperlinkText(""); accountInfoLabel.setIcon(null); projectAccountSeparatorLabel.setVisible(false); }
private void updateStyle(@NotNull JEditorPane pane) { EditorKit kit = pane.getEditorKit(); if (kit instanceof HTMLEditorKit) { StyleSheet css = ((HTMLEditorKit)kit).getStyleSheet(); css.addRule("body, p {" + "color:#" + ColorUtil.toHex(getForeground()) + ";" + "font-family:" + getFont().getFamily() + ";" + "font-size:" + getFont().getSize() + "pt;" + "white-space:nowrap;}"); } } }
private static LabeledComponent<RawCommandLineEditor> copyDialogCaption(final LabeledComponent<RawCommandLineEditor> component, String text) { final RawCommandLineEditor rawCommandLineEditor = component.getComponent(); rawCommandLineEditor.setDialogCaption(text); component.getLabel().setLabelFor(rawCommandLineEditor.getTextField()); return component; } }
private void checkBackgroundSessions() { boolean hasUnselectedBackgroundSessions = isContinued() && !targetMatchesCurrentState(); if (hasUnselectedBackgroundSessions) { warningHeader.setVisible(true); warningMessage.setVisible(true); warningMessage.setText( StackdriverDebuggerBundle.getString("clouddebug.terminate.background")); } }
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 Ballerina version"); gettingVersionPanel.add(gettingVersionIcon); gettingVersionPanel.add(new JLabel("Getting...")); myVersionPanel.add(gettingVersionPanel, VERSION_GETTING); myVersionPanel.add(myVersionLabel, VERSION_RESULT); setVersion(null); }
private void setVersion(@Nullable String version) { if (version == null) { myVersionLabel.setText("N/A"); myVersionLabel.setForeground(JBColor.RED); } else { myVersionLabel.setText(version); myVersionLabel.setForeground(myDefaultLabelColor); } ((CardLayout) myVersionPanel.getLayout()).show(myVersionPanel, VERSION_RESULT); }
public void showTooltip(GraphEntity entity, VisualItem item, MouseEvent e) { if (balloon != null && !balloon.isDisposed()) { balloon.hide(); } balloonPopupBuilder.setTitle(getTooltipTitle(entity)); balloonLabel.setText(getTooltipText(entity)); balloon = balloonPopupBuilder.createBalloon(); Container panel = e.getComponent().getParent(); final int magicNumber = 15; int heightOffset = balloon.getPreferredSize().height / 2 + magicNumber; int widthOffset; if (e.getX() > panel.getWidth() / 2) { widthOffset = balloon.getPreferredSize().width / 2; } else { widthOffset = panel.getWidth() - balloon.getPreferredSize().width / 2; } balloon.show(new RelativePoint(panel, new Point(widthOffset, heightOffset)), Balloon.Position.below); }