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;
}
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));
}
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);
}
}
}
}
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;
}
Aggregations