Search in sources :

Example 26 with JBLabel

use of com.intellij.ui.components.JBLabel in project intellij-community by JetBrains.

the class GitBranchIsNotFullyMergedDialog method createNorthPanel.

@Override
protected JComponent createNorthPanel() {
    JBLabel descriptionLabel = new JBLabel(makeDescription(myInitialRepository));
    JComboBox repositorySelector = new JComboBox(ArrayUtil.toObjectArray(myRepositories, GitRepository.class));
    repositorySelector.setRenderer(new GitRepositoryComboboxListCellRenderer(repositorySelector));
    repositorySelector.setSelectedItem(myInitialRepository);
    repositorySelector.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            GitRepository selectedRepo = (GitRepository) repositorySelector.getSelectedItem();
            descriptionLabel.setText(makeDescription(selectedRepo));
            myCommitListWithDiffPanel.setCommits(myCommits.get(selectedRepo));
        }
    });
    JPanel repoSelectorPanel = new JPanel(new BorderLayout());
    JBLabel label = new JBLabel("Repository: ");
    label.setLabelFor(repoSelectorPanel);
    repoSelectorPanel.add(label, BorderLayout.WEST);
    repoSelectorPanel.add(repositorySelector);
    if (myRepositories.size() < 2) {
        repoSelectorPanel.setVisible(false);
    }
    JPanel northPanel = new JPanel(new BorderLayout());
    northPanel.add(descriptionLabel);
    northPanel.add(repoSelectorPanel, BorderLayout.SOUTH);
    return northPanel;
}
Also used : GitRepository(git4idea.repo.GitRepository) GitRepositoryComboboxListCellRenderer(git4idea.ui.GitRepositoryComboboxListCellRenderer) ActionListener(java.awt.event.ActionListener) JBLabel(com.intellij.ui.components.JBLabel) ActionEvent(java.awt.event.ActionEvent)

Example 27 with JBLabel

use of com.intellij.ui.components.JBLabel in project intellij-community by JetBrains.

the class GitSmartOperationDialog method createNorthPanel.

@Override
protected JComponent createNorthPanel() {
    JBLabel description = new JBLabel("<html>Your local changes to the following files would be overwritten by " + myOperationTitle + ".<br/>" + ApplicationNamesInfo.getInstance().getFullProductName() + " can stash the changes, " + myOperationTitle + " and unstash them after that.</html>");
    description.setBorder(IdeBorderFactory.createEmptyBorder(0, 0, 10, 0));
    return description;
}
Also used : JBLabel(com.intellij.ui.components.JBLabel)

Example 28 with JBLabel

use of com.intellij.ui.components.JBLabel in project intellij-community by JetBrains.

the class GitCompareBranchesLogPanel method createNorthPanel.

private JComponent createNorthPanel() {
    final JComboBox repoSelector = new JComboBox(ArrayUtil.toObjectArray(myCompareInfo.getRepositories(), GitRepository.class));
    repoSelector.setRenderer(new GitRepositoryComboboxListCellRenderer(repoSelector));
    repoSelector.setSelectedItem(myInitialRepo);
    repoSelector.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            GitRepository selectedRepo = (GitRepository) repoSelector.getSelectedItem();
            myHeadToBranchListPanel.setCommits(getHeadToBranchCommits(selectedRepo));
            myBranchToHeadListPanel.setCommits(getBranchToHeadCommits(selectedRepo));
        }
    });
    JPanel repoSelectorPanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0));
    JBLabel label = new JBLabel("Repository: ");
    label.setLabelFor(repoSelectorPanel);
    label.setDisplayedMnemonic(KeyEvent.VK_R);
    repoSelectorPanel.add(label);
    repoSelectorPanel.add(repoSelector);
    if (myCompareInfo.getRepositories().size() < 2) {
        repoSelectorPanel.setVisible(false);
    }
    return repoSelectorPanel;
}
Also used : GitRepository(git4idea.repo.GitRepository) GitRepositoryComboboxListCellRenderer(git4idea.ui.GitRepositoryComboboxListCellRenderer) ActionListener(java.awt.event.ActionListener) JBLabel(com.intellij.ui.components.JBLabel) ActionEvent(java.awt.event.ActionEvent)

Example 29 with JBLabel

use of com.intellij.ui.components.JBLabel in project intellij-community by JetBrains.

the class GithubRepositoryEditor method createCustomPanel.

@Nullable
@Override
protected JComponent createCustomPanel() {
    myHostLabel = new JBLabel("Host:", SwingConstants.RIGHT);
    JPanel myHostPanel = new JPanel(new BorderLayout(5, 0));
    myHostPanel.add(myURLText, BorderLayout.CENTER);
    myHostPanel.add(myShareUrlCheckBox, BorderLayout.EAST);
    myRepositoryLabel = new JBLabel("Repository:", SwingConstants.RIGHT);
    myRepoAuthor = new MyTextField("Repository Owner");
    myRepoName = new MyTextField("Repository Name");
    myRepoAuthor.setPreferredSize("SomelongNickname");
    myRepoName.setPreferredSize("SomelongReponame-with-suffixes");
    JPanel myRepoPanel = new JPanel(new GridBagLayout());
    GridBag bag = new GridBag().setDefaultWeightX(1).setDefaultFill(GridBagConstraints.HORIZONTAL);
    myRepoPanel.add(myRepoAuthor, bag.nextLine().next());
    myRepoPanel.add(new JLabel("/"), bag.next().fillCellNone().insets(0, 5, 0, 5).weightx(0));
    myRepoPanel.add(myRepoName, bag.next());
    myTokenLabel = new JBLabel("API Token:", SwingConstants.RIGHT);
    myToken = new MyTextField("OAuth2 token");
    myTokenButton = new JButton("Create API token");
    myTokenButton.addActionListener(e -> {
        generateToken();
        doApply();
    });
    JPanel myTokenPanel = new JPanel();
    myTokenPanel.setLayout(new BorderLayout(5, 5));
    myTokenPanel.add(myToken, BorderLayout.CENTER);
    myTokenPanel.add(myTokenButton, BorderLayout.EAST);
    myShowNotAssignedIssues = new JBCheckBox("Include issues not assigned to me");
    installListener(myRepoAuthor);
    installListener(myRepoName);
    installListener(myToken);
    installListener(myShowNotAssignedIssues);
    return FormBuilder.createFormBuilder().setAlignLabelOnRight(true).addLabeledComponent(myHostLabel, myHostPanel).addLabeledComponent(myRepositoryLabel, myRepoPanel).addLabeledComponent(myTokenLabel, myTokenPanel).addComponentToRightColumn(myShowNotAssignedIssues).getPanel();
}
Also used : JBLabel(com.intellij.ui.components.JBLabel) GridBag(com.intellij.util.ui.GridBag) JBCheckBox(com.intellij.ui.components.JBCheckBox) Nullable(org.jetbrains.annotations.Nullable)

Example 30 with JBLabel

use of com.intellij.ui.components.JBLabel in project intellij-community by JetBrains.

the class IdeaGradleProjectSettingsControlBuilder method addGradleHomeComponents.

@Override
public IdeaGradleProjectSettingsControlBuilder addGradleHomeComponents(PaintAwarePanel content, int indentLevel) {
    if (dropGradleHomePathComponents)
        return this;
    myGradleHomeLabel = new JBLabel(GradleBundle.message("gradle.settings.text.home.path"));
    myGradleHomePathField = new TextFieldWithBrowseButton();
    myGradleHomePathField.addBrowseFolderListener("", GradleBundle.message("gradle.settings.text.home.path"), null, GradleUtil.getGradleHomeFileChooserDescriptor(), TextComponentAccessor.TEXT_FIELD_WHOLE_TEXT);
    myGradleHomePathField.getTextField().getDocument().addDocumentListener(new DocumentListener() {

        @Override
        public void insertUpdate(DocumentEvent e) {
            myGradleHomePathField.getTextField().setForeground(LocationSettingType.EXPLICIT_CORRECT.getColor());
        }

        @Override
        public void removeUpdate(DocumentEvent e) {
            myGradleHomePathField.getTextField().setForeground(LocationSettingType.EXPLICIT_CORRECT.getColor());
        }

        @Override
        public void changedUpdate(DocumentEvent e) {
        }
    });
    content.add(myGradleHomeLabel, ExternalSystemUiUtil.getLabelConstraints(indentLevel));
    content.add(myGradleHomePathField, ExternalSystemUiUtil.getFillLineConstraints(0));
    return this;
}
Also used : DocumentListener(javax.swing.event.DocumentListener) TextFieldWithBrowseButton(com.intellij.openapi.ui.TextFieldWithBrowseButton) JBLabel(com.intellij.ui.components.JBLabel) DocumentEvent(javax.swing.event.DocumentEvent)

Aggregations

JBLabel (com.intellij.ui.components.JBLabel)98 Nullable (org.jetbrains.annotations.Nullable)23 NotNull (org.jetbrains.annotations.NotNull)11 JBCheckBox (com.intellij.ui.components.JBCheckBox)10 FileChooserDescriptor (com.intellij.openapi.fileChooser.FileChooserDescriptor)9 VirtualFile (com.intellij.openapi.vfs.VirtualFile)8 ComboBox (com.intellij.openapi.ui.ComboBox)7 VerticalFlowLayout (com.intellij.openapi.ui.VerticalFlowLayout)7 GridBag (com.intellij.util.ui.GridBag)7 List (java.util.List)7 JBList (com.intellij.ui.components.JBList)6 JBTable (com.intellij.ui.table.JBTable)6 JBTextField (com.intellij.ui.components.JBTextField)5 DocumentEvent (javax.swing.event.DocumentEvent)5 DumbAwareAction (com.intellij.openapi.project.DumbAwareAction)4 Project (com.intellij.openapi.project.Project)4 TextFieldWithBrowseButton (com.intellij.openapi.ui.TextFieldWithBrowseButton)4 StringUtil (com.intellij.openapi.util.text.StringUtil)4 java.awt (java.awt)4 ArrayList (java.util.ArrayList)4