Search in sources :

Example 1 with MultiLineLabel

use of com.intellij.openapi.ui.ex.MultiLineLabel in project android by JetBrains.

the class LibraryPropertiesDialog method createCenterPanel.

@Nullable
@Override
protected JComponent createCenterPanel() {
    myIconLabel.setIcon(AllIcons.Modules.Library);
    myNameLabel.setText(myLibrary.getName());
    LibraryEditor editor = new SourcesAndDocsOnlyEditor(myLibrary);
    myLibraryEditorComponent = new LibraryRootsComponent(myProject, editor) {

        @Override
        public void updatePropertiesLabel() {
            JComponent c = getComponent();
            if (c != null) {
                MultiLineLabel propertiesLabel = findComponentOfType(c, MultiLineLabel.class);
                if (propertiesLabel != null) {
                    propertiesLabel.setText("Add or remove source/Javadoc attachments");
                }
            }
        }
    };
    myLibraryEditorComponent.updatePropertiesLabel();
    JComponent c = myLibraryEditorComponent.getComponent();
    // Remove "Exclude" button. We don't support this in libraries.
    List<ActionButton> actionButtons = findComponentsOfType(c, ActionButton.class);
    for (ActionButton actionButton : actionButtons) {
        String text = actionButton.getAction().getTemplatePresentation().getText();
        if (text != null && text.startsWith("Exclude")) {
            actionButton.setVisible(false);
            break;
        }
    }
    MultiLineLabel propertiesLabel = findComponentOfType(c, MultiLineLabel.class);
    if (propertiesLabel != null) {
        propertiesLabel.setBorder(BorderFactory.createEmptyBorder(1, 1, 0, 1));
    }
    myTreePanel.add(c, BorderLayout.CENTER);
    myTreePanel.setBorder(customLine(OnePixelDivider.BACKGROUND, 1, 1, 1, 1));
    return myMainPanel;
}
Also used : ExistingLibraryEditor(com.intellij.openapi.roots.ui.configuration.libraryEditor.ExistingLibraryEditor) LibraryEditor(com.intellij.openapi.roots.ui.configuration.libraryEditor.LibraryEditor) ActionButton(com.intellij.openapi.actionSystem.impl.ActionButton) LibraryRootsComponent(com.intellij.openapi.roots.ui.configuration.libraryEditor.LibraryRootsComponent) MultiLineLabel(com.intellij.openapi.ui.ex.MultiLineLabel) Nullable(org.jetbrains.annotations.Nullable)

Example 2 with MultiLineLabel

use of com.intellij.openapi.ui.ex.MultiLineLabel in project intellij-community by JetBrains.

the class LocalChangesWouldBeOverwrittenHelper method showErrorDialog.

private static void showErrorDialog(@NotNull Project project, @NotNull String operationName, @NotNull List<Change> changes, @NotNull Collection<String> absolutePaths) {
    String title = "Local Changes Prevent from " + StringUtil.capitalize(operationName);
    String description = getErrorDialogDescription();
    if (changes.isEmpty()) {
        GitUtil.showPathsInDialog(project, absolutePaths, title, description);
    } else {
        DialogBuilder builder = new DialogBuilder(project);
        builder.setNorthPanel(new MultiLineLabel(description));
        builder.setCenterPanel(new ChangesBrowserWithRollback(project, changes));
        builder.addOkAction();
        builder.setTitle(title);
        builder.show();
    }
}
Also used : ChangesBrowserWithRollback(git4idea.ui.ChangesBrowserWithRollback) DialogBuilder(com.intellij.openapi.ui.DialogBuilder) MultiLineLabel(com.intellij.openapi.ui.ex.MultiLineLabel)

Example 3 with MultiLineLabel

use of com.intellij.openapi.ui.ex.MultiLineLabel in project intellij-community by JetBrains.

the class GitUtil method showPathsInDialog.

public static void showPathsInDialog(@NotNull Project project, @NotNull Collection<String> absolutePaths, @NotNull String title, @Nullable String description) {
    DialogBuilder builder = new DialogBuilder(project);
    builder.setCenterPanel(new GitSimplePathsBrowser(project, absolutePaths));
    if (description != null) {
        builder.setNorthPanel(new MultiLineLabel(description));
    }
    builder.addOkAction();
    builder.setTitle(title);
    builder.show();
}
Also used : GitSimplePathsBrowser(git4idea.util.GitSimplePathsBrowser) DialogBuilder(com.intellij.openapi.ui.DialogBuilder) MultiLineLabel(com.intellij.openapi.ui.ex.MultiLineLabel)

Example 4 with MultiLineLabel

use of com.intellij.openapi.ui.ex.MultiLineLabel in project intellij-community by JetBrains.

the class RootsDetectionStep method createResultsPanel.

protected JComponent createResultsPanel() {
    final JPanel panel = new JPanel(new GridBagLayout());
    myDetectedRootsChooser = new DetectedRootsChooser();
    myDetectedRootsChooser.addSelectionListener(new DetectedRootsChooser.RootSelectionListener() {

        @Override
        public void selectionChanged() {
            updateSelectedTypes();
        }
    });
    final String text = IdeBundle.message("label.project.roots.have.been.found");
    final JLabel label = new JLabel(text);
    label.setUI(new MultiLineLabelUI());
    panel.add(label, new GridBagConstraints(0, GridBagConstraints.RELATIVE, 2, 1, 1.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, JBUI.insets(8, 10, 0, 10), 0, 0));
    panel.add(myDetectedRootsChooser.getComponent(), new GridBagConstraints(0, GridBagConstraints.RELATIVE, 2, 1, 1.0, 1.0, GridBagConstraints.NORTHWEST, GridBagConstraints.BOTH, JBUI.insets(8, 10), 0, 0));
    final JButton markAllButton = new JButton(IdeBundle.message("button.mark.all"));
    panel.add(markAllButton, new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, JBUI.insets(0, 10, 8, 2), 0, 0));
    final JButton unmarkAllButton = new JButton(IdeBundle.message("button.unmark.all"));
    panel.add(unmarkAllButton, new GridBagConstraints(1, GridBagConstraints.RELATIVE, 1, 1, 1.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, JBUI.insets(0, 0, 8, 10), 0, 0));
    markAllButton.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            myDetectedRootsChooser.setAllElementsMarked(true);
        }
    });
    unmarkAllButton.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            myDetectedRootsChooser.setAllElementsMarked(false);
        }
    });
    myResultPanel = new JPanel(new CardLayout());
    myResultPanel.add(ROOTS_FOUND_CARD, panel);
    JPanel notFoundPanel = new JPanel(new BorderLayout());
    notFoundPanel.setBorder(IdeBorderFactory.createEmptyBorder(5));
    notFoundPanel.add(BorderLayout.NORTH, new MultiLineLabel(IdeBundle.message("label.project.roots.not.found")));
    myResultPanel.add(ROOTS_NOT_FOUND_CARD, notFoundPanel);
    return myResultPanel;
}
Also used : ActionEvent(java.awt.event.ActionEvent) MultiLineLabelUI(com.intellij.openapi.ui.MultiLineLabelUI) ActionListener(java.awt.event.ActionListener) MultiLineLabel(com.intellij.openapi.ui.ex.MultiLineLabel)

Aggregations

MultiLineLabel (com.intellij.openapi.ui.ex.MultiLineLabel)4 DialogBuilder (com.intellij.openapi.ui.DialogBuilder)2 ActionButton (com.intellij.openapi.actionSystem.impl.ActionButton)1 ExistingLibraryEditor (com.intellij.openapi.roots.ui.configuration.libraryEditor.ExistingLibraryEditor)1 LibraryEditor (com.intellij.openapi.roots.ui.configuration.libraryEditor.LibraryEditor)1 LibraryRootsComponent (com.intellij.openapi.roots.ui.configuration.libraryEditor.LibraryRootsComponent)1 MultiLineLabelUI (com.intellij.openapi.ui.MultiLineLabelUI)1 ChangesBrowserWithRollback (git4idea.ui.ChangesBrowserWithRollback)1 GitSimplePathsBrowser (git4idea.util.GitSimplePathsBrowser)1 ActionEvent (java.awt.event.ActionEvent)1 ActionListener (java.awt.event.ActionListener)1 Nullable (org.jetbrains.annotations.Nullable)1