Skip to content

Commit 2595b33

Browse files
committed
Changed HashMaps to TreeMaps so saved XML will be sorted by key
therefore making diffs and merges easier
1 parent 25a9857 commit 2595b33

File tree

4 files changed

+18
-16
lines changed

4 files changed

+18
-16
lines changed

build.xml

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
22
<project>
3-
<property name="one-jar.dist.dir" value="c:/one-jar"/>
4-
<property name="plugin.dir" value="C:\Program Files (x86)\eclipse.luna\eclipse\plugins"/>
3+
<property name="one-jar.dist.dir" value="c:/one-jar-ant"/>
4+
<property name="plugin.dir" value="C:\eclipse\plugins"/>
55
<import file="${one-jar.dist.dir}/one-jar-ant-task.xml" optional="true" />
66
<path id="classpath">
77
<fileset dir="lib" includes="**/*.jar"/>
8-
<fileset dir="C:\Program Files (x86)\eclipse.luna\eclipse\plugins" includes="**/*.jar"/>
8+
<fileset dir="C:\eclipse\plugins" includes="**/*.jar"/>
99
</path>
1010
<target name="clean">
1111
<delete dir="build"/>
@@ -35,7 +35,7 @@
3535
<lib>
3636
<fileset file="lib/swt_win64.jar"/>
3737
<fileset file="lib/json-simple-1.1.1.jar"/>
38-
<fileset file="${plugin.dir}/org.eclipse.jface_3.10.1.v20140813-1009.jar"/>
38+
<fileset file="${plugin.dir}/org.eclipse.jface_3.10.2.v20141021-1035.jar"/>
3939
<fileset file="${plugin.dir}/org.eclipse.core.runtime_3.10.0.v20140318-2214.jar"/>
4040
<fileset file="${plugin.dir}/org.eclipse.core.commands_3.6.100.v20140528-1422.jar"/>
4141
<fileset file="${plugin.dir}/org.eclipse.equinox.common_3.6.200.v20130402-1505.jar"/>
@@ -48,7 +48,7 @@
4848
<lib>
4949
<fileset file="lib/swt_linux64.jar"/>
5050
<fileset file="lib/json-simple-1.1.1.jar"/>
51-
<fileset file="${plugin.dir}/org.eclipse.jface_3.10.1.v20140813-1009.jar"/>
51+
<fileset file="${plugin.dir}/org.eclipse.jface_3.10.2.v20141021-1035.jar"/>
5252
<fileset file="${plugin.dir}/org.eclipse.core.runtime_3.10.0.v20140318-2214.jar"/>
5353
<fileset file="${plugin.dir}/org.eclipse.core.commands_3.6.100.v20140528-1422.jar"/>
5454
<fileset file="${plugin.dir}/org.eclipse.equinox.common_3.6.200.v20130402-1505.jar"/>

src/com/ibm/ServerWizard2/MainDialog.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import java.util.HashMap;
44
import java.util.Map;
5+
import java.util.TreeMap;
56
import java.util.Vector;
67

78
import org.eclipse.jface.dialogs.Dialog;
@@ -752,7 +753,7 @@ private void refreshAttributes(Target targetInstance,ConnectionEndpoint ep) {
752753
if (attribute.isGlobal()) {
753754
if (ep !=null) {
754755
String path="/"+ep.getName();
755-
HashMap<String,Field> settings = controller.getGlobalSettings(path);
756+
TreeMap<String,Field> settings = controller.getGlobalSettings(path);
756757
if (settings == null) {
757758
controller.setGlobalSetting(path, attribute.name, "");
758759
controller.setGlobalSetting(path, "INSTANCE_ID", ep.getTargetName());

src/com/ibm/ServerWizard2/SystemModel.java

+9-9
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public class SystemModel {
3838
public HashMap<String, Vector<Target>> childTargetTypes = new HashMap<String, Vector<Target>>();
3939

4040
// From attribute types
41-
public HashMap<String, Enumerator> enumerations = new HashMap<String, Enumerator>();
41+
public TreeMap<String, Enumerator> enumerations = new TreeMap<String, Enumerator>();
4242
public HashMap<String, Attribute> attributes = new HashMap<String, Attribute>();
4343

4444
// List of targets in current system
@@ -48,7 +48,7 @@ public class SystemModel {
4848
private Vector<Target> busTypes = new Vector<Target>();
4949
private PropertyChangeSupport changes = new PropertyChangeSupport(this);
5050

51-
private HashMap<String, HashMap<String, Field>> globalSettings = new HashMap<String, HashMap<String, Field>>();
51+
private TreeMap<String, TreeMap<String, Field>> globalSettings = new TreeMap<String, TreeMap<String, Field>>();
5252

5353
public String logData;
5454

@@ -358,9 +358,9 @@ public void writeEnumeration(Writer out) throws Exception {
358358
}
359359

360360
public Field setGlobalSetting(String path, String attribute, String value) {
361-
HashMap<String, Field> s = globalSettings.get(path);
361+
TreeMap<String, Field> s = globalSettings.get(path);
362362
if (s == null) {
363-
s = new HashMap<String, Field>();
363+
s = new TreeMap<String, Field>();
364364
globalSettings.put(path, s);
365365
}
366366
Field f = s.get(attribute);
@@ -374,7 +374,7 @@ public Field setGlobalSetting(String path, String attribute, String value) {
374374
}
375375

376376
public Boolean isGlobalSetting(String path, String attribute) {
377-
HashMap<String, Field> s = globalSettings.get(path);
377+
TreeMap<String, Field> s = globalSettings.get(path);
378378
if (s == null) {
379379
return false;
380380
}
@@ -386,7 +386,7 @@ public Boolean isGlobalSetting(String path, String attribute) {
386386
}
387387

388388
public Field getGlobalSetting(String path, String attribute) {
389-
HashMap<String, Field> s = globalSettings.get(path);
389+
TreeMap<String, Field> s = globalSettings.get(path);
390390
if (s == null) {
391391
Field f=this.setGlobalSetting(path, attribute, "");
392392
return f;
@@ -398,13 +398,13 @@ public Field getGlobalSetting(String path, String attribute) {
398398
return f;
399399
}
400400

401-
public HashMap<String, Field> getGlobalSettings(String path) {
402-
HashMap<String, Field> s = globalSettings.get(path);
401+
public TreeMap<String, Field> getGlobalSettings(String path) {
402+
TreeMap<String, Field> s = globalSettings.get(path);
403403
return s;
404404
}
405405

406406
public void writeGlobalSettings(Writer out) throws Exception {
407-
for (Map.Entry<String, HashMap<String, Field>> entry : this.globalSettings.entrySet()) {
407+
for (Map.Entry<String, TreeMap<String, Field>> entry : this.globalSettings.entrySet()) {
408408
out.write("<globalSetting>\n");
409409
out.write("\t<id>" + entry.getKey() + "</id>\n");
410410
for (Map.Entry<String, Field> setting : entry.getValue().entrySet()) {

src/com/ibm/ServerWizard2/TargetWizardController.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import java.nio.file.Files;
1010
import java.nio.file.StandardCopyOption;
1111
import java.util.HashMap;
12+
import java.util.TreeMap;
1213
import java.util.Vector;
1314

1415
import javax.xml.parsers.DocumentBuilder;
@@ -214,7 +215,7 @@ public void setGlobalSetting(String path,String attribute,String value) {
214215
public Field getGlobalSetting(String path,String attribute) {
215216
return model.getGlobalSetting(path, attribute);
216217
}
217-
public HashMap<String,Field> getGlobalSettings(String path) {
218+
public TreeMap<String,Field> getGlobalSettings(String path) {
218219
return model.getGlobalSettings(path);
219220
}
220221
public Vector<Target> getChildTargets(Target target) {

0 commit comments

Comments
 (0)