From: <hu...@us...> - 2006-10-24 05:17:26
|
Revision: 310 http://svn.sourceforge.net/cishell/?rev=310&view=rev Author: huangb Date: 2006-10-23 22:17:17 -0700 (Mon, 23 Oct 2006) Log Message: ----------- when there are multiple converters that can support a certain file format (such as .xml), the application will automatically try one by one till find a good converter to load the file. (the old feature is the application will ask users to choose a converter) If all converters didn't work, the application will report the error in the end. Modified Paths: -------------- trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/load/FileLoad.java Modified: trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/load/FileLoad.java =================================================================== --- trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/load/FileLoad.java 2006-10-23 21:49:51 UTC (rev 309) +++ trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/load/FileLoad.java 2006-10-24 05:17:17 UTC (rev 310) @@ -93,6 +93,7 @@ } final class DataUpdater implements Runnable{ + boolean loadFileSuccess = false; IWorkbenchWindow window; ArrayList returnList = new ArrayList(); @@ -146,27 +147,59 @@ "Sorry, the file format: *."+fileExtension+" is not supported so far. \n"+ "Please send your requests to cis...@li.... \n" +"Thank you."); - return; + } //<filename>[.<data model type>][.<index>] // only one persister found, so load the model - if (serviceRefList.length == 1){ - logger.log(LogService.LOG_INFO, "Loaded: "+file.getPath()); + else if (serviceRefList.length == 1){ AlgorithmFactory persister = (AlgorithmFactory)bContext.getService(serviceRefList[0]); Data[] dm = new Data[]{new BasicData(file.getPath(), String.class.getName()) }; dm = persister.createAlgorithm(dm, null, ciContext).execute(); - for (int i=0; i<dm.length; i++) - returnList.add(dm[i]); - return; + if (dm != null){ + loadFileSuccess = true; + logger.log(LogService.LOG_INFO, "Loaded: "+file.getPath()); + for (int i=0; i<dm.length; i++) + returnList.add(dm[i]); + } + } // lots of persisters found, return the chooser - new LoadDataChooser("Load", file, window.getShell(), - ciContext, bContext, serviceRefList, returnList).open(); - + else if (serviceRefList.length > 1){ +// new LoadDataChooser("Load", file, window.getShell(), +// ciContext, bContext, serviceRefList, returnList).open(); + for (int index=0; index<serviceRefList.length; index++){ + AlgorithmFactory persister = (AlgorithmFactory)bContext.getService(serviceRefList[index]); + Data[] dm = new Data[]{new BasicData(file.getPath(), String.class.getName()) }; + dm = persister.createAlgorithm(dm, null, ciContext).execute(); + if (dm != null ){ + loadFileSuccess = true; + logger.log(LogService.LOG_INFO, "Loaded: "+file.getPath()); + for (int i=0; i<dm.length; i++){ + returnList.add(dm[i]); + } + break; + } + } + } + if (serviceRefList != null){ + if(serviceRefList.length >0 && !loadFileSuccess){ + guiBuilder.showError("Can Not Load The File", + "Sorry, it's very possible that you have a wrong file format," + + "since the file can not be loaded to the application.", + + "Please check Data Formats that this application can support at "+ + "https://nwb.slis.indiana.edu/community/?n=Algorithms.HomePage." + + "And send your requests or report the problem to "+ + "cis...@li.... \n"+"Thank you."); + } + } + + + }catch (Exception e){ e.printStackTrace(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |