Search in sources :

Example 1 with EditChangelistSupport

use of com.intellij.openapi.vcs.changes.ui.EditChangelistSupport in project intellij-community by JetBrains.

the class ShareDialog method createFolderPanel.

private JComponent createFolderPanel() {
    final Project project = myVCS.getProject();
    myCommitMessage = new CommitMessage(project) {

        @Override
        public Dimension getPreferredSize() {
            final Dimension superValue = super.getPreferredSize();
            return new Dimension(superValue.width, superValue.height > 90 ? superValue.height : 90);
        }

        @Override
        public void addNotify() {
            super.addNotify();
            myCommitMessage.getEditorField().getFocusTarget().addFocusListener(new FocusAdapter() {

                @Override
                public void focusGained(FocusEvent e) {
                    myPrefferedFocused = myCommitMessage.getEditorField();
                }
            });
        }
    };
    final JPanel panel = new JPanel(new GridBagLayout());
    final GridBagConstraints gb = new GridBagConstraints(0, 0, 1, 1, 1, 0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, JBUI.insets(1), 0, 0);
    gb.insets.top = 5;
    final JLabel label = new JLabel("Define share target");
    label.setFont(label.getFont().deriveFont(Font.BOLD));
    panel.add(label, gb);
    gb.insets.top = 1;
    final ButtonGroup bg = new ButtonGroup();
    myExisting = new JRadioButton();
    mySameNameAsLocal = new JRadioButton();
    myTrunk = new JRadioButton();
    bg.add(myExisting);
    bg.add(mySameNameAsLocal);
    bg.add(myTrunk);
    gb.insets.top = 1;
    ++gb.gridy;
    panel.add(myExisting, gb);
    ++gb.gridy;
    panel.add(mySameNameAsLocal, gb);
    ++gb.gridy;
    gb.insets.top = 5;
    panel.add(myTrunk, gb);
    myCreateStandard = new JCheckBox("Create /tags and /branches");
    myTrunk.addChangeListener(e -> myCreateStandard.setEnabled(myTrunk.isSelected()));
    myCreateStandard.setSelected(true);
    ++gb.gridy;
    gb.insets.top = 0;
    gb.insets.left = 10;
    panel.add(myCreateStandard, gb);
    ++gb.gridy;
    gb.gridx = 0;
    gb.insets.top = 1;
    gb.insets.left = 1;
    gb.weightx = 1;
    gb.fill = GridBagConstraints.HORIZONTAL;
    final LocalChangeList list = ChangeListManager.getInstance(project).getDefaultChangeList();
    String text = list.getComment();
    text = StringUtil.isEmptyOrSpaces(text) ? (list.hasDefaultName() ? "" : list.getName()) : text;
    myCommitMessage.setText(text);
    panel.add(myCommitMessage, gb);
    myCommitMessage.setSeparatorText("Commit Comment Prefix");
    for (EditChangelistSupport support : Extensions.getExtensions(EditChangelistSupport.EP_NAME, project)) {
        support.installSearch(myCommitMessage.getEditorField(), myCommitMessage.getEditorField());
    }
    myTrunk.setSelected(true);
    return panel;
}
Also used : FocusAdapter(java.awt.event.FocusAdapter) CommitMessage(com.intellij.openapi.vcs.ui.CommitMessage) FocusEvent(java.awt.event.FocusEvent) Project(com.intellij.openapi.project.Project) EditChangelistSupport(com.intellij.openapi.vcs.changes.ui.EditChangelistSupport) LocalChangeList(com.intellij.openapi.vcs.changes.LocalChangeList)

Aggregations

Project (com.intellij.openapi.project.Project)1 LocalChangeList (com.intellij.openapi.vcs.changes.LocalChangeList)1 EditChangelistSupport (com.intellij.openapi.vcs.changes.ui.EditChangelistSupport)1 CommitMessage (com.intellij.openapi.vcs.ui.CommitMessage)1 FocusAdapter (java.awt.event.FocusAdapter)1 FocusEvent (java.awt.event.FocusEvent)1