From: <hu...@us...> - 2008-07-29 21:35:29
|
Revision: 791 http://cishell.svn.sourceforge.net/cishell/?rev=791&view=rev Author: huangb Date: 2008-07-29 21:35:26 +0000 (Tue, 29 Jul 2008) Log Message: ----------- Make the following fix. 1. If there's no default_menu.xml under {nwb_installation_dir}/configuration, the tool should not crash and should display all plug-ins that have been specified menu_path and label in the properties files. Note: in this case, there's no control of the order of top menu and submenus. It completely depends on which plug-in has been loaded first when the tool starts up every time. 2. If there's a default_menu.xml under {nwb_installation_dir}/configuration, use it for constructing the layout of the top menu and submenus. However, there's a preference about what name/label should show up on the menu. 2.1)If an alg's properties file has specified the label, and the corresponding name in the default_menu xml file (share the same pid) is not specified or blank, use the label specified in the properties file. If the name in the xml is not blank, use the name to overwrite the label. If both the label in the properties file and the name in the xml file are blank, this is an error that need to be fixed. 2.2)If an alg didn't specified in the xml file, use the menu_path and label in the properties file to add this alg to the menu. Modified Paths: -------------- trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/menu/MenuAdapter.java Modified: trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/menu/MenuAdapter.java =================================================================== --- trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/menu/MenuAdapter.java 2008-07-25 21:00:08 UTC (rev 790) +++ trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/menu/MenuAdapter.java 2008-07-29 21:35:26 UTC (rev 791) @@ -14,9 +14,12 @@ package org.cishell.reference.gui.menumanager.menu; import java.io.IOException; +import java.io.File; import java.util.HashMap; import java.util.Map; +import java.net.URI; + import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; @@ -63,9 +66,21 @@ /* * This map holds a pid as a key and the corresponding - * ServiceReference as a value. + * ServiceReference as a value. It is built when + * preprocessServiceBundles() is invoked. Then the entries + * are gradually removed when the pids are specified in + * the defaul_menu.xml. If any entries are left, in + * processLeftServiceBundles(), those plug-ins that have + * specified the menu_path and label but are not listed in + * default_menu.xml will be added on to the menu. */ private Map pidToServiceReferenceMap; + /* + * This is the exactly same copy of pidToServiceReferenceMap. + * Since some plug-ins could display on menu more than once, it + * provides a map between a pid and a ref while in pidToServiceReferenceMap + * that pid has been removed. + */ private Map pidToServiceReferenceMapCopy; private Document dom; private static String DEFAULT_MENU_FILE_NAME = "default_menu.xml"; @@ -106,11 +121,15 @@ listener = new ContextListener(); bContext.addServiceListener(listener, filter); preprocessServiceBundles(); - createMenuFromXML(); - processLeftServiceBundles(); + URI fullpath=URI.create(System.getProperty("osgi.configuration.area") + DEFAULT_MENU_FILE_NAME); + if (new File(fullpath).exists()){ + createMenuFromXML(fullpath.toString()); + processLeftServiceBundles(); + }else{ + initializeMenu(); + } Display.getDefault().asyncExec(updateAction); -// initializeMenu(); } catch (InvalidSyntaxException e) { getLog().log(LogService.LOG_DEBUG, "Invalid Syntax", e); } @@ -118,9 +137,10 @@ /* * This method scans all service bundles. If a bundle specifies - * menu_path, get service.pid of this bundle (key), let the service + * menu_path and label, get service.pid of this bundle (key), let the service * reference as the value, and put key/value pair * to pidToServiceReferenceMap for further processing. + * */ private void preprocessServiceBundles() throws InvalidSyntaxException{ ServiceReference[] refs = bContext.getAllServiceReferences( @@ -128,6 +148,7 @@ if (refs != null){ for (int i=0; i < refs.length; i++) { String path = (String)refs[i].getProperty(MENU_PATH); + String label = (String)refs[i].getProperty(LABEL); if (path == null){ continue; } @@ -144,9 +165,16 @@ * check if the pid exists in pidToServiceReferenceMap. If so, get the action and add to the parent menu * If not, ignore this menu. At the end of each top menu or subgroup menu or before help menu, * add "additions" so that new algorithms can be added on later + * + * What is the reasonable logic? + * If a plug-in has been specified in the default_menu.xml, always use that menu layout + * If a plug-in has not been specified in the default_menu.xml, use the menu_path + * specified in the properties file. + * If a plug-in specifies a label in the properties file, always use it. + * */ - private void createMenuFromXML() throws InvalidSyntaxException{ - parseXmlFile(); + private void createMenuFromXML(String menuFilePath) throws InvalidSyntaxException{ + parseXmlFile(menuFilePath); //get the root elememt Element docEle = dom.getDocumentElement(); //get a nodelist of the top menu elements @@ -249,7 +277,6 @@ private void processAMenuNode(Element menuNode, MenuManager parentMenuBar ){ String menuName = menuNode.getAttribute(ATTR_NAME); String pid = menuNode.getAttribute(ATTR_PID); - //System.out.println(">>>pid="+pid); if (pid == null || pid.length()==0){ //check if the name is one of the preserved one //if so add the default action @@ -261,9 +288,25 @@ get(pid.toLowerCase().trim()); pidToServiceReferenceMap.remove(pid.toLowerCase().trim()); AlgorithmAction action = new AlgorithmAction(ref, bContext, ciContext); - action.setId(getItemID(ref)); - action.setText(menuName); - parentMenuBar.add(action); + String menuLabel = (String)ref.getProperty(LABEL); + if(menuName!= null && !menuName.isEmpty()){ + //use the name specified in the xml to overwrite the label + action.setText(menuName); + action.setId(getItemID(ref)); + parentMenuBar.add(action); + } + else{ + if (menuLabel!= null && !menuLabel.isEmpty()){ + action.setText(menuLabel); + action.setId(getItemID(ref)); + parentMenuBar.add(action); + } + else { + //this is a problem -- no label is specified in the plug-in's properties file + //and no name is specified in the xml file. + } + } + } else{ //otherwise log the error @@ -274,7 +317,7 @@ } } - private void parseXmlFile(){ + private void parseXmlFile(String menuFilePath){ //get the factory DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); dbf.setCoalescing(true); @@ -282,9 +325,8 @@ //Using factory get an instance of document builder DocumentBuilder db = dbf.newDocumentBuilder(); - //parse using builder to get DOM representation of the XML file - String fullpath=System.getProperty("osgi.configuration.area") + DEFAULT_MENU_FILE_NAME; - dom = db.parse(fullpath); + //parse using builder to get DOM representation of the XML file + dom = db.parse(menuFilePath); // printElementAttributes(dom); }catch(ParserConfigurationException pce) { @@ -311,7 +353,7 @@ } } -/* + private void initializeMenu() throws InvalidSyntaxException{ ServiceReference[] refs = bContext.getAllServiceReferences( AlgorithmFactory.class.getName(), null); @@ -323,7 +365,7 @@ } } -*/ + private class ContextListener implements ServiceListener { public void serviceChanged(ServiceEvent event) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hu...@us...> - 2008-08-01 18:19:27
|
Revision: 795 http://cishell.svn.sourceforge.net/cishell/?rev=795&view=rev Author: huangb Date: 2008-08-01 18:19:19 +0000 (Fri, 01 Aug 2008) Log Message: ----------- stick to Java 1.4.2 APIs, otherwise the compilation will fail. Modified Paths: -------------- trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/menu/MenuAdapter.java Modified: trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/menu/MenuAdapter.java =================================================================== --- trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/menu/MenuAdapter.java 2008-07-30 17:33:06 UTC (rev 794) +++ trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/menu/MenuAdapter.java 2008-08-01 18:19:19 UTC (rev 795) @@ -289,14 +289,14 @@ pidToServiceReferenceMap.remove(pid.toLowerCase().trim()); AlgorithmAction action = new AlgorithmAction(ref, bContext, ciContext); String menuLabel = (String)ref.getProperty(LABEL); - if(menuName!= null && !menuName.isEmpty()){ + if(menuName!= null && menuName.trim().length()>0){ //use the name specified in the xml to overwrite the label action.setText(menuName); action.setId(getItemID(ref)); parentMenuBar.add(action); } else{ - if (menuLabel!= null && !menuLabel.isEmpty()){ + if (menuLabel!= null && menuLabel.trim().length()>0){ action.setText(menuLabel); action.setId(getItemID(ref)); parentMenuBar.add(action); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mwl...@us...> - 2008-08-13 17:09:14
|
Revision: 797 http://cishell.svn.sourceforge.net/cishell/?rev=797&view=rev Author: mwlinnem Date: 2008-08-13 17:09:07 +0000 (Wed, 13 Aug 2008) Log Message: ----------- Improved the error message for when an algorithm specified in the menu.xml file cannot be found. Modified Paths: -------------- trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/menu/MenuAdapter.java Modified: trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/menu/MenuAdapter.java =================================================================== --- trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/menu/MenuAdapter.java 2008-08-05 18:19:56 UTC (rev 796) +++ trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/menu/MenuAdapter.java 2008-08-13 17:09:07 UTC (rev 797) @@ -311,8 +311,9 @@ else{ //otherwise log the error getLog().log(LogService.LOG_DEBUG, - "Can not find an algorithm package associated with Menu: " - +menuName+" and pid: " +pid+ ". Skip to show it on the menu."); + "Oops! Network Workbench tried to place an algorithm with the id '" + pid + "' on the menu, but the algorithm could not be found."); + getLog().log(LogService.LOG_DEBUG, "If you see this error, please contact nwb...@go..., or post a ticket on our bug tracker at " + + "http://cns-trac.slis.indiana.edu/trac/nwb. "); } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mwl...@us...> - 2008-08-13 17:14:53
|
Revision: 798 http://cishell.svn.sourceforge.net/cishell/?rev=798&view=rev Author: mwlinnem Date: 2008-08-13 17:14:47 +0000 (Wed, 13 Aug 2008) Log Message: ----------- Minor change to error message. Modified Paths: -------------- trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/menu/MenuAdapter.java Modified: trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/menu/MenuAdapter.java =================================================================== --- trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/menu/MenuAdapter.java 2008-08-13 17:09:07 UTC (rev 797) +++ trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/menu/MenuAdapter.java 2008-08-13 17:14:47 UTC (rev 798) @@ -313,7 +313,7 @@ getLog().log(LogService.LOG_DEBUG, "Oops! Network Workbench tried to place an algorithm with the id '" + pid + "' on the menu, but the algorithm could not be found."); getLog().log(LogService.LOG_DEBUG, "If you see this error, please contact nwb...@go..., or post a ticket on our bug tracker at " + - "http://cns-trac.slis.indiana.edu/trac/nwb. "); + "http://cns-trac.slis.indiana.edu/trac/nwb ."); } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hu...@us...> - 2008-08-22 21:11:44
|
Revision: 800 http://cishell.svn.sourceforge.net/cishell/?rev=800&view=rev Author: huangb Date: 2008-08-22 21:11:42 +0000 (Fri, 22 Aug 2008) Log Message: ----------- Fix the bug that the menu didn't show up in most windows machines. Use URI to get a file path seems not work. Switch back to feed a String with the full file path to validate file location. Also System.getProperty("osgi.configuration.area") return the nwb application location starting with "file:/C:/...", have to trim first six letters. However, some Windows machine does work fine such as Bonnie's laptop. Modified Paths: -------------- trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/menu/MenuAdapter.java Modified: trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/menu/MenuAdapter.java =================================================================== --- trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/menu/MenuAdapter.java 2008-08-15 19:00:54 UTC (rev 799) +++ trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/menu/MenuAdapter.java 2008-08-22 21:11:42 UTC (rev 800) @@ -121,9 +121,10 @@ listener = new ContextListener(); bContext.addServiceListener(listener, filter); preprocessServiceBundles(); - URI fullpath=URI.create(System.getProperty("osgi.configuration.area") + DEFAULT_MENU_FILE_NAME); + String app_location = System.getProperty("osgi.configuration.area"); + String fullpath = app_location.substring(6)+ DEFAULT_MENU_FILE_NAME; if (new File(fullpath).exists()){ - createMenuFromXML(fullpath.toString()); + createMenuFromXML(fullpath); processLeftServiceBundles(); }else{ initializeMenu(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hu...@us...> - 2008-09-04 14:41:53
|
Revision: 802 http://cishell.svn.sourceforge.net/cishell/?rev=802&view=rev Author: huangb Date: 2008-09-04 14:41:47 +0000 (Thu, 04 Sep 2008) Log Message: ----------- another fix to make sure the menu shows up properly on some Windows and Mac machines Modified Paths: -------------- trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/menu/MenuAdapter.java Modified: trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/menu/MenuAdapter.java =================================================================== --- trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/menu/MenuAdapter.java 2008-08-29 17:07:43 UTC (rev 801) +++ trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/menu/MenuAdapter.java 2008-09-04 14:41:47 UTC (rev 802) @@ -122,8 +122,29 @@ bContext.addServiceListener(listener, filter); preprocessServiceBundles(); String app_location = System.getProperty("osgi.configuration.area"); - String fullpath = app_location.substring(6)+ DEFAULT_MENU_FILE_NAME; - if (new File(fullpath).exists()){ + /* + * This is a temporary fix. A bit complex to explain the observation + * I got so far. On Windows XP + * app_location = file:/C:/Documents and Settings/huangb/Desktop/ + * nwb-sept4/nwb/configuration/ + * If I didn't trim "file:/", on some windows machines + * new File(fileFullpath).exists() will return false, and + * initializaMenu() will be invoked. When initializaMenu() is invoked, + * not all required top menus will show up. So either Bruce code + * or Tim's fix has some problems. Can not append top menu such as + * Tools-->Scheduler if Tools is not specified in the XML + * If pass trimed file path C:/Documents and Settings/huangb/Desktop/ + * nwb-sept4/nwb/configuration/ to createMenuFromXML, on some machines, + * URL = C:/Documents and Settings/huangb/Desktop/nwb-sept4/nwb/configuration/ + * is a bad one, and can not create a document builder instance and the + * DOM representation of the XML file. + * + * This piece of code needs to be reviewed and refactored!!! + */ + System.out.println(">>>app_location = "+app_location); + String fileFullpath = app_location.substring(6)+ DEFAULT_MENU_FILE_NAME; + String fullpath = app_location+ DEFAULT_MENU_FILE_NAME; + if (new File(fileFullpath).exists() || new File(fullpath).exists()){ createMenuFromXML(fullpath); processLeftServiceBundles(); }else{ @@ -177,7 +198,8 @@ private void createMenuFromXML(String menuFilePath) throws InvalidSyntaxException{ parseXmlFile(menuFilePath); //get the root elememt - Element docEle = dom.getDocumentElement(); + Element docEle = dom.getDocumentElement(); + //get a nodelist of the top menu elements NodeList topMenuList = docEle.getElementsByTagName(TAG_TOP_MENU); if(topMenuList != null && topMenuList.getLength() > 0) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mwl...@us...> - 2008-09-04 17:56:07
|
Revision: 803 http://cishell.svn.sourceforge.net/cishell/?rev=803&view=rev Author: mwlinnem Date: 2008-09-04 17:56:05 +0000 (Thu, 04 Sep 2008) Log Message: ----------- New way of getting the config.ini file which seems to work on various platforms better than the old one. It works on at least one platform that didn't work before, so it's good enough to upload and hope it works in general. Modified Paths: -------------- trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/menu/MenuAdapter.java Modified: trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/menu/MenuAdapter.java =================================================================== --- trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/menu/MenuAdapter.java 2008-09-04 14:41:47 UTC (rev 802) +++ trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/menu/MenuAdapter.java 2008-09-04 17:56:05 UTC (rev 803) @@ -13,13 +13,13 @@ * ***************************************************************************/ package org.cishell.reference.gui.menumanager.menu; +import java.io.File; import java.io.IOException; -import java.io.File; +import java.net.URI; +import java.net.URISyntaxException; import java.util.HashMap; import java.util.Map; -import java.net.URI; - import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; @@ -101,27 +101,40 @@ + public MenuAdapter(IMenuManager menu, Shell shell, BundleContext bContext,CIShellContext ciContext, IWorkbenchWindow window) { + //basic initialization this.menuBar = menu; this.shell = shell; this.bContext = bContext; this.ciContext = ciContext; this.window = window; + this.algorithmToItemMap = new HashMap(); this.itemToParentMap = new HashMap(); + pidToServiceReferenceMap = new HashMap(); pidToServiceReferenceMapCopy = new HashMap(); + //appears to add a listener which updates the menu item whenever a + //corresponding change occurs in the bundle (registers, unregisters, etc...) String filter = "(" + Constants.OBJECTCLASS + "=" + AlgorithmFactory.class.getName() + ")"; + listener = new ContextListener(); + try { - listener = new ContextListener(); + bContext.addServiceListener(listener, filter); preprocessServiceBundles(); String app_location = System.getProperty("osgi.configuration.area"); + + //Comments below refer to problems with earlier versions of this document. + //Keeping these around for now, as well as the system.out.printlns, + //until we are sure that the current fix works. + /* * This is a temporary fix. A bit complex to explain the observation * I got so far. On Windows XP @@ -141,19 +154,27 @@ * * This piece of code needs to be reviewed and refactored!!! */ + System.out.println(">>>app_location = "+app_location); - String fileFullpath = app_location.substring(6)+ DEFAULT_MENU_FILE_NAME; - String fullpath = app_location+ DEFAULT_MENU_FILE_NAME; - if (new File(fileFullpath).exists() || new File(fullpath).exists()){ - createMenuFromXML(fullpath); - processLeftServiceBundles(); - }else{ - initializeMenu(); - } + String fileFullPath = app_location + DEFAULT_MENU_FILE_NAME; + System.out.println(">>>fileFullPath = " + fileFullPath); + URI configurationDirectoryURI = new URI(fileFullPath); + System.out.println(">>>URI = " + configurationDirectoryURI.toString()); + System.out.println(">>> file at URI = " + new File(configurationDirectoryURI).toString()); + if (new File(configurationDirectoryURI).exists()) { + System.out.println("config.ini Exists!"); + String fullpath = app_location + DEFAULT_MENU_FILE_NAME; + createMenuFromXML(fullpath); + } else { + System.out.println("config.ini does not exist... Reverting to backup plan"); + processLeftServiceBundles(); + } Display.getDefault().asyncExec(updateAction); } catch (InvalidSyntaxException e) { getLog().log(LogService.LOG_DEBUG, "Invalid Syntax", e); + } catch (URISyntaxException e) { + getLog().log(LogService.LOG_DEBUG, "Invalid Syntax", e); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hu...@us...> - 2008-09-04 20:21:56
|
Revision: 804 http://cishell.svn.sourceforge.net/cishell/?rev=804&view=rev Author: huangb Date: 2008-09-04 20:21:53 +0000 (Thu, 04 Sep 2008) Log Message: ----------- processLeftServiceBundles() is the followup function after createMenuFromXML(). Basically, it looks for any bundles that specifies the menu_path and label but not defined in the default_menu.xml file, and tries to add them to the menu. If can not find {nwb_installation_dir}/configuration/default_menu.xml, call initializeMenu(), which will add algorithms to the menu based on menu_path and label specified in the properties files, but there's no control on the order of the algorithm list under each top menu. Modified Paths: -------------- trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/menu/MenuAdapter.java Modified: trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/menu/MenuAdapter.java =================================================================== --- trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/menu/MenuAdapter.java 2008-09-04 17:56:05 UTC (rev 803) +++ trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/menu/MenuAdapter.java 2008-09-04 20:21:53 UTC (rev 804) @@ -162,12 +162,12 @@ System.out.println(">>>URI = " + configurationDirectoryURI.toString()); System.out.println(">>> file at URI = " + new File(configurationDirectoryURI).toString()); if (new File(configurationDirectoryURI).exists()) { - System.out.println("config.ini Exists!"); - String fullpath = app_location + DEFAULT_MENU_FILE_NAME; - createMenuFromXML(fullpath); + System.out.println(">>>config.ini Exists!"); + createMenuFromXML(fileFullPath); + processLeftServiceBundles(); } else { System.out.println("config.ini does not exist... Reverting to backup plan"); - processLeftServiceBundles(); + initializeMenu(); } Display.getDefault().asyncExec(updateAction); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mwl...@us...> - 2008-09-04 21:09:02
|
Revision: 805 http://cishell.svn.sourceforge.net/cishell/?rev=805&view=rev Author: mwlinnem Date: 2008-09-04 21:08:59 +0000 (Thu, 04 Sep 2008) Log Message: ----------- Added code that should be helpful for debugging the URI problem. Modified Paths: -------------- trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/menu/MenuAdapter.java Modified: trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/menu/MenuAdapter.java =================================================================== --- trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/menu/MenuAdapter.java 2008-09-04 20:21:53 UTC (rev 804) +++ trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/menu/MenuAdapter.java 2008-09-04 21:08:59 UTC (rev 805) @@ -155,18 +155,20 @@ * This piece of code needs to be reviewed and refactored!!! */ - System.out.println(">>>app_location = "+app_location); + //Better to use System.err, since it prints the stream immediately instead of storing it in a buffer which might be lost if there is a crash. + System.err.println(">>>app_location = "+app_location); String fileFullPath = app_location + DEFAULT_MENU_FILE_NAME; - System.out.println(">>>fileFullPath = " + fileFullPath); + System.err.println(">>>fileFullPath = " + fileFullPath); URI configurationDirectoryURI = new URI(fileFullPath); - System.out.println(">>>URI = " + configurationDirectoryURI.toString()); - System.out.println(">>> file at URI = " + new File(configurationDirectoryURI).toString()); + System.err.println(">>>URI = " + configurationDirectoryURI.toString()); + System.err.println(">>> file at URI = " + new File(configurationDirectoryURI).toString()); if (new File(configurationDirectoryURI).exists()) { System.out.println(">>>config.ini Exists!"); createMenuFromXML(fileFullPath); processLeftServiceBundles(); + } else { - System.out.println("config.ini does not exist... Reverting to backup plan"); + System.err.println("config.ini does not exist... Reverting to backup plan"); initializeMenu(); } Display.getDefault().asyncExec(updateAction); @@ -175,6 +177,10 @@ getLog().log(LogService.LOG_DEBUG, "Invalid Syntax", e); } catch (URISyntaxException e) { getLog().log(LogService.LOG_DEBUG, "Invalid Syntax", e); + } catch (Throwable e) { + //Should catch absolutely everything catchable. Will hopefully reveal the error coming out of the URI constructor. + //No time to test today, just commiting this for testing later. + e.printStackTrace(); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mwl...@us...> - 2008-09-05 18:59:57
|
Revision: 806 http://cishell.svn.sourceforge.net/cishell/?rev=806&view=rev Author: mwlinnem Date: 2008-09-05 18:59:54 +0000 (Fri, 05 Sep 2008) Log Message: ----------- New version using a URL instead of a URI. Makes it work on Hanning's computer. We'll see if it works elsewhere. Modified Paths: -------------- trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/menu/MenuAdapter.java Modified: trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/menu/MenuAdapter.java =================================================================== --- trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/menu/MenuAdapter.java 2008-09-04 21:08:59 UTC (rev 805) +++ trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/menu/MenuAdapter.java 2008-09-05 18:59:54 UTC (rev 806) @@ -15,8 +15,8 @@ import java.io.File; import java.io.IOException; -import java.net.URI; import java.net.URISyntaxException; +import java.net.URL; import java.util.HashMap; import java.util.Map; @@ -159,15 +159,15 @@ System.err.println(">>>app_location = "+app_location); String fileFullPath = app_location + DEFAULT_MENU_FILE_NAME; System.err.println(">>>fileFullPath = " + fileFullPath); - URI configurationDirectoryURI = new URI(fileFullPath); - System.err.println(">>>URI = " + configurationDirectoryURI.toString()); - System.err.println(">>> file at URI = " + new File(configurationDirectoryURI).toString()); - if (new File(configurationDirectoryURI).exists()) { + URL configurationDirectoryURL = new URL(fileFullPath); + System.err.println(">>>URL = " + configurationDirectoryURL.toString()); + try { + configurationDirectoryURL.getContent(); System.out.println(">>>config.ini Exists!"); createMenuFromXML(fileFullPath); processLeftServiceBundles(); - - } else { + } catch (IOException e) { + e.printStackTrace(); System.err.println("config.ini does not exist... Reverting to backup plan"); initializeMenu(); } @@ -175,8 +175,6 @@ } catch (InvalidSyntaxException e) { getLog().log(LogService.LOG_DEBUG, "Invalid Syntax", e); - } catch (URISyntaxException e) { - getLog().log(LogService.LOG_DEBUG, "Invalid Syntax", e); } catch (Throwable e) { //Should catch absolutely everything catchable. Will hopefully reveal the error coming out of the URI constructor. //No time to test today, just commiting this for testing later. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |