mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-95136 Move to another changelist shall pre-select 'create new' option If there's only one changelist so far [r=vasya]
This commit is contained in:
+5
@@ -71,6 +71,11 @@ public class MockChangeListManager extends ChangeListManagerEx {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getChangeListsNumber() {
|
||||
return getChangeListsCopy().size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<LocalChangeList> getChangeListsCopy() {
|
||||
return new ArrayList<LocalChangeList>(myChangeLists.values());
|
||||
|
||||
@@ -51,6 +51,7 @@ public abstract class ChangeListManager implements ChangeListModification {
|
||||
@TestOnly
|
||||
public abstract boolean ensureUpToDate(boolean canBeCanceled);
|
||||
|
||||
public abstract int getChangeListsNumber();
|
||||
public abstract List<LocalChangeList> getChangeListsCopy();
|
||||
@NotNull
|
||||
public abstract List<LocalChangeList> getChangeLists();
|
||||
|
||||
@@ -1410,6 +1410,13 @@ public class ChangeListManagerImpl extends ChangeListManagerEx implements Projec
|
||||
return worker.isDone();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getChangeListsNumber() {
|
||||
synchronized (myDataLock) {
|
||||
return myWorker.getChangeListsNumber();
|
||||
}
|
||||
}
|
||||
|
||||
// only a light attempt to show that some dirty scope request is asynchronously coming
|
||||
// for users to see changes are not valid
|
||||
// (commit -> asynch synch VFS -> asynch vcs dirty scope)
|
||||
|
||||
@@ -549,6 +549,10 @@ public class ChangeListWorker implements ChangeListsWriteOperations {
|
||||
return changes;
|
||||
}
|
||||
|
||||
public int getChangeListsNumber() {
|
||||
return myMap.size();
|
||||
}
|
||||
|
||||
private abstract class ExternalVsInternalChangesIntersection {
|
||||
protected final Collection<Change> myInChanges;
|
||||
protected final Map<Pair<String, String>, LocalChangeList> myInternalMap;
|
||||
|
||||
@@ -17,10 +17,7 @@ package com.intellij.openapi.vcs.changes.ui;
|
||||
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.DialogWrapper;
|
||||
import com.intellij.openapi.vcs.changes.ChangeList;
|
||||
import com.intellij.openapi.vcs.changes.ChangeListEditHandler;
|
||||
import com.intellij.openapi.vcs.changes.LocalChangeList;
|
||||
import com.intellij.openapi.vcs.changes.LocalChangeListImpl;
|
||||
import com.intellij.openapi.vcs.changes.*;
|
||||
import com.intellij.util.NullableConsumer;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -61,7 +58,7 @@ public class ChangeListChooser extends DialogWrapper {
|
||||
|
||||
myPanel.init();
|
||||
myPanel.setChangeLists(changelists);
|
||||
myPanel.setDefaultSelection(defaultSelection);
|
||||
myPanel.setDefaultSelection(changelists.size() <= 1 && onlyOneListInProject() ? null : defaultSelection);
|
||||
|
||||
setTitle(title);
|
||||
if (defaultName != null) {
|
||||
@@ -71,6 +68,10 @@ public class ChangeListChooser extends DialogWrapper {
|
||||
init();
|
||||
}
|
||||
|
||||
private boolean onlyOneListInProject() {
|
||||
return ChangeListManager.getInstance(myProject).getChangeListsNumber() <= 1;
|
||||
}
|
||||
|
||||
public JComponent getPreferredFocusedComponent() {
|
||||
return myPanel.getPreferredFocusedComponent();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user