From: <mwl...@us...> - 2008-03-25 19:21:25
|
Revision: 707 http://cishell.svn.sourceforge.net/cishell/?rev=707&view=rev Author: mwlinnem Date: 2008-03-25 12:18:32 -0700 (Tue, 25 Mar 2008) Log Message: ----------- Made CIShell 1.0 compatible. Modified Paths: -------------- trunk/clients/gui/org.cishell.reference.gui.persistence/META-INF/MANIFEST.MF 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/FileLoadFactory.java trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/save/FileSaver.java trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/save/Save.java trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/save/SaveDataChooser.java trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/save/SaveFactory.java trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/view/FileView.java trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/view/FileViewFactory.java trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/view/ViewDataChooser.java trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/viewwith/FileViewWith.java trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/viewwith/FileViewWithFactory.java trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/viewwith/ViewWithDataChooser.java Modified: trunk/clients/gui/org.cishell.reference.gui.persistence/META-INF/MANIFEST.MF =================================================================== --- trunk/clients/gui/org.cishell.reference.gui.persistence/META-INF/MANIFEST.MF 2008-03-25 18:05:28 UTC (rev 706) +++ trunk/clients/gui/org.cishell.reference.gui.persistence/META-INF/MANIFEST.MF 2008-03-25 19:18:32 UTC (rev 707) @@ -2,17 +2,17 @@ Bundle-ManifestVersion: 2 Bundle-Name: Persistence Plug-in Bundle-SymbolicName: org.cishell.reference.gui.persistence;singleton:=true -Bundle-Version: 0.7.0 +Bundle-Version: 1.0.0 Bundle-ClassPath: . Bundle-Localization: plugin Import-Package: org.cishell.app.service.datamanager, - org.cishell.framework, - org.cishell.framework.algorithm, - org.cishell.framework.data, + org.cishell.framework;version="1.0.0", + org.cishell.framework.algorithm;version="1.0.0", + org.cishell.framework.data;version="1.0.0", org.cishell.reference.gui.common, org.cishell.reference.service.metatype, - org.cishell.service.conversion, - org.cishell.service.guibuilder, + org.cishell.service.conversion;version="1.0.0", + org.cishell.service.guibuilder;version="1.0.0", org.osgi.framework;version="1.3.0", org.osgi.service.component;version="1.0.0", org.osgi.service.log;version="1.3.0", 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 2008-03-25 18:05:28 UTC (rev 706) +++ trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/load/FileLoad.java 2008-03-25 19:18:32 UTC (rev 707) @@ -3,26 +3,24 @@ import java.io.File; import java.util.ArrayList; +import org.cishell.framework.CIShellContext; +import org.cishell.framework.algorithm.Algorithm; +import org.cishell.framework.algorithm.AlgorithmExecutionException; +import org.cishell.framework.algorithm.AlgorithmFactory; +import org.cishell.framework.data.BasicData; +import org.cishell.framework.data.Data; +import org.cishell.service.guibuilder.GUIBuilderService; +import org.eclipse.jface.action.IAction; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.swt.SWT; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.FileDialog; import org.eclipse.ui.IWorkbenchWindow; import org.eclipse.ui.PlatformUI; -import org.eclipse.swt.SWT; -import org.eclipse.swt.widgets.FileDialog; -import org.eclipse.swt.widgets.Display; -import org.eclipse.jface.action.IAction; -import org.eclipse.jface.viewers.ISelection; - - import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceReference; import org.osgi.service.log.LogService; -import org.cishell.framework.CIShellContext; -import org.cishell.framework.algorithm.AlgorithmFactory; -import org.cishell.framework.algorithm.Algorithm; -import org.cishell.framework.data.Data; -import org.cishell.framework.data.BasicData; -import org.cishell.service.guibuilder.GUIBuilderService; - /* * @author Weixia(Bonnie) Huang (hu...@in...) */ @@ -48,7 +46,8 @@ } - public Data[] execute() { + public Data[] execute() throws AlgorithmExecutionException { + try { // int counter = PlatformUI.getWorkbench().getWorkbenchWindowCount(); // System.out.println("counter is "+counter); // ?? why getActiveWorkbenchWindow() didn't work?? @@ -56,7 +55,7 @@ final IWorkbenchWindow[] windows = PlatformUI.getWorkbench().getWorkbenchWindows(); if (windows.length ==0){ - return null; + throw new AlgorithmExecutionException("Cannot obtain workbench window needed to open dialog."); } Display display = PlatformUI.getWorkbench().getDisplay(); @@ -76,10 +75,14 @@ } return returnDM; } - else { - return null; + else { + throw new AlgorithmExecutionException("No data could be loaded."); } - + } catch (AlgorithmExecutionException e1) { + throw e1; + } catch (Throwable e2) { + throw new AlgorithmExecutionException(e2); + } } public static String getFileExtension(File theFile) { @@ -209,7 +212,7 @@ }catch (Exception e){ - e.printStackTrace(); + throw new RuntimeException(e); } }//end run() Modified: trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/load/FileLoadFactory.java =================================================================== --- trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/load/FileLoadFactory.java 2008-03-25 18:05:28 UTC (rev 706) +++ trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/load/FileLoadFactory.java 2008-03-25 19:18:32 UTC (rev 707) @@ -23,13 +23,8 @@ protected void activate(ComponentContext ctxt) { bcontext = ctxt.getBundleContext(); } - protected void deactivate(ComponentContext ctxt) {} - + public Algorithm createAlgorithm(Data[] data, Dictionary parameters, CIShellContext context) { return new FileLoad(context, bcontext); } - public MetaTypeProvider createParameters(Data[] data) { - return null; - } - } \ No newline at end of file Modified: trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/save/FileSaver.java =================================================================== --- trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/save/FileSaver.java 2008-03-25 18:05:28 UTC (rev 706) +++ trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/save/FileSaver.java 2008-03-25 19:18:32 UTC (rev 707) @@ -13,6 +13,7 @@ import org.cishell.framework.algorithm.AlgorithmProperty; import org.cishell.framework.data.Data; import org.cishell.framework.data.DataProperty; +import org.cishell.service.conversion.ConversionException; import org.cishell.service.conversion.Converter; import org.cishell.service.guibuilder.GUIBuilderService; import org.eclipse.swt.SWT; @@ -107,7 +108,7 @@ dialog.setText("Choose File"); - String fileLabel = (String)data.getMetaData().get(DataProperty.LABEL); + String fileLabel = (String)data.getMetadata().get(DataProperty.LABEL); String suggestedFileName = getFileName(fileLabel); dialog.setFileName(suggestedFileName + "." + ext); @@ -128,9 +129,10 @@ if (ext != null && ext.length() != 0) if (!selectedFile.getPath().endsWith(ext) && !ext.equals("*")) selectedFile = new File(selectedFile.getPath()+'.'+ ext); - + try { Data newData = converter.convert(data); - + + copy((File)newData.getData(), selectedFile); if (selectedFile.isDirectory()) { @@ -140,7 +142,10 @@ } done = true; - + } catch (ConversionException e1) { + this.log.log(LogService.LOG_ERROR, "Error occurred while converting data to saved format.", e1); + return false; + } log.log(LogService.LOG_INFO, "Saved: " + selectedFile.getPath()); } else { done = true; Modified: trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/save/Save.java =================================================================== --- trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/save/Save.java 2008-03-25 18:05:28 UTC (rev 706) +++ trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/save/Save.java 2008-03-25 19:18:32 UTC (rev 707) @@ -6,6 +6,7 @@ import org.cishell.framework.CIShellContext; import org.cishell.framework.algorithm.Algorithm; +import org.cishell.framework.algorithm.AlgorithmExecutionException; import org.cishell.framework.algorithm.AlgorithmFactory; import org.cishell.framework.algorithm.AlgorithmProperty; import org.cishell.framework.data.Data; @@ -54,7 +55,8 @@ * * @return Null for this algorithm */ - public Data[] execute() { + public Data[] execute() throws AlgorithmExecutionException { + try { //This only checks the first Data in the array final Converter[] converters = conversionManager.findConverters(data[0], "file-ext:*"); @@ -105,7 +107,10 @@ } } return null; + } catch (Throwable e) { + throw new AlgorithmExecutionException(e); } + } private void guiRun(Runnable run) { if (Thread.currentThread() == Display.getDefault().getThread()) { Modified: trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/save/SaveDataChooser.java =================================================================== --- trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/save/SaveDataChooser.java 2008-03-25 18:05:28 UTC (rev 706) +++ trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/save/SaveDataChooser.java 2008-03-25 19:18:32 UTC (rev 707) @@ -17,6 +17,7 @@ import org.cishell.framework.algorithm.AlgorithmProperty; import org.cishell.framework.data.Data; import org.cishell.reference.gui.common.AbstractDialog; +import org.cishell.service.conversion.ConversionException; import org.cishell.service.conversion.Converter; import org.eclipse.swt.SWT; import org.eclipse.swt.custom.StyleRange; @@ -308,11 +309,15 @@ * of opening the FileSaver and saving the model. * @param selectedIndex The chosen converter */ - protected void selectionMade(int selectedIndex) { + protected void selectionMade(int selectedIndex){ + try { getShell().setVisible(false); final Converter converter = converterArray[selectedIndex]; final FileSaver saver = new FileSaver(getShell(), context); close(saver.save(converter, data)); + } catch (Exception e) { + throw new RuntimeException(e); + } } /** @@ -327,7 +332,7 @@ select.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { int index = converterList.getSelectionIndex(); - + if (index != -1) { selectionMade(index); } Modified: trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/save/SaveFactory.java =================================================================== --- trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/save/SaveFactory.java 2008-03-25 18:05:28 UTC (rev 706) +++ trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/save/SaveFactory.java 2008-03-25 19:18:32 UTC (rev 707) @@ -33,12 +33,6 @@ protected void activate(ComponentContext ctxt) { context = new LocalCIShellContext(ctxt.getBundleContext()); } - - /** - * Deactivate the plugin - * @param ctxt Current CIShell context - */ - protected void deactivate(ComponentContext ctxt) {} /** * Create a Save algorithm @@ -53,15 +47,6 @@ } /** - * Create parameters (this returns null only) - * data input data - * @return null; - */ - public MetaTypeProvider createParameters(Data[] data) { - return null; - } - - /** * Validate the SaveFactory can handle the incoming file type * @param data The data to save * @return empty string on success Modified: trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/view/FileView.java =================================================================== --- trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/view/FileView.java 2008-03-25 18:05:28 UTC (rev 706) +++ trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/view/FileView.java 2008-03-25 19:18:32 UTC (rev 707) @@ -9,7 +9,9 @@ import org.cishell.framework.CIShellContext; import org.cishell.framework.algorithm.Algorithm; +import org.cishell.framework.algorithm.AlgorithmExecutionException; import org.cishell.framework.data.Data; +import org.cishell.service.conversion.ConversionException; import org.cishell.service.conversion.Converter; import org.cishell.service.conversion.DataConversionService; import org.cishell.service.guibuilder.GUIBuilderService; @@ -28,7 +30,6 @@ Dictionary parameters; CIShellContext context; DataConversionService conversionManager; - static GUIBuilderService guiBuilder; LogService logger; Program program; // Program programTwo; @@ -43,9 +44,8 @@ DataConversionService.class.getName()); logger = (LogService)context.getService(LogService.class.getName()); - guiBuilder = (GUIBuilderService)context.getService(GUIBuilderService.class.getName()); - - } + } + public File getTempFile(){ File tempFile; @@ -82,7 +82,8 @@ return tempFile; } - public Data[] execute() { + public Data[] execute() throws AlgorithmExecutionException { + try { boolean lastSaveSuccessful = false; boolean isCSVFile = false;//TC181 String format; @@ -93,7 +94,7 @@ windows = PlatformUI.getWorkbench().getWorkbenchWindows(); if (windows.length == 0){ - return null; + throw new AlgorithmExecutionException("Cannot get workbench window."); } parentShell = windows[0].getShell(); display = PlatformUI.getWorkbench().getDisplay(); @@ -150,10 +151,9 @@ final Converter[] converters = conversionManager.findConverters(data[i], "file-ext:*"); if (converters.length < 1) { - guiBuilder.showError("No Converters", - "No valid converters for data type: " + - data[i].getData().getClass().getName(), - "Please install a plugin that will save the data type to a file"); + throw new AlgorithmExecutionException("No valid converters for data type: " + + data[i].getData().getClass().getName() + + ". Please install a plugin that will save the data type to a file"); } else if (converters.length == 1){ //If length=1, use the unique path to save it directly @@ -202,10 +202,10 @@ } */ if (program == null) { - guiBuilder.showError("No Text Viewer", + throw new AlgorithmExecutionException( "No valid text viewer for the .txt file. " + - "The file is located at: "+tempFile.getAbsolutePath(), - "Unable to open default text viewer. File is located at: "+ + "The file is located at: "+tempFile.getAbsolutePath() + + ". Unable to open default text viewer. File is located at: "+ tempFile.getAbsolutePath()); } else { @@ -220,10 +220,15 @@ } - return null; + return null; + } catch (ConversionException e1) { + throw new AlgorithmExecutionException("Error converting data to target view format.", e1); + } catch (Throwable e2){ + throw new AlgorithmExecutionException(e2); + } } - public static boolean copy(File in, File out) { + public static boolean copy(File in, File out) throws AlgorithmExecutionException{ try { FileInputStream fis = new FileInputStream(in); FileOutputStream fos = new FileOutputStream(out); @@ -238,9 +243,8 @@ return true; } catch (IOException ioe) { - guiBuilder.showError("Copy Error", "IOException during copy", ioe.getMessage()); - return false; - } + throw new AlgorithmExecutionException("IOException during copy", ioe); + } } final class DataViewer implements Runnable { Modified: trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/view/FileViewFactory.java =================================================================== --- trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/view/FileViewFactory.java 2008-03-25 18:05:28 UTC (rev 706) +++ trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/view/FileViewFactory.java 2008-03-25 19:18:32 UTC (rev 707) @@ -12,24 +12,8 @@ public class FileViewFactory implements AlgorithmFactory { -// private MetaTypeProvider provider; - protected void activate(ComponentContext ctxt) { - //You may delete all references to metatype service if - //your algorithm does not require parameters and return - //null in the createParameters() method -// MetaTypeService mts = (MetaTypeService)ctxt.locateService("MTS"); -// provider = mts.getMetaTypeInformation(ctxt.getBundleContext().getBundle()); - } - protected void deactivate(ComponentContext ctxt) { -// provider = null; - } - - public Algorithm createAlgorithm(Data[] data, Dictionary parameters, CIShellContext context) { + public Algorithm createAlgorithm(Data[] data, Dictionary parameters, CIShellContext context) { return new FileView(data, parameters, context); } - public MetaTypeProvider createParameters(Data[] data) { -// return provider; - return null; - } } \ No newline at end of file Modified: trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/view/ViewDataChooser.java =================================================================== --- trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/view/ViewDataChooser.java 2008-03-25 18:05:28 UTC (rev 706) +++ trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/view/ViewDataChooser.java 2008-03-25 19:18:32 UTC (rev 707) @@ -6,7 +6,6 @@ import org.cishell.framework.data.Data; import org.cishell.reference.gui.persistence.save.SaveDataChooser; import org.cishell.service.conversion.Converter; - import org.eclipse.swt.widgets.Shell; /* @@ -26,12 +25,16 @@ this.theData = data; } - protected void selectionMade(int selectedIndex) { + protected void selectionMade(int selectedIndex){ + try { getShell().setVisible(false); final Converter converter = converterArray[selectedIndex]; Data newData = converter.convert(theData); isSaved = FileView.copy((File)newData.getData(), tempFile); close(true); + } catch (Exception e) { + throw new RuntimeException(e); + } } public boolean isSaved(){ Modified: trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/viewwith/FileViewWith.java =================================================================== --- trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/viewwith/FileViewWith.java 2008-03-25 18:05:28 UTC (rev 706) +++ trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/viewwith/FileViewWith.java 2008-03-25 19:18:32 UTC (rev 707) @@ -9,7 +9,9 @@ import org.cishell.framework.CIShellContext; import org.cishell.framework.algorithm.Algorithm; +import org.cishell.framework.algorithm.AlgorithmExecutionException; import org.cishell.framework.data.Data; +import org.cishell.service.conversion.ConversionException; import org.cishell.service.conversion.Converter; import org.cishell.service.conversion.DataConversionService; import org.cishell.service.guibuilder.GUIBuilderService; @@ -66,7 +68,7 @@ return tempFile; } - public Data[] execute() { + public Data[] execute() throws AlgorithmExecutionException { boolean lastSaveSuccessful = false; String format; @@ -104,16 +106,25 @@ else if (converters.length == 1){ //If length=1, use the unique path to save it directly //and bring the text editor. - Data newData = converters[0].convert(data[i]); + try { + Data newData = converters[0].convert(data[i]); copy((File)newData.getData(), tempFile); lastSaveSuccessful = true; + } catch (ConversionException e) { + this.logger.log(LogService.LOG_WARNING, "Error while converting to target save format. Will attempt to use other available converters."); + } } else { if (!parentShell.isDisposed()) { + try { DataViewer dataViewer = new DataViewer(parentShell, data[i], converters); display.syncExec(dataViewer); + lastSaveSuccessful = dataViewer.isSaved; tempFile = dataViewer.theFile; + } catch (Throwable e1) { + throw new AlgorithmExecutionException(e1); + } } } } Modified: trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/viewwith/FileViewWithFactory.java =================================================================== --- trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/viewwith/FileViewWithFactory.java 2008-03-25 18:05:28 UTC (rev 706) +++ trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/viewwith/FileViewWithFactory.java 2008-03-25 19:18:32 UTC (rev 707) @@ -1,23 +1,20 @@ package org.cishell.reference.gui.persistence.viewwith; -import java.io.IOException; import java.util.Dictionary; import org.cishell.framework.CIShellContext; import org.cishell.framework.algorithm.Algorithm; import org.cishell.framework.algorithm.AlgorithmFactory; +import org.cishell.framework.algorithm.ParameterMutator; import org.cishell.framework.data.Data; import org.cishell.reference.service.metatype.BasicAttributeDefinition; import org.cishell.reference.service.metatype.BasicMetaTypeProvider; import org.cishell.reference.service.metatype.BasicObjectClassDefinition; import org.eclipse.swt.program.Program; import org.eclipse.swt.widgets.Display; -import org.eclipse.ui.PlatformUI; import org.osgi.service.component.ComponentContext; import org.osgi.service.metatype.AttributeDefinition; -import org.osgi.service.metatype.MetaTypeInformation; import org.osgi.service.metatype.MetaTypeProvider; -import org.osgi.service.metatype.MetaTypeService; import org.osgi.service.metatype.ObjectClassDefinition; @@ -26,7 +23,7 @@ // It implements AlgorithmFactory and adds dropbox boxes... // You will need to do something similar, but much less complicated, here, I believe. -public class FileViewWithFactory implements AlgorithmFactory { +public class FileViewWithFactory implements AlgorithmFactory, ParameterMutator { Program programTxt; Program programDoc; Program programHtml; @@ -46,8 +43,9 @@ return new FileViewWith(data, parameters, context); } - public MetaTypeProvider createParameters(Data[] data) { - + public ObjectClassDefinition mutateParameters(Data[] data, + ObjectClassDefinition parameters) { + BasicObjectClassDefinition definition; definition = new BasicObjectClassDefinition("fileViewWithDefinition", "Application Viewer Type", "Please choose an application viewer to read this file.", null); @@ -118,7 +116,6 @@ AttributeDefinition ad = new BasicAttributeDefinition("viewWith", "View file as", "Type of viewer", AttributeDefinition.STRING /*string*/, 0, defValStringArray/*String[] defaultValue*/, null /*validator*/, myOptionLabels, myOptionValues); definition.addAttributeDefinition(ObjectClassDefinition.REQUIRED, ad); - MetaTypeProvider provider = new BasicMetaTypeProvider(definition); - return provider; - } + return definition; + } } \ No newline at end of file Modified: trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/viewwith/ViewWithDataChooser.java =================================================================== --- trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/viewwith/ViewWithDataChooser.java 2008-03-25 18:05:28 UTC (rev 706) +++ trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/viewwith/ViewWithDataChooser.java 2008-03-25 19:18:32 UTC (rev 707) @@ -5,8 +5,8 @@ import org.cishell.framework.CIShellContext; import org.cishell.framework.data.Data; import org.cishell.reference.gui.persistence.save.SaveDataChooser; +import org.cishell.service.conversion.ConversionException; import org.cishell.service.conversion.Converter; - import org.eclipse.swt.widgets.Shell; /* @@ -26,12 +26,16 @@ this.theData = data; } - protected void selectionMade(int selectedIndex) { - getShell().setVisible(false); + protected void selectionMade(int selectedIndex){ + try { + getShell().setVisible(false); final Converter converter = converterArray[selectedIndex]; Data newData = converter.convert(theData); isSaved = FileViewWith.copy((File)newData.getData(), tempFile); close(true); + } catch (Exception e) { + throw new RuntimeException(e); + } } public boolean isSaved(){ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |