Skip to content

Commit

Permalink
Move attribute inheritance until all libraries are loaded
Browse files Browse the repository at this point in the history
  • Loading branch information
nkskjames committed Jan 10, 2017
1 parent 37d248d commit 6e4cb40
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .classpath
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@
<classpathentry kind="lib" path="lib/org.eclipse.core.commands_3.6.100.v20140528-1422.jar"/>
<classpathentry kind="lib" path="lib/org.eclipse.core.runtime-3.10.0-v20140318-2214.jar"/>
<classpathentry kind="lib" path="lib/org.eclipse.equinox.common-3.6.200.v20130402-1505.jar"/>
<classpathentry kind="lib" path="lib/org.eclipse.jface_3.10.2.v20141021-1035.jar"/>
<classpathentry kind="lib" path="lib/org.eclipse.jgit-4.4.1.201607150455-r.jar"/>
<classpathentry kind="lib" path="lib/jgit/jsch-0.1.54.jar"/>
<classpathentry kind="lib" path="lib/jgit/log4j-1.2-api-2.6.2.jar"/>
<classpathentry kind="lib" path="lib/jgit/log4j-api-2.6.2.jar"/>
<classpathentry kind="lib" path="lib/jgit/log4j-core-2.6.2.jar"/>
<classpathentry kind="lib" path="lib/jgit/slf4j-api-1.7.21.jar"/>
<classpathentry kind="lib" path="lib/jgit/slf4j-log4j12-1.7.21.jar"/>
<classpathentry kind="lib" path="lib/org.eclipse.jface_3.12.0.v20160518-1929.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
34 changes: 20 additions & 14 deletions src/com/ibm/ServerWizard2/model/SystemModel.java
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,27 @@ public void loadLibrary(String path) throws Exception {
this.loadTargetTypes(file.getPath());
}
}
}
}
//Add inherited attributes
//must load twice so inherited attributes pick up their
//inherited attributes
for (int i=0;i<2;i++) {
for (Map.Entry<String, Target> entry : targetModels.entrySet()) {
Target target = entry.getValue();

// add inherited attributes
addParentAttributes(target, target);
if (target.getAttribute("CLASS").equals("BUS")) {
busTypesTree.put(entry.getKey(),target);
}
}
}
busTypes.removeAllElements();
for (Target t : busTypesTree.values()) {
busTypes.add(t);
}
}

File partsDir = new File(path+File.separator+"parts"+File.separator);
File filesList[] = partsDir.listFiles();
if (filesList == null) {
Expand Down Expand Up @@ -614,19 +633,6 @@ public void loadTargetTypes(String fileName) throws SAXException,
}
}
}
for (Map.Entry<String, Target> entry : targetModels.entrySet()) {
Target target = entry.getValue();

// add inherited attributes
addParentAttributes(target, target);
if (target.getAttribute("CLASS").equals("BUS")) {
busTypesTree.put(entry.getKey(),target);
}
}
busTypes.removeAllElements();
for (Target t : busTypesTree.values()) {
busTypes.add(t);
}
}

public void loadAttributes(String fileName) throws SAXException,
Expand Down
10 changes: 8 additions & 2 deletions src/com/ibm/ServerWizard2/model/Target.java
Original file line number Diff line number Diff line change
Expand Up @@ -336,8 +336,14 @@ public void initBusses(Vector<Target> v) {
////////////////////////////////////////////////////
// XML file handling
public void readModelXML(Element target, HashMap<String, Attribute> attrMap) {
type = SystemModel.getElement(target, "id");
parent = SystemModel.getElement(target, "parent");
String tmptype = SystemModel.getElement(target, "id");
String tmpparent = SystemModel.getElement(target, "parent");
if (!tmptype.isEmpty()) {
type = tmptype;
}
if (!tmpparent.isEmpty()) {
parent = tmpparent;
}
NodeList parentList = target.getElementsByTagName("parent_type");
for (int i = 0; i < parentList.getLength(); i++) {
Element e = (Element) parentList.item(i);
Expand Down

0 comments on commit 6e4cb40

Please sign in to comment.