TCF Debugger: fixed order of entries in the Modules view
diff --git a/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFChildrenModules.java b/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFChildrenModules.java
index d9adcff..194c90e 100644
--- a/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFChildrenModules.java
+++ b/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFChildrenModules.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011, 2012 Wind River Systems, Inc. and others.
+ * Copyright (c) 2011, 2015 Wind River Systems, Inc. and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -36,12 +36,14 @@
TCFDataCache<MemoryRegion[]> map_cache = exe.getMemoryMap();
if (!map_cache.validate(this)) return false;
MemoryRegion[] map = map_cache.getData();
- Map<String, TCFNode> data = new HashMap<String, TCFNode>();
+ Map<String,TCFNode> data = new HashMap<String,TCFNode>();
if (map != null) {
+ int cnt = 0;
for (int index = 0; index < map.length; index++) {
String id = exe.id + ".Module-" + index;
TCFNodeModule module = (TCFNodeModule)node.model.getNode(id);
if (module == null) module = new TCFNodeModule(exe, id, index);
+ module.setSortPosition(cnt++);
data.put(id, module);
}
}
diff --git a/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFNodeModule.java b/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFNodeModule.java
index f7aeb6e..9b890d7 100644
--- a/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFNodeModule.java
+++ b/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFNodeModule.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011, 2012 Wind River Systems, Inc. and others.
+ * Copyright (c) 2011, 2015 Wind River Systems, Inc. and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -31,6 +31,7 @@
public class TCFNodeModule extends TCFNode implements IDetailsProvider {
private final TCFData<MemoryRegion> region;
+ private int sort_pos;
protected TCFNodeModule(final TCFNodeExecContext parent, String id, final int index) {
super(parent, id);
@@ -53,6 +54,10 @@
return region;
}
+ void setSortPosition(int sort_pos) {
+ this.sort_pos = sort_pos;
+ }
+
void onMemoryMapChanged() {
region.reset();
}
@@ -181,4 +186,12 @@
else flagsLabel.append('-');
return flagsLabel.toString();
}
+
+ @Override
+ public int compareTo(TCFNode n) {
+ TCFNodeModule e = (TCFNodeModule)n;
+ if (sort_pos < e.sort_pos) return -1;
+ if (sort_pos > e.sort_pos) return +1;
+ return 0;
+ }
}