mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[vcs]: use last typed description for new changelist instead of empty one
This commit is contained in:
+21
-1
@@ -37,6 +37,8 @@ import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.FocusAdapter;
|
||||
import java.awt.event.FocusEvent;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
@@ -49,6 +51,7 @@ public class ChangeListChooserPanel extends JPanel {
|
||||
private final NewEditChangelistPanel myListPanel;
|
||||
private final NullableConsumer<String> myOkEnabledListener;
|
||||
private final Project myProject;
|
||||
private String myLastTypedDescription;
|
||||
|
||||
public ChangeListChooserPanel(final Project project, @NotNull final NullableConsumer<String> okEnabledListener) {
|
||||
super(new BorderLayout());
|
||||
@@ -107,6 +110,20 @@ public class ChangeListChooserPanel extends JPanel {
|
||||
myOkEnabledListener.consume(errorMessage);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(LocalChangeList initial) {
|
||||
super.init(initial);
|
||||
myDescriptionTextArea.addFocusListener(new FocusAdapter() {
|
||||
@Override
|
||||
public void focusLost(FocusEvent e) {
|
||||
super.focusLost(e);
|
||||
if (getExistingChangelist() == null) {
|
||||
myLastTypedDescription = myListPanel.getDescription();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void nameChangedImpl(Project project, LocalChangeList initial) {
|
||||
nameChanged(StringUtil.isEmptyOrSpaces(getChangeListName()) ? "Cannot create new changelist with empty name." : null);
|
||||
@@ -175,7 +192,10 @@ public class ChangeListChooserPanel extends JPanel {
|
||||
|
||||
private void updateDescription() {
|
||||
LocalChangeList list = getExistingChangelist();
|
||||
myListPanel.setDescription(list != null ? list.getComment() : "");
|
||||
String newText = list != null ? list.getComment() : myLastTypedDescription;
|
||||
if (!StringUtil.equals(myListPanel.getDescription(), newText)) {
|
||||
myListPanel.setDescription(newText);
|
||||
}
|
||||
}
|
||||
|
||||
private LocalChangeList getExistingChangelist() {
|
||||
|
||||
+2
-2
@@ -37,8 +37,8 @@ import java.awt.*;
|
||||
import java.util.Set;
|
||||
|
||||
public abstract class NewEditChangelistPanel extends JPanel {
|
||||
private final EditorTextField myNameTextField;
|
||||
private final EditorTextField myDescriptionTextArea;
|
||||
protected final EditorTextField myNameTextField;
|
||||
protected final EditorTextField myDescriptionTextArea;
|
||||
private final JPanel myAdditionalControlsPanel;
|
||||
private final JCheckBox myMakeActiveCheckBox;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user