Search in sources :

Example 16 with MultiLineLabelUI

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

the class RootsAndBranches method createPanels.

private void createPanels(final RepositoryLocation location, final Runnable afterRefresh) {
    final Task.Backgroundable backgroundable = new Task.Backgroundable(myProject, "Subversion: loading working copies data..", false) {

        public void run(@NotNull final ProgressIndicator indicator) {
            indicator.setIndeterminate(true);
            final Map<String, SvnMergeInfoRootPanelManual> panels = new HashMap<>();
            final Map<String, MergeInfoHolder> holders = new HashMap<>();
            final List<WCInfoWithBranches> roots = myDataLoader.loadRoots();
            SwingUtilities.invokeLater(() -> {
                if (myDisposed)
                    return;
                final JPanel mainPanel = prepareData(panels, holders, roots);
                myMergePanels.clear();
                myHolders.clear();
                myMergePanels.putAll(panels);
                myHolders.putAll(holders);
                if (myPanelWrapper != null) {
                    myPanelWrapper.removeAll();
                    if (myMergePanels.isEmpty()) {
                        final JPanel emptyPanel = new JPanel(new GridBagLayout());
                        final GridBagConstraints gb = new GridBagConstraints(0, 0, 1, 1, 1, 1, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(5, 5, 0, 5), 0, 0);
                        final JLabel label = new JLabel("No Subversion 1.5 working copies\nof 1.5 repositories in the project");
                        label.setUI(new MultiLineLabelUI());
                        emptyPanel.add(label, gb);
                        gb.fill = GridBagConstraints.HORIZONTAL;
                        myPanelWrapper.add(emptyPanel, gb);
                    } else {
                        for (MergeInfoHolder holder : myHolders.values()) {
                            holder.updateMixedRevisionsForPanel();
                        }
                        myPanelWrapper.add(mainPanel, new GridBagConstraints(0, 0, 1, 1, 1, 1, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
                    }
                    myPanelWrapper.repaint();
                } else {
                    myPanel = mainPanel;
                }
                if (afterRefresh != null) {
                    afterRefresh.run();
                }
            });
        }
    };
    ProgressManager.getInstance().run(backgroundable);
}
Also used : Task(com.intellij.openapi.progress.Task) HashMap(java.util.HashMap) NotNull(org.jetbrains.annotations.NotNull) MergeInfoHolder(org.jetbrains.idea.svn.mergeinfo.MergeInfoHolder) MultiLineLabelUI(com.intellij.openapi.ui.MultiLineLabelUI) ProgressIndicator(com.intellij.openapi.progress.ProgressIndicator) WCInfoWithBranches(org.jetbrains.idea.svn.dialogs.WCInfoWithBranches)

Example 17 with MultiLineLabelUI

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

the class UpgradeFormatDialog method createCenterPanel.

@Nullable
protected JComponent createCenterPanel() {
    JPanel panel = new JPanel();
    panel.setLayout(new GridBagLayout());
    GridBagConstraints gb = new GridBagConstraints();
    // top label.
    gb.insets = JBUI.insets(2);
    gb.weightx = 1;
    gb.weighty = 0;
    gb.gridwidth = 2;
    gb.gridheight = 1;
    gb.gridx = 0;
    gb.gridy = 0;
    gb.anchor = GridBagConstraints.WEST;
    gb.fill = GridBagConstraints.HORIZONTAL;
    File adminPath = new File(myPath, SVNFileUtil.getAdminDirectoryName());
    final boolean adminPathIsDirectory = adminPath.isDirectory();
    final String label = getMiddlePartOfResourceKey(adminPathIsDirectory);
    JLabel topLabel = new JLabel(getTopMessage(label));
    topLabel.setUI(new MultiLineLabelUI());
    panel.add(topLabel, gb);
    gb.gridy += 1;
    registerFormat(WorkingCopyFormat.ONE_DOT_SIX, label, panel, gb);
    registerFormat(WorkingCopyFormat.ONE_DOT_SEVEN, label, panel, gb);
    registerFormat(WorkingCopyFormat.ONE_DOT_EIGHT, label, panel, gb);
    final JPanel auxiliaryPanel = getBottomAuxiliaryPanel();
    if (auxiliaryPanel != null) {
        panel.add(auxiliaryPanel, gb);
        gb.gridy += 1;
    }
    myLoadingPanel = new JBLoadingPanel(new BorderLayout(), getDisposable());
    myLoadingPanel.add(panel, BorderLayout.CENTER);
    return myLoadingPanel;
}
Also used : MultiLineLabelUI(com.intellij.openapi.ui.MultiLineLabelUI) JBLoadingPanel(com.intellij.ui.components.JBLoadingPanel) File(java.io.File) Nullable(org.jetbrains.annotations.Nullable)

Example 18 with MultiLineLabelUI

use of com.intellij.openapi.ui.MultiLineLabelUI 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)

Example 19 with MultiLineLabelUI

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

the class SourcePathsStep method createComponentForChooseSources.

private JComponent createComponentForChooseSources() {
    final JPanel panel = new JPanel(new GridBagLayout());
    mySourcePathsChooser = new ElementsChooser<JavaModuleSourceRoot>(true) {

        public String getItemText(@NotNull JavaModuleSourceRoot sourceRoot) {
            StringBuilder builder = StringBuilderSpinAllocator.alloc();
            try {
                builder.append(sourceRoot.getDirectory().getAbsolutePath());
                final String packagePrefix = sourceRoot.getPackagePrefix();
                if (!packagePrefix.isEmpty()) {
                    builder.append(" (").append(packagePrefix).append(")");
                }
                builder.append(" [").append(sourceRoot.getRootTypeName()).append("]");
                return builder.toString();
            } finally {
                StringBuilderSpinAllocator.dispose(builder);
            }
        }
    };
    final String text = IdeBundle.message("label.java.source.files.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(mySourcePathsChooser, 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) {
            mySourcePathsChooser.setAllElementsMarked(true);
        }
    });
    unmarkAllButton.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            mySourcePathsChooser.setAllElementsMarked(false);
        }
    });
    return panel;
}
Also used : MultiLineLabelUI(com.intellij.openapi.ui.MultiLineLabelUI) ActionListener(java.awt.event.ActionListener) ActionEvent(java.awt.event.ActionEvent) JavaModuleSourceRoot(com.intellij.ide.util.projectWizard.importSources.JavaModuleSourceRoot)

Example 20 with MultiLineLabelUI

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

the class RefactoringMessageDialog method createNorthPanel.

@Override
protected JComponent createNorthPanel() {
    JLabel label = new JLabel(myMessage);
    label.setUI(new MultiLineLabelUI());
    JPanel panel = new JPanel(new BorderLayout(10, 0));
    if (myIcon != null) {
        panel.add(new JLabel(myIcon), BorderLayout.WEST);
        panel.add(label, BorderLayout.CENTER);
    } else {
        panel.add(label, BorderLayout.WEST);
    }
    return panel;
}
Also used : MultiLineLabelUI(com.intellij.openapi.ui.MultiLineLabelUI)

Aggregations

MultiLineLabelUI (com.intellij.openapi.ui.MultiLineLabelUI)20 ActionEvent (java.awt.event.ActionEvent)3 ActionListener (java.awt.event.ActionListener)3 Nullable (org.jetbrains.annotations.Nullable)3 NotNull (org.jetbrains.annotations.NotNull)2 PathMacroListEditor (com.intellij.application.options.pathMacros.PathMacroListEditor)1 JavaModuleSourceRoot (com.intellij.ide.util.projectWizard.importSources.JavaModuleSourceRoot)1 FileChooserDescriptor (com.intellij.openapi.fileChooser.FileChooserDescriptor)1 ProgressIndicator (com.intellij.openapi.progress.ProgressIndicator)1 Task (com.intellij.openapi.progress.Task)1 MultiLineLabel (com.intellij.openapi.ui.ex.MultiLineLabel)1 CollectionComboBoxModel (com.intellij.ui.CollectionComboBoxModel)1 DocumentAdapter (com.intellij.ui.DocumentAdapter)1 FieldPanel (com.intellij.ui.FieldPanel)1 JBLabel (com.intellij.ui.components.JBLabel)1 JBLoadingPanel (com.intellij.ui.components.JBLoadingPanel)1 Chunk (com.intellij.util.Chunk)1 Table (com.intellij.util.ui.Table)1 BorderLayoutPanel (com.intellij.util.ui.components.BorderLayoutPanel)1 GridBagConstraints (java.awt.GridBagConstraints)1