Search in sources :

Example 1 with CommitMessage

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

the class SvnEditCommitMessageDialog method createCenterPanel.

@Nullable
@Override
protected JComponent createCenterPanel() {
    JPanel parentPanel = new JPanel(new BorderLayout());
    final JPanel labelPanel = new JPanel(new GridBagLayout());
    final JLabel label1 = new JLabel(SvnBundle.message("svn.edit.commit.message.attention"));
    parentPanel.setMinimumSize(new Dimension(label1.getPreferredSize().width + 50, 150));
    final GridBagConstraints gb = new GridBagConstraints(0, 0, 1, 1, 0, 0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, JBUI.insets(1), 0, 0);
    label1.setFont(label1.getFont().deriveFont(Font.BOLD));
    labelPanel.add(label1, gb);
    ++gb.gridy;
    gb.insets.top = 5;
    gb.insets.bottom = 3;
    final JLabel label2 = new JLabel(SvnBundle.message("svn.edit.commit.message.prompt"));
    labelPanel.add(label2, gb);
    final JPanel wrapper = new JPanel(new BorderLayout());
    wrapper.add(labelPanel, BorderLayout.WEST);
    parentPanel.add(wrapper, BorderLayout.NORTH);
    myCommitMessage = new CommitMessage(myProject, false);
    myCommitMessage.setText(myOldText);
    parentPanel.add(myCommitMessage, BorderLayout.CENTER);
    return parentPanel;
}
Also used : CommitMessage(com.intellij.openapi.vcs.ui.CommitMessage) Nullable(org.jetbrains.annotations.Nullable)

Example 2 with CommitMessage

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

the class TaskCompletionTest method configureFile.

private void configureFile(String text) {
    PsiFile psiFile = myFixture.configureByText("test.txt", text);
    Document document = myFixture.getDocument(psiFile);
    final Project project = getProject();
    TextFieldWithAutoCompletion.installCompletion(document, project, new TaskAutoCompletionListProvider(project), false);
    document.putUserData(CommitMessage.DATA_KEY, new CommitMessage(project));
}
Also used : Project(com.intellij.openapi.project.Project) CommitMessage(com.intellij.openapi.vcs.ui.CommitMessage) TaskAutoCompletionListProvider(com.intellij.tasks.actions.TaskAutoCompletionListProvider) PsiFile(com.intellij.psi.PsiFile) Document(com.intellij.openapi.editor.Document)

Example 3 with CommitMessage

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

the class CommitCompletionContributor method fillCompletionVariants.

@Override
public void fillCompletionVariants(@NotNull CompletionParameters parameters, @NotNull CompletionResultSet result) {
    PsiFile file = parameters.getOriginalFile();
    Document document = PsiDocumentManager.getInstance(file.getProject()).getDocument(file);
    if (document == null)
        return;
    CommitMessage commitMessage = document.getUserData(CommitMessage.DATA_KEY);
    if (commitMessage == null)
        return;
    result.stopHere();
    if (parameters.getInvocationCount() <= 0)
        return;
    List<ChangeList> lists = commitMessage.getChangeLists();
    if (lists.isEmpty())
        return;
    String prefix = TextFieldWithAutoCompletionListProvider.getCompletionPrefix(parameters);
    CompletionResultSet insensitive = result.caseInsensitive().withPrefixMatcher(new CamelHumpMatcher(prefix));
    for (ChangeList list : lists) {
        for (Change change : list.getChanges()) {
            ContentRevision revision = change.getAfterRevision() == null ? change.getBeforeRevision() : change.getAfterRevision();
            if (revision != null) {
                FilePath filePath = revision.getFile();
                LookupElementBuilder element = LookupElementBuilder.create(filePath.getName()).withIcon(filePath.getFileType().getIcon());
                insensitive.addElement(element);
            }
        }
    }
}
Also used : CommitMessage(com.intellij.openapi.vcs.ui.CommitMessage) ChangeList(com.intellij.openapi.vcs.changes.ChangeList) CompletionResultSet(com.intellij.codeInsight.completion.CompletionResultSet) ContentRevision(com.intellij.openapi.vcs.changes.ContentRevision) LookupElementBuilder(com.intellij.codeInsight.lookup.LookupElementBuilder) PsiFile(com.intellij.psi.PsiFile) Change(com.intellij.openapi.vcs.changes.Change) Document(com.intellij.openapi.editor.Document) CamelHumpMatcher(com.intellij.codeInsight.completion.impl.CamelHumpMatcher)

Example 4 with CommitMessage

use of com.intellij.openapi.vcs.ui.CommitMessage 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

CommitMessage (com.intellij.openapi.vcs.ui.CommitMessage)4 Document (com.intellij.openapi.editor.Document)2 Project (com.intellij.openapi.project.Project)2 PsiFile (com.intellij.psi.PsiFile)2 CompletionResultSet (com.intellij.codeInsight.completion.CompletionResultSet)1 CamelHumpMatcher (com.intellij.codeInsight.completion.impl.CamelHumpMatcher)1 LookupElementBuilder (com.intellij.codeInsight.lookup.LookupElementBuilder)1 Change (com.intellij.openapi.vcs.changes.Change)1 ChangeList (com.intellij.openapi.vcs.changes.ChangeList)1 ContentRevision (com.intellij.openapi.vcs.changes.ContentRevision)1 LocalChangeList (com.intellij.openapi.vcs.changes.LocalChangeList)1 EditChangelistSupport (com.intellij.openapi.vcs.changes.ui.EditChangelistSupport)1 TaskAutoCompletionListProvider (com.intellij.tasks.actions.TaskAutoCompletionListProvider)1 FocusAdapter (java.awt.event.FocusAdapter)1 FocusEvent (java.awt.event.FocusEvent)1 Nullable (org.jetbrains.annotations.Nullable)1