mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
keep task sorting order
This commit is contained in:
@@ -81,8 +81,8 @@ public class TaskManagerImpl extends TaskManager implements ProjectComponent, Pe
|
||||
|
||||
private final WorkingContextManager myContextManager;
|
||||
|
||||
private final Map<String,Task> myIssueCache = Collections.synchronizedMap(new HashMap<String,Task>());
|
||||
private final Map<String,Task> myTemporaryCache = Collections.synchronizedMap(new HashMap<String,Task>());
|
||||
private final Map<String,Task> myIssueCache = Collections.synchronizedMap(new LinkedHashMap<String,Task>());
|
||||
private final Map<String,Task> myTemporaryCache = Collections.synchronizedMap(new LinkedHashMap<String,Task>());
|
||||
|
||||
private final Map<String, LocalTaskImpl> myTasks = Collections.synchronizedMap(new LinkedHashMap<String, LocalTaskImpl>() {
|
||||
@Override
|
||||
@@ -654,7 +654,9 @@ public class TaskManagerImpl extends TaskManager implements ProjectComponent, Pe
|
||||
|
||||
synchronized (myIssueCache) {
|
||||
myIssueCache.clear();
|
||||
myIssueCache.putAll(ContainerUtil.assignKeys(issues.iterator(), KEY_CONVERTOR));
|
||||
for (Task issue : issues) {
|
||||
myIssueCache.put(issue.getId(), issue);
|
||||
}
|
||||
}
|
||||
// update local tasks
|
||||
synchronized (myTasks) {
|
||||
@@ -681,7 +683,7 @@ public class TaskManagerImpl extends TaskManager implements ProjectComponent, Pe
|
||||
});
|
||||
}
|
||||
|
||||
private List<Task> getIssuesFromRepositories(String request, int max, long since, boolean forceRequest) {
|
||||
private List<Task> getIssuesFromRepositories(@Nullable String request, int max, long since, boolean forceRequest) {
|
||||
List<Task> issues = new ArrayList<Task>();
|
||||
for (final TaskRepository repository : getAllRepositories()) {
|
||||
if (!repository.isConfigured() || (!forceRequest && myBadRepositories.contains(repository))) {
|
||||
|
||||
@@ -15,6 +15,7 @@ import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase;
|
||||
import com.intellij.ui.TextFieldWithAutoCompletionContributor;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Dmitry Avdeev
|
||||
@@ -47,9 +48,18 @@ public class TaskCompletionTest extends LightCodeInsightFixtureTestCase {
|
||||
|
||||
public void testKeepOrder() throws Exception {
|
||||
configureFile("<caret>");
|
||||
configureRepository(new LocalTaskImpl("TEST-002", "Test task 2"), new LocalTaskImpl("TEST-001", "Test task 1"));
|
||||
configureRepository(new LocalTaskImpl("TEST-002", "Test task 2"),
|
||||
new LocalTaskImpl("TEST-003", "Test task 1"),
|
||||
new LocalTaskImpl("TEST-001", "Test task 1"),
|
||||
new LocalTaskImpl("TEST-004", "Test task 1")
|
||||
);
|
||||
|
||||
getManager().updateIssues(null);
|
||||
List<Task> issues = getManager().getCachedIssues();
|
||||
// assertEquals("TEST-002", issues.get(0).getSummary());
|
||||
|
||||
myFixture.complete(CompletionType.BASIC);
|
||||
assertEquals(Arrays.asList("TEST-002", "TEST-001"), myFixture.getLookupElementStrings());
|
||||
assertEquals(Arrays.asList("TEST-002", "TEST-003", "TEST-001", "TEST-004"), myFixture.getLookupElementStrings());
|
||||
}
|
||||
|
||||
public void testSIOOBE() throws Exception {
|
||||
@@ -73,9 +83,15 @@ public class TaskCompletionTest extends LightCodeInsightFixtureTestCase {
|
||||
document.putUserData(CommitMessage.DATA_CONTEXT_KEY, new MapDataContext());
|
||||
}
|
||||
|
||||
private void configureRepository(LocalTaskImpl... tasks) {
|
||||
TaskManagerImpl manager = (TaskManagerImpl)TaskManager.getManager(getProject());
|
||||
manager.setRepositories(Arrays.asList(new TestRepository(tasks)));
|
||||
private TestRepository configureRepository(LocalTaskImpl... tasks) {
|
||||
TaskManagerImpl manager = getManager();
|
||||
TestRepository repository = new TestRepository(tasks);
|
||||
manager.setRepositories(Arrays.asList(repository));
|
||||
manager.getState().updateEnabled = false;
|
||||
return repository;
|
||||
}
|
||||
|
||||
private TaskManagerImpl getManager() {
|
||||
return (TaskManagerImpl)TaskManager.getManager(getProject());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user