From dc19d25aa6cd979d0249c3e9ed5cf50640a357ac Mon Sep 17 00:00:00 2001 From: Silenio Quarti Date: Thu, 7 Aug 2008 13:52:32 +0000 Subject: *** empty log message *** --- .../eclipse/swt/tools/internal/MacGeneratorUI.java | 56 +++++++++++----------- 1 file changed, 27 insertions(+), 29 deletions(-) (limited to 'bundles') diff --git a/bundles/org.eclipse.swt.tools/Mac Generation/org/eclipse/swt/tools/internal/MacGeneratorUI.java b/bundles/org.eclipse.swt.tools/Mac Generation/org/eclipse/swt/tools/internal/MacGeneratorUI.java index 284f404d97..9ffcb9e847 100644 --- a/bundles/org.eclipse.swt.tools/Mac Generation/org/eclipse/swt/tools/internal/MacGeneratorUI.java +++ b/bundles/org.eclipse.swt.tools/Mac Generation/org/eclipse/swt/tools/internal/MacGeneratorUI.java @@ -108,10 +108,8 @@ public class MacGeneratorUI { Document getDocument(String xmlPath) { try { InputStream is = null; - if (xmlPath.indexOf(File.separatorChar) == -1) { - is = getClass().getResourceAsStream(xmlPath); - if (is == null) is = new BufferedInputStream(new FileInputStream(xmlPath)); - } + if (xmlPath.indexOf(File.separatorChar) == -1) is = getClass().getResourceAsStream(xmlPath); + if (is == null) is = new BufferedInputStream(new FileInputStream(xmlPath)); if (is != null) return DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(new InputSource(is)); } catch (Exception e) { // e.printStackTrace(); @@ -182,33 +180,33 @@ public class MacGeneratorUI { void updateNodes() { if (xmls == null) return; - try { - for (int x = 0; x < xmls.length; x++) { - String xmlPath = xmls[x]; - TreeItem xmlItem = new TreeItem(nodesTree, SWT.NONE); - String xmlText = xmlPath; - int index = xmlText.lastIndexOf(File.separatorChar); - if (index != -1) xmlText = xmlText.substring(index + 1); - xmlItem.setText(xmlText); - - Hashtable extras = new Hashtable(); - Document extraDocument = getDocument(xmlText + ".extras"); - if (extraDocument != null) { - buildLookup(extraDocument, extras); - } - - Document document = getDocument(xmlPath); - NodeList list = document.getDocumentElement().getChildNodes(); - for (int i = 0; i < list.getLength(); i++) { - addChild(list.item(i), xmlItem, extras); - } + for (int x = 0; x < xmls.length; x++) { + String xmlPath = xmls[x]; + String xmlSimplePath = xmlPath; + int index = xmlSimplePath.lastIndexOf(File.separatorChar); + if (index != -1) xmlSimplePath = xmlSimplePath.substring(index + 1); + + Document document = getDocument(xmlPath); + if (document == null) { + System.out.println("Could not find: " + xmlPath); + continue; + } + Hashtable extras = new Hashtable(); + Document extraDocument = getDocument(xmlSimplePath + ".extras"); + if (extraDocument != null) { + buildLookup(extraDocument, extras); } - TreeColumn[] columns = nodesTree.getColumns(); - for (int i = 0; i < columns.length; i++) { - columns[i].pack(); + + TreeItem xmlItem = new TreeItem(nodesTree, SWT.NONE); + xmlItem.setText(xmlSimplePath); + NodeList list = document.getDocumentElement().getChildNodes(); + for (int i = 0; i < list.getLength(); i++) { + addChild(list.item(i), xmlItem, extras); } - } catch (Throwable e) { - e.printStackTrace(); + } + TreeColumn[] columns = nodesTree.getColumns(); + for (int i = 0; i < columns.length; i++) { + columns[i].pack(); } } -- cgit