From: <mwl...@us...> - 2009-07-14 17:58:56
|
Revision: 884 http://cishell.svn.sourceforge.net/cishell/?rev=884&view=rev Author: mwlinnem Date: 2009-07-14 17:58:51 +0000 (Tue, 14 Jul 2009) Log Message: ----------- Turning parameter preferences off by default. These don't yet work nicely with mutateParameters, and are causing bugs. We can re-enable it by default if/when it works for mutateParameters and is shown to be more stable. Modified Paths: -------------- trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/menu/AlgorithmWrapper.java trunk/core/org.cishell.reference.prefs.admin/src/org/cishell/reference/prefs/admin/internal/PrefReferenceProcessor.java Modified: trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/menu/AlgorithmWrapper.java =================================================================== --- trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/menu/AlgorithmWrapper.java 2009-07-14 15:51:03 UTC (rev 883) +++ trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/menu/AlgorithmWrapper.java 2009-07-14 17:58:51 UTC (rev 884) @@ -349,7 +349,7 @@ protected boolean hasParamDefaultPreferences(ServiceReference algRef) { String prefsToPublish = (String) algRef.getProperty(UserPrefsProperty.PREFS_PUBLISHED_KEY); if (prefsToPublish == null) { - return true; + return false; } return prefsToPublish.contains(UserPrefsProperty.PUBLISH_PARAM_DEFAULT_PREFS_VALUE); Modified: trunk/core/org.cishell.reference.prefs.admin/src/org/cishell/reference/prefs/admin/internal/PrefReferenceProcessor.java =================================================================== --- trunk/core/org.cishell.reference.prefs.admin/src/org/cishell/reference/prefs/admin/internal/PrefReferenceProcessor.java 2009-07-14 15:51:03 UTC (rev 883) +++ trunk/core/org.cishell.reference.prefs.admin/src/org/cishell/reference/prefs/admin/internal/PrefReferenceProcessor.java 2009-07-14 17:58:51 UTC (rev 884) @@ -193,11 +193,7 @@ } else { String unparsedPublishedPrefsValues = (String) prefReference.getProperty(UserPrefsProperty.PREFS_PUBLISHED_KEY); if (unparsedPublishedPrefsValues == null) { - if (processingKey ==UserPrefsProperty.PUBLISH_PARAM_DEFAULT_PREFS_VALUE) { - return true; - } else { - return false; - } + return false; } String[] publishedPrefsValues = unparsedPublishedPrefsValues.split(","); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jrb...@us...> - 2009-07-27 16:07:41
|
Revision: 902 http://cishell.svn.sourceforge.net/cishell/?rev=902&view=rev Author: jrbibers Date: 2009-07-27 16:07:28 +0000 (Mon, 27 Jul 2009) Log Message: ----------- Minor stylistic refactoring while reading CIShell code in preparation for updates to conversion exception handling. Modified Paths: -------------- trunk/core/org.cishell.framework/src/org/cishell/service/conversion/Converter.java trunk/core/org.cishell.reference/src/org/cishell/reference/service/conversion/ConverterImpl.java trunk/core/org.cishell.reference/src/org/cishell/reference/service/conversion/DataConversionServiceImpl.java trunk/core/org.cishell.reference/src/org/cishell/reference/service/conversion/NullConverter.java trunk/templates/org.cishell.templates/src/org/cishell/templates/staticexecutable/StaticExecutableAlgorithmFactory.java Modified: trunk/core/org.cishell.framework/src/org/cishell/service/conversion/Converter.java =================================================================== --- trunk/core/org.cishell.framework/src/org/cishell/service/conversion/Converter.java 2009-07-24 20:46:36 UTC (rev 901) +++ trunk/core/org.cishell.framework/src/org/cishell/service/conversion/Converter.java 2009-07-27 16:07:28 UTC (rev 902) @@ -58,7 +58,7 @@ /** * Uses this Converter to convert the given Data object to a new format. * This is a convenience method that uses this Converter to convert a Data - * object of the corrent format to a Data object of the defined output format. + * object of the current format to a Data object of the defined output format. * * @param data The Data object with compatible format * @return A Data object of correct output format Modified: trunk/core/org.cishell.reference/src/org/cishell/reference/service/conversion/ConverterImpl.java =================================================================== --- trunk/core/org.cishell.reference/src/org/cishell/reference/service/conversion/ConverterImpl.java 2009-07-24 20:46:36 UTC (rev 901) +++ trunk/core/org.cishell.reference/src/org/cishell/reference/service/conversion/ConverterImpl.java 2009-07-27 16:07:28 UTC (rev 902) @@ -52,16 +52,11 @@ props.put(OUT_DATA, refs[refs.length-1].getProperty(OUT_DATA)); props.put(LABEL, props.get(IN_DATA) + " -> " + props.get(OUT_DATA)); - String lossiness = LOSSLESS; - for (int i=0; i < refs.length; i++) { - if (LOSSY.equals(refs[i].getProperty(CONVERSION))) { - lossiness = LOSSY; - } - } - //TODO: Do the same thing for complexity + // TODO: Do the same thing for complexity + String lossiness = calculateLossiness(refs); props.put(CONVERSION, lossiness); } - + /** * @see org.cishell.service.conversion.Converter#convert(org.cishell.framework.data.Data) */ @@ -73,10 +68,14 @@ try { dm = alg.execute(); - } catch (AlgorithmExecutionException e1) { - throw new ConversionException("Exception occurred while converting data \r\n" + e1.getMessage(),e1); - } catch (Exception e2) { - throw new ConversionException("Exception occurred while converting data \r\n" + e2.getMessage(), e2); + } catch (AlgorithmExecutionException aee) { + throw new ConversionException( + "Problem converting data: " + aee.getMessage(), + aee); + } catch (Exception e) { + throw new ConversionException( + "Problem converting data: " + e.getMessage(), + e); } Object outData = null; @@ -88,12 +87,14 @@ Dictionary props = inDM.getMetadata(); Dictionary newProps = new Hashtable(); - for (Enumeration e=props.keys(); e.hasMoreElements();) { + for (Enumeration e = props.keys(); e.hasMoreElements();) { Object key = e.nextElement(); newProps.put(key, props.get(key)); } - String outFormat = (String)getProperties().get(AlgorithmProperty.OUT_DATA); + String outFormat = + (String) getProperties().get(AlgorithmProperty.OUT_DATA); + return new BasicData(newProps, outData, outFormat); } else { return null; @@ -122,7 +123,9 @@ return props; } - public Algorithm createAlgorithm(Data[] dm, Dictionary parameters, CIShellContext context) { + public Algorithm createAlgorithm(Data[] dm, + Dictionary parameters, + CIShellContext context) { return new ConverterAlgorithm(dm, parameters, context); } @@ -137,37 +140,59 @@ public String toString() { String str =""; for (int j = 0; j < refs.length; ++j) { - str += refs[j].getProperty(Constants.SERVICE_ID) + " " + refs[j].getProperty(Constants.SERVICE_PID) + "-> "; + str += refs[j].getProperty(Constants.SERVICE_ID); + str += " "; + str += refs[j].getProperty(Constants.SERVICE_PID); + str += "-> "; } + return str; } public boolean equals(Object o) { - boolean equals = false; + boolean equal = false; if (o instanceof Converter) { - ServiceReference[] otherServiceReference = ((Converter)o).getConverterChain(); + ServiceReference[] otherServiceReference = + ((Converter) o).getConverterChain(); if (refs.length == otherServiceReference.length) { for (int i = 0; i < otherServiceReference.length; i++) { if (refs[i].getProperty(Constants.SERVICE_ID).equals( - otherServiceReference[i].getProperty(Constants.SERVICE_ID))) { - equals = true; + otherServiceReference[i].getProperty( + Constants.SERVICE_ID))) { + equal = true; } else { - equals = false; + equal = false; break; } } } } - return equals; + return equal; } - private class ConverterAlgorithm implements Algorithm { + /* The conversion chain (refs) is lossless + * if and only if no conversion (ref) is lossy. + */ + private String calculateLossiness(ServiceReference[] refs) { + String lossiness = LOSSLESS; + for (int i=0; i < refs.length; i++) { + if (LOSSY.equals(refs[i].getProperty(CONVERSION))) { + lossiness = LOSSY; + } + } + + return lossiness; + } + + private class ConverterAlgorithm implements Algorithm { Data[] inDM; CIShellContext context; Dictionary parameters; - public ConverterAlgorithm(Data[] dm, Dictionary parameters, CIShellContext context) { + public ConverterAlgorithm(Data[] dm, + Dictionary parameters, + CIShellContext context) { this.inDM = dm; this.parameters = parameters; this.context = context; @@ -175,15 +200,18 @@ public Data[] execute() throws AlgorithmExecutionException { Data[] dm = inDM; - for (int i=0; i < refs.length; i++) { - AlgorithmFactory factory = (AlgorithmFactory)bContext.getService(refs[i]); + for (int i = 0; i < refs.length; i++) { + AlgorithmFactory factory = + (AlgorithmFactory) bContext.getService(refs[i]); if (factory != null) { - Algorithm alg = factory.createAlgorithm(dm, parameters, context); + Algorithm alg = + factory.createAlgorithm(dm, parameters, context); dm = alg.execute(); } else { - throw new AlgorithmExecutionException("Missing subconverter: " + throw new AlgorithmExecutionException( + "Missing subconverter: " + refs[i].getProperty(Constants.SERVICE_PID)); } } Modified: trunk/core/org.cishell.reference/src/org/cishell/reference/service/conversion/DataConversionServiceImpl.java =================================================================== --- trunk/core/org.cishell.reference/src/org/cishell/reference/service/conversion/DataConversionServiceImpl.java 2009-07-24 20:46:36 UTC (rev 901) +++ trunk/core/org.cishell.reference/src/org/cishell/reference/service/conversion/DataConversionServiceImpl.java 2009-07-27 16:07:28 UTC (rev 902) @@ -94,8 +94,7 @@ } /** - * Assemble the directed graph of converters. Currently unweighted - * + * Assemble the directed graph of converters. Currently unweighted. */ private void assembleGraph() { try { @@ -132,8 +131,8 @@ */ public Converter[] findConverters(String inFormat, String outFormat) { // saveGraph(); - if (inFormat != null && inFormat.length() > 0 && - outFormat != null && outFormat.length() > 0) { + if (inFormat != null && inFormat.length() > 0 + && outFormat != null && outFormat.length() > 0) { Converter[] converters = null; @@ -146,28 +145,25 @@ return converters; } - return new Converter[0]; + return new Converter[0]; } /** - * If the final format is of type file-ext, then append the final converter to the - * converter list + * If the final format is of type file-ext, then append the final converter + * to the converter list * * @param converters Current converter chain * @param outFormat Final data type * @return The edited converter chain */ - private Converter[] addFinalStepConversions(Converter[] converters, String outFormat) { + private Converter[] addFinalStepConversions(Converter[] converters, + String outFormat) { Collection newConverters = new HashSet(); Set formats = new HashSet(); for (int i=0; i < converters.length; i++) { String format = (String) converters[i].getProperties().get(OUT_DATA); - //tmp - //String inFormat = (String) converters[i].getProperties().get(IN_DATA); - //System.out.println("Converter:"+converters.length+":"+ inFormat + "->" + format + "->" + outFormat); - if (!formats.contains(format)) { String filter = "(&("+ALGORITHM_TYPE+"="+TYPE_VALIDATOR+")" + "(!("+REMOTE+"=*))" + @@ -175,8 +171,10 @@ "("+OUT_DATA+"="+outFormat+"))"; try { - ServiceReference[] refs = bContext.getServiceReferences( - AlgorithmFactory.class.getName(), filter); + ServiceReference[] refs = + bContext.getServiceReferences( + AlgorithmFactory.class.getName(), + filter); if (refs != null && refs.length > 0) { for (int j=0; j < refs.length; j++) { @@ -184,10 +182,12 @@ converters[i].getConverterChain())); chain.add(refs[j]); - ServiceReference[] newChain = (ServiceReference[]) - chain.toArray(new ServiceReference[0]); + ServiceReference[] newChain = (ServiceReference[]) + chain.toArray(new ServiceReference[0]); - newConverters.add(new ConverterImpl(bContext, ciContext, newChain)); + newConverters.add(new ConverterImpl(bContext, + ciContext, + newChain)); } formats.add(format); @@ -209,13 +209,8 @@ * @see org.cishell.service.conversion.DataConversionService#findConverters(java.lang.String, java.lang.String) */ private Converter[] getConverters(String inFormat, String outFormat) { - String inFilter = "(&(" + ALGORITHM_TYPE + "=" + TYPE_CONVERTER + ")" - + "("+IN_DATA+"="+inFormat+") " + "("+OUT_DATA+"=*)" + - "(!("+IN_DATA+"=file-ext:*))" + "(!(" + REMOTE + "=*)))"; - - String outFilter = "(&(" + ALGORITHM_TYPE + "=" + TYPE_CONVERTER + ")" - + "("+IN_DATA+"=*) " + "("+OUT_DATA+"="+outFormat+")" - + "(!(" + REMOTE + "=*)))"; + String inFilter = createConverterFilterForInFormat(inFormat); + String outFilter = createConverterFilterForOutFormat(outFormat); Collection converterList = new HashSet(); @@ -238,23 +233,24 @@ if (inRefs != null && outRefs != null) { Set inFileTypeSet = new HashSet(); for (int i = 0; i < inRefs.length; ++i) { - inFileTypeSet.add(inRefs[i] - .getProperty(AlgorithmProperty.IN_DATA)); + inFileTypeSet.add( + inRefs[i].getProperty(AlgorithmProperty.IN_DATA)); } Set outFileTypeSet = new HashSet(); for (int i = 0; i < outRefs.length; ++i) { - outFileTypeSet.add(outRefs[i] - .getProperty(AlgorithmProperty.OUT_DATA)); + outFileTypeSet.add( + outRefs[i].getProperty(AlgorithmProperty.OUT_DATA)); } for (Iterator i = inFileTypeSet.iterator(); i.hasNext();) { String srcDataType = (String) i.next(); for (Iterator j = outFileTypeSet.iterator(); j.hasNext();) { - Converter converter = getConverter( srcDataType, - (String) j.next()); - if (converter != null) + Converter converter = + getConverter(srcDataType, (String) j.next()); + if (converter != null) { converterList.add(converter); + } } } } @@ -263,6 +259,20 @@ } return (Converter[]) converterList.toArray(new Converter[0]); } + + private String createConverterFilterForOutFormat(String outFormat) { + String outFilter = "(&(" + ALGORITHM_TYPE + "=" + TYPE_CONVERTER + ")" + + "("+IN_DATA+"=*) " + "("+OUT_DATA+"="+outFormat+")" + + "(!(" + REMOTE + "=*)))"; + return outFilter; + } + + private String createConverterFilterForInFormat(String inFormat) { + String inFilter = "(&(" + ALGORITHM_TYPE + "=" + TYPE_CONVERTER + ")" + + "("+IN_DATA+"="+inFormat+") " + "("+OUT_DATA+"=*)" + + "(!("+IN_DATA+"=file-ext:*))" + "(!(" + REMOTE + "=*)))"; + return inFilter; + } /** * Get the shortest converter path. This returns a single converter path @@ -271,26 +281,31 @@ * @return Single converter path */ private Converter getConverter(String inType, String outType) { - Vertex srcVertex = (Vertex)dataTypeToVertex.get(inType); - Vertex tgtVertex = (Vertex)dataTypeToVertex.get(outType); + Vertex sourceVertex = (Vertex) dataTypeToVertex.get(inType); + Vertex targetVertex = (Vertex) dataTypeToVertex.get(outType); - if (srcVertex != null && tgtVertex != null) { - DijkstraShortestPath shortestPathAlg = new DijkstraShortestPath(graph); - List edgeList = shortestPathAlg.getPath(srcVertex, tgtVertex); + if (sourceVertex != null && targetVertex != null) { + DijkstraShortestPath shortestPathAlg = + new DijkstraShortestPath(graph); + List edgeList = shortestPathAlg.getPath(sourceVertex, targetVertex); if (edgeList.size() > 0) { - ServiceReference[] serviceReferenceArray = new ServiceReference[edgeList - .size()]; + ServiceReference[] serviceReferenceArray = + new ServiceReference[edgeList.size()]; for (int i = 0; i < serviceReferenceArray.length; ++i) { Edge edge = (Edge) edgeList.get(i); - AbstractList converterList = (AbstractList) edge - .getUserDatum(SERVICE_LIST); - serviceReferenceArray[i] = (ServiceReference) converterList - .get(0); + AbstractList converterList = + (AbstractList) edge.getUserDatum(SERVICE_LIST); + serviceReferenceArray[i] = + (ServiceReference) converterList.get(0); } - return new ConverterImpl(bContext, ciContext, serviceReferenceArray); + + return new ConverterImpl(bContext, + ciContext, + serviceReferenceArray); } } + return null; } @@ -318,10 +333,11 @@ converters = findConverters(format, outFormat); set.addAll(new HashSet(Arrays.asList(converters))); } - if (!(data.getData() instanceof File) && data.getData() != null) { - Iterator iter = getClassesFor(data.getData().getClass()).iterator(); - while (iter.hasNext()) { - Class c = (Class) iter.next(); + if (!(data.getData() instanceof File) && data.getData() != null) { + Class dataClass = data.getData().getClass(); + for (Iterator it = getClassesFor(dataClass).iterator(); + it.hasNext();) { + Class c = (Class) it.next(); converters = findConverters(c.getName(), outFormat); set.addAll(new HashSet(Arrays.asList(converters))); } @@ -386,8 +402,10 @@ public void serviceChanged(ServiceEvent event) { ServiceReference inServiceRef = event.getServiceReference(); - String inDataType = (String)inServiceRef.getProperty(AlgorithmProperty.IN_DATA); - String outDataType = (String)inServiceRef.getProperty(AlgorithmProperty.OUT_DATA); + String inDataType = + (String) inServiceRef.getProperty(AlgorithmProperty.IN_DATA); + String outDataType = + (String) inServiceRef.getProperty(AlgorithmProperty.OUT_DATA); if (event.getType() == ServiceEvent.MODIFIED) { removeServiceReference(inDataType, outDataType, inServiceRef); @@ -403,31 +421,33 @@ /** * Remove a service reference in the graph - * @param srcDataType The source data type of the serviceReference to remove - * @param tgtDataType The target data type of the serviceReference to remove + * @param sourceDataType The source data type of the serviceReference to remove + * @param targetDataType The target data type of the serviceReference to remove * @param serviceReference The serviceReference to remove */ - private void removeServiceReference(String srcDataType, String tgtDataType, ServiceReference serviceReference) { - if (srcDataType != null && tgtDataType != null) { - Vertex srcVertex = (Vertex) dataTypeToVertex.get(srcDataType); - Vertex tgtVertex = (Vertex) dataTypeToVertex.get(tgtDataType); - String pid = (String) serviceReference - .getProperty(Constants.SERVICE_PID); + private void removeServiceReference(String sourceDataType, + String targetDataType, + ServiceReference serviceReference) { + if (sourceDataType != null && targetDataType != null) { + Vertex sourceVertex = (Vertex) dataTypeToVertex.get(sourceDataType); + Vertex targetVertex = (Vertex) dataTypeToVertex.get(targetDataType); + String pid = + (String) serviceReference.getProperty(Constants.SERVICE_PID); - if (srcVertex != null && tgtVertex != null) { - Edge edge = srcVertex.findEdge(tgtVertex); + if (sourceVertex != null && targetVertex != null) { + Edge edge = sourceVertex.findEdge(targetVertex); if (edge != null) { - AbstractList serviceList = (AbstractList) edge - .getUserDatum(SERVICE_LIST); - for (Iterator iterator = serviceList.iterator(); iterator - .hasNext();) { - ServiceReference currentServiceReference = (ServiceReference) iterator - .next(); - String currentPid = (String) currentServiceReference + AbstractList serviceList = + (AbstractList) edge.getUserDatum(SERVICE_LIST); + for (Iterator refs = serviceList.iterator(); refs.hasNext();) { + ServiceReference currentServiceReference = + (ServiceReference) refs.next(); + String currentPid = + (String) currentServiceReference .getProperty(Constants.SERVICE_PID); if (pid.equals(currentPid)) { - iterator.remove(); + refs.remove(); } } if (serviceList.isEmpty()) { @@ -440,25 +460,30 @@ /** * Add service reference to the graph - * @param srcDataType The source data type - * @param tgtDataType The target data type + * @param sourceDataType The source data type + * @param targetDataType The target data type * @param serviceReference The service reference to add */ - private void addServiceReference(String srcDataType, String tgtDataType, ServiceReference serviceReference) { - if (srcDataType != null && srcDataType.length() > 0 - && tgtDataType != null && tgtDataType.length() > 0) { - Vertex srcVertex = getVertex(srcDataType); - Vertex tgtVertex = getVertex(tgtDataType); + private void addServiceReference(String sourceDataType, + String targetDataType, + ServiceReference serviceReference) { + if (sourceDataType != null && sourceDataType.length() > 0 + && targetDataType != null && targetDataType.length() > 0) { + Vertex sourceVertex = getVertex(sourceDataType); + Vertex targetVertex = getVertex(targetDataType); - removeServiceReference(srcDataType, tgtDataType, serviceReference); + removeServiceReference( + sourceDataType, targetDataType, serviceReference); - Edge directedEdge = srcVertex.findEdge(tgtVertex); + Edge directedEdge = sourceVertex.findEdge(targetVertex); if (directedEdge == null) { - directedEdge = new DirectedSparseEdge(srcVertex, tgtVertex); + directedEdge = + new DirectedSparseEdge(sourceVertex, targetVertex); graph.addEdge(directedEdge); } - AbstractList serviceList = (AbstractList) directedEdge.getUserDatum(SERVICE_LIST); + AbstractList serviceList = + (AbstractList) directedEdge.getUserDatum(SERVICE_LIST); if (serviceList == null) { serviceList = new ArrayList(); serviceList.add(serviceReference); @@ -475,10 +500,11 @@ * @return The vertex */ private Vertex getVertex(String dataType) { - Vertex vertex = (SparseVertex)dataTypeToVertex.get(dataType); + Vertex vertex = (SparseVertex) dataTypeToVertex.get(dataType); if (vertex== null) { vertex = new SparseVertex(); - vertex.addUserDatum("label", dataType, + vertex.addUserDatum("label", + dataType, new UserDataContainer.CopyAction.Shared()); graph.addVertex(vertex); dataTypeToVertex.put(dataType, vertex); @@ -488,16 +514,18 @@ /** * Save the current converter graph to the user's home directory - * + */ private void saveGraph() { GraphMLFile writer = new GraphMLFile(); - Graph g = (Graph)graph.copy(); - for (Iterator i = g.getEdges().iterator(); i.hasNext();) { - Edge e = (Edge)i.next(); + Graph g = (Graph) graph.copy(); + for (Iterator edges = g.getEdges().iterator(); edges.hasNext();) { + Edge e = (Edge) edges.next(); e.removeUserDatum(SERVICE_LIST); } - writer.save(g, System.getProperty("user.home") + File.separator + "convertGraph.xml"); - + + writer.save(g, System.getProperty("user.home") + + File.separator + + "convertGraph.xml"); } } Modified: trunk/core/org.cishell.reference/src/org/cishell/reference/service/conversion/NullConverter.java =================================================================== --- trunk/core/org.cishell.reference/src/org/cishell/reference/service/conversion/NullConverter.java 2009-07-24 20:46:36 UTC (rev 901) +++ trunk/core/org.cishell.reference/src/org/cishell/reference/service/conversion/NullConverter.java 2009-07-27 16:07:28 UTC (rev 902) @@ -40,10 +40,8 @@ props.put(OUT_DATA, inData); props.put(LABEL, props.get(IN_DATA) + " -> " + props.get(OUT_DATA)); - String lossiness = LOSSLESS; - //TODO: Do the same thing for complexity - props.put(CONVERSION, lossiness); + props.put(CONVERSION, LOSSLESS); } /** Modified: trunk/templates/org.cishell.templates/src/org/cishell/templates/staticexecutable/StaticExecutableAlgorithmFactory.java =================================================================== --- trunk/templates/org.cishell.templates/src/org/cishell/templates/staticexecutable/StaticExecutableAlgorithmFactory.java 2009-07-24 20:46:36 UTC (rev 901) +++ trunk/templates/org.cishell.templates/src/org/cishell/templates/staticexecutable/StaticExecutableAlgorithmFactory.java 2009-07-27 16:07:28 UTC (rev 902) @@ -56,10 +56,8 @@ return provider; } - //pretty sure this isn't used by anything, but I fear deleting it. public StaticExecutableAlgorithmFactory(String algName, BundleContext bContext) { this.algName = algName; this.bContext = bContext; } - } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <kon...@us...> - 2010-12-16 22:44:14
|
Revision: 1179 http://cishell.svn.sourceforge.net/cishell/?rev=1179&view=rev Author: kongchinhua Date: 2010-12-16 22:44:07 +0000 (Thu, 16 Dec 2010) Log Message: ----------- Add executeAlgorithm() to AlgorithmUtilities class to support non-progress monitoring execution Fix Database ISI loading issue on Load and Clean Change the Generic load to use Load and Clean by default Remove Load and Clean ISI from menu Create PrettyLabels method to support hierarchy labeling Reviewed by Micah Modified Paths: -------------- trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/load/FileLoadAlgorithm.java trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/load/PrettyLabeler.java trunk/core/org.cishell.utilities/.project trunk/core/org.cishell.utilities/src/org/cishell/utilities/AlgorithmUtilities.java trunk/core/org.cishell.utilities/src/org/cishell/utilities/FileUtilities.java Modified: trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/load/FileLoadAlgorithm.java =================================================================== --- trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/load/FileLoadAlgorithm.java 2010-12-13 18:48:52 UTC (rev 1178) +++ trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/load/FileLoadAlgorithm.java 2010-12-16 22:44:07 UTC (rev 1179) @@ -130,7 +130,8 @@ } private Data[] labelFileData(File file, Data[] validatedFileData) { - Data[] labeledFileData = PrettyLabeler.relabelWithFileName(validatedFileData, file); + Data[] labeledFileData = PrettyLabeler.relabelWithFileNameHierarchy( + validatedFileData, file); return labeledFileData; } Modified: trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/load/PrettyLabeler.java =================================================================== --- trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/load/PrettyLabeler.java 2010-12-13 18:48:52 UTC (rev 1178) +++ trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/load/PrettyLabeler.java 2010-12-16 22:44:07 UTC (rev 1179) @@ -41,4 +41,44 @@ return newData.toArray(new Data[0]); } + + /** + * Support Hierarchy structure labeling. The algorithm will avoid labeling + * on children. + * @param data - data that need to relabel + * @param file - file that contains filename to be used for relabeling + * @return the processed data with new labels + */ + public static Data[] relabelWithFileNameHierarchy(Data[] data, File file) { + File absoluteFile = file.getAbsoluteFile(); + File parent = absoluteFile.getParentFile(); + + String prefix; + String parentName = parent.getName(); + if (parentName.trim().length() == 0) { + prefix = File.separator; + } else { + prefix = "..." + File.separator + parentName + File.separator; + } + + Collection<Data> possibleParents = new ArrayList<Data>(data.length); + + for (Data datum : data) { + Dictionary<String, Object> labeledDatumMetadata = datum.getMetadata(); + Data dataParent = getParent(labeledDatumMetadata); + if (!possibleParents.contains(dataParent)) { + labeledDatumMetadata.put(DataProperty.LABEL, prefix + absoluteFile.getName()); + } + possibleParents.add(datum); + } + + return data; + } + + /* + * Get the parent of the data + */ + private static Data getParent(Dictionary<String, Object> labeledDatumMetadata) { + return (Data) labeledDatumMetadata.get(DataProperty.PARENT); + } } \ No newline at end of file Modified: trunk/core/org.cishell.utilities/.project =================================================================== --- trunk/core/org.cishell.utilities/.project 2010-12-13 18:48:52 UTC (rev 1178) +++ trunk/core/org.cishell.utilities/.project 2010-12-16 22:44:07 UTC (rev 1179) @@ -20,9 +20,15 @@ <arguments> </arguments> </buildCommand> + <buildCommand> + <name>net.sf.eclipsecs.core.CheckstyleBuilder</name> + <arguments> + </arguments> + </buildCommand> </buildSpec> <natures> <nature>org.eclipse.pde.PluginNature</nature> <nature>org.eclipse.jdt.core.javanature</nature> + <nature>net.sf.eclipsecs.core.CheckstyleNature</nature> </natures> </projectDescription> Modified: trunk/core/org.cishell.utilities/src/org/cishell/utilities/AlgorithmUtilities.java =================================================================== --- trunk/core/org.cishell.utilities/src/org/cishell/utilities/AlgorithmUtilities.java 2010-12-13 18:48:52 UTC (rev 1178) +++ trunk/core/org.cishell.utilities/src/org/cishell/utilities/AlgorithmUtilities.java 2010-12-16 22:44:07 UTC (rev 1179) @@ -117,6 +117,9 @@ } } + /* + * Use this to execute algorithm with progress monitoring + */ @SuppressWarnings("unchecked") // Dictionary<String, Object> public static Data[] executeAlgorithm( AlgorithmFactory algorithmFactory, @@ -136,4 +139,17 @@ return result; } + + /* + * Use this to execute algorithm without progress monitoring + */ + public static Data[] executeAlgorithm( + AlgorithmFactory algorithmFactory, + Data[] data, + Dictionary parameters, + CIShellContext ciShellContext) + throws AlgorithmExecutionException { + + return executeAlgorithm(algorithmFactory, null, data, parameters, ciShellContext); + } } \ No newline at end of file Modified: trunk/core/org.cishell.utilities/src/org/cishell/utilities/FileUtilities.java =================================================================== --- trunk/core/org.cishell.utilities/src/org/cishell/utilities/FileUtilities.java 2010-12-13 18:48:52 UTC (rev 1178) +++ trunk/core/org.cishell.utilities/src/org/cishell/utilities/FileUtilities.java 2010-12-16 22:44:07 UTC (rev 1179) @@ -367,7 +367,7 @@ } if (!extension.startsWith(".")) { - extension = extension + "."; + extension = "." + extension; } String tempPath = System.getProperty("java.io.tmpdir"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pat...@us...> - 2011-02-16 17:41:32
|
Revision: 1211 http://cishell.svn.sourceforge.net/cishell/?rev=1211&view=rev Author: pataphil Date: 2011-02-16 17:41:25 +0000 (Wed, 16 Feb 2011) Log Message: ----------- * Trying to fix the build. Modified Paths: -------------- trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/save/SaveDataChooser.java trunk/core/org.cishell.reference/src/org/cishell/reference/app/service/fileloader/FileFormatSelector.java 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 2011-02-16 17:40:45 UTC (rev 1210) +++ trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/save/SaveDataChooser.java 2011-02-16 17:41:25 UTC (rev 1211) @@ -16,7 +16,7 @@ import org.cishell.framework.CIShellContext; import org.cishell.framework.algorithm.AlgorithmProperty; import org.cishell.framework.data.Data; -import org.cishell.reference.gui.common.AbstractDialog; +import org.cishell.reference.gui.workspace.common.AbstractDialog; import org.cishell.service.conversion.Converter; import org.eclipse.swt.SWT; import org.eclipse.swt.custom.StyleRange; Modified: trunk/core/org.cishell.reference/src/org/cishell/reference/app/service/fileloader/FileFormatSelector.java =================================================================== --- trunk/core/org.cishell.reference/src/org/cishell/reference/app/service/fileloader/FileFormatSelector.java 2011-02-16 17:40:45 UTC (rev 1210) +++ trunk/core/org.cishell.reference/src/org/cishell/reference/app/service/fileloader/FileFormatSelector.java 2011-02-16 17:41:25 UTC (rev 1211) @@ -3,7 +3,7 @@ import java.io.File; import org.cishell.framework.algorithm.AlgorithmFactory; -import org.cishell.reference.gui.common.AbstractDialog; +import org.cishell.reference.gui.workspace.common.AbstractDialog; import org.eclipse.swt.SWT; import org.eclipse.swt.events.MouseAdapter; import org.eclipse.swt.events.MouseEvent; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <re...@us...> - 2011-12-20 16:54:57
|
Revision: 1285 http://cishell.svn.sourceforge.net/cishell/?rev=1285&view=rev Author: rescdsk Date: 2011-12-20 16:54:45 +0000 (Tue, 20 Dec 2011) Log Message: ----------- Maven-ify! Modified Paths: -------------- trunk/core/org.cishell.framework/.classpath trunk/core/org.cishell.framework/.project trunk/core/org.cishell.framework/.settings/org.eclipse.jdt.core.prefs trunk/core/org.cishell.reference/.classpath trunk/core/org.cishell.reference/.project trunk/core/org.cishell.reference/.settings/org.eclipse.jdt.core.prefs trunk/deployment/org.cishell.environment.equinox.feature/.project trunk/deployment/org.cishell.feature/.project trunk/deployment/org.cishell.feature/feature.xml Added Paths: ----------- trunk/core/org.cishell.framework/.settings/org.eclipse.core.resources.prefs trunk/core/org.cishell.framework/.settings/org.eclipse.m2e.core.prefs trunk/core/org.cishell.framework/pom.xml trunk/core/org.cishell.reference/.settings/org.eclipse.m2e.core.prefs trunk/core/org.cishell.reference/pom.xml trunk/deployment/org.cishell.environment.equinox.feature/.settings/ trunk/deployment/org.cishell.environment.equinox.feature/.settings/org.eclipse.m2e.core.prefs trunk/deployment/org.cishell.environment.equinox.feature/pom.xml trunk/deployment/org.cishell.feature/.settings/ trunk/deployment/org.cishell.feature/.settings/org.eclipse.m2e.core.prefs trunk/deployment/org.cishell.feature/pom.xml Modified: trunk/core/org.cishell.framework/.classpath =================================================================== --- trunk/core/org.cishell.framework/.classpath 2011-12-20 16:52:35 UTC (rev 1284) +++ trunk/core/org.cishell.framework/.classpath 2011-12-20 16:54:45 UTC (rev 1285) @@ -2,6 +2,6 @@ <classpath> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/> <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> - <classpathentry kind="src" path="src"/> - <classpathentry kind="output" path="bin"/> + <classpathentry kind="src" path="src/"/> + <classpathentry kind="output" path="target/classes"/> </classpath> Modified: trunk/core/org.cishell.framework/.project =================================================================== --- trunk/core/org.cishell.framework/.project 2011-12-20 16:52:35 UTC (rev 1284) +++ trunk/core/org.cishell.framework/.project 2011-12-20 16:54:45 UTC (rev 1285) @@ -1,28 +1,34 @@ -<?xml version="1.0" encoding="UTF-8"?> -<projectDescription> - <name>org.cishell.framework</name> - <comment></comment> - <projects> - </projects> - <buildSpec> - <buildCommand> - <name>org.eclipse.jdt.core.javabuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>org.eclipse.pde.ManifestBuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>org.eclipse.pde.SchemaBuilder</name> - <arguments> - </arguments> - </buildCommand> - </buildSpec> - <natures> - <nature>org.eclipse.pde.PluginNature</nature> - <nature>org.eclipse.jdt.core.javanature</nature> - </natures> -</projectDescription> +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>org.cishell.framework</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.jdt.core.javabuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.pde.ManifestBuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.pde.SchemaBuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.m2e.core.maven2Builder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.m2e.core.maven2Nature</nature> + <nature>org.eclipse.pde.PluginNature</nature> + <nature>org.eclipse.jdt.core.javanature</nature> + </natures> +</projectDescription> Added: trunk/core/org.cishell.framework/.settings/org.eclipse.core.resources.prefs =================================================================== --- trunk/core/org.cishell.framework/.settings/org.eclipse.core.resources.prefs (rev 0) +++ trunk/core/org.cishell.framework/.settings/org.eclipse.core.resources.prefs 2011-12-20 16:54:45 UTC (rev 1285) @@ -0,0 +1,3 @@ +#Thu Dec 15 14:05:43 EST 2011 +eclipse.preferences.version=1 +encoding/src=UTF-8 Modified: trunk/core/org.cishell.framework/.settings/org.eclipse.jdt.core.prefs =================================================================== --- trunk/core/org.cishell.framework/.settings/org.eclipse.jdt.core.prefs 2011-12-20 16:52:35 UTC (rev 1284) +++ trunk/core/org.cishell.framework/.settings/org.eclipse.jdt.core.prefs 2011-12-20 16:54:45 UTC (rev 1285) @@ -1,4 +1,4 @@ -#Fri Jun 11 22:41:08 EDT 2010 +#Fri Dec 09 14:04:21 EST 2011 eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 @@ -9,4 +9,5 @@ org.eclipse.jdt.core.compiler.debug.sourceFile=generate org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning org.eclipse.jdt.core.compiler.source=1.5 Added: trunk/core/org.cishell.framework/.settings/org.eclipse.m2e.core.prefs =================================================================== --- trunk/core/org.cishell.framework/.settings/org.eclipse.m2e.core.prefs (rev 0) +++ trunk/core/org.cishell.framework/.settings/org.eclipse.m2e.core.prefs 2011-12-20 16:54:45 UTC (rev 1285) @@ -0,0 +1,5 @@ +#Fri Dec 09 13:55:42 EST 2011 +activeProfiles= +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1 Added: trunk/core/org.cishell.framework/pom.xml =================================================================== --- trunk/core/org.cishell.framework/pom.xml (rev 0) +++ trunk/core/org.cishell.framework/pom.xml 2011-12-20 16:54:45 UTC (rev 1285) @@ -0,0 +1,18 @@ +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <artifactId>org.cishell.framework</artifactId> + <packaging>eclipse-plugin</packaging> + <version>1.0.0</version> + <parent> + <groupId>org.cishell</groupId> + <artifactId>plugin-parent</artifactId> + <version>0.0.1</version> + <relativePath>../plugin-parent/pom.xml</relativePath> + </parent> + + <build> + <sourceDirectory>src</sourceDirectory> + </build> + +</project> \ No newline at end of file Modified: trunk/core/org.cishell.reference/.classpath =================================================================== --- trunk/core/org.cishell.reference/.classpath 2011-12-20 16:52:35 UTC (rev 1284) +++ trunk/core/org.cishell.reference/.classpath 2011-12-20 16:54:45 UTC (rev 1285) @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <classpath> - <classpathentry kind="src" path="src"/> - <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/> <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> - <classpathentry kind="output" path="bin"/> + <classpathentry kind="src" path="src/"/> + <classpathentry kind="output" path="target/classes"/> </classpath> Modified: trunk/core/org.cishell.reference/.project =================================================================== --- trunk/core/org.cishell.reference/.project 2011-12-20 16:52:35 UTC (rev 1284) +++ trunk/core/org.cishell.reference/.project 2011-12-20 16:54:45 UTC (rev 1285) @@ -1,28 +1,34 @@ -<?xml version="1.0" encoding="UTF-8"?> -<projectDescription> - <name>org.cishell.reference</name> - <comment></comment> - <projects> - </projects> - <buildSpec> - <buildCommand> - <name>org.eclipse.jdt.core.javabuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>org.eclipse.pde.ManifestBuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>org.eclipse.pde.SchemaBuilder</name> - <arguments> - </arguments> - </buildCommand> - </buildSpec> - <natures> - <nature>org.eclipse.pde.PluginNature</nature> - <nature>org.eclipse.jdt.core.javanature</nature> - </natures> -</projectDescription> +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>org.cishell.reference</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.jdt.core.javabuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.pde.ManifestBuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.pde.SchemaBuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.m2e.core.maven2Builder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.m2e.core.maven2Nature</nature> + <nature>org.eclipse.pde.PluginNature</nature> + <nature>org.eclipse.jdt.core.javanature</nature> + </natures> +</projectDescription> Modified: trunk/core/org.cishell.reference/.settings/org.eclipse.jdt.core.prefs =================================================================== --- trunk/core/org.cishell.reference/.settings/org.eclipse.jdt.core.prefs 2011-12-20 16:52:35 UTC (rev 1284) +++ trunk/core/org.cishell.reference/.settings/org.eclipse.jdt.core.prefs 2011-12-20 16:54:45 UTC (rev 1285) @@ -1,4 +1,4 @@ -#Wed Jul 21 20:42:37 EDT 2010 +#Thu Dec 15 14:43:35 EST 2011 eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 @@ -9,4 +9,5 @@ org.eclipse.jdt.core.compiler.debug.sourceFile=generate org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning org.eclipse.jdt.core.compiler.source=1.5 Added: trunk/core/org.cishell.reference/.settings/org.eclipse.m2e.core.prefs =================================================================== --- trunk/core/org.cishell.reference/.settings/org.eclipse.m2e.core.prefs (rev 0) +++ trunk/core/org.cishell.reference/.settings/org.eclipse.m2e.core.prefs 2011-12-20 16:54:45 UTC (rev 1285) @@ -0,0 +1,5 @@ +#Thu Dec 15 14:43:34 EST 2011 +activeProfiles= +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1 Added: trunk/core/org.cishell.reference/pom.xml =================================================================== --- trunk/core/org.cishell.reference/pom.xml (rev 0) +++ trunk/core/org.cishell.reference/pom.xml 2011-12-20 16:54:45 UTC (rev 1285) @@ -0,0 +1,26 @@ +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <artifactId>org.cishell.reference</artifactId> + <version>1.0.0</version> + <packaging>eclipse-plugin</packaging> + <parent> + <groupId>org.cishell</groupId> + <artifactId>plugin-parent</artifactId> + <version>0.0.1</version> + <relativePath>../plugin-parent/pom.xml</relativePath> + </parent> + + <build> + <sourceDirectory>src</sourceDirectory> + + </build> + <dependencies> + <dependency> + <groupId>jung</groupId> + <artifactId>jung</artifactId> + <version>1.7.5</version> + </dependency> + </dependencies> + +</project> \ No newline at end of file Modified: trunk/deployment/org.cishell.environment.equinox.feature/.project =================================================================== --- trunk/deployment/org.cishell.environment.equinox.feature/.project 2011-12-20 16:52:35 UTC (rev 1284) +++ trunk/deployment/org.cishell.environment.equinox.feature/.project 2011-12-20 16:54:45 UTC (rev 1285) @@ -1,17 +1,23 @@ -<?xml version="1.0" encoding="UTF-8"?> -<projectDescription> - <name>org.cishell.environment.equinox.feature</name> - <comment></comment> - <projects> - </projects> - <buildSpec> - <buildCommand> - <name>org.eclipse.pde.FeatureBuilder</name> - <arguments> - </arguments> - </buildCommand> - </buildSpec> - <natures> - <nature>org.eclipse.pde.FeatureNature</nature> - </natures> -</projectDescription> +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>org.cishell.environment.equinox.feature</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.pde.FeatureBuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.m2e.core.maven2Builder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.m2e.core.maven2Nature</nature> + <nature>org.eclipse.pde.FeatureNature</nature> + </natures> +</projectDescription> Added: trunk/deployment/org.cishell.environment.equinox.feature/.settings/org.eclipse.m2e.core.prefs =================================================================== --- trunk/deployment/org.cishell.environment.equinox.feature/.settings/org.eclipse.m2e.core.prefs (rev 0) +++ trunk/deployment/org.cishell.environment.equinox.feature/.settings/org.eclipse.m2e.core.prefs 2011-12-20 16:54:45 UTC (rev 1285) @@ -0,0 +1,5 @@ +#Mon Dec 19 10:09:04 EST 2011 +activeProfiles= +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1 Added: trunk/deployment/org.cishell.environment.equinox.feature/pom.xml =================================================================== --- trunk/deployment/org.cishell.environment.equinox.feature/pom.xml (rev 0) +++ trunk/deployment/org.cishell.environment.equinox.feature/pom.xml 2011-12-20 16:54:45 UTC (rev 1285) @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" + xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.cishell</groupId> + <artifactId>parent</artifactId> + <version>0.0.1</version> + <relativePath>../parent/pom.xml</relativePath> + </parent> + + <artifactId>org.cishell.environment.equinox.feature</artifactId> + <version>1.0.0</version> + <packaging>eclipse-feature</packaging> + +</project> \ No newline at end of file Modified: trunk/deployment/org.cishell.feature/.project =================================================================== --- trunk/deployment/org.cishell.feature/.project 2011-12-20 16:52:35 UTC (rev 1284) +++ trunk/deployment/org.cishell.feature/.project 2011-12-20 16:54:45 UTC (rev 1285) @@ -1,17 +1,23 @@ -<?xml version="1.0" encoding="UTF-8"?> -<projectDescription> - <name>org.cishell.feature</name> - <comment></comment> - <projects> - </projects> - <buildSpec> - <buildCommand> - <name>org.eclipse.pde.FeatureBuilder</name> - <arguments> - </arguments> - </buildCommand> - </buildSpec> - <natures> - <nature>org.eclipse.pde.FeatureNature</nature> - </natures> -</projectDescription> +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>org.cishell.feature</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.pde.FeatureBuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.m2e.core.maven2Builder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.m2e.core.maven2Nature</nature> + <nature>org.eclipse.pde.FeatureNature</nature> + </natures> +</projectDescription> Added: trunk/deployment/org.cishell.feature/.settings/org.eclipse.m2e.core.prefs =================================================================== --- trunk/deployment/org.cishell.feature/.settings/org.eclipse.m2e.core.prefs (rev 0) +++ trunk/deployment/org.cishell.feature/.settings/org.eclipse.m2e.core.prefs 2011-12-20 16:54:45 UTC (rev 1285) @@ -0,0 +1,5 @@ +#Thu Dec 15 14:28:47 EST 2011 +activeProfiles= +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1 Modified: trunk/deployment/org.cishell.feature/feature.xml =================================================================== --- trunk/deployment/org.cishell.feature/feature.xml 2011-12-20 16:52:35 UTC (rev 1284) +++ trunk/deployment/org.cishell.feature/feature.xml 2011-12-20 16:54:45 UTC (rev 1285) @@ -1,18 +1,18 @@ -<?xml version="1.0" encoding="UTF-8"?> -<feature - id="org.cishell.feature" - label="CIShell Framework API Feature" - version="1.0.0"> - - <description url="http://cishell.org"> - CIShell Framework API - </description> - - <copyright> - Copyright 2006 Indiana University - </copyright> - - <license url="http://www.apache.org/licenses/LICENSE-2.0"> +<?xml version="1.0" encoding="UTF-8"?> +<feature + id="org.cishell.feature" + label="CIShell Framework API Feature" + version="1.0.0"> + + <description url="http://cishell.org"> + CIShell Framework API + </description> + + <copyright> + Copyright 2006 Indiana University + </copyright> + + <license url="http://www.apache.org/licenses/LICENSE-2.0"> CIShell: Cyberinfrastructure Shell Copyright 2006 Indiana University Licensed under the Apache License, Version 2.0 (the "License"); @@ -28,19 +28,19 @@ Bruce Herr (bh...@bh...) Weixia Huang (hu...@in...) Shashikant Penumarthy (sp...@in...) -Dr. Katy Borner (ka...@in...) - </license> - - <url> - <update label="CIShell Update Site" url="http://cishell.org/update"/> - <discovery label="CIShell Update Site" url="http://cishell.org/update"/> - </url> - - <plugin - id="org.cishell.framework" - download-size="0" - install-size="0" - version="0.0.0" - unpack="false"/> - -</feature> +Dr. Katy Borner (ka...@in...) + </license> + + <url> + <update label="CIShell Update Site" url="http://cishell.org/update"/> + <discovery label="CIShell Update Site" url="http://cishell.org/update"/> + </url> + + <plugin + id="org.cishell.framework" + download-size="0" + install-size="0" + version="0.0.0" + unpack="false"/> + +</feature> Added: trunk/deployment/org.cishell.feature/pom.xml =================================================================== --- trunk/deployment/org.cishell.feature/pom.xml (rev 0) +++ trunk/deployment/org.cishell.feature/pom.xml 2011-12-20 16:54:45 UTC (rev 1285) @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" + xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.cishell</groupId> + <artifactId>parent</artifactId> + <version>0.0.1</version> + <relativePath>../parent/pom.xml</relativePath> + </parent> + + <artifactId>org.cishell.feature</artifactId> + <version>1.0.0</version> + <packaging>eclipse-feature</packaging> + +</project> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jrb...@us...> - 2009-08-03 16:33:53
|
Revision: 912 http://cishell.svn.sourceforge.net/cishell/?rev=912&view=rev Author: jrbibers Date: 2009-08-03 16:33:43 +0000 (Mon, 03 Aug 2009) Log Message: ----------- For conversion exception handling task, NWB sprint, July 2009. Stepped through each converter algorithm and tried to clean up the exception handling in each to provide useful error messages. While at it, also updated the style of unpacking the input Data[]. I've been told we're now trying to unpack this data in the constructor rather than the execute method. Finally, updated central conversion exception handling in CIShell. I've attempted to maintain this desired behavior: When an exception occurs during a conversion, if the first and only exception occurred in the final step (of a potentially multi-stepped conversion chain), and that final converter was specifically a file handler (in the "validator, reader, writer, handler" sense: it takes data from MIME type "foo" to file extension "foo"), do not throw an error, but rather log a warning and use the "unhandled" data. Conversion should work this way whether it is for saving, for viewing, or (implicitly) for use by another algorithm. As a pleasant side effect, since adding these changes, I haven't gotten any of the ugly dialogs filled with raw/junky-looking text that would sometimes pop up when saving or viewing a file in a relatively buggy format (like Pajek .net). Modified Paths: -------------- trunk/clients/gui/org.cishell.reference.gui.persistence/.classpath 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/FileUtil.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/view/FileView.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/ViewWithDataChooser.java trunk/core/org.cishell.reference/.classpath trunk/core/org.cishell.reference/src/org/cishell/reference/service/conversion/ConverterImpl.java trunk/core/org.cishell.reference/src/org/cishell/reference/service/conversion/DataConversionServiceImpl.java Added Paths: ----------- trunk/clients/gui/org.cishell.reference.gui.persistence/.settings/org.eclipse.jdt.core.prefs trunk/core/org.cishell.reference/.settings/org.eclipse.jdt.core.prefs Modified: trunk/clients/gui/org.cishell.reference.gui.persistence/.classpath =================================================================== --- trunk/clients/gui/org.cishell.reference.gui.persistence/.classpath 2009-07-31 20:40:05 UTC (rev 911) +++ trunk/clients/gui/org.cishell.reference.gui.persistence/.classpath 2009-08-03 16:33:43 UTC (rev 912) @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <classpath> <classpathentry kind="src" path="src"/> - <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/j2sdk1.4.2_19"/> <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> <classpathentry kind="output" path="bin"/> </classpath> Added: trunk/clients/gui/org.cishell.reference.gui.persistence/.settings/org.eclipse.jdt.core.prefs =================================================================== --- trunk/clients/gui/org.cishell.reference.gui.persistence/.settings/org.eclipse.jdt.core.prefs (rev 0) +++ trunk/clients/gui/org.cishell.reference.gui.persistence/.settings/org.eclipse.jdt.core.prefs 2009-08-03 16:33:43 UTC (rev 912) @@ -0,0 +1,12 @@ +#Tue Jul 28 13:21:05 EDT 2009 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.4 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=warning +org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning +org.eclipse.jdt.core.compiler.source=1.3 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 2009-07-31 20:40:05 UTC (rev 911) +++ trunk/clients/gui/org.cishell.reference.gui.persistence/META-INF/MANIFEST.MF 2009-08-03 16:33:43 UTC (rev 912) @@ -9,6 +9,7 @@ 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.conversion, org.cishell.reference.service.metatype, org.cishell.service.conversion;version="1.0.0", org.cishell.service.guibuilder;version="1.0.0", Modified: trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/FileUtil.java =================================================================== --- trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/FileUtil.java 2009-07-31 20:40:05 UTC (rev 911) +++ trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/FileUtil.java 2009-08-03 16:33:43 UTC (rev 912) @@ -51,8 +51,10 @@ public static String extractExtension(String format) { String extension = ""; - //TODO: We should really have explicit piece of metadata that says what the extension is, - //TODO: as this method is not guaranteed to yield the correct extension + /* TODO: We should really have explicit piece of metadata that says what + * the extension is, as this method is not guaranteed to yield the + * correct extension. + */ if (format.startsWith("file:text/")) { extension = "." + format.substring("file:text/".length()); } else if (format.startsWith("file-ext:")) { 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 2009-07-31 20:40:05 UTC (rev 911) +++ trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/save/FileSaver.java 2009-08-03 16:33:43 UTC (rev 912) @@ -28,8 +28,10 @@ * @author Team */ public class FileSaver { - private static File currentDir; + public static final String FILE_EXTENSION_PREFIX = "file-ext:"; + private static File currentDir; + private Shell parent; private GUIBuilderService guiBuilder; @@ -87,25 +89,28 @@ * @return Whether or not the save was successful */ public boolean save(Converter converter, Data data) { - String outDataStr = (String)converter.getProperties().get(AlgorithmProperty.OUT_DATA); + String outDataStr = + (String) converter.getProperties().get(AlgorithmProperty.OUT_DATA); String ext = ""; - if (outDataStr.startsWith("file-ext:")) { - ext = outDataStr.substring(outDataStr.indexOf(':')+1); + if (outDataStr.startsWith(FILE_EXTENSION_PREFIX)) { + ext = outDataStr.substring(FILE_EXTENSION_PREFIX.length()); } - if ((""+ext).startsWith(".")) { + // Skip any initial "." if present. + if (ext.startsWith(".")) { ext = ext.substring(1); } FileDialog dialog = new FileDialog(parent, SWT.SAVE); if (currentDir == null) { - currentDir = new File(System.getProperty("user.home") + File.separator + "anything"); + currentDir = new File(System.getProperty("user.home") + File.separator + + "anything"); } dialog.setFilterPath(currentDir.getPath()); - + if (ext != null && !ext.equals("*")) { dialog.setFilterExtensions(new String[]{"*." + ext}); } @@ -128,38 +133,46 @@ String fileName = dialog.open(); if (fileName != null) { File selectedFile = new File(fileName); - if (!isSaveFileValid(selectedFile)) + if (!isSaveFileValid(selectedFile)) { continue; - if (ext != null && ext.length() != 0) - if (!selectedFile.getPath().endsWith(ext) && !ext.equals("*")) + } + + 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()) { - currentDir = new File(selectedFile + File.separator + "anything"); - } else { - currentDir = new File(selectedFile.getParent() + File.separator + "anything"); + Data newData = converter.convert(data); + + copy((File) newData.getData(), selectedFile); + + if (selectedFile.isDirectory()) { + currentDir = new File(selectedFile + File.separator + "anything"); + } else { + currentDir = new File(selectedFile.getParent() + File.separator + "anything"); + } + + done = true; } - - done = true; - } catch (ConversionException e1) { - this.log.log(LogService.LOG_ERROR, "Error occurred while converting data to saved format.", e1); + catch (ConversionException e) { + log.log(LogService.LOG_ERROR, "Error occurred while converting data to saved format:\n " + e.getMessage(), e); return false; } + log.log(LogService.LOG_INFO, "Saved: " + selectedFile.getPath()); } else { done = true; return false; - } + } } return true; } - - /** + + + + /** * Converter puts it into a temporary directory, this copies it over * * @param in The temp file to copy 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 2009-07-31 20:40:05 UTC (rev 911) +++ trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/save/Save.java 2009-08-03 16:33:43 UTC (rev 912) @@ -24,14 +24,13 @@ * @author bmarkine */ public class Save implements Algorithm { - Data[] data; - Dictionary parameters; - CIShellContext context; - Shell parentShell; + public static final String ANY_FILE_EXTENSION = "file-ext:*"; + public static final String SAVE_DIALOG_TITLE = "Save"; + private Data[] data; + private CIShellContext context; + private Shell parentShell; - private GUIBuilderService guiBuilder; private DataConversionService conversionManager; - private LogService log; /** * Sets up default services for the algorithm @@ -42,102 +41,66 @@ */ public Save(Data[] data, Dictionary parameters, CIShellContext context) { this.data = data; - this.parameters = parameters; this.context = context; - this.conversionManager = (DataConversionService) context.getService( - DataConversionService.class.getName()); - - this.log = (LogService) context.getService(LogService.class.getName()); - this.guiBuilder = (GUIBuilderService)context.getService(GUIBuilderService.class.getName()); + this.conversionManager = (DataConversionService) + context.getService(DataConversionService.class.getName()); } /** - * Executes the algorithm - * - * @return Null for this algorithm + * @return Null when successful */ public Data[] execute() throws AlgorithmExecutionException { - //NOTE: A "converter" here is actually a converter path - //starting with the format for the data we want to save - //and ending in a output format - Data dataToSave = data[0]; + Data outData = data[0]; + + tryToSave(outData, ANY_FILE_EXTENSION); - //first, try to save the normal way, which is using validators to validate the output. - String saveThroughValidators = "file-ext:*"; - Object firstAttemptResult = tryToSave(dataToSave, saveThroughValidators); - if (firstAttemptResult instanceof Boolean) { - boolean succeeded = ((Boolean) firstAttemptResult).booleanValue(); - if (succeeded) { - System.out.println("Success"); - return null; //FILE SAVED SUCCESSFULLY. DONE. - } else { - System.out.println("No converter"); - this.log.log(LogService.LOG_WARNING, "No converters found that can save file through a validator." + - " Attempting to save without validating."); - } - } else { //result instanceof Exception - Exception reasonForFailure = (Exception) firstAttemptResult; - this.log.log(LogService.LOG_WARNING, "Exception occurred while attempting to save" + - " file using a validator. Attempting to save without validating.", reasonForFailure); - System.out.println("Exception"); - } - - System.out.println("Trying without validators"); - - //if saving with validators didn't work, try to save it without using validators - String saveWithoutValidators = "file:*"; - Object secondAttemptResult = tryToSave(dataToSave, saveWithoutValidators); - if (secondAttemptResult instanceof Boolean) { - boolean succeeded = ((Boolean) secondAttemptResult).booleanValue(); - if (succeeded) { - return null; //FILE SAVED SUCCESSFULLY. DONE. - } else { - throw new AlgorithmExecutionException("No converters found that could save file. Save failed"); - } - } else { //result instanceof Exception - Exception reasonForFailure2 = (Exception) secondAttemptResult; - throw new AlgorithmExecutionException("Exception occurred while attempting to save", reasonForFailure2); - } + return null; } - //returns True if save was successful - //return False if there are no converter chains available to save to the given format - //return an Exception if an exception occurred while attempting to save - private Object tryToSave(final Data dataToSave, String formatToSaveTo) { - final Converter[] converters = conversionManager.findConverters(dataToSave, formatToSaveTo); - if (converters.length == 0) {return new Boolean(false);}; + private void tryToSave(final Data outData, String outFormat) + throws AlgorithmExecutionException { + final Converter[] converters = + conversionManager.findConverters(outData, outFormat); + if (converters.length == 0) { + throw new AlgorithmExecutionException( + "Error: Calculated an empty converter chain."); + } - parentShell = PlatformUI.getWorkbench().getWorkbenchWindows()[0].getShell(); - if (parentShell.isDisposed()) {return makeParentShellDisposedException();}; + parentShell = + PlatformUI.getWorkbench().getWorkbenchWindows()[0].getShell(); + if (parentShell.isDisposed()) { + throw new AlgorithmExecutionException( + "Attempted to use disposed parent shell."); + } try { - guiRun(new Runnable() { - public void run() { - if (converters.length == 1){ - //only one possible choice in how to save data. Just do it. - Converter onlyConverter = converters[0]; - final FileSaver saver = new FileSaver(parentShell, context); - saver.save(onlyConverter, dataToSave); - } else { //converters.length > 1 - //multiple ways to save the data. Let user choose. - SaveDataChooser saveChooser = new SaveDataChooser(dataToSave, - parentShell, converters, "Save", context); - saveChooser.createContent(new Shell(parentShell)); - saveChooser.open(); - } - }}); + guiRun(new Runnable() { + public void run() { + if (converters.length == 1) { + // Only one possible choice in how to save data. Do it. + Converter onlyConverter = converters[0]; + final FileSaver saver = + new FileSaver(parentShell, context); + saver.save(onlyConverter, outData); + } else { + // Multiple ways to save the data. Let user choose. + SaveDataChooser saveChooser = + new SaveDataChooser(outData, + parentShell, + converters, + SAVE_DIALOG_TITLE, + context); + saveChooser.createContent(new Shell(parentShell)); + saveChooser.open(); + } + } + }); } catch (Exception e) { - return e; + throw new AlgorithmExecutionException(e.getMessage(), e); } - - return new Boolean(true); } - private AlgorithmExecutionException makeParentShellDisposedException() { - return new AlgorithmExecutionException("Attempted to use disposed parent shell"); - } - private void guiRun(Runnable run) { if (Thread.currentThread() == Display.getDefault().getThread()) { run.run(); @@ -145,29 +108,4 @@ parentShell.getDisplay().syncExec(run); } } - - private class NoConversionConverter implements Converter { - Dictionary props = new Hashtable(); - - public Data convert(Data data) { - return data; - } - - public AlgorithmFactory getAlgorithmFactory() { - return null; - } - - public ServiceReference[] getConverterChain() { - return null; - } - - public Dictionary getProperties() { - props.put(AlgorithmProperty.OUT_DATA, "file:*"); - return props; - } - } - - private Data removeExtension(Data data) { - return new BasicData(data.getMetadata(), data, ""); - } } \ No newline at end of file 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 2009-07-31 20:40:05 UTC (rev 911) +++ trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/save/SaveDataChooser.java 2009-08-03 16:33:43 UTC (rev 912) @@ -308,12 +308,12 @@ * 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)); + 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); } @@ -328,34 +328,38 @@ public void createDialogButtons(Composite parent) { Button select = new Button(parent, SWT.PUSH); select.setText("Select"); - select.addSelectionListener(new SelectionAdapter() { + select.addSelectionListener( + new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { int index = converterList.getSelectionIndex(); - + if (index != -1) { selectionMade(index); } } - }); + } + ); Button cancel = new Button(parent, SWT.NONE); cancel.setText("Cancel"); - cancel.addSelectionListener(new SelectionAdapter() { + cancel.addSelectionListener( + new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { close(false); } - }); + } + ); } /** * Checks for the number of file savers. If there is one - * converter then it will save directly, otherwise intialize the chooser. + * converter then it will save directly, otherwise initialize the chooser. * * @param parent The parent GUI for new dialog windows. */ public Composite createContent(Composite parent) { if (converterArray.length == 1) { - final FileSaver saver = new FileSaver((Shell)parent, context); + final FileSaver saver = new FileSaver((Shell) parent, context); close(saver.save(converterArray[0], data)); return parent; } @@ -365,31 +369,30 @@ } private class CompareAlphabetically implements Comparator { - public int compare(Object o1, Object o2) { - if (o1 instanceof Converter && o2 instanceof Converter) { - Converter c1 = (Converter) o1; - String c1Label = getLabel(c1); - - Converter c2 = (Converter) o2; - String c2Label = getLabel(c2); - - if (c1Label != null && c2Label != null) { - return c1Label.compareTo(c2Label); - } else if (c1Label == null) { - //c1 > c2 - return 1; - } else if (c2Label == null) { - //c1 < c2 - return -1; - } else { - //c1 == c2 - return 0; - } - } else { - throw new IllegalArgumentException("Can only " + - "compare Converters"); - } + if (o1 instanceof Converter && o2 instanceof Converter) { + Converter c1 = (Converter) o1; + String c1Label = getLabel(c1); + + Converter c2 = (Converter) o2; + String c2Label = getLabel(c2); + + if (c1Label != null && c2Label != null) { + return c1Label.compareTo(c2Label); + } else if (c1Label == null) { + //c1 > c2 + return 1; + } else if (c2Label == null) { + //c1 < c2 + return -1; + } else { + //c1 == c2 + return 0; + } + } else { + throw new IllegalArgumentException("Can only " + + "compare Converters"); + } } private String getLabel(Converter c) { 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 2009-07-31 20:40:05 UTC (rev 911) +++ trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/view/FileView.java 2009-08-03 16:33:43 UTC (rev 912) @@ -27,266 +27,269 @@ * @author Weixia(Bonnie) Huang (hu...@in...) */ public class FileView implements Algorithm { - Data[] data; - Dictionary parameters; - CIShellContext context; - DataConversionService conversionManager; - LogService logger; - Program program; - // Program programTwo; - File tempFile; - - public FileView(Data[] data, Dictionary parameters, CIShellContext context) { - this.data = data; - this.parameters = parameters; - this.context = context; - - conversionManager = (DataConversionService) context.getService( - DataConversionService.class.getName()); - - logger = (LogService)context.getService(LogService.class.getName()); - } + public static final String ANY_FILE_EXTENSION_FILTER = "file-ext:*"; + private static final String CSV_FILE_EXT = "file-ext:csv"; + private static final String CSV_MIME_TYPE = "file:text/csv"; + public static final String FILE_EXTENSION_PREFIX = "file-ext:"; + public static final String ANY_TEXT_MIME_TYPE = "file:text/"; + private Data[] data; + private CIShellContext context; + private DataConversionService conversionManager; + private LogService logger; + private Program program; + private File tempFile; + - //show the contents of a file to the user - public Data[] execute() throws AlgorithmExecutionException { - try { - boolean lastSaveSuccessful = false; - boolean isCSVFile = false; - String format; - - //tempFile = getTempFile(); TC181 - - - //for each data item we want to view... - for (int i = 0; i < data.length; i++){ - Object theData = data[i].getData(); - format = data[i].getFormat(); - String label = (String) data[i].getMetadata().get(DataProperty.LABEL); - - //if it is a text file... - if (theData instanceof File || - format.startsWith("file:text/") || - format.startsWith("file-ext:")){ - - //if it is a csv text file... - if (format.startsWith("file:text/csv") || format.startsWith("file-ext:csv")) - { - //prepare to open it like a csv file - tempFile = getTempFileCSV(); - isCSVFile = true; - - } - else //it is just a regular text file - { - //prepare to open it like a normal text file - String fileName = FileUtil.extractFileName(label); - String extension = FileUtil.extractExtension(format); - tempFile = FileUtil.getTempFile(fileName, extension, logger); - } - - //copy out data into the temp file we just created. - copy((File)data[i].getData(), tempFile); - lastSaveSuccessful = true; - - - - }else {//the data item is in an in-memory format, and must be converted to a file format before the user can see it - - final Converter[] convertersCSV = conversionManager.findConverters(data[i], "file-ext:csv"); - - //if the data item can be converted to a csv file ... do it. - if (convertersCSV.length == 1) - { - Data newDataCSV = convertersCSV[0].convert(data[i]); - tempFile = getTempFileCSV(); - isCSVFile = true; - copy((File)newDataCSV.getData(), tempFile); - lastSaveSuccessful = true; - - } - else if (convertersCSV.length > 1) - { - Data newDataCSV = convertersCSV[0].convert(data[i]); - for (int j = 1; j < convertersCSV.length; j++ ) - { - newDataCSV = convertersCSV[j].convert(newDataCSV); - } - tempFile = getTempFileCSV(); - isCSVFile = true; - copy((File)newDataCSV.getData(), tempFile); - lastSaveSuccessful = true; - } else { //it cannot be converted to a .csv - - //try to convert it to any other file format - - final Converter[] converters = conversionManager.findConverters(data[i], "file-ext:*"); - - //if it can't be converted to any file format... - if (converters.length < 1) { - //throw an error - 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 there is only file format it can be converted to - //go ahead and convert the data item to that format - Data newData = converters[0].convert(data[i]); - - String fileName = FileUtil.extractFileName(label); - String extension = FileUtil.extractExtension(newData.getFormat()); - tempFile = FileUtil.getTempFile(fileName, extension, logger); - copy((File)newData.getData(), tempFile); - lastSaveSuccessful = true; - } - else { //there is more than one format that the data item could be converted to - - //let the user choose - - //(get some eclipse UI stuff that we need to open the data viewer) - - Display display; - IWorkbenchWindow[] windows; - final Shell parentShell; - - windows = PlatformUI.getWorkbench().getWorkbenchWindows(); - if (windows.length == 0){ - throw new AlgorithmExecutionException("Cannot get workbench window."); - } - parentShell = windows[0].getShell(); - display = PlatformUI.getWorkbench().getDisplay(); - - //(open the data viewer, which lets the user choose which format they want to see the data item in.) - - if (!parentShell.isDisposed()) { - DataViewer dataViewer = new DataViewer(parentShell, data[i], converters); - display.syncExec(dataViewer); - lastSaveSuccessful = dataViewer.isSaved; - tempFile = dataViewer.outputFile; - } - } - } - } - - //if it's a CSV file - if (isCSVFile){//TC181 - //prepare to open the file with the default csv program - Display.getDefault().syncExec(new Runnable() { - public void run() { - program = Program.findProgram("csv"); - }}); - - }else - {//it's any other file - //prepare to open it with the standard text editor. - Display.getDefault().syncExec(new Runnable() { - public void run() { - program = Program.findProgram("txt"); - }}); - - } - - /* - Display.getDefault().syncExec(new Runnable() { - public void run() { - programTwo = Program.findProgram("doc"); - }}); - - if (programTwo == null) { - System.out.println("***\nYO!\nNo doc viewer\n"); - } else { - System.out.println("!!!\nHEY!\nDoc viewer found\n"); - - } - */ - - //if we can't find any program to open the file... - if (program == null) { - //throw an error - 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: "+ - tempFile.getAbsolutePath()); - } - else {//we found a program to open the file - //open it, for real. - if (lastSaveSuccessful == true) { - Display.getDefault().syncExec(new Runnable() { - public void run() { - program.execute(tempFile.getAbsolutePath()); - }}); - } - } - } - return null; - } catch (ConversionException e1) { - throw new AlgorithmExecutionException("Error converting data to target view format.", e1); - } catch (Throwable e2){ - throw new AlgorithmExecutionException(e2); - } - } - - public File getTempFileCSV(){ //TC181 - File tempFile; - - String tempPath = System.getProperty("java.io.tmpdir"); - File tempDir = new File(tempPath+File.separator+"temp"); - if(!tempDir.exists()) - tempDir.mkdir(); - try{ - tempFile = File.createTempFile("xxx-Session-", ".csv", tempDir); - - }catch (IOException e){ - logger.log(LogService.LOG_ERROR, e.toString(), e); - tempFile = new File (tempPath+File.separator+"temp"+File.separator+"temp.csv"); + public FileView(Data[] data, Dictionary parameters, CIShellContext context) { + this.data = data; + this.context = context; - } - return tempFile; - } - - public static boolean copy(File in, File out) throws AlgorithmExecutionException{ - try { - FileInputStream fis = new FileInputStream(in); - FileOutputStream fos = new FileOutputStream(out); - - FileChannel readableChannel = fis.getChannel(); - FileChannel writableChannel = fos.getChannel(); - - writableChannel.truncate(0); - writableChannel.transferFrom(readableChannel, 0, readableChannel.size()); - fis.close(); - fos.close(); - return true; - } - catch (IOException ioe) { - throw new AlgorithmExecutionException("IOException during copy", ioe); - } - } - - final class DataViewer implements Runnable { - Shell shell; - boolean isSaved; - File outputFile; - Data theData; - Converter[] theConverters; + this.conversionManager = (DataConversionService) context + .getService(DataConversionService.class.getName()); + + this.logger = (LogService) context.getService(LogService.class.getName()); + } + + + // Show the contents of a file to the user + public Data[] execute() throws AlgorithmExecutionException { + try { + boolean lastSaveSuccessful = false; + boolean isCSVFile = false; + String format; + + // For each data item we want to view... + for (int i = 0; i < data.length; i++) { + Object theData = data[i].getData(); + format = data[i].getFormat(); + String label = (String) data[i].getMetadata().get( + DataProperty.LABEL); + + // If it is a text file... + if (theData instanceof File + || format.startsWith(ANY_TEXT_MIME_TYPE) + || format.startsWith(FILE_EXTENSION_PREFIX)) { + + // If it is a CSV text file... + if (format.startsWith(CSV_MIME_TYPE) + || format.startsWith(CSV_FILE_EXT)) { + // Prepare to open it like a CSV file + tempFile = getTempFileCSV(); + isCSVFile = true; + } else { + // Prepare to open it like a normal text file + String fileName = FileUtil.extractFileName(label); + String extension = FileUtil.extractExtension(format); + tempFile = FileUtil.getTempFile(fileName, extension, + logger); + } + + // Copy out data into the temp file we just created. + copy((File) data[i].getData(), tempFile); + lastSaveSuccessful = true; + + } else { + /* The data item is in an in-memory format, and must be + * converted to a file format before the user can see it. + */ + final Converter[] convertersCSV = + conversionManager.findConverters(data[i], CSV_FILE_EXT); + + // If the data item can be converted to a CSV file, do so. + if (convertersCSV.length == 1) { + Data newDataCSV = convertersCSV[0].convert(data[i]); + tempFile = getTempFileCSV(); + isCSVFile = true; + copy((File) newDataCSV.getData(), tempFile); + lastSaveSuccessful = true; + + } else if (convertersCSV.length > 1) { + Data newDataCSV = convertersCSV[0].convert(data[i]); + for (int j = 1; j < convertersCSV.length; j++) { + newDataCSV = convertersCSV[j].convert(newDataCSV); + } + tempFile = getTempFileCSV(); + isCSVFile = true; + copy((File) newDataCSV.getData(), tempFile); + lastSaveSuccessful = true; + } else { // it cannot be converted to a .csv + + // try to convert it to any other file format + + final Converter[] converters = + conversionManager.findConverters( + data[i], ANY_FILE_EXTENSION_FILTER); + + // if it can't be converted to any file format... + if (converters.length < 1) { + // throw an error + 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 there is only + // file format + // it can be + // converted to + // go ahead and convert the data item to that format + Data newData = converters[0].convert(data[i]); + + String fileName = FileUtil.extractFileName(label); + String extension = FileUtil + .extractExtension(newData.getFormat()); + tempFile = FileUtil.getTempFile(fileName, + extension, logger); + copy((File) newData.getData(), tempFile); + lastSaveSuccessful = true; + } else { + // there is more than one format that the data + // item could be converted to + // let the user choose + // (get some eclipse UI stuff that we need to open + // the data viewer) + + Display display; + IWorkbenchWindow[] windows; + final Shell parentShell; + + windows = PlatformUI.getWorkbench() + .getWorkbenchWindows(); + if (windows.length == 0) { + throw new AlgorithmExecutionException( + "Cannot get workbench window."); + } + parentShell = windows[0].getShell(); + display = PlatformUI.getWorkbench().getDisplay(); + + // (open the data viewer, which lets the user choose + // which format they want to see the data item in.) + + if (!parentShell.isDisposed()) { + DataViewer dataViewer = new DataViewer( + parentShell, data[i], converters); + display.syncExec(dataViewer); + lastSaveSuccessful = dataViewer.isSaved; + tempFile = dataViewer.outputFile; + } + } + } + } + + // If it's a CSV file + if (isCSVFile) {// TC181 + // prepare to open the file with the default csv program + Display.getDefault().syncExec(new Runnable() { + public void run() { + program = Program.findProgram("csv"); + } + }); + } else { + // Prepare to open it with the standard text editor. + Display.getDefault().syncExec( + new Runnable() { + public void run() { + program = Program.findProgram("txt"); + } + } + ); + } + + // If we can't find any program to open the file... + if (program == null) { + 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: " + + tempFile.getAbsolutePath()); + } else { + // We found a program to open the file. Open it. + if (lastSaveSuccessful == true) { + Display.getDefault().syncExec( + new Runnable() { + public void run() { + program.execute(tempFile.getAbsolutePath()); + } + } + ); + } + } + } - DataViewer (Shell parentShell, Data data, Converter[] converters){ + return null; + } catch (ConversionException e) { + throw new AlgorithmExecutionException( + "Error: Unable to view data:\n " + e.getMessage(), e); + } catch (Throwable e) { + throw new AlgorithmExecutionException(e); + } + } + + public File getTempFileCSV() { + File tempFile; + + String tempPath = System.getProperty("java.io.tmpdir"); + File tempDir = new File(tempPath + File.separator + "temp"); + if (!tempDir.exists()) + tempDir.mkdir(); + try { + tempFile = File.createTempFile("xxx-Session-", ".csv", tempDir); + + } catch (IOException e) { + logger.log(LogService.LOG_ERROR, e.toString(), e); + tempFile = new File(tempPath + File.separator + "temp" + + File.separator + "temp.csv"); + + } + return tempFile; + } + + public static boolean copy(File in, File out) + throws AlgorithmExecutionException { + try { + FileInputStream fis = new FileInputStream(in); + FileOutputStream fos = new FileOutputStream(out); + + FileChannel readableChannel = fis.getChannel(); + FileChannel writableChannel = fos.getChannel(); + + writableChannel.truncate(0); + writableChannel.transferFrom(readableChannel, 0, readableChannel + .size()); + fis.close(); + fos.close(); + return true; + } catch (IOException ioe) { + throw new AlgorithmExecutionException("IOException during copy", + ioe); + } + } + + final class DataViewer implements Runnable { + public static final String VIEW_DIALOG_TITLE = "View"; + private Shell shell; + private boolean isSaved; + private File outputFile; + private Data data; + private Converter[] converters; + + + DataViewer(Shell parentShell, Data data, Converter[] converters) { this.shell = parentShell; - this.theData = data; - this.theConverters = converters; + this.data = data; + this.converters = converters; } + public void run() { - // lots of persisters found, return the chooser - ViewDataChooser vdc = new ViewDataChooser("View", shell, - theData, theConverters, context, logger); + // Lots of persisters found, return the chooser + ViewDataChooser vdc = new ViewDataChooser( + VIEW_DIALOG_TITLE, shell, data, converters, context, logger); vdc.open(); isSaved = vdc.isSaved(); outputFile = vdc.outputFile; } } - - - - } \ 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 2009-07-31 20:40:05 UTC (rev 911) +++ trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/view/ViewDataChooser.java 2009-08-03 16:33:43 UTC (rev 912) @@ -3,10 +3,12 @@ import java.io.File; import org.cishell.framework.CIShellContext; +import org.cishell.framework.algorithm.AlgorithmExecutionException; import org.cishell.framework.data.Data; import org.cishell.framework.data.DataProperty; import org.cishell.reference.gui.persistence.FileUtil; 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; import org.osgi.service.log.LogService; @@ -29,20 +31,29 @@ this.logger = logger; } - protected void selectionMade(int selectedIndex){ - try { + protected void selectionMade(int selectedIndex) { getShell().setVisible(false); final Converter converter = converterArray[selectedIndex]; - Data newData = converter.convert(theData); - String label = (String) newData.getMetadata().get(DataProperty.LABEL); - String fileName = FileUtil.extractFileName(label); - String extension = FileUtil.extractExtension(newData.getFormat()); - File tempFile = FileUtil.getTempFile(fileName, extension, logger); - isSaved = FileView.copy((File)newData.getData(), tempFile); - outputFile = tempFile; - close(true); - } catch (Exception e) { - throw new RuntimeException(e); + + try { + Data newData = converter.convert(theData); + String label = (String) newData.getMetadata().get(DataProperty.LABEL); + String fileName = FileUtil.extractFileName(label); + String extension = FileUtil.extractExtension(newData.getFormat()); + File tempFile = FileUtil.getTempFile(fileName, extension, logger); + + try { + isSaved = FileView.copy((File)newData.getData(), tempFile); + } catch (AlgorithmExecutionException e) { + logger.log(LogService.LOG_ERROR, "Error copying view for view:\n " + e.getMessage(), e); + return; + } + + outputFile = tempFile; + close(true); + } catch (ConversionException e) { + logger.log(LogService.LOG_ERROR, "Error: Unable to view data:\n " + e.getMessage(), e); + return; } } 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 2009-07-31 20:40:05 UTC (rev 911) +++ trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/viewwith/FileViewWith.java 2009-08-03 16:33:43 UTC (rev 912) @@ -107,11 +107,11 @@ //If length=1, use the unique path to save it directly //and bring the text editor. try { - Data newData = converters[0].convert(data[i]); - copy((File)newData.getData(), tempFile); - lastSaveSuccessful = true; + 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.", e); + this.logger.log(LogService.LOG_WARNING, "Warning: Unable to convert to target save format (" + e.getMessage() + "). Will attempt to use other available converters.", e); } } else { 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 2009-07-31 20:40:05 UTC (rev 911) +++ trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/viewwith/ViewWithDataChooser.java 2009-08-03 16:33:43 UTC (rev 912) @@ -28,11 +28,13 @@ 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); + getShell().setVisible(false); + final Converter converter = converterArray[selectedIndex]; + Data newData = converter.convert(theData); + isSaved = FileViewWith.copy((File)newData.getData(), tempFile); + close(true); + } catch (ConversionException e) { + throw new RuntimeException("Error: Unable to view data:\n " + e.getMessage(), e); } catch (Exception e) { throw new RuntimeException(e); } Modified: trunk/core/org.cishell.reference/.classpath =================================================================== --- trunk/core/org.cishell.reference/.classpath 2009-07-31 20:40:05 UTC (rev 911) +++ trunk/core/org.cishell.reference/.classpath 2009-08-03 16:33:43 UTC (rev 912) @@ -1,7 +1,7 @@ -<?xml version="1.0" encoding="UTF-8"?> -<classpath> - <classpathentry kind="src" path="src"/> - <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> - <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> - <classpathentry kind="output" path="bin"/> -</classpath> +<?xml version="1.0" encoding="UTF-8"?> +<classpath> + <classpathentry kind="src" path="src"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/j2sdk1.4.2_19"/> + <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> + <classpathentry kind="output" path="bin"/> +</classpath> Added: trunk/core/org.cishell.reference/.settings/org.eclipse.jdt.core.prefs =================================================================== --- trunk/core/org.cishell.reference/.settings/org.eclipse.jdt.core.prefs (rev 0) +++ trunk/core/org.cishell.reference/.settings/org.eclipse.jdt.core.prefs 2009-08-03 16:33:43 UTC (rev 912) @@ -0,0 +1,12 @@ +#Mon Jul 27 15:45:33 EDT 2009 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.4 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=warning +org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning +org.eclipse.jdt.core.compiler.source=1.3 Modified: trunk/core/org.cishell.reference/src/org/cishell/reference/service/conversion/ConverterImpl.java =================================================================== --- trunk/core/org.cishell.reference/src/org/cishell/reference/service/conversion/ConverterImpl.java 2009-07-31 20:40:05 UTC (rev 911) +++ trunk/core/org.cishell.reference/src/org/cishell/reference/service/conversion/ConverterImpl.java 2009-08-03 16:33:43 UTC (rev 912) @@ -29,73 +29,69 @@ import org.osgi.framework.BundleContext; import org.osgi.framework.Constants; import org.osgi.framework.ServiceReference; +import org.osgi.service.log.LogService; import org.osgi.service.metatype.MetaTypeProvider; -/** - * - * @author Bruce Herr (bh...@bh...) - */ public class ConverterImpl implements Converter, AlgorithmFactory, AlgorithmProperty { private ServiceReference[] refs; private BundleContext bContext; - private Dictionary props; + private Dictionary properties; private CIShellContext ciContext; + public ConverterImpl(BundleContext bContext, CIShellContext ciContext, ServiceReference[] refs) { this.bContext = bContext; this.ciContext = ciContext; this.refs = refs; - props = new Hashtable(); - props.put(IN_DATA, refs[0].getProperty(IN_DATA)); - props.put(OUT_DATA, refs[refs.length-1].getProperty(OUT_DATA)); - props.put(LABEL, props.get(IN_DATA) + " -> " + props.get(OUT_DATA)); + properties = new Hashtable(); + properties.put(IN_DATA, refs[0].getProperty(IN_DATA)); + properties.put(OUT_DATA, refs[refs.length-1].getProperty(OUT_DATA)); + properties.put(LABEL, properties.get(IN_DATA) + " -> " + properties.get(OUT_DATA)); + // TODO: Do the same thing for complexity String lossiness = calculateLossiness(refs); - props.put(CONVERSION, lossiness); + properties.put(CONVERSION, lossiness); } /** * @see org.cishell.service.conversion.Converter#convert(org.cishell.framework.data.Data) */ - public Data convert(Data inDM) throws ConversionException { - Data[] dm = new Data[]{inDM}; + public Data convert(Data inData) throws ConversionException { + Data[] data = new Data[]{inData}; AlgorithmFactory factory = getAlgorithmFactory(); - Algorithm alg = factory.createAlgorithm(dm, new Hashtable(), ciContext); + Algorithm algorithm = factory.createAlgorithm(data, new Hashtable(), ciContext); try { - dm = alg.execute(); - } catch (AlgorithmExecutionException aee) { - throw new ConversionException( - "Problem converting data: " + aee.getMessage(), - aee); + data = algorithm.execute(); + } catch (AlgorithmExecutionException e) { + throw new ConversionException(e.getMessage(), e); } catch (Exception e) { throw new ConversionException( - "Problem converting data: " + e.getMessage(), - e); + "Unexpected error: " + e.getMessage(), e); } Object outData = null; - if (dm != null && dm.length > 0) { - outData = dm[0].getData(); + if (data != null && data.length > 0) { + outData = data[0].getData(); } if (outData != null) { - Dictionary props = inDM.getMetadata(); - Dictionary newProps = new Hashtable(); + Dictionary properties = inData.getMetadata(); + Dictionary newProperties = new Hashtable(); - for (Enumeration e = props.keys(); e.hasMoreElements();) { - Object key = e.nextElement(); - newProps.put(key, props.get(key)); + for (Enumeration propertyKeys = properties.keys(); propertyKeys.hasMoreElements();) { + Object key = propertyKeys.nextElement(); + newProperties.put(key, properties.get(key)); } String outFormat = (String) getProperties().get(AlgorithmProperty.OUT_DATA); - return new BasicData(newProps, outData, outFormat); + return new BasicData(newProperties, outData, outFormat); } else { return null; } @@ -120,7 +116,7 @@ * @see org.cishell.service.conversion.Converter#getProperties() */ public Dictionary getProperties() { - return props; + return properties; } public Algorithm createAlgorithm(Data[] dm, @@ -186,37 +182,141 @@ } private class ConverterAlgorithm implements Algorithm { - Data[] inDM; - CIShellContext context; - Dictionary parameters; + public static final String FILE_EXTENSION_PREFIX = "file-ext:"; + public static final String MIME_TYPE_PREFIX = "file:"; + + private Data[] inData; + private Dictionary parameters; + private CIShellContext context; + private LogService log; - public ConverterAlgorithm(Data[] dm, + + public ConverterAlgorithm(Data[] inData, Dictionary parameters, CIShellContext context) { - this.inDM = dm; + this.inData = inData; this.parameters = parameters; this.context = context; + this.log = + (LogService) context.getService(LogService.class.getName()); } + public Data[] execute() throws AlgorithmExecutionException { - Data[] dm = inDM; - for (int i = 0; i < refs.length; i++) { + Data[] convertedData = inData; + + // For each converter in the converter chain (refs) + for (int ii = 0; ii < refs.length; ii++) { AlgorithmFactory factory = - (AlgorithmFactory) bContext.getService(refs[i]); + (AlgorithmFactory) bContext.getService(refs[ii]); if (factory != null) { Algorithm alg = - factory.createAlgorithm(dm, parameters, context); + factory.createAlgorithm(convertedData, parameters, context); - dm = alg.execute(); + try { + convertedData = alg.execute(); + } catch(AlgorithmExecutionException e) { + boolean isLastStep = (ii == refs.length - 1); + if (isLastStep && isHandler(refs[ii])) { + /* If the last step of the converter chain is a + * handler and it is the first (and so only) step + * to fail, just log a warning and return the + * un-handled data. + */ + String warningMessage = + "Warning: Attempting to convert data without " + + "validating the output since the validator failed " + + "with this problem:\n " + + createErrorMessage(refs[ii], e); + + log.log(LogService.LOG_WARNING, warningMessage, e); + + return convertedData; + } else { + throw new AlgorithmExecutionException( + createErrorMessage(refs[ii], e), e); + } + } } else { throw new AlgorithmExecutionException( - "Missing subconverter: " - + refs[i].getProperty(Constants.SERVICE_PID)); + "Missing subconverter: " + + refs[ii].getProperty(Constants.SERVICE_PID)); } } - return dm; + return convertedData; } + + private boolean isHandler(ServiceReference ref) { + /* For some reason, handlers are often referred to as validators, + * though strictly speaking, validators are for reading in data and + * handlers are for writing out data. + */ + String algorithmType = + (String) ref.getProperty(AlgorithmProperty.ALGORITHM_TYPE); + boolean algorithmTypeIsValidator = + AlgorithmProperty.TYPE_VALIDATOR.equals(algorithmType); + + String inDataType = + (String) ref.getProperty(AlgorithmProperty.IN_DATA); + boolean inDataTypeIsFile = inDataType.startsWith(MIME_TYPE_PREFIX); + + String outDataType = + (String) ref.getProperty(AlgorithmProperty.OUT_DATA); + boolean outDataTypeIsFileExt = + outDataType.startsWith(FILE_EXTENSION_PREFIX); + + return (algorithmTypeIsValidator + && inDataTypeIsFile + && outDataTypeIsFileExt); + } + + private String createErrorMessage(ServiceReference ref, Throwable e) { + String inType = (String) properties.get(IN_DATA); + String preProblemType = (String) ref.getProperty(IN_DATA); + String postProblemType = (String) ref.getProperty(OUT_DATA); + String outType = (String) properties.get(OUT_DATA); + + /* Only report the intermediate conversion if it is different + * from the overall conversion. + */ + if (inType.equals(preProblemType) + && outType.equals(postProblemType)) { + return "Problem converting data from " + + prettifyDataType(inType) + + " to " + prettifyDataType(outType) + + " (See the log file for more details).:\n ... [truncated message content] |
From: <mwl...@us...> - 2009-11-30 19:31:04
|
Revision: 985 http://cishell.svn.sourceforge.net/cishell/?rev=985&view=rev Author: mwlinnem Date: 2009-11-30 19:30:56 +0000 (Mon, 30 Nov 2009) Log Message: ----------- Added 'model' data type to CIShell (for EpiC). These should probably belong to their specific projects (in this case EpiC), but oh well (it's not as if networks are specifically part of CIShell either really). Modified Paths: -------------- trunk/clients/gui/org.cishell.reference.gui.datamanager/src/org/cishell/reference/gui/datamanager/DataGUIItem.java trunk/core/org.cishell.framework/src/org/cishell/framework/data/DataProperty.java Modified: trunk/clients/gui/org.cishell.reference.gui.datamanager/src/org/cishell/reference/gui/datamanager/DataGUIItem.java =================================================================== --- trunk/clients/gui/org.cishell.reference.gui.datamanager/src/org/cishell/reference/gui/datamanager/DataGUIItem.java 2009-11-24 20:05:47 UTC (rev 984) +++ trunk/clients/gui/org.cishell.reference.gui.datamanager/src/org/cishell/reference/gui/datamanager/DataGUIItem.java 2009-11-30 19:30:56 UTC (rev 985) @@ -43,6 +43,7 @@ private Image databaseIcon; private Image rasterImageIcon; private Image vectorImageIcon; + private Image modelIcon; private Map typeToImageMapping; @@ -73,6 +74,7 @@ databaseIcon = getImage("database.jpg", this.brandPluginID); rasterImageIcon = getImage("raster_image.jpg", this.brandPluginID); vectorImageIcon = getImage("vector_image.jpg", this.brandPluginID); + modelIcon = getImage("model.jpg", this.brandPluginID); typeToImageMapping = new HashMap(); registerImage(DataProperty.OTHER_TYPE, unknownIcon); @@ -93,6 +95,7 @@ registerImage(DataProperty.DATABASE_TYPE, databaseIcon); registerImage(DataProperty.RASTER_IMAGE_TYPE, rasterImageIcon); registerImage(DataProperty.VECTOR_IMAGE_TYPE, vectorImageIcon); + registerImage(DataProperty.MODEL_TYPE, modelIcon); } /** Modified: trunk/core/org.cishell.framework/src/org/cishell/framework/data/DataProperty.java =================================================================== --- trunk/core/org.cishell.framework/src/org/cishell/framework/data/DataProperty.java 2009-11-24 20:05:47 UTC (rev 984) +++ trunk/core/org.cishell.framework/src/org/cishell/framework/data/DataProperty.java 2009-11-30 19:30:56 UTC (rev 985) @@ -90,4 +90,7 @@ /** Says this data model is a JPEG object */ public static String RASTER_IMAGE_TYPE = "Raster Image"; + + /** Says this data model is a 'model' object */ + public static String MODEL_TYPE = "Model"; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pat...@us...> - 2009-12-04 23:14:10
|
Revision: 989 http://cishell.svn.sourceforge.net/cishell/?rev=989&view=rev Author: pataphil Date: 2009-12-04 23:14:01 +0000 (Fri, 04 Dec 2009) Log Message: ----------- * Did a fair amount of code cleanup. * Algorithms can now assign keyboard shortcuts to their corresponding menu entries via the "shortcut" property (in their properties files). * Reviewed by Micah. Modified Paths: -------------- trunk/clients/gui/org.cishell.reference.gui.datamanager/src/org/cishell/reference/gui/datamanager/AbstractDataManagerView.java trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/menu/AlgorithmAction.java trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/menu/MenuAdapter.java trunk/clients/gui/org.cishell.reference.gui.workspace/src/org/cishell/reference/gui/workspace/ApplicationActionBarAdvisor.java trunk/core/org.cishell.framework/src/org/cishell/framework/algorithm/AlgorithmProperty.java Modified: trunk/clients/gui/org.cishell.reference.gui.datamanager/src/org/cishell/reference/gui/datamanager/AbstractDataManagerView.java =================================================================== --- trunk/clients/gui/org.cishell.reference.gui.datamanager/src/org/cishell/reference/gui/datamanager/AbstractDataManagerView.java 2009-12-04 23:11:02 UTC (rev 988) +++ trunk/clients/gui/org.cishell.reference.gui.datamanager/src/org/cishell/reference/gui/datamanager/AbstractDataManagerView.java 2009-12-04 23:14:01 UTC (rev 989) @@ -68,49 +68,34 @@ import org.osgi.framework.ServiceReference; import org.osgi.service.log.LogService; -/** - * - * @author Bruce Herr (bh...@bh...) - */ -public abstract class AbstractDataManagerView extends ViewPart implements - DataManagerListener, BundleListener { +public abstract class AbstractDataManagerView + extends ViewPart + implements DataManagerListener, BundleListener { private String brandPluginID; - private DataManagerService manager; - private TreeViewer viewer; - private TreeEditor editor; - + // TODO: Finish cleaning this file up. private Text newEditor; - private DataGUIItem rootItem; - - // flag to notify if a tree item is currently being updated so there - // isnt a conflict among various listeners + /* + * Flag to notify if a tree item is currently being updated so there isnt a conflict among + * various listeners. + */ private boolean updatingTreeItem; - private Tree tree; - private Menu menu; - private Map dataToDataGUIItemMap; - private AlgorithmFactory saveFactory; private AlgorithmFactory viewFactory; private AlgorithmFactory viewWithFactory; - - private DiscardListener discardListener; - private SaveListener saveListener; private ViewListener viewListener; private ViewWithListener viewWithListener; private LogService log; public AbstractDataManagerView(String brandPluginID) { - - this.brandPluginID = brandPluginID; dataToDataGUIItemMap = new HashMap(); @@ -124,9 +109,12 @@ } } - private String getItemID(ServiceReference ref) { - return ref.getProperty("PID:" + Constants.SERVICE_PID) + "-SID:" + - ref.getProperty(Constants.SERVICE_ID); + private String getItemID(ServiceReference serviceReference) { + return serviceReference.getProperty( + "PID:" + + Constants.SERVICE_PID) + + "-SID:" + + serviceReference.getProperty(Constants.SERVICE_ID); } @@ -134,19 +122,18 @@ * @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite) */ public void createPartControl(Composite parent) { - // Label label = new Label(parent, SWT.NONE); // label.setText("Data Manager"); - viewer = new TreeViewer(parent); - viewer.setContentProvider(new DataTreeContentProvider()); - viewer.setLabelProvider(new DataTreeLabelProvider()); + this.viewer = new TreeViewer(parent); + this.viewer.setContentProvider(new DataTreeContentProvider()); + this.viewer.setLabelProvider(new DataTreeLabelProvider()); rootItem = new DataGUIItem(null, null, this.brandPluginID); - viewer.setInput(rootItem); - viewer.expandAll(); + this.viewer.setInput(rootItem); + this.viewer.expandAll(); // grab the tree and add the appropriate listeners - tree = viewer.getTree(); + tree = this.viewer.getTree(); tree.addSelectionListener(new DatamodelSelectionListener()); tree.addMouseListener(new ContextMenuListener()); @@ -183,22 +170,21 @@ discardItem.addListener(SWT.Selection, discardListener); tree.setMenu(menu); - // allow cells to be edited on double click or when pressing enter on - // them - editor = new TreeEditor(tree); - editor.horizontalAlignment = SWT.LEFT; - editor.grabHorizontal = true; - editor.minimumWidth = 50; + // Allow cells to be edited on double click or when pressing enter on them. + this.editor = new TreeEditor(tree); + this.editor.horizontalAlignment = SWT.LEFT; + this.editor.grabHorizontal = true; + this.editor.minimumWidth = 50; // listen to OSGi for models being added by plugins - if (manager != null) { - manager.addDataManagerListener(this); - } - else { + if (this.manager != null) { + this.manager.addDataManagerListener(this); + } else { Activator.getBundleContext().addBundleListener(this); - manager = Activator.getDataManagerService(); - if (manager != null) { - manager.addDataManagerListener(this); + this.manager = Activator.getDataManagerService(); + + if (this.manager != null) { + this.manager.addDataManagerListener(this); } } @@ -207,9 +193,10 @@ public void bundleChanged(BundleEvent event) { if (event.getType() == BundleEvent.STARTED) { - manager = Activator.getDataManagerService(); - if (manager != null) { - manager.addDataManagerListener(this); + this.manager = Activator.getDataManagerService(); + + if (this.manager != null) { + this.manager.addDataManagerListener(this); } } } @@ -218,7 +205,7 @@ * @see org.eclipse.ui.part.WorkbenchPart#setFocus() */ public void setFocus() { - viewer.getControl().setFocus(); + this.viewer.getControl().setFocus(); } public void dataAdded(final Data newData, String label) { @@ -246,12 +233,12 @@ public void run() { if (!tree.isDisposed()) { // update the TreeView - viewer.refresh(); + AbstractDataManagerView.this.viewer.refresh(); // context menu may need to have options enabled/disabled // based on the new selection updateContextMenu(newData); // update the global selection - viewer.expandToLevel(newItem, 0); + AbstractDataManagerView.this.viewer.expandToLevel(newItem, 0); manager.setSelectedData((Data[]) selection.toArray(new Data[0])); } } @@ -390,7 +377,7 @@ modelArray[i] = model; } - manager.setSelectedData(modelArray); + AbstractDataManagerView.this.manager.setSelectedData(modelArray); } } @@ -401,7 +388,7 @@ */ private void handleInput() { // Clean up any previous editor control - Control oldEditor = editor.getEditor(); + Control oldEditor = this.editor.getEditor(); if (oldEditor != null) { oldEditor.dispose(); @@ -428,7 +415,8 @@ public void focusLost(FocusEvent e) { if (!updatingTreeItem) { //updateText(newEditor.getText(), item); - manager.setLabel(((DataGUIItem)item.getData()).getModel(), newEditor.getText()); + AbstractDataManagerView.this.manager.setLabel( + ((DataGUIItem)item.getData()).getModel(), newEditor.getText()); // FELIX. This is not > stupidness. } } @@ -446,7 +434,7 @@ }); newEditor.selectAll(); newEditor.setFocus(); - editor.setEditor(newEditor, item); + this.editor.setEditor(newEditor, item); } /* @@ -460,7 +448,7 @@ newLabel = newLabel.substring(1); - editor.getItem().setText(newLabel); + this.editor.getItem().setText(newLabel); DataGUIItem treeItem = (DataGUIItem) item.getData(); Data model = treeItem.getModel(); @@ -581,11 +569,11 @@ } dataToDataGUIItemMap.remove(item.getModel()); - manager.removeData(item.getModel()); + AbstractDataManagerView.this.manager.removeData(item.getModel()); } - manager.setSelectedData(new Data[0]); - viewer.refresh(); + AbstractDataManagerView.this.manager.setSelectedData(new Data[0]); + AbstractDataManagerView.this.viewer.refresh(); } } @@ -638,7 +626,7 @@ public void setSelection(ISelection selection) { if (selection != this.selection) { this.selection = selection; - viewer.refresh(true); + AbstractDataManagerView.this.viewer.refresh(true); if (selection != null && selection instanceof IStructuredSelection) { @@ -652,7 +640,7 @@ TreeItem result = getTreeItem((Data) next, tree .getItems()); newTreeSelection[i] = result; - viewer.expandToLevel( + AbstractDataManagerView.this.viewer.expandToLevel( dataToDataGUIItemMap.get(next), 0); } i++; Modified: trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/menu/AlgorithmAction.java =================================================================== --- trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/menu/AlgorithmAction.java 2009-12-04 23:11:02 UTC (rev 988) +++ trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/menu/AlgorithmAction.java 2009-12-04 23:14:01 UTC (rev 989) @@ -40,23 +40,13 @@ protected Data[] originalData; protected Converter[][] converters; - public AlgorithmAction(ServiceReference ref, BundleContext bContext, CIShellContext ciContext) { - this.ref = ref; - this.ciContext = ciContext; - this.bContext = bContext; - - setText((String)ref.getProperty(LABEL)); - setToolTipText((String)ref.getProperty(AlgorithmProperty.DESCRIPTION)); - - DataManagerService dataManager = (DataManagerService) - bContext.getService(bContext.getServiceReference( - DataManagerService.class.getName())); - - dataManager.addDataManagerListener(this); - dataSelected(dataManager.getSelectedData()); + public AlgorithmAction( + ServiceReference ref, BundleContext bContext, CIShellContext ciContext) { + this((String)ref.getProperty(LABEL), ref, bContext, ciContext); } - public AlgorithmAction(String label, ServiceReference ref, BundleContext bContext, CIShellContext ciContext) { + public AlgorithmAction( + String label, ServiceReference ref, BundleContext bContext, CIShellContext ciContext) { this.ref = ref; this.ciContext = ciContext; this.bContext = bContext; @@ -80,48 +70,68 @@ SchedulerService scheduler = (SchedulerService) getService(SchedulerService.class); scheduler.schedule(algorithm, ref); - } catch (Throwable e) { - //Just in case an uncaught exception occurs. Eclipse will swallow errors thrown here... - e.printStackTrace(); + } catch (Throwable exception) { + // Just in case an uncaught exception occurs. Eclipse will swallow errors thrown here. + exception.printStackTrace(); } } private void printAlgorithmInformation(ServiceReference ref, CIShellContext ciContext) { - //adjust to log the whole acknowledgement in one block + // Adjust to log the whole acknowledgement in one block. LogService logger = (LogService) ciContext.getService(LogService.class.getName()); StringBuffer acknowledgement = new StringBuffer(); String label = (String)ref.getProperty(LABEL); - if (label != null){ - acknowledgement.append("..........\n"+label+" was selected.\n"); + + if (label != null) { + acknowledgement.append("..........\n" + label + " was selected.\n"); } + String authors = (String)ref.getProperty(AUTHORS); - if (authors != null) - acknowledgement.append("Author(s): "+authors+"\n"); + + if (authors != null) { + acknowledgement.append("Author(s): " + authors + "\n"); + } + String implementers = (String)ref.getProperty(IMPLEMENTERS); - if (implementers != null) - acknowledgement.append("Implementer(s): "+implementers+"\n"); + + if (implementers != null) { + acknowledgement.append("Implementer(s): " + implementers + "\n"); + } + String integrators = (String)ref.getProperty(INTEGRATORS); - if (integrators != null) - acknowledgement.append("Integrator(s): "+integrators+"\n"); + + if (integrators != null) { + acknowledgement.append("Integrator(s): " + integrators + "\n"); + } + String reference = (String)ref.getProperty(REFERENCE); String reference_url = (String)ref.getProperty(REFERENCE_URL); - if (reference != null && reference_url != null ) - acknowledgement.append("Reference: "+reference+ - " ("+reference_url+")\n"); - else if (reference != null && reference_url == null ) - acknowledgement.append("Reference: "+reference+"\n"); + + if ((reference != null) && (reference_url != null)) { + acknowledgement.append( + "Reference: " + reference + " (" + reference_url + ")\n"); + } else if ((reference != null) && (reference_url == null)) { + acknowledgement.append("Reference: " + reference + "\n"); + } + String docu = (String)ref.getProperty(DOCUMENTATION_URL); - if (docu != null) - acknowledgement.append("Documentation: "+docu+"\n"); - if(acknowledgement.length()>1) + + if (docu != null) { + acknowledgement.append("Documentation: " + docu + "\n"); + } + + if (acknowledgement.length() > 1) { logger.log(LogService.LOG_INFO, acknowledgement.toString()); + } } private String[] separateInData(String inDataString) { String[] inData = ("" + inDataString).split(","); - for(int ii = 0; ii < inData.length; ii++) { + + for (int ii = 0; ii < inData.length; ii++) { inData[ii] = inData[ii].trim(); } + return inData; } 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 2009-12-04 23:11:02 UTC (rev 988) +++ trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/menu/MenuAdapter.java 2009-12-04 23:14:01 UTC (rev 989) @@ -13,9 +13,7 @@ * ***************************************************************************/ package org.cishell.reference.gui.menumanager.menu; -import java.io.File; import java.io.IOException; -import java.net.URISyntaxException; import java.net.URL; import java.util.HashMap; import java.util.Map; @@ -55,243 +53,297 @@ public class MenuAdapter implements AlgorithmProperty { - private IMenuManager menuBar; + public static final String DEFAULT_MENU_FILE_NAME = "default_menu.xml"; + + // Tags in DEFAULT_MENU_FILE_NAME. + public static final String TAG_TOP_MENU = "top_menu"; + public static final String TAG_MENU = "menu"; + public static final String TYPE_ATTRIBUTE = "type"; + public static final String NAME_ATTRIBUTE = "name"; + public static final String PID_ATTRIBUTE = "pid"; + public static final String PRESERVED_GROUP = "group"; + public static final String PRESERVED_BREAK = "break"; + public static final String PRESERVED_EXIT = "Exit"; + public static final String PRESERVED_SERVICE_PID = "service.pid"; + public static final String PRESERVED = "preserved"; + + private IMenuManager menuManager; private Shell shell; - private BundleContext bContext; - private CIShellContext ciContext; - private Map algorithmToItemMap; - private Map itemToParentMap; - private ContextListener listener; - private IWorkbenchWindow window; - + private BundleContext bundleContext; + private CIShellContext ciShellContext; + private Map algorithmsToItems; + private Map itemsToParents; + private ContextListener contextListener; + private IWorkbenchWindow workbenchWindow; + private LogService logger; /* - * This map holds a pid as a key and the corresponding - * 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. + * This map holds a pid as a key and the corresponding ServiceReference as a value. + * It is built when preprocessServiceBundles() is invoked. + * Then the entries are gradually removed when the pids are specified in + * DEFAULT_MENU_FILE_NAME. + * 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_FILE_NAME will be added on to + * the menu. */ - private Map pidToServiceReferenceMap; + private Map pidsToServiceReferences; /* - * 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. + * This is the exactly same copy of pidsToServiceReferences. + * Since some plug-ins could display on menu more than once, it provides a map between a pid + * and a ref while in pidsToServiceReferences that pid has been removed. */ - private Map pidToServiceReferenceMapCopy; - private Document dom; - private static String DEFAULT_MENU_FILE_NAME = "default_menu.xml"; - - /* - * The following section specify the tags in the default_menu.xml - */ - private static String TAG_TOP_MENU = "top_menu"; - private static String TAG_MENU = "menu"; - private static String ATTR_TYPE = "type"; - private static String ATTR_NAME = "name"; - private static String ATTR_PID = "pid"; - private static String PRESERVED_GROUP = "group"; - private static String PRESERVED_BREAK = "break"; - private static String PRESERVED_EXIT = "Exit"; - private static String PRESERVED_SERVICE_PID="service.pid"; - private static String PRESERVED = "preserved"; - + private Map pidsToServiceReferencesCopy; + private Document documentObjectModel; + private Runnable updateAction = new Runnable() { + public void run() { + MenuAdapter.this.menuManager.updateAll(true); + } + }; - - public MenuAdapter(IMenuManager menu, Shell shell, - BundleContext bContext,CIShellContext ciContext, - IWorkbenchWindow window) { - //basic initialization - this.menuBar = menu; + private Runnable stopAction = new Runnable() { + public void run() { + String[] algorithmKeys = + (String[])MenuAdapter.this.algorithmsToItems.keySet().toArray(new String[]{}); + + for (int ii = 0; ii < algorithmKeys.length; ii++) { + Action item = (Action)algorithmsToItems.get(algorithmKeys[ii]); + IMenuManager targetMenu = (IMenuManager)MenuAdapter.this.itemsToParents.get(item); + + targetMenu.remove(item.getId()); + MenuAdapter.this.algorithmsToItems.remove(algorithmKeys[ii]); + MenuAdapter.this.itemsToParents.remove(item); + } + } + }; + + public MenuAdapter( + IMenuManager menuManager, + Shell shell, + BundleContext bundleContext, + CIShellContext ciShellContext, + IWorkbenchWindow workbenchWindow) { + this.menuManager = menuManager; 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(); - - + this.bundleContext = bundleContext; + this.ciShellContext = ciShellContext; + this.workbenchWindow = workbenchWindow; + this.algorithmsToItems = new HashMap(); + this.itemsToParents = new HashMap(); + this.pidsToServiceReferences = new HashMap(); + this.pidsToServiceReferencesCopy = new HashMap(); + this.logger = (LogService)this.ciShellContext.getService(LogService.class.getName()); + + /* + * The intention of this clearShortcuts was to programmatically clear all of the + * bound shortcuts, so any found in our own plugins wouldn't have conflicts. + * Doing this doesn't immediately seem very possible, though there may be some promise in + * "redirecting" the actions taken by the shortcuts. + * (See: http://dev.eclipse.org/newslists/news.eclipse.platform/msg79882.html ) + * As a note, the keyboard shortcuts are actually called accelerator key codes, and the + * machinery that makes them work is very deeply ingrained in Eclipse. + * The difficulties I faced with trying to clear already-bound shortcuts has led me to + * suspect three possible things: + * We may be "abusing" Eclipse by using it as the foundation for our own applications. + * There may be a way to customize/configure (or interface with) the culprit plugin + * that's binding the shortcuts before us (org.eclipse.ui.workbench). This seems to be + * highly-likely, and more research on the matter can probably be justified at + * some point. + * The intended way TO work around the shortcuts already being bound is to redirect the + * actions taken by them, as mentioned above. + * Either way, to get these shortcuts working, I'm just going to use non-standard key + * combinations. + */ + //clearShortcuts(); + + /* + * Appears to add a context listener which updates the menu item whenever a corresponding + * change occurs in the bundle (registers, unregisters, etc...). + */ + String filter = "(" + Constants.OBJECTCLASS + "=" + AlgorithmFactory.class.getName() + ")"; + this.contextListener = new ContextListener(); + try { - - bContext.addServiceListener(listener, filter); + bundleContext.addServiceListener(this.contextListener, filter); preprocessServiceBundles(); - String app_location = System.getProperty("osgi.configuration.area"); + String applicationLocation = 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. + /* + * 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 - * app_location = file:/C:/Documents and Settings/huangb/Desktop/ - * nwb-sept4/nwb/configuration/ + * 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. + * 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 trimmed 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!!! */ - //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.err.println(">>>fileFullPath = " + fileFullPath); + /* + * 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. + */ + String fileFullPath = applicationLocation + DEFAULT_MENU_FILE_NAME; URL configurationDirectoryURL = new URL(fileFullPath); - System.err.println(">>>URL = " + configurationDirectoryURL.toString()); + try { configurationDirectoryURL.getContent(); - System.out.println(">>>config.ini Exists!"); + //System.out.println(">>>config.ini Exists!"); createMenuFromXML(fileFullPath); processLeftServiceBundles(); - } catch (IOException e) { - e.printStackTrace(); - System.err.println("config.ini does not exist... Reverting to backup plan"); + } catch (IOException ioException) { + ioException.printStackTrace(); + //System.err.println("config.ini does not exist... Reverting to backup plan"); initializeMenu(); } - Display.getDefault().asyncExec(updateAction); - - } catch (InvalidSyntaxException 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(); + + Display.getDefault().asyncExec(this.updateAction); + } catch (InvalidSyntaxException invalidSyntaxException) { + // TODO: Improve this error message. "Invalid Syntax" is terrible! + this.logger.log(LogService.LOG_DEBUG, "Invalid Syntax", invalidSyntaxException); + } catch (Throwable exception) { + /* + * TODO: Improve this. + * 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. + */ + exception.printStackTrace(); } } /* - * This method scans all service bundles. If a bundle specifies - * 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. - * + * This method scans all service bundles. If a bundle specifies menu_path and label, + * get service.pid of this bundle (key), let the service reference as the value, and put + * key/value pair to pidsToServiceReferences for further processing. */ - private void preprocessServiceBundles() throws InvalidSyntaxException{ - ServiceReference[] refs = bContext.getAllServiceReferences( - AlgorithmFactory.class.getName(), null); - 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){ + private void preprocessServiceBundles() throws InvalidSyntaxException { + ServiceReference[] serviceReferences = + this.bundleContext.getAllServiceReferences(AlgorithmFactory.class.getName(), null); + + if (serviceReferences != null){ + for (int ii = 0; ii < serviceReferences.length; ii++) { + String path = (String)serviceReferences[ii].getProperty(MENU_PATH); + + if (path == null) { continue; + } else { + String pid = (String)serviceReferences[ii].getProperty(PRESERVED_SERVICE_PID); + pidsToServiceReferences.put(pid.toLowerCase().trim(), serviceReferences[ii]); + pidsToServiceReferencesCopy.put( + pid.toLowerCase().trim(), serviceReferences[ii]); } - else{ - String pid = (String)refs[i].getProperty(PRESERVED_SERVICE_PID); - pidToServiceReferenceMap.put(pid.toLowerCase().trim(), refs[i]); - pidToServiceReferenceMapCopy.put(pid.toLowerCase().trim(), refs[i]); - } } } } /* - * Parse default_menu.xml file. For each menu node, get the value of the attribut "pid" - * 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 + * Parse DEFAULT_MENU_FILE_NAME file. + * For each menu node, get the value of the attribute pid. + * Check if the pid exists in pidsToServiceReferences. + * 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 has been specified in the DEFAULT_MENU_FILE_NAME, always use that menu layout + * If a plug-in specified in the DEFAULT_MENU_FILE_NAME, 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(String menuFilePath) throws InvalidSyntaxException{ - parseXmlFile(menuFilePath); - //get the root elememt - Element docEle = dom.getDocumentElement(); + parseXMLFile(menuFilePath); + // Get the root elememt. + Element documentElement = this.documentObjectModel.getDocumentElement(); - //get a nodelist of the top menu elements - NodeList topMenuList = docEle.getElementsByTagName(TAG_TOP_MENU); - if(topMenuList != null && topMenuList.getLength() > 0) { - for(int i = 0 ; i < topMenuList.getLength();i++) { - Element el = (Element)topMenuList.item(i); - processTopMenu(el); + // Get a nodelist of the top menu elements. + NodeList topMenuList = documentElement.getElementsByTagName(TAG_TOP_MENU); + + if ((topMenuList != null) && (topMenuList.getLength() > 0)) { + for (int ii = 0; ii < topMenuList.getLength(); ii++) { + Element element = (Element)topMenuList.item(ii); + processTopMenu(element); } } } - private void processTopMenu (Element topMenuNode){ - MenuManager topMenuBar = null; - + private void processTopMenu(Element topMenuNode) { /* - * The File and Help menus are created in ApplicationActionBarAdvisor.java - * This function now parses the XML file and appends the new menus/menu items to the correct group - * We first check to see if the menu already exists in our MenuBar. If it does, we modify the already - * existing menu. If not, then we create a new Menu. + * The File and Help menus are created in ApplicationActionBarAdvisor.java. + * This function now parses the XML file and appends the new menus/menu items to the + * correct group. + * We first check to see if the menu already exists in our MenuBar. + * If it does, we modify the already existing menu. If not, then we create a new Menu. * - * Modified by: Tim Kelley - * Date: May 8-9, 2007 * Additional code at: org.cishell.reference.gui.workspace.ApplicationActionBarAdvisor.java */ - String topMenuName = topMenuNode.getAttribute(ATTR_NAME); - if((topMenuBar = (MenuManager)menuBar.findUsingPath(topMenuName)) == null){ //Check to see if menu exists - topMenuBar= new MenuManager(topMenuName, topMenuName.toLowerCase()); //Create a new menu if it doesn't - menuBar.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, topMenuBar); + String topMenuName = topMenuNode.getAttribute(NAME_ATTRIBUTE); + MenuManager topMenuBar = (MenuManager)this.menuManager.findUsingPath(topMenuName); + + if (topMenuBar == null) { + topMenuBar = new MenuManager(topMenuName, topMenuName.toLowerCase()); + this.menuManager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, topMenuBar); } - //Second process submenu + // Second process submenu. processSubMenu(topMenuNode, topMenuBar); } /* - * Recursively process sub menu and group menu + * Recursively process sub menu and group menu. */ - private void processSubMenu (Element menuNode, MenuManager parentMenuBar){ - + private void processSubMenu(Element menuNode, MenuManager parentMenuBar){ NodeList subMenuList = menuNode.getElementsByTagName(TAG_MENU); - if(subMenuList != null && subMenuList.getLength() > 0) { - for(int i = 0 ; i < subMenuList.getLength();i++) { - Element el = (Element)subMenuList.item(i); + + if ((subMenuList != null) && (subMenuList.getLength() > 0)) { + for (int ii = 0; ii < subMenuList.getLength(); ii++) { + Element element = (Element)subMenuList.item(ii); - //only process direct children nodes and - //drop all grand or grand of grand children nodes - if (!el.getParentNode().equals(menuNode)) + /* + * Only process direct children nodes and drop all grand or grand of grand + * children nodes. + * TODO: Why? + */ + if (!element.getParentNode().equals(menuNode)) { continue; - - String menu_type = el.getAttribute(ATTR_TYPE); - String pid=el.getAttribute(ATTR_PID); - if ((menu_type == null || menu_type.length()==0)&& pid !=null){ - processAMenuNode(el, parentMenuBar); - } - else if (menu_type.equalsIgnoreCase(PRESERVED_GROUP)){ - String groupName = el.getAttribute(ATTR_NAME); + } + + String menuType = element.getAttribute(TYPE_ATTRIBUTE); + String algorithmPID = element.getAttribute(PID_ATTRIBUTE); + + if (((menuType == null) || (menuType.length() == 0)) && (algorithmPID != null)) { + processAMenuNode(element, parentMenuBar); + } else if (menuType.equalsIgnoreCase(PRESERVED_GROUP)) { + String groupName = element.getAttribute(NAME_ATTRIBUTE); MenuManager groupMenuBar = new MenuManager(groupName, groupName.toLowerCase()); parentMenuBar.add(groupMenuBar); - processSubMenu(el, groupMenuBar); + processSubMenu(element, groupMenuBar); } - else if (menu_type.equalsIgnoreCase(PRESERVED_BREAK)){ - //It seems that Framework automatically takes care of issues - //such as double separators, a separator at the top or bottom + else if (menuType.equalsIgnoreCase(PRESERVED_BREAK)){ + /* + * It seems that the framework automatically takes care of issues such as + * double separators and a separator at the top or bottom. + */ parentMenuBar.add(new Separator()); } - else if (menu_type.equalsIgnoreCase(PRESERVED)){ - String menuName = el.getAttribute(ATTR_NAME); + else if (menuType.equalsIgnoreCase(PRESERVED)){ + String menuName = element.getAttribute(NAME_ATTRIBUTE); if(menuName.equalsIgnoreCase(PRESERVED_EXIT) ){ //allow to add more menu before "File/Exit" if(parentMenuBar.getId().equalsIgnoreCase(IWorkbenchActionConstants.M_FILE)){ @@ -299,7 +351,7 @@ parentMenuBar.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS)); parentMenuBar.add(new GroupMarker(END_GROUP)); } - IWorkbenchAction exitAction = ActionFactory.QUIT.create(window); + IWorkbenchAction exitAction = ActionFactory.QUIT.create(workbenchWindow); parentMenuBar.add(new Separator()); parentMenuBar.add(exitAction); } @@ -314,152 +366,166 @@ parentMenuBar.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS)); parentMenuBar.add(new GroupMarker(END_GROUP)); } - - } - + } } /* - * process a menu (algorithm) + * TODO: Better name? + * Process a menu (algorithm). */ - private void processAMenuNode(Element menuNode, MenuManager parentMenuBar ){ - String menuName = menuNode.getAttribute(ATTR_NAME); - String pid = menuNode.getAttribute(ATTR_PID); - if (pid == null || pid.length()==0){ - //check if the name is one of the preserved one - //if so add the default action - } - else{ - //check if the pid has registered in pidToServiceReferenceMap - if (pidToServiceReferenceMapCopy.containsKey(pid.toLowerCase().trim())){ - ServiceReference ref = (ServiceReference) pidToServiceReferenceMapCopy. - get(pid.toLowerCase().trim()); - pidToServiceReferenceMap.remove(pid.toLowerCase().trim()); - AlgorithmAction action = new AlgorithmAction(ref, bContext, ciContext); - String menuLabel = (String)ref.getProperty(LABEL); - if(menuName!= null && menuName.trim().length()>0){ - //use the name specified in the xml to overwrite the label + private void processAMenuNode(Element menuNode, MenuManager parentMenuBar) { + String menuName = menuNode.getAttribute(NAME_ATTRIBUTE); + String pid = menuNode.getAttribute(PID_ATTRIBUTE); + + if ((pid == null) || (pid.length() == 0)) { + /* + * TODO: Check if the name is one of the preserved one, and add the default action if + * it is? + */ + } else { + // Check if the PID has registered in pidsToServiceReferences. + if (this.pidsToServiceReferencesCopy.containsKey(pid.toLowerCase().trim())){ + ServiceReference serviceReference = + (ServiceReference)this.pidsToServiceReferencesCopy.get( + pid.toLowerCase().trim()); + this.pidsToServiceReferences.remove(pid.toLowerCase().trim()); + AlgorithmAction action = + new AlgorithmAction(serviceReference, this.bundleContext, this.ciShellContext); + String menuLabel = (String)serviceReference.getProperty(LABEL); + + 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)); + action.setId(getItemID(serviceReference)); parentMenuBar.add(action); - } - else{ - if (menuLabel!= null && menuLabel.trim().length()>0){ + handleActionAccelerator(action, parentMenuBar, serviceReference); + } else { + if ((menuLabel != null) && (menuLabel.trim().length() > 0)) { action.setText(menuLabel); - action.setId(getItemID(ref)); - parentMenuBar.add(action); + action.setId(getItemID(serviceReference)); + parentMenuBar.add(action); + handleActionAccelerator(action, parentMenuBar, serviceReference); + } else { + /* + * TODO: 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 { - //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 { + String algorithmNotFoundMessage = + "Oops! Network Workbench tried to place an algorithm with the id '" + + pid + + "' on the menu, but the algorithm could not be found."; + String contactInformationMessage = + "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.logger.log(LogService.LOG_DEBUG, algorithmNotFoundMessage); + this.logger.log(LogService.LOG_DEBUG, contactInformationMessage); } - else{ - //otherwise log the error - 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 ."); - } } } - private void parseXmlFile(String menuFilePath){ - //get the factory - DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); - dbf.setCoalescing(true); - try { - //Using factory get an instance of document builder - DocumentBuilder db = dbf.newDocumentBuilder(); - - //parse using builder to get DOM representation of the XML file - dom = db.parse(menuFilePath); - // printElementAttributes(dom); + private void parseXMLFile(String menuFilePath){ + DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance(); + documentBuilderFactory.setCoalescing(true); - }catch(ParserConfigurationException pce) { - pce.printStackTrace(); - }catch(SAXException se) { - se.printStackTrace(); - }catch(IOException ioe) { - ioe.printStackTrace(); + try { + DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder(); + + this.documentObjectModel = documentBuilder.parse(menuFilePath); + + } catch(ParserConfigurationException parserConfigurationException) { + parserConfigurationException.printStackTrace(); + } catch(SAXException saxException) { + saxException.printStackTrace(); + } catch(IOException ioException) { + ioException.printStackTrace(); } } /* * Handle some service bundles that have specified the menu_path and label - * but not specified in the default_menu.xml + * but not specified in the DEFAULT_MENU_FILE_NAME */ - private void processLeftServiceBundles(){ - if (!pidToServiceReferenceMap.isEmpty()){ - Object[] keys = pidToServiceReferenceMap.keySet().toArray(); - for (int i=0; i<keys.length; i++){ - ServiceReference ref= (ServiceReference) - pidToServiceReferenceMap.get((String)keys[i]); - makeMenuItem(ref); + private void processLeftServiceBundles() { + if (!this.pidsToServiceReferences.isEmpty()){ + Object[] keys = this.pidsToServiceReferences.keySet().toArray(); + + for (int ii = 0; ii < keys.length; ii++) { + ServiceReference serviceReference = + (ServiceReference)this.pidsToServiceReferences.get((String)keys[ii]); + makeMenuItem(serviceReference); } } } - private void initializeMenu() throws InvalidSyntaxException{ - ServiceReference[] refs = bContext.getAllServiceReferences( - AlgorithmFactory.class.getName(), null); + ServiceReference[] serviceReferences = this.bundleContext.getAllServiceReferences( + AlgorithmFactory.class.getName(), null); - if (refs != null) { - for (int i=0; i < refs.length; i++) { - makeMenuItem(refs[i]); + if (serviceReferences != null) { + for (int ii = 0; ii < serviceReferences.length; ii++) { + makeMenuItem(serviceReferences[ii]); } } + } - } - - private class ContextListener implements ServiceListener { public void serviceChanged(ServiceEvent event) { switch (event.getType()) { case ServiceEvent.REGISTERED: makeMenuItem(event.getServiceReference()); + break; case ServiceEvent.UNREGISTERING: removeMenuItem(event.getServiceReference()); + break; case ServiceEvent.MODIFIED: updateMenuItem(event.getServiceReference()); + break; } } } - private void makeMenuItem(ServiceReference ref) { - String path = (String)ref.getProperty(MENU_PATH); - String[] items = (path == null) ? null : path.split("/"); + private void makeMenuItem(ServiceReference serviceReference) { + String path = (String)serviceReference.getProperty(MENU_PATH); + String[] items = null; + + if (path != null) { + items = path.split("/"); + } + IMenuManager menu = null; - if (items != null && items.length > 1) { - AlgorithmAction action = new AlgorithmAction(ref, bContext, ciContext); - action.setId(getItemID(ref)); + + if ((items != null) && (items.length > 1)) { + AlgorithmAction action = + new AlgorithmAction(serviceReference, this.bundleContext, this.ciShellContext); + action.setId(getItemID(serviceReference)); - IMenuManager targetMenu = menuBar; - String group = items[items.length-1]; + IMenuManager targetMenu = this.menuManager; + String group = items[items.length - 1]; - for (int i=0; i < items.length-1; i++) { - - menu = targetMenu.findMenuUsingPath(items[i]); + for (int ii = 0; ii < items.length - 1; ii++) { + menu = targetMenu.findMenuUsingPath(items[ii]); - if (menu == null && items[i] != null) { - menu = targetMenu.findMenuUsingPath(items[i].toLowerCase()); + if ((menu == null) && (items[ii] != null)) { + menu = targetMenu.findMenuUsingPath(items[ii].toLowerCase()); } if (menu == null) { - menu = createMenu(items[i],items[i]); + menu = createMenu(items[ii], items[ii]); targetMenu.appendToGroup(ADDITIONS_GROUP, menu); } targetMenu = menu; } - group = items[items.length-1]; + group = items[items.length - 1]; IContributionItem groupItem = targetMenu.find(group); if (groupItem == null) { @@ -468,98 +534,124 @@ } targetMenu.appendToGroup(group, action); + handleActionAccelerator(action, targetMenu, serviceReference); targetMenu.appendToGroup(group, new Separator()); - algorithmToItemMap.put(getItemID(ref), action); - itemToParentMap.put(action, targetMenu); + algorithmsToItems.put(getItemID(serviceReference), action); + itemsToParents.put(action, targetMenu); - Display.getDefault().asyncExec(updateAction); + Display.getDefault().asyncExec(this.updateAction); } else { - getLog().log(LogService.LOG_DEBUG, - "Bad menu path for Algorithm: " + ref.getProperty(LABEL)); + this.logger.log( + LogService.LOG_DEBUG, + "Bad menu path for Algorithm: " + serviceReference.getProperty(LABEL)); } } - private Runnable updateAction = new Runnable() { - public void run() { - menuBar.updateAll(true); - } - }; - - private String getItemID(ServiceReference ref) { - return ref.getProperty("PID:" + Constants.SERVICE_PID) + "-SID:" + - ref.getProperty(Constants.SERVICE_ID); + private String getItemID(ServiceReference serviceReference) { + return + serviceReference.getProperty("PID:" + Constants.SERVICE_PID) + + "-SID:" + + serviceReference.getProperty(Constants.SERVICE_ID); } - + private MenuManager createMenu(String name, String id){ MenuManager menu = new MenuManager(name, id); menu.add(new GroupMarker(START_GROUP)); menu.add(new GroupMarker(ADDITIONS_GROUP)); menu.add(new GroupMarker(END_GROUP)); + return menu; } - - private void updateMenuItem(ServiceReference ref) { - Action item = (Action) algorithmToItemMap.get(getItemID(ref)); + + private void updateMenuItem(ServiceReference serviceReference) { + Action item = (Action)this.algorithmsToItems.get(getItemID(serviceReference)); - if (item != null) - item.setText(""+ref.getProperty(LABEL)); + if (item != null) { + this.logger.log( + LogService.LOG_DEBUG, "updateMenuItem for " + getItemID(serviceReference)); + item.setText("" + serviceReference.getProperty(LABEL)); + } } - private void removeMenuItem(ServiceReference ref) { - String path = (String)ref.getProperty(MENU_PATH); - final Action item = (Action) algorithmToItemMap.get(getItemID(ref)); + private void removeMenuItem(ServiceReference serviceReference) { + String path = (String)serviceReference.getProperty(MENU_PATH); + final Action item = (Action)this.algorithmsToItems.get(getItemID(serviceReference)); - if (path != null && item != null) { + if ((path != null) && (item != null)) { int index = path.lastIndexOf('/'); + if (index != -1) { path = path.substring(0, index); - - final IMenuManager targetMenu = menuBar.findMenuUsingPath(path); + final IMenuManager targetMenu = this.menuManager.findMenuUsingPath(path); if (targetMenu != null) { - - if (!shell.isDisposed()) { - shell.getDisplay().syncExec(new Runnable() { - public void run() { - targetMenu.remove(item.getId()); - }}); + if (!this.shell.isDisposed()) { + this.shell.getDisplay().syncExec(new Runnable() { + public void run() { + targetMenu.remove(item.getId()); + } + }); } - - - algorithmToItemMap.remove(getItemID(ref)); - itemToParentMap.remove(item); + + this.algorithmsToItems.remove(getItemID(serviceReference)); + this.itemsToParents.remove(item); } } } } - - private Runnable stopAction = new Runnable() { - public void run() { - String[] algs = (String[]) - algorithmToItemMap.keySet().toArray(new String[]{}); - - for (int i=0; i < algs.length; i++) { - Action item = (Action)algorithmToItemMap.get(algs[i]); - IMenuManager targetMenu = (IMenuManager)itemToParentMap.get(item); - - targetMenu.remove(item.getId()); - algorithmToItemMap.remove(algs[i]); - itemToParentMap.remove(item); - } - } - }; - + public void stop() { - bContext.removeServiceListener(listener); + this.bundleContext.removeServiceListener(this.contextListener); - if (!shell.isDisposed()) { - shell.getDisplay().syncExec(stopAction); + if (!this.shell.isDisposed()) { + this.shell.getDisplay().syncExec(this.stopAction); } } - - private LogService getLog() { - return (LogService) ciContext.getService(LogService.class.getName()); - } + + //private void clearShortcuts() { + /*IWorkbench workbench = this.window.getWorkbench(); + IBindingService bindingService = + (IBindingService)workbench.getService(IBindingService.class); + Binding[] bindings = bindingService.getBindings(); + IHandlerService handlerService = + (IHandlerService)workbench.getService(IHandlerService.class);*/ + //getLog().log(LogService.LOG_WARNING, "handlerService: " + handlerService); + //for (int ii = 0; ii < bindings.length; ii++) { + // getLog().log(LogService.LOG_INFO, "Binding[" + ii + "]: " + bindings[ii]); + /*String bindingInfo = + "\tcontextID: " + bindings[ii].getContextId() + "\n" + + "\tparameterized command: " + bindings[ii].getParameterizedCommand() + "\n" + + "\ttrigger sequence: " + bindings[ii].getTriggerSequence().format(); + getLog().log(LogService.LOG_INFO, "Binding:\n" + bindingInfo);*/ + + /*KeyBinding( + bindings[ii].getTriggerSequence(), + null, + bindings[ii].getSchemeId(), + bindings[ii].getContextId(), + null, + null, + null, + Binding.SYSTEM);*/ + //} + //} + + private void handleActionAccelerator( + Action action, IMenuManager parentMenuBar, ServiceReference serviceReference) { + action.setAccelerator(determineActionAcceleratorKeyCode(serviceReference, action)); + } + + private static int determineActionAcceleratorKeyCode( + ServiceReference serviceReference, Action action) { + String shortcutString = (String)serviceReference.getProperty(SHORTCUT); + + if (shortcutString != null) { + return action.convertAccelerator(shortcutString); + } else { + return 0; + } + } + /* * printElementAttributes takes in a xml document, gets the nodes, then prints the attributes. * Copied from Java Tutorial on XML Parsing by Tim Kelley for debugging purposes. Modified: trunk/clients/gui/org.cishell.reference.gui.workspace/src/org/cishell/reference/gui/workspace/ApplicationActionBarAdvisor.java =================================================================== --- trunk/clients/gui/org.cishell.reference.gui.workspace/src/org/cishell/reference/gui/workspace/ApplicationActionBarAdvisor.java 2009-12-04 23:11:02 UTC (rev 988) +++ trunk/clients/gui/org.cishell.reference.gui.workspace/src/org/cishell/reference/gui/workspace/ApplicationActionBarAdvisor.java 2009-12-04 23:14:01 UTC (rev 989) @@ -1,7 +1,11 @@ package org.cishell.reference.gui.workspace; +import java.io.BufferedWriter; +import java.io.FileWriter; + import org.eclipse.jface.action.GroupMarker; +import org.eclipse.jface.action.IAction; import org.eclipse.jface.action.IMenuManager; import org.eclipse.jface.action.MenuManager; import org.eclipse.jface.action.Separator; @@ -79,8 +83,18 @@ menu.add(new GroupMarker("start")); menu.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS)); menu.add(new GroupMarker("end")); - //System.out.println(IWorkbenchActionConstants.MB_ADDITIONS); + return menu; } - + +// protected void register(IAction action) { +// try { +// FileWriter fstream = new FileWriter("C:/Documents and Settings/pataphil/Desktop/out.txt", true); +// BufferedWriter out = new BufferedWriter(fstream); +// out.write("action: " + action + "\r\n"); +// out.close(); +// } catch (Exception e) { +// System.err.println("Error: " + e.getMessage()); +// } +// } } Modified: trunk/core/org.cishell.framework/src/org/cishell/framework/algorithm/AlgorithmProperty.java =================================================================== --- trunk/core/org.cishell.framework/src/org/cishell/framework/algorithm/AlgorithmProperty.java 2009-12-04 23:11:02 UTC (rev 988) +++ trunk/core/org.cishell.framework/src/org/cishell/framework/algorithm/AlgorithmProperty.java 2009-12-04 23:14:01 UTC (rev 989) @@ -48,6 +48,7 @@ public static final String ADDITIONS_GROUP = "additions"; public static final String START_GROUP = "start"; public static final String END_GROUP = "end"; + public static final String SHORTCUT = "shortcut"; public static final String CONVERSION = "conversion"; public static final String LOSSY = "lossy"; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mwl...@us...> - 2010-02-10 21:31:50
|
Revision: 1033 http://cishell.svn.sourceforge.net/cishell/?rev=1033&view=rev Author: mwlinnem Date: 2010-02-10 21:31:42 +0000 (Wed, 10 Feb 2010) Log Message: ----------- Updated to use latest version of derby. Seemed to give a performance boost compared to the old version (will need to test though). This also gives us the option using in-memory databases. Modified Paths: -------------- trunk/core/org.cishell.reference.service.database/.settings/org.eclipse.jdt.core.prefs trunk/core/org.cishell.reference.service.database/META-INF/MANIFEST.MF trunk/core/org.cishell.service.database/.settings/org.eclipse.jdt.core.prefs trunk/libs/derbylib/.classpath trunk/libs/derbylib/META-INF/MANIFEST.MF trunk/libs/derbylib/derby.jar trunk/libs/derbylib/derbyLocale_cs.jar trunk/libs/derbylib/derbyLocale_de_DE.jar trunk/libs/derbylib/derbyLocale_es.jar trunk/libs/derbylib/derbyLocale_fr.jar trunk/libs/derbylib/derbyLocale_hu.jar trunk/libs/derbylib/derbyLocale_it.jar trunk/libs/derbylib/derbyLocale_ja_JP.jar trunk/libs/derbylib/derbyLocale_ko_KR.jar trunk/libs/derbylib/derbyLocale_pl.jar trunk/libs/derbylib/derbyLocale_pt_BR.jar trunk/libs/derbylib/derbyLocale_ru.jar trunk/libs/derbylib/derbyLocale_zh_CN.jar trunk/libs/derbylib/derbyLocale_zh_TW.jar trunk/libs/derbylib/derbyclient.jar trunk/libs/derbylib/derbynet.jar trunk/libs/derbylib/derbyrun.jar trunk/libs/derbylib/derbytools.jar Added Paths: ----------- trunk/core/org.cishell.service.database/.settings/org.eclipse.pde.core.prefs Modified: trunk/core/org.cishell.reference.service.database/.settings/org.eclipse.jdt.core.prefs =================================================================== --- trunk/core/org.cishell.reference.service.database/.settings/org.eclipse.jdt.core.prefs 2010-02-04 22:49:51 UTC (rev 1032) +++ trunk/core/org.cishell.reference.service.database/.settings/org.eclipse.jdt.core.prefs 2010-02-10 21:31:42 UTC (rev 1033) @@ -1,8 +1,12 @@ -#Mon Jan 04 15:00:54 EST 2010 +#Wed Dec 23 12:43:04 EST 2009 eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.source=1.5 Modified: trunk/core/org.cishell.reference.service.database/META-INF/MANIFEST.MF =================================================================== --- trunk/core/org.cishell.reference.service.database/META-INF/MANIFEST.MF 2010-02-04 22:49:51 UTC (rev 1032) +++ trunk/core/org.cishell.reference.service.database/META-INF/MANIFEST.MF 2010-02-10 21:31:42 UTC (rev 1033) @@ -8,7 +8,6 @@ Import-Package: org.apache.commons.dbcp, org.apache.commons.pool, org.apache.commons.pool.impl, - org.apache.derby, org.apache.derby.jdbc, org.cishell.framework.algorithm;version="1.0.0", org.cishell.service.database, Modified: trunk/core/org.cishell.service.database/.settings/org.eclipse.jdt.core.prefs =================================================================== --- trunk/core/org.cishell.service.database/.settings/org.eclipse.jdt.core.prefs 2010-02-04 22:49:51 UTC (rev 1032) +++ trunk/core/org.cishell.service.database/.settings/org.eclipse.jdt.core.prefs 2010-02-10 21:31:42 UTC (rev 1033) @@ -1,12 +1,12 @@ -#Wed Jan 21 13:34:47 EST 2009 -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2 -org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.4 -org.eclipse.jdt.core.compiler.debug.lineNumber=generate -org.eclipse.jdt.core.compiler.debug.localVariable=generate -org.eclipse.jdt.core.compiler.debug.sourceFile=generate -org.eclipse.jdt.core.compiler.problem.assertIdentifier=warning -org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning -org.eclipse.jdt.core.compiler.source=1.3 +#Wed Dec 30 17:15:09 EST 2009 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.5 Added: trunk/core/org.cishell.service.database/.settings/org.eclipse.pde.core.prefs =================================================================== --- trunk/core/org.cishell.service.database/.settings/org.eclipse.pde.core.prefs (rev 0) +++ trunk/core/org.cishell.service.database/.settings/org.eclipse.pde.core.prefs 2010-02-10 21:31:42 UTC (rev 1033) @@ -0,0 +1,4 @@ +#Thu Jan 15 16:13:04 EST 2009 +eclipse.preferences.version=1 +pluginProject.extensions=false +resolve.requirebundle=false Modified: trunk/libs/derbylib/.classpath =================================================================== --- trunk/libs/derbylib/.classpath 2010-02-04 22:49:51 UTC (rev 1032) +++ trunk/libs/derbylib/.classpath 2010-02-10 21:31:42 UTC (rev 1033) @@ -1,24 +1,24 @@ <?xml version="1.0" encoding="UTF-8"?> <classpath> - <classpathentry exported="true" kind="lib" path="derbyLocale_fr.jar"/> - <classpathentry exported="true" kind="lib" path="derbyLocale_zh_CN.jar"/> - <classpathentry exported="true" kind="lib" path="derby.jar"/> - <classpathentry exported="true" kind="lib" path="derbytools.jar"/> - <classpathentry exported="true" kind="lib" path="derbyLocale_it.jar"/> - <classpathentry exported="true" kind="lib" path="derbyLocale_ko_KR.jar"/> - <classpathentry exported="true" kind="lib" path="derbyLocale_es.jar"/> - <classpathentry exported="true" kind="lib" path="derbyrun.jar"/> - <classpathentry exported="true" kind="lib" path="derbynet.jar"/> - <classpathentry exported="true" kind="lib" path="derbyLocale_ru.jar"/> - <classpathentry exported="true" kind="lib" path="derbyLocale_pt_BR.jar"/> - <classpathentry exported="true" kind="lib" path="derbyclient.jar"/> - <classpathentry exported="true" kind="lib" path="derbyLocale_pl.jar"/> - <classpathentry exported="true" kind="lib" path="derbyLocale_ja_JP.jar"/> - <classpathentry exported="true" kind="lib" path="derbyLocale_zh_TW.jar"/> - <classpathentry exported="true" kind="lib" path="derbyLocale_de_DE.jar"/> - <classpathentry exported="true" kind="lib" path="derbyLocale_cs.jar"/> - <classpathentry exported="true" kind="lib" path="derbyLocale_hu.jar"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> + <classpathentry kind="lib" path="derby.jar"/> + <classpathentry kind="lib" path="derbyclient.jar"/> + <classpathentry kind="lib" path="derbyLocale_cs.jar"/> + <classpathentry kind="lib" path="derbyLocale_de_DE.jar"/> + <classpathentry kind="lib" path="derbyLocale_es.jar"/> + <classpathentry kind="lib" path="derbyLocale_fr.jar"/> + <classpathentry kind="lib" path="derbyLocale_hu.jar"/> + <classpathentry kind="lib" path="derbyLocale_it.jar"/> + <classpathentry kind="lib" path="derbyLocale_ja_JP.jar"/> + <classpathentry kind="lib" path="derbyLocale_ko_KR.jar"/> + <classpathentry kind="lib" path="derbyLocale_pl.jar"/> + <classpathentry kind="lib" path="derbyLocale_pt_BR.jar"/> + <classpathentry kind="lib" path="derbyLocale_ru.jar"/> + <classpathentry kind="lib" path="derbyLocale_zh_CN.jar"/> + <classpathentry kind="lib" path="derbyLocale_zh_TW.jar"/> + <classpathentry kind="lib" path="derbynet.jar"/> + <classpathentry kind="lib" path="derbyrun.jar"/> + <classpathentry kind="lib" path="derbytools.jar"/> <classpathentry kind="output" path="bin"/> </classpath> Modified: trunk/libs/derbylib/META-INF/MANIFEST.MF =================================================================== --- trunk/libs/derbylib/META-INF/MANIFEST.MF 2010-02-04 22:49:51 UTC (rev 1032) +++ trunk/libs/derbylib/META-INF/MANIFEST.MF 2010-02-10 21:31:42 UTC (rev 1033) @@ -4,12 +4,12 @@ Bundle-SymbolicName: Apache_Derby Bundle-Version: 1.0.0 Bundle-ClassPath: derbyLocale_fr.jar,derbyLocale_zh_CN.jar,derby.jar,derbytools.jar,derbyLocale_it.jar,derbyLocale_ko_KR.jar,derbyLocale_es.jar,derbyrun.jar,derbynet.jar,derbyLocale_ru.jar,derbyLocale_pt_BR.jar,derbyclient.jar,derbyLocale_pl.jar,derbyLocale_ja_JP.jar,derbyLocale_zh_TW.jar,derbyLocale_de_DE.jar,derbyLocale_cs.jar,derbyLocale_hu.jar -Export-Package: org.apache.derby, - org.apache.derby.authentication, +Export-Package: org.apache.derby.authentication, org.apache.derby.catalog, org.apache.derby.catalog.types, org.apache.derby.client, org.apache.derby.client.am, + org.apache.derby.client.am.stmtcache, org.apache.derby.client.net, org.apache.derby.database, org.apache.derby.diag, @@ -18,6 +18,7 @@ org.apache.derby.iapi.error, org.apache.derby.iapi.jdbc, org.apache.derby.iapi.reference, + org.apache.derby.iapi.security, org.apache.derby.iapi.services.cache, org.apache.derby.iapi.services.classfile, org.apache.derby.iapi.services.compiler, @@ -28,6 +29,7 @@ org.apache.derby.iapi.services.i18n, org.apache.derby.iapi.services.info, org.apache.derby.iapi.services.io, + org.apache.derby.iapi.services.jmx, org.apache.derby.iapi.services.loader, org.apache.derby.iapi.services.locks, org.apache.derby.iapi.services.memory, @@ -49,6 +51,8 @@ org.apache.derby.iapi.store.raw.data, org.apache.derby.iapi.store.raw.log, org.apache.derby.iapi.store.raw.xact, + org.apache.derby.iapi.store.replication.master, + org.apache.derby.iapi.store.replication.slave, org.apache.derby.iapi.tools, org.apache.derby.iapi.tools.i18n, org.apache.derby.iapi.types, @@ -56,6 +60,7 @@ org.apache.derby.impl.db, org.apache.derby.impl.drda, org.apache.derby.impl.io, + org.apache.derby.impl.io.vfmem, org.apache.derby.impl.jdbc, org.apache.derby.impl.jdbc.authentication, org.apache.derby.impl.load, @@ -63,6 +68,8 @@ org.apache.derby.impl.services.cache, org.apache.derby.impl.services.daemon, org.apache.derby.impl.services.jce, + org.apache.derby.impl.services.jmx, + org.apache.derby.impl.services.jmxnone, org.apache.derby.impl.services.locks, org.apache.derby.impl.services.monitor, org.apache.derby.impl.services.reflect, @@ -86,16 +93,22 @@ org.apache.derby.impl.store.raw.data, org.apache.derby.impl.store.raw.log, org.apache.derby.impl.store.raw.xact, + org.apache.derby.impl.store.replication, + org.apache.derby.impl.store.replication.buffer, + org.apache.derby.impl.store.replication.master, + org.apache.derby.impl.store.replication.net, + org.apache.derby.impl.store.replication.slave, org.apache.derby.impl.tools.dblook, org.apache.derby.impl.tools.ij, org.apache.derby.impl.tools.sysinfo, - org.apache.derby.info, org.apache.derby.io, org.apache.derby.jdbc, - org.apache.derby.loc, - org.apache.derby.loc.drda, + org.apache.derby.mbeans, + org.apache.derby.mbeans.drda, org.apache.derby.osgi, + org.apache.derby.security, org.apache.derby.shared.common.error, org.apache.derby.shared.common.i18n, + org.apache.derby.shared.common.sanity, org.apache.derby.tools, org.apache.derby.vti Modified: trunk/libs/derbylib/derby.jar =================================================================== (Binary files differ) Modified: trunk/libs/derbylib/derbyLocale_cs.jar =================================================================== (Binary files differ) Modified: trunk/libs/derbylib/derbyLocale_de_DE.jar =================================================================== (Binary files differ) Modified: trunk/libs/derbylib/derbyLocale_es.jar =================================================================== (Binary files differ) Modified: trunk/libs/derbylib/derbyLocale_fr.jar =================================================================== (Binary files differ) Modified: trunk/libs/derbylib/derbyLocale_hu.jar =================================================================== (Binary files differ) Modified: trunk/libs/derbylib/derbyLocale_it.jar =================================================================== (Binary files differ) Modified: trunk/libs/derbylib/derbyLocale_ja_JP.jar =================================================================== (Binary files differ) Modified: trunk/libs/derbylib/derbyLocale_ko_KR.jar =================================================================== (Binary files differ) Modified: trunk/libs/derbylib/derbyLocale_pl.jar =================================================================== (Binary files differ) Modified: trunk/libs/derbylib/derbyLocale_pt_BR.jar =================================================================== (Binary files differ) Modified: trunk/libs/derbylib/derbyLocale_ru.jar =================================================================== (Binary files differ) Modified: trunk/libs/derbylib/derbyLocale_zh_CN.jar =================================================================== (Binary files differ) Modified: trunk/libs/derbylib/derbyLocale_zh_TW.jar =================================================================== (Binary files differ) Modified: trunk/libs/derbylib/derbyclient.jar =================================================================== (Binary files differ) Modified: trunk/libs/derbylib/derbynet.jar =================================================================== (Binary files differ) Modified: trunk/libs/derbylib/derbyrun.jar =================================================================== (Binary files differ) Modified: trunk/libs/derbylib/derbytools.jar =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jrb...@us...> - 2010-03-26 16:30:29
|
Revision: 1061 http://cishell.svn.sourceforge.net/cishell/?rev=1061&view=rev Author: jrbibers Date: 2010-03-26 16:30:23 +0000 (Fri, 26 Mar 2010) Log Message: ----------- http://cns-jira.slis.indiana.edu/browse/SCISQUARED-121 Reviewed by Russell. Modified Paths: -------------- trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/FileUtil.java trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/view/core/FileViewer.java trunk/core/org.cishell.utilities/src/org/cishell/utilities/FileUtilities.java trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/converter/graph/ConverterGraph.java Modified: trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/FileUtil.java =================================================================== --- trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/FileUtil.java 2010-03-26 15:32:11 UTC (rev 1060) +++ trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/FileUtil.java 2010-03-26 16:30:23 UTC (rev 1061) @@ -135,13 +135,4 @@ return fileNameWithoutExtension; } - - public static void main(String[] args) { -// String s = "Input data: CSV file: C:\\Documents and Settings\\katy\\Desktop\\NIH-Demo\\nih\\NIH-data\\NIH-NIGMS-PPBC-R01s,-FY08-Publications.csv"; - String s = "a\\b/c:d*e?f\"g<h>i|j"; - - System.out.println(replaceInvalidFilenameCharacters(s)); - - System.exit(0); - } } Modified: trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/view/core/FileViewer.java =================================================================== --- trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/view/core/FileViewer.java 2010-03-26 15:32:11 UTC (rev 1060) +++ trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/view/core/FileViewer.java 2010-03-26 16:30:23 UTC (rev 1061) @@ -31,7 +31,7 @@ public static final String ANY_MIME_TYPE = "file:"; public static final String CSV_FILE_EXT = "file-ext:csv"; public static final String CSV_MIME_TYPE = "file:text/csv"; - public static final String TEMPORARY_CSV_FILE_NAME = "xxx-Session-"; + public static final String TEMPORARY_CSV_FILE_NAME = "CSV-"; public static final String CSV_FILE_EXTENSION = "csv"; public static final String TXT_FILE_EXTENSION = "txt"; public static final String ANY_FILE_FORMAT_PATTERN = Modified: trunk/core/org.cishell.utilities/src/org/cishell/utilities/FileUtilities.java =================================================================== --- trunk/core/org.cishell.utilities/src/org/cishell/utilities/FileUtilities.java 2010-03-26 15:32:11 UTC (rev 1060) +++ trunk/core/org.cishell.utilities/src/org/cishell/utilities/FileUtilities.java 2010-03-26 16:30:23 UTC (rev 1061) @@ -45,7 +45,7 @@ try { temporaryFile = - File.createTempFile("NWB-Session-" + temporaryFileName, + File.createTempFile(temporaryFileName, "." + temporaryFileExtension, temporaryDirectory); } @@ -120,7 +120,7 @@ String temporaryDirectoryPath = getDefaultTemporaryDirectory(); File temporaryImageFile = createTemporaryFileInTemporaryDirectory(temporaryDirectoryPath, - "nwb-temp", + "image-", imageType); // Attempt to write the image to the temporary file on disk. @@ -140,7 +140,7 @@ String temporaryDirectoryPath = getDefaultTemporaryDirectory(); File temporaryTextFile = createTemporaryFileInTemporaryDirectory(temporaryDirectoryPath, - "nwb-temp", + "text-", fileExtension); FileWriter textFileWriter = new FileWriter(temporaryTextFile); Modified: trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/converter/graph/ConverterGraph.java =================================================================== --- trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/converter/graph/ConverterGraph.java 2010-03-26 15:32:11 UTC (rev 1060) +++ trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/converter/graph/ConverterGraph.java 2010-03-26 16:30:23 UTC (rev 1061) @@ -486,7 +486,7 @@ if(!tempDir.exists()) tempDir.mkdir(); try{ - tempFile = File.createTempFile("NWB-Session-", ".nwb", tempDir); + tempFile = File.createTempFile("ConverterTester-", ".nwb", tempDir); }catch (IOException e){ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jrb...@us...> - 2010-06-16 23:01:04
|
Revision: 1074 http://cishell.svn.sourceforge.net/cishell/?rev=1074&view=rev Author: jrbibers Date: 2010-06-16 23:00:57 +0000 (Wed, 16 Jun 2010) Log Message: ----------- Improved UTF-8 support by: * Tolerating byte-order marks in UTF-8 files, where they are unnecessary but harmless and standard-permissible. * Wrapping FileReaders throughout the converters inside UnicodeReader, a CIShell utility class. This detects the character encodings UTF-8, UTF-16LE, UTF-16BE, UTF-32LE, and UTF-32BE according to any byte-order mark at the head of the file, defaulting to UTF-8 when unclear. The multiple existing UnicodeReaders are removed. * Specifying the preferred encoding UTF-8 on FileWriters throughout the converter set. * Adding a friendlier error message to the File > Load algorithm when an unrecognized encoding is presented. It suggests two common fixes. Reviewed by Russell. Modified Paths: -------------- trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/load/FileLoadAlgorithm.java Added Paths: ----------- trunk/core/org.cishell.utilities/src/org/cishell/utilities/UnicodeReader.java Modified: trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/load/FileLoadAlgorithm.java =================================================================== --- trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/load/FileLoadAlgorithm.java 2010-06-12 01:41:40 UTC (rev 1073) +++ trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/load/FileLoadAlgorithm.java 2010-06-16 23:00:57 UTC (rev 1074) @@ -1,6 +1,7 @@ package org.cishell.reference.gui.persistence.load; import java.io.File; +import java.io.UnsupportedEncodingException; import java.util.Dictionary; import org.cishell.framework.CIShellContext; @@ -88,30 +89,38 @@ return fileSelector.getFile(); } - private Data[] validateFile(IWorkbenchWindow window, Display display, File file) - throws AlgorithmExecutionException { + private Data[] validateFile(IWorkbenchWindow window, Display display, File file) { AlgorithmFactory validator = null; - boolean shouldTryValidator = true; - while (shouldTryValidator) { - try { - validator = getValidatorFromUser(window, display, file); + try { + validator = getValidatorFromUser(window, display, file); - if ((file == null) || (validator == null)) { - String logMessage = "File loading canceled"; - this.logger.log(LogService.LOG_WARNING, logMessage); - - shouldTryValidator = false; - } else { + if ((file == null) || (validator == null)) { + String logMessage = "File loading canceled"; + this.logger.log(LogService.LOG_WARNING, logMessage); + } else { + try { return FileValidator.validateFile( - file, validator, this.progressMonitor, this.ciShellContext, this.logger); + file, validator, this.progressMonitor, this.ciShellContext, this.logger); + } catch (AlgorithmExecutionException e) { + if (e.getCause() != null + && e.getCause() instanceof UnsupportedEncodingException) { + String logMessage = + "This file cannot be loaded; it uses the unsupported character encoding " + + e.getCause().getMessage() + "."; + this.logger.log(LogService.LOG_ERROR, logMessage); + } else { + throw e; + } } - } catch (Throwable e) { - String logMessage = - "The chosen file is not compatible with the chosen file. " + - "Please try a different format or cancel."; - this.logger.log(LogService.LOG_ERROR, logMessage); } + } catch (Throwable e) { + String logMessage = + "The chosen file is not compatible with this format. " + + "Check that your file is correctly formatted or try another validator. " + + "The reason is: " + e.getMessage(); + e.printStackTrace(); // TODO remove + this.logger.log(LogService.LOG_ERROR, logMessage); } return null; Added: trunk/core/org.cishell.utilities/src/org/cishell/utilities/UnicodeReader.java =================================================================== --- trunk/core/org.cishell.utilities/src/org/cishell/utilities/UnicodeReader.java (rev 0) +++ trunk/core/org.cishell.utilities/src/org/cishell/utilities/UnicodeReader.java 2010-06-16 23:00:57 UTC (rev 1074) @@ -0,0 +1,141 @@ +package org.cishell.utilities; + +/** + version: 1.1 / 2007-01-25 + - changed BOM recognition ordering (longer boms first) + + Original pseudocode : Thomas Weidenfeller + Implementation tweaked: Aki Nieminen + + http://www.unicode.org/unicode/faq/utf_bom.html + BOMs: + 00 00 FE FF = UTF-32, big-endian + FF FE 00 00 = UTF-32, little-endian + EF BB BF = UTF-8, + FE FF = UTF-16, big-endian + FF FE = UTF-16, little-endian + + Win2k Notepad: + Unicode format = UTF-16LE + */ + +import java.io.*; + +/** + * Generic unicode textreader, which will use BOM mark to identify the encoding + * to be used. If BOM is not found then use a given default or system encoding. + */ +public class UnicodeReader extends Reader { + public static final int BOM_SIZE = 4; + + private PushbackInputStream internalIn; + private InputStreamReader internalIn2 = null; + private String defaultEnc; + + /** + * @param in + * inputstream to be read + */ + public UnicodeReader(InputStream in) { + this(in, "UTF-8"); + } + + /** + * @param in + * inputstream to be read + * @param defaultEnc + * default encoding if stream does not have BOM marker. Give null + * to use system-level default. + */ + public UnicodeReader(InputStream in, String defaultEnc) { + internalIn = new PushbackInputStream(in, BOM_SIZE); + this.defaultEnc = defaultEnc; + } + + public String getDefaultEncoding() { + return defaultEnc; + } + + /** + * Get stream encoding or null if stream is uninitialized. Call init() or + * read() method to initialize it. + */ + public String getEncoding() { + if (internalIn2 == null) { + return null; + } + + return internalIn2.getEncoding(); + } + + /** + * Read-ahead four bytes and check for BOM marks. Extra bytes are unread + * back to the stream, only BOM bytes are skipped. + */ + protected void init() throws IOException { + if (internalIn2 != null) { + return; + } + + String encoding; + byte bom[] = new byte[BOM_SIZE]; + int n; + int unread; + n = internalIn.read(bom, 0, bom.length); + + if ((bom[0] == (byte) 0x00) && (bom[1] == (byte) 0x00) && (bom[2] == (byte) 0xFE) + && (bom[3] == (byte) 0xFF)) { + encoding = "UTF-32BE"; + unread = n - 4; + System.out.println("encoding detected: " + encoding); + } else if ((bom[0] == (byte) 0xFF) && (bom[1] == (byte) 0xFE) && (bom[2] == (byte) 0x00) + && (bom[3] == (byte) 0x00)) { + encoding = "UTF-32LE"; + unread = n - 4; + System.out.println("encoding detected: " + encoding); + } else if ((bom[0] == (byte) 0xEF) && (bom[1] == (byte) 0xBB) && (bom[2] == (byte) 0xBF)) { + encoding = "UTF-8"; + unread = n - 3; + System.out.println("encoding detected: " + encoding); + } else if ((bom[0] == (byte) 0xFE) && (bom[1] == (byte) 0xFF)) { + encoding = "UTF-16BE"; + unread = n - 2; + System.out.println("encoding detected: " + encoding); + } else if ((bom[0] == (byte) 0xFF) && (bom[1] == (byte) 0xFE)) { + encoding = "UTF-16LE"; + unread = n - 2; + System.out.println("encoding detected: " + encoding); + } else { + // Unicode BOM mark not found, unread all bytes + encoding = defaultEnc; + unread = n; + System.out.println("using default encoding: " + encoding); + } + + + + if (unread > 0) { + internalIn.unread(bom, (n - unread), unread); + } + + // Use given encoding + if (encoding == null) { + internalIn2 = new InputStreamReader(internalIn, "UTF-8"); + } else { + internalIn2 = new InputStreamReader(internalIn, encoding); + } + } + + @Override + public void close() throws IOException { + init(); + internalIn2.close(); + } + + @Override + public int read(char[] cbuf, int off, int len) throws IOException { + init(); + return internalIn2.read(cbuf, off, len); + } + +} \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pat...@us...> - 2010-08-18 20:39:59
|
Revision: 1125 http://cishell.svn.sourceforge.net/cishell/?rev=1125&view=rev Author: pataphil Date: 2010-08-18 20:39:52 +0000 (Wed, 18 Aug 2010) Log Message: ----------- * Style cleanup. Modified Paths: -------------- trunk/clients/gui/org.cishell.reference.gui.datamanager/src/org/cishell/reference/gui/datamanager/AbstractDataManagerView.java trunk/core/org.cishell.framework/src/org/cishell/framework/algorithm/AlgorithmCanceledException.java trunk/core/org.cishell.reference/src/org/cishell/reference/service/conversion/ConverterImpl.java trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/converter/graph/Converter.java trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/converter/graph/ConverterPath.java trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/tester2/DefaultTestRunner.java Modified: trunk/clients/gui/org.cishell.reference.gui.datamanager/src/org/cishell/reference/gui/datamanager/AbstractDataManagerView.java =================================================================== --- trunk/clients/gui/org.cishell.reference.gui.datamanager/src/org/cishell/reference/gui/datamanager/AbstractDataManagerView.java 2010-08-18 20:38:51 UTC (rev 1124) +++ trunk/clients/gui/org.cishell.reference.gui.datamanager/src/org/cishell/reference/gui/datamanager/AbstractDataManagerView.java 2010-08-18 20:39:52 UTC (rev 1125) @@ -24,6 +24,7 @@ import org.cishell.app.service.datamanager.DataManagerListener; import org.cishell.app.service.datamanager.DataManagerService; import org.cishell.framework.algorithm.Algorithm; +import org.cishell.framework.algorithm.AlgorithmCanceledException; import org.cishell.framework.algorithm.AlgorithmExecutionException; import org.cishell.framework.algorithm.AlgorithmFactory; import org.cishell.framework.data.Data; @@ -501,11 +502,14 @@ e.printStackTrace(); } else { AbstractDataManagerView.this.logger = Activator.getLogService(); - AbstractDataManagerView.this.logger.log( - LogService.LOG_ERROR, - "org.cishell.framework.algorithm.AlgorithmExecutionException", - e); - e.printStackTrace(); + + if (AbstractDataManagerView.this.logger != null) { + AbstractDataManagerView.this.logger.log( + LogService.LOG_ERROR, + "org.cishell.framework.algorithm.AlgorithmExecutionException", + e); + e.printStackTrace(); + } } } } @@ -522,11 +526,17 @@ try { algorithm.execute(); } catch (AlgorithmExecutionException e) { - if (logger != null) { - logger.log(LogService.LOG_ERROR, e.getMessage(), e); + if (AbstractDataManagerView.this.logger != null) { + AbstractDataManagerView.this.logger.log( + LogService.LOG_ERROR, e.getMessage(), e); } else { - logger = Activator.getLogService(); - logger.log(LogService.LOG_ERROR, e.getMessage(), e); + AbstractDataManagerView.this.logger = Activator.getLogService(); + + // TODO: Find occurrences of this crap happening, and make it a method. + if (AbstractDataManagerView.this.logger != null) { + AbstractDataManagerView.this.logger.log( + LogService.LOG_ERROR, e.getMessage(), e); + } } e.printStackTrace(); Modified: trunk/core/org.cishell.framework/src/org/cishell/framework/algorithm/AlgorithmCanceledException.java =================================================================== --- trunk/core/org.cishell.framework/src/org/cishell/framework/algorithm/AlgorithmCanceledException.java 2010-08-18 20:38:51 UTC (rev 1124) +++ trunk/core/org.cishell.framework/src/org/cishell/framework/algorithm/AlgorithmCanceledException.java 2010-08-18 20:39:52 UTC (rev 1125) @@ -1,6 +1,6 @@ package org.cishell.framework.algorithm; -public class AlgorithmCanceledException extends Exception { +public class AlgorithmCanceledException extends RuntimeException { private static final long serialVersionUID = 9017277008277139930L; public AlgorithmCanceledException(String message, Throwable exception) { Modified: trunk/core/org.cishell.reference/src/org/cishell/reference/service/conversion/ConverterImpl.java =================================================================== --- trunk/core/org.cishell.reference/src/org/cishell/reference/service/conversion/ConverterImpl.java 2010-08-18 20:38:51 UTC (rev 1124) +++ trunk/core/org.cishell.reference/src/org/cishell/reference/service/conversion/ConverterImpl.java 2010-08-18 20:39:52 UTC (rev 1125) @@ -33,20 +33,18 @@ import org.osgi.service.metatype.MetaTypeProvider; public class ConverterImpl implements Converter, AlgorithmFactory, AlgorithmProperty { - private ServiceReference[] refs; + private ServiceReference[] serviceReferences; private BundleContext bContext; - private Dictionary properties; + private Dictionary<String, Object> properties; private CIShellContext ciContext; public ConverterImpl(BundleContext bContext, CIShellContext ciContext, ServiceReference[] refs) { this.bContext = bContext; this.ciContext = ciContext; - this.refs = refs; + this.serviceReferences = refs; + properties = new Hashtable<String, Object>(); - - properties = new Hashtable(); - properties.put(IN_DATA, refs[0].getProperty(IN_DATA)); properties.put(OUT_DATA, refs[refs.length-1].getProperty(OUT_DATA)); properties.put(LABEL, properties.get(IN_DATA) + " -> " + properties.get(OUT_DATA)); @@ -109,7 +107,7 @@ * @see org.cishell.service.conversion.Converter#getConverterChain() */ public ServiceReference[] getConverterChain() { - return refs; + return this.serviceReferences; } /** @@ -134,25 +132,27 @@ } public String toString() { - String str =""; - for (int j = 0; j < refs.length; ++j) { - str += refs[j].getProperty(Constants.SERVICE_ID); + String str = ""; + + for (ServiceReference serviceReference : this.serviceReferences) { + str += serviceReference.getProperty(Constants.SERVICE_ID); str += " "; - str += refs[j].getProperty(Constants.SERVICE_PID); + str += serviceReference.getProperty(Constants.SERVICE_PID); str += "-> "; } return str; } - public boolean equals(Object o) { + public boolean equals(Object compareTo) { boolean equal = false; - if (o instanceof Converter) { - ServiceReference[] otherServiceReference = - ((Converter) o).getConverterChain(); - if (refs.length == otherServiceReference.length) { + + if (compareTo instanceof Converter) { + ServiceReference[] otherServiceReference = ((Converter) compareTo).getConverterChain(); + + if (this.serviceReferences.length == otherServiceReference.length) { for (int i = 0; i < otherServiceReference.length; i++) { - if (refs[i].getProperty(Constants.SERVICE_ID).equals( + if (this.serviceReferences[i].getProperty(Constants.SERVICE_ID).equals( otherServiceReference[i].getProperty( Constants.SERVICE_ID))) { equal = true; @@ -167,7 +167,7 @@ return equal; } - /* The conversion chain (refs) is lossless + /* The conversion chain (serviceReferences) is lossless * if and only if no conversion (ref) is lossy. */ private String calculateLossiness(ServiceReference[] refs) { @@ -186,62 +186,61 @@ public static final String MIME_TYPE_PREFIX = "file:"; private Data[] inData; - private Dictionary parameters; - private CIShellContext context; - private LogService log; + private Dictionary<String, Object> parameters; + private CIShellContext ciShellContext; + private LogService logger; - public ConverterAlgorithm(Data[] inData, - Dictionary parameters, - CIShellContext context) { + public ConverterAlgorithm( + Data[] inData, Dictionary<String, Object> parameters, CIShellContext ciShellContext) { this.inData = inData; this.parameters = parameters; - this.context = context; - this.log = - (LogService) context.getService(LogService.class.getName()); + this.ciShellContext = ciShellContext; + this.logger = + (LogService) ciShellContext.getService(LogService.class.getName()); } public Data[] execute() throws AlgorithmExecutionException { - Data[] convertedData = inData; + Data[] convertedData = this.inData; - // For each converter in the converter chain (refs) - for (int ii = 0; ii < refs.length; ii++) { + // For each converter in the converter chain (serviceReferences) + for (int ii = 0; ii < serviceReferences.length; ii++) { AlgorithmFactory factory = - (AlgorithmFactory) bContext.getService(refs[ii]); + (AlgorithmFactory) bContext.getService(serviceReferences[ii]); if (factory != null) { - Algorithm alg = - factory.createAlgorithm(convertedData, parameters, context); + Algorithm algorithm = factory.createAlgorithm( + convertedData, this.parameters, this.ciShellContext); try { - convertedData = alg.execute(); + convertedData = algorithm.execute(); } catch(AlgorithmExecutionException e) { - boolean isLastStep = (ii == refs.length - 1); - if (isLastStep && isHandler(refs[ii])) { + boolean isLastStep = (ii == serviceReferences.length - 1); + if (isLastStep && isHandler(serviceReferences[ii])) { /* If the last step of the converter chain is a * handler and it is the first (and so only) step - * to fail, just log a warning and return the + * to fail, just logger a warning and return the * un-handled data. */ String warningMessage = "Warning: Attempting to convert data without " + "validating the output since the validator failed " + "with this problem:\n " - + createErrorMessage(refs[ii], e); + + createErrorMessage(serviceReferences[ii], e); - log.log(LogService.LOG_WARNING, warningMessage, e); + this.logger.log(LogService.LOG_WARNING, warningMessage, e); return convertedData; } else { throw new AlgorithmExecutionException( - createErrorMessage(refs[ii], e), e); + createErrorMessage(serviceReferences[ii], e), e); } } } else { throw new AlgorithmExecutionException( "Missing subconverter: " - + refs[ii].getProperty(Constants.SERVICE_PID)); + + serviceReferences[ii].getProperty(Constants.SERVICE_PID)); } } @@ -286,7 +285,7 @@ return "Problem converting data from " + prettifyDataType(inType) + " to " + prettifyDataType(outType) - + " (See the log file for more details).:\n " + + " (See the logger file for more details).:\n " + e.getMessage(); } else { @@ -296,7 +295,7 @@ + " during the necessary intermediate conversion from " + prettifyDataType(preProblemType) + " to " + prettifyDataType(postProblemType) - + " (See the log file for more details):\n " + + " (See the logger file for more details):\n " + e.getMessage(); } } Modified: trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/converter/graph/Converter.java =================================================================== --- trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/converter/graph/Converter.java 2010-08-18 20:38:51 UTC (rev 1124) +++ trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/converter/graph/Converter.java 2010-08-18 20:39:52 UTC (rev 1125) @@ -12,31 +12,29 @@ import org.osgi.framework.ServiceReference; public class Converter { + private BundleContext bundleContext; + private ServiceReference serviceReference; - private BundleContext bContext; - - private ServiceReference ref; - - public Converter(BundleContext bContext, ServiceReference ref) { - this.bContext = bContext; - this.ref = ref; + public Converter(BundleContext bundleContext, ServiceReference serviceReference) { + this.bundleContext = bundleContext; + this.serviceReference = serviceReference; } public ServiceReference getServiceReference() { - return this.ref; + return this.serviceReference; } - public ServiceReference getRef() { - return this.ref; + public ServiceReference getServieReference() { + return this.serviceReference; } public boolean isLossy() { - String conversion = (String) - ref.getProperty(AlgorithmProperty.CONVERSION); + String conversion = + (String) this.serviceReference.getProperty(AlgorithmProperty.CONVERSION); if (conversion == null) { return false; - //if lossiness is not defined, assume it is not lossy. + // If lossiness is not defined, assume it is not lossy. } if (conversion.equals(AlgorithmProperty.LOSSY)) { @@ -44,17 +42,17 @@ } else if (conversion.equals(AlgorithmProperty.LOSSLESS)) { return false; } else { - //assuming lossy by default + // Assuming lossy by default. return true; } } public String getInData() { - return (String) ref.getProperty(AlgorithmProperty.IN_DATA); + return (String) this.serviceReference.getProperty(AlgorithmProperty.IN_DATA); } public String getOutData() { - return (String) ref.getProperty(AlgorithmProperty.OUT_DATA); + return (String) this.serviceReference.getProperty(AlgorithmProperty.OUT_DATA); } public String getShortName() { @@ -62,23 +60,22 @@ } public String getUniqueName() { - return (String) this.ref.getProperty("service.pid"); + return (String) this.serviceReference.getProperty("service.pid"); } public String toString() { return getUniqueName(); } - public Data[] execute(Data[] input, Hashtable parameters, - CIShellContext cContext) throws AlgorithmExecutionException { + public Data[] execute( + Data[] input, Hashtable<String, Object> parameters, CIShellContext ciShellContext) + throws AlgorithmExecutionException { + + AlgorithmFactory converterFactory = + (AlgorithmFactory) this.bundleContext.getService(this.serviceReference); + Algorithm converter = converterFactory.createAlgorithm(input, parameters, ciShellContext); + Data[] output = converter.execute(); - AlgorithmFactory convAlgFactory = - (AlgorithmFactory) this.bContext.getService(this.ref); - Algorithm convAlg = convAlgFactory.createAlgorithm(input, parameters, - cContext); - - Data[] output = convAlg.execute(); - return output; } Modified: trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/converter/graph/ConverterPath.java =================================================================== --- trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/converter/graph/ConverterPath.java 2010-08-18 20:38:51 UTC (rev 1124) +++ trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/converter/graph/ConverterPath.java 2010-08-18 20:39:52 UTC (rev 1125) @@ -9,87 +9,74 @@ import org.osgi.service.log.LogService; public class ConverterPath implements AlgorithmProperty { + private LogService logger; + private String inData = null; + private String outData = null; + private List<Converter> path; - private BundleContext bContext; - private LogService log; - private String in_data = null; - private String out_data = null; - - private List path; - - public ConverterPath(BundleContext bContext, LogService log){ - this.bContext = bContext; - this.log = log; - - path = new ArrayList(); + public ConverterPath(BundleContext bundleContext, LogService logger){ + this.logger = logger; + this.path = new ArrayList<Converter>(); } - public ConverterPath(ConverterPath p, BundleContext bContext) { - this.bContext = bContext; - - in_data = p.getInData(); - out_data = p.getOutData(); + public ConverterPath(ConverterPath path, BundleContext bundleContext) { + this.inData = path.getInData(); + this.outData = path.getOutData(); + this.path = new ArrayList<Converter>(path.getPath()); - this.path = new ArrayList(p.getPath()); - } - public void setInData(String s){ - - this.in_data = s; + public void setInData(String inData) { + this.inData = inData; } - public void setOutData(String s){ - - this.out_data = s; + public void setOutData(String outData) { + this.outData = outData; } - public boolean add(Converter c){ - - boolean val = true; - - if(path.contains(c)){ + public boolean add(Converter converter) { + if (path.contains(converter)) { return false; + } else { + path.add(converter); + this.setOutData(converter.getOutData()); + + return true; } - - path.add(c); - this.setOutData(c.getOutData()); - return val; } - public String getInData(){ - - return this.in_data; + public String getInData() { + return this.inData; } - public String getOutData(){ - - return this.out_data; + public String getOutData() { + return this.outData; } public String getAcceptedFileFormat() { if (size() > 0) { - return (String) getRef(0).getProperty(AlgorithmProperty.OUT_DATA); + return (String) getServiceReference(0).getProperty(AlgorithmProperty.OUT_DATA); } else { - this.log.log(LogService.LOG_ERROR, "Converter Path cannot " + + this.logger.log(LogService.LOG_ERROR, "Converter Path cannot " + "determine accepted file format if there are no " + "converters inside it. Returning null String."); + return ""; } } - public List getPath(){ - + public List<Converter> getPath() { return this.path; } - //inclusive - public List getPathUpTo(Converter upToConv) { + /// Inclusive. + public List<Converter> getPathUpTo(Converter upToConverter) { int convIndex = -1; + for (int ii = 0; ii < this.path.size(); ii++) { Converter aConvInPath = get(ii); - if (aConvInPath.equals(upToConv)) { + if (aConvInPath.equals(upToConverter)) { convIndex = ii; break; } @@ -108,50 +95,40 @@ return (Converter) this.path.get(index); } - public ServiceReference getRef(int index) { + public ServiceReference getServiceReference(int index) { + Converter converter = this.path.get(index); + ServiceReference serviceReference = converter.getServieReference(); - Converter c = (Converter) this.path.get(index); - ServiceReference ref = c.getRef(); - return ref; + return serviceReference; } - public Converter[] getPathAsArray(){ - + public Converter[] getPathAsArray() { return (Converter[]) this.path.toArray(new Converter[0]); } public boolean isLossy() { - - String lossiness = LOSSLESS; - for (int i = 0; i < this.path.size(); i++) { - Converter c = (Converter) this.path.get(i); - - if (c.isLossy()) { - lossiness = LOSSY; + for (Converter converter : this.path) { + if (converter.isLossy()) { + return true; } } - boolean result = lossiness.equals(LOSSY); - return result; + return false; } public boolean preservesIDs() { - - //TODO: Determine this somehow. + // TODO: Determine this somehow. return false; } public int size() { - return this.path.size(); } - public boolean containsConverterNamed(String convName) { - for (int ii = 0; ii < this.path.size(); ii++) { - Converter conv = (Converter) this.path.get(ii); - - if (conv.getShortName().equals(convName) || - conv.getUniqueName().equals(convName)) { + public boolean containsConverterNamed(String converterName) { + for (Converter converter : this.path) { + if (converter.getShortName().equals(converterName) || + converter.getUniqueName().equals(converterName)) { return true; } } @@ -160,6 +137,6 @@ } public String getConverterName(int index) { - return (String) get(index).getUniqueName(); + return get(index).getUniqueName(); } } Modified: trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/tester2/DefaultTestRunner.java =================================================================== --- trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/tester2/DefaultTestRunner.java 2010-08-18 20:38:51 UTC (rev 1124) +++ trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/tester2/DefaultTestRunner.java 2010-08-18 20:39:52 UTC (rev 1125) @@ -28,43 +28,38 @@ import prefuse.data.Graph; +// TODO: Continue refactoring this. public class DefaultTestRunner implements TestRunner { + private LogService logger; - private LogService log; - - public DefaultTestRunner(LogService log) { - this.log = log; + public DefaultTestRunner(LogService logger) { + this.logger = logger; } public FilePassResult[] runTest(TestConfigData testData) { - Data[][] testFileData = testData.getTestFileData(); ConverterPath testConverters = testData.getTestConverters(); - ConverterPath comparisonConverters = testData - .getComparisonConverters(); - - List testResults = new ArrayList(); + ConverterPath comparisonConverters = testData.getComparisonConverters(); + List<FilePassResult> testResults = new ArrayList<FilePassResult>(); - for (int ii = 0; ii < testFileData.length; ii++) { - Data[] originalFileData = testFileData[ii]; - - // test conversion phase + for (Data[] originalFileData : testFileData) { + // Test conversion phase. - ConvertResult testPhaseResult = convert(originalFileData, - testConverters, testData); - + ConvertResult testPhaseResult = convert(originalFileData, testConverters, testData); Data[][] allDataFromTestPhase = testPhaseResult.getAllData(); if (!testPhaseResult.succeeded()) { - FilePassFailure failure = createFailResult(originalFileData, - PassPhase.TEST_CONV_PHASE, - testPhaseResult.getFailInfo(), + FilePassFailure failure = createFailResult( + originalFileData, + PassPhase.TEST_CONV_PHASE, + testPhaseResult.getFailInfo(), allDataFromTestPhase, null, null); testResults.add(failure); continue; } + Data[] resultFileData = testPhaseResult.getResult(); @@ -144,9 +139,8 @@ ConverterPath converters, TestConfigData testData) { Data[] currentData = getFilePathData(startData); + List<Data[]> dataSoFar = new ArrayList<Data[]>(); - List dataSoFar = new ArrayList(); - // if (startData != null) { // alterMetaData(startData); // dataSoFar.add(startData); @@ -156,7 +150,7 @@ * rig up fake CIShellContext so we can get ahold of * errors sent to logger. */ - FakeLogCIShellContext fakeCContext = + FakeLogCIShellContext fakeCIShellContext = new FakeLogCIShellContext(testData.getContext()); @@ -168,14 +162,15 @@ for (int ii = 0; ii < converters.size(); ii++) { currentConverter = converters.get(ii); - Hashtable parameters = new Hashtable(); //no parameters used + // No parameters used. + Hashtable<String, Object> parameters = new Hashtable<String, Object>(); - currentData = currentConverter.execute(currentData, - parameters, fakeCContext); + currentData = + currentConverter.execute(currentData, parameters, fakeCIShellContext); if (currentData != null) { - setMetaData(currentData, currentConverter); - dataSoFar.add(currentData); + setMetadata(currentData, currentConverter); + dataSoFar.add(currentData); } /* @@ -191,9 +186,9 @@ String explanation = "Result of conversion was null. \r\n"; - if (fakeCContext.hasLogEntries()) { - String logText = extractLogText(fakeCContext); - explanation += "Error log contains the following: \r\n" + + if (fakeCIShellContext.hasLogEntries()) { + String logText = extractLogText(fakeCIShellContext); + explanation += "Error logger contains the following: \r\n" + logText; } else { explanation += "No errors logged. Cause unknown. \r\n"; @@ -202,19 +197,24 @@ ConvFailureInfo failInfo = new ConvFailureInfo( explanation, converter); - ConvertResult result = new ConvertResult(failInfo, (Data[][]) dataSoFar.toArray(new Data[dataSoFar.size()][])); + ConvertResult result = new ConvertResult( + failInfo, (Data[][]) dataSoFar.toArray(new Data[dataSoFar.size()][])); + return result; } } } catch (Throwable t) { - ConvFailureInfo failInfo = new ConvFailureInfo(getStackTrace(t), - currentConverter); - ConvertResult result = new ConvertResult(failInfo,(Data[][]) dataSoFar.toArray(new Data[dataSoFar.size()][])); + ConvFailureInfo failInfo = new ConvFailureInfo(getStackTrace(t), currentConverter); + ConvertResult result = new ConvertResult( + failInfo,(Data[][]) dataSoFar.toArray(new Data[dataSoFar.size()][])); + return result; } Data[] resultData = currentData; - ConvertResult result = new ConvertResult(resultData,(Data[][]) dataSoFar.toArray(new Data[dataSoFar.size()][])); + ConvertResult result = new ConvertResult( + resultData,(Data[][]) dataSoFar.toArray(new Data[dataSoFar.size()][])); + return result; } @@ -288,7 +288,7 @@ Data result = new BasicData(filePath, format); return new Data[] { result }; } catch (IOException e) { - this.log.log(LogService.LOG_ERROR, "Could not get file path " + + this.logger.log(LogService.LOG_ERROR, "Could not get file path " + "from file " + actualFile, e); return null; } @@ -316,51 +316,49 @@ return logText; } - private void setMetaData(Data[] data, Converter converter) { - if (data == null || data.length < 1) { + private void setMetadata(Data[] data, Converter converter) { + if ((data == null) || (data.length < 1)) { return; } Data datum = data[0]; - Dictionary md = datum.getMetadata(); - if (md.get(DataProperty.LABEL) == null) { - md.put(DataProperty.LABEL, "result of " + converter.getShortName()); + Dictionary<String, Object> metadata = datum.getMetadata(); + + if (metadata.get(DataProperty.LABEL) == null) { + metadata.put(DataProperty.LABEL, "result of " + converter.getShortName()); } else { - alterMetaData(data); - md.put(DataProperty.LABEL, md.get(DataProperty.LABEL) + ": result of " + converter.getShortName()); + alterMetadata(data); + metadata.put( + DataProperty.LABEL, + metadata.get(DataProperty.LABEL) + ": result of " + converter.getShortName()); } } private String getFileName(String fileLabel) { - - //index variables will be -1 if index is not found. + // Index variables will be -1 if index is not found. int descriptionEndIndex = fileLabel.lastIndexOf(":"); int filePathEndIndex = fileLabel.lastIndexOf(File.separator); - //doesn't matter if either variable is -1, since startIndex will be - //zero and none of the string will be cut off the front. + /* Doesn't matter if either variable is -1, since startIndex will be zero and none of the + * string will be cut off the front. + */ int startIndex = Math.max(descriptionEndIndex, filePathEndIndex) + 1; - String fileNameWithExtension = fileLabel.substring(startIndex); - - - - int endIndex = fileNameWithExtension.length(); // don't cut any off the end. - - + int endIndex = fileNameWithExtension.length(); // Don't cut any off the end. String fileNameWithoutExtension = fileNameWithExtension.substring(0, endIndex); - String fileName = fileNameWithoutExtension; + return fileName; } - private void alterMetaData(Data[] origFileData) { - Data data = origFileData[0]; - Dictionary metadata = data.getMetadata(); + private void alterMetadata(Data[] originalFileData) { + Data data = originalFileData[0]; + Dictionary<String, Object> metadata = data.getMetadata(); String label = (String) metadata.get(DataProperty.LABEL); + if (label != null) { - metadata.put(DataProperty.LABEL, getFileName(label)); + metadata.put(DataProperty.LABEL, getFileName(label)); } else { metadata.put(DataProperty.LABEL, "null"); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pat...@us...> - 2010-10-01 17:31:06
|
Revision: 1141 http://cishell.svn.sourceforge.net/cishell/?rev=1141&view=rev Author: pataphil Date: 2010-10-01 17:30:59 +0000 (Fri, 01 Oct 2010) Log Message: ----------- * Enhanced ProgressMonitor to accept doubles. Modified Paths: -------------- trunk/clients/gui/org.cishell.reference.gui.scheduler/src/org/cishell/reference/gui/scheduler/SchedulerTableItem.java trunk/clients/gui/org.cishell.reference.gui.scheduler/src/org/cishell/reference/gui/scheduler/SchedulerView.java trunk/core/org.cishell.framework/src/org/cishell/framework/algorithm/ProgressMonitor.java Modified: trunk/clients/gui/org.cishell.reference.gui.scheduler/src/org/cishell/reference/gui/scheduler/SchedulerTableItem.java =================================================================== --- trunk/clients/gui/org.cishell.reference.gui.scheduler/src/org/cishell/reference/gui/scheduler/SchedulerTableItem.java 2010-09-30 14:55:41 UTC (rev 1140) +++ trunk/clients/gui/org.cishell.reference.gui.scheduler/src/org/cishell/reference/gui/scheduler/SchedulerTableItem.java 2010-10-01 17:30:59 UTC (rev 1141) @@ -18,22 +18,22 @@ * if it is monitorable. */ public class SchedulerTableItem { - private Algorithm algorithm; - private Calendar cal; - private String algorithmLabel; + public static final Image CHECKED_IMAGE = Activator.createImage("check.gif"); + public static final Image UNCHECKED_IMAGE = Activator.createImage("uncheck.gif"); + public static final Image ERROR_IMAGE = Activator.createImage("error.gif"); + + private String algorithmLabel; + private Calendar calendar; - private TableItem tableItem; + private TableItem tableItem; private TableEditor tableEditor; - private int progressSelection; + private int progressSelection; private ProgressBar progressBar; - - private static Image checkedImage = Activator.createImage("check.gif"); - private static Image uncheckedImage = Activator.createImage("uncheck.gif"); - private static Image errorImage = Activator.createImage("error.gif"); private boolean encounteredError; - private String workBeingDone; + @SuppressWarnings("unused") + private String workBeingDone; private boolean cancelRequested; private boolean pauseRequested; private boolean started; @@ -49,29 +49,24 @@ * Initializes flags and records the current algorithm to monitor * * @param algorithmLabel + * @param calendar * @param algorithm - * @param cal */ - public SchedulerTableItem(String algorithmLabel, Algorithm algorithm, Calendar cal) { - this.algorithm = algorithm; - this.cal = cal; - + public SchedulerTableItem(String algorithmLabel, Calendar calendar, Algorithm algorithm) { + this.algorithmLabel = algorithmLabel; + this.calendar = calendar; + this.encounteredError = false; - this.cancelRequested = false; - this.started = false; - this.done = false; - - this.isCancellable = false; - this.isPauseable = false; + this.started = false; + this.done = false; + this.isCancellable = false; + this.isPauseable = false; this.isWorkTrackable = false; - - this.algorithmLabel = algorithmLabel; - if (algorithm instanceof ProgressTrackable) { - algorithmProgressMonitor = new AlgorithmProgressMonitor(); - ((ProgressTrackable)algorithm).setProgressMonitor(algorithmProgressMonitor); + this.algorithmProgressMonitor = new AlgorithmProgressMonitor(); + ((ProgressTrackable)algorithm).setProgressMonitor(this.algorithmProgressMonitor); } } @@ -80,7 +75,7 @@ * @param request Cancel request */ public void requestCancel(boolean request) { - cancelRequested = request; + this.cancelRequested = request; } /** @@ -88,7 +83,7 @@ * @param request Pause request */ public void requestPause(boolean request) { - pauseRequested = request; + this.pauseRequested = request; } /** @@ -110,16 +105,17 @@ * @param table The parent table */ public void finishTableEntry(final Table table) { - done = true; + this.done = true; - if (!tableItem.isDisposed()) { + if (!this.tableItem.isDisposed()) { guiRun(new Runnable() { public void run() { - progressBar.dispose(); - progressBar = new ProgressBar(table, SWT.NONE); + SchedulerTableItem.this.progressBar.dispose(); + SchedulerTableItem.this.progressBar = new ProgressBar(table, SWT.NONE); - progressSelection = progressBar.getMaximum(); - drawTableEntry(table, table.indexOf(tableItem)); + SchedulerTableItem.this.progressSelection = + SchedulerTableItem.this.progressBar.getMaximum(); + drawTableEntry(table, table.indexOf(SchedulerTableItem.this.tableItem)); } }); } @@ -133,56 +129,65 @@ public void moveTableEntry(final Table table, final int tblNdx) { guiRun(new Runnable() { public void run() { - progressSelection = progressBar.getSelection(); + SchedulerTableItem.this.progressSelection = + SchedulerTableItem.this.progressBar.getSelection(); drawTableEntry(table, tblNdx); } }); } /** - * Draws a table entry with the current state provided - * the parent table and index of the new entry - * - * @param table Parent table - * @param tblNdx Index into the table + * Draws a table entry with the current state provided the parent table and index of the + * new entry. */ - private void drawTableEntry(final Table table, final int tblNdx) { + private void drawTableEntry(final Table table, final int tableIndex) { guiRun(new Runnable() { public void run() { - if (tableItem != null) { - tableItem.dispose(); + if (SchedulerTableItem.this.tableItem != null) { + SchedulerTableItem.this.tableItem.dispose(); } - tableItem = new TableItem(table, SWT.NONE, tblNdx); + + SchedulerTableItem.this.tableItem = new TableItem(table, SWT.NONE, tableIndex); - if (done) { - tableItem.setImage(SchedulerView.COMPLETED_COLUMN, checkedImage); + if (SchedulerTableItem.this.done) { + SchedulerTableItem.this.tableItem.setImage( + SchedulerView.COMPLETED_COLUMN, CHECKED_IMAGE); } - else if (encounteredError) { - tableItem.setImage(SchedulerView.COMPLETED_COLUMN, errorImage); + else if (SchedulerTableItem.this.encounteredError) { + SchedulerTableItem.this.tableItem.setImage( + SchedulerView.COMPLETED_COLUMN, ERROR_IMAGE); } else { - tableItem.setImage(SchedulerView.COMPLETED_COLUMN, uncheckedImage); + SchedulerTableItem.this.tableItem.setImage( + SchedulerView.COMPLETED_COLUMN, UNCHECKED_IMAGE); } - tableItem.setText(SchedulerView.ALGORITHM_COLUMN, algorithmLabel); + SchedulerTableItem.this.tableItem.setText( + SchedulerView.ALGORITHM_COLUMN, SchedulerTableItem.this.algorithmLabel); setCalendar(); - if (started) { - if (progressBar != null) - progressBar.dispose(); - if (isWorkTrackable || done) { - progressBar = new ProgressBar(table, SWT.NONE); - progressBar.setSelection(progressSelection); + if (SchedulerTableItem.this.started) { + if (SchedulerTableItem.this.progressBar != null) + SchedulerTableItem.this.progressBar.dispose(); + if (SchedulerTableItem.this.isWorkTrackable || SchedulerTableItem.this.done) { + SchedulerTableItem.this.progressBar = new ProgressBar(table, SWT.NONE); + SchedulerTableItem.this.progressBar.setSelection( + SchedulerTableItem.this.progressSelection); } else { - progressBar = new ProgressBar(table, SWT.INDETERMINATE); + SchedulerTableItem.this.progressBar = + new ProgressBar(table, SWT.INDETERMINATE); } } else { - progressBar = new ProgressBar(table, SWT.NONE); + SchedulerTableItem.this.progressBar = new ProgressBar(table, SWT.NONE); } - tableEditor = new TableEditor(table); - tableEditor.grabHorizontal = tableEditor.grabVertical = true; - tableEditor.setEditor(progressBar, tableItem, - SchedulerView.PERCENT_COLUMN); + + SchedulerTableItem.this.tableEditor = new TableEditor(table); + SchedulerTableItem.this.tableEditor.grabHorizontal = true; + SchedulerTableItem.this.tableEditor.grabVertical = true; + SchedulerTableItem.this.tableEditor.setEditor( + SchedulerTableItem.this.progressBar, + SchedulerTableItem.this.tableItem, + SchedulerView.PERCENT_COLUMN); } }); } @@ -193,10 +198,10 @@ private void setCalendar() { guiRun(new Runnable() { public void run() { - final String date = getDateString(cal); - final String time = getTimeString(cal); - tableItem.setText(SchedulerView.DATE_COLUMN, date); - tableItem.setText(SchedulerView.TIME_COLUMN, time); + String date = getDateString(SchedulerTableItem.this.calendar); + String time = getTimeString(SchedulerTableItem.this.calendar); + SchedulerTableItem.this.tableItem.setText(SchedulerView.DATE_COLUMN, date); + SchedulerTableItem.this.tableItem.setText(SchedulerView.TIME_COLUMN, time); } }); } @@ -207,17 +212,17 @@ * @param table The parent table */ public void algorithmStarted(Table table) { - done = false; - started = true; - drawTableEntry(table, table.indexOf(tableItem)); + this.done = false; + this.started = true; + drawTableEntry(table, table.indexOf(this.tableItem)); } /** * Notification of rescheduling of the algorithm - * @param cal The rescheduled time + * @param calendar The rescheduled time */ - public void reschedule(Calendar cal) { - this.cal = cal; + public void reschedule(Calendar calendar) { + this.calendar = calendar; setCalendar(); } @@ -226,8 +231,8 @@ * @param table Parent table */ public void errorTableEntry(Table table) { - encounteredError = true; - drawTableEntry(table, table.indexOf(tableItem)); + this.encounteredError = true; + drawTableEntry(table, table.indexOf(this.tableItem)); } /** @@ -237,11 +242,14 @@ public void refresh() { guiRun(new Runnable() { public void run() { - if (!progressBar.isDisposed()) { - progressBar.setSelection(progressSelection); - tableEditor.grabHorizontal = tableEditor.grabVertical = true; - tableEditor.setEditor(progressBar, tableItem, - SchedulerView.PERCENT_COLUMN); + if (!SchedulerTableItem.this.progressBar.isDisposed()) { + SchedulerTableItem.this.progressBar.setSelection(SchedulerTableItem.this.progressSelection); + SchedulerTableItem.this.tableEditor.grabHorizontal = true; + SchedulerTableItem.this.tableEditor.grabVertical = true; + SchedulerTableItem.this.tableEditor.setEditor( + SchedulerTableItem.this.progressBar, + SchedulerTableItem.this.tableItem, + SchedulerView.PERCENT_COLUMN); } } }); @@ -254,8 +262,8 @@ public void remove() { guiRun(new Runnable() { public void run() { - progressBar.dispose(); - tableItem.dispose(); + SchedulerTableItem.this.progressBar.dispose(); + SchedulerTableItem.this.tableItem.dispose(); } }); } @@ -336,8 +344,11 @@ * @return cancellable state */ public boolean isCancellable() { - if (done) return false; - return isCancellable; + if (this.done) { + return false; + } + + return this.isCancellable; } /** @@ -346,8 +357,11 @@ * @return Pausable state */ public boolean isPausable() { - if (done) return false; - return isPauseable; + if (this.done) { + return false; + } + + return this.isPauseable; } /** @@ -363,7 +377,7 @@ * @return Paused state */ public boolean isPaused() { - if (algorithmProgressMonitor.isPaused() && !done) { + if (this.algorithmProgressMonitor.isPaused() && !this.done) { return true; } else { @@ -377,7 +391,7 @@ * @return Running state */ public boolean isRunning() { - if (cancelRequested) { + if (this.cancelRequested) { return false; } return true; @@ -388,77 +402,90 @@ * @return Done state */ public boolean isDone() { - return done; + return this.done; } - /** * Monitors an algorithm - * */ private class AlgorithmProgressMonitor implements ProgressMonitor { - private int totalWorkUnits; + private double totalWorkUnits; public void describeWork(String currentWork) { - workBeingDone = currentWork; + SchedulerTableItem.this.workBeingDone = currentWork; } public void done() { - done = true; + SchedulerTableItem.this.done = true; } public boolean isCanceled() { - return cancelRequested; + return SchedulerTableItem.this.cancelRequested; } public boolean isPaused() { - return pauseRequested; + return SchedulerTableItem.this.pauseRequested; } public void setCanceled(boolean value) { - cancelRequested = value; + SchedulerTableItem.this.cancelRequested = value; } public void setPaused(boolean value) { - pauseRequested = value; + SchedulerTableItem.this.pauseRequested = value; } public void start(int capabilities, int totalWorkUnits) { - + start(capabilities, (double) this.totalWorkUnits); + } + + public void start(int capabilities, double totalWorkUnits) { if ((capabilities & ProgressMonitor.CANCELLABLE) > 0){ - isCancellable = true; + SchedulerTableItem.this.isCancellable = true; } - if ((capabilities & ProgressMonitor.PAUSEABLE) > 0){ - isPauseable = true; + + if ((capabilities & ProgressMonitor.PAUSEABLE) > 0) { + SchedulerTableItem.this.isPauseable = true; } - if ((capabilities & ProgressMonitor.WORK_TRACKABLE) > 0){ + + if ((capabilities & ProgressMonitor.WORK_TRACKABLE) > 0) { refresh(); - isWorkTrackable = true; + SchedulerTableItem.this.isWorkTrackable = true; guiRun(new Runnable() { public void run() { - Table table = (Table)progressBar.getParent(); - progressBar.dispose(); - progressBar = new ProgressBar(table, SWT.NONE); - progressBar.setSelection(progressBar.getMinimum()); - tableEditor = new TableEditor(table); - tableEditor.grabHorizontal = tableEditor.grabVertical = true; - tableEditor.setEditor(progressBar, tableItem, SchedulerView.PERCENT_COLUMN); + Table table = (Table) progressBar.getParent(); + SchedulerTableItem.this.progressBar.dispose(); + SchedulerTableItem.this.progressBar = new ProgressBar(table, SWT.NONE); + SchedulerTableItem.this.progressBar.setSelection(progressBar.getMinimum()); + SchedulerTableItem.this.tableEditor = new TableEditor(table); + SchedulerTableItem.this.tableEditor.grabHorizontal = true; + SchedulerTableItem.this.tableEditor.grabVertical = true; + SchedulerTableItem.this.tableEditor.setEditor( + SchedulerTableItem.this.progressBar, + SchedulerTableItem.this.tableItem, + SchedulerView.PERCENT_COLUMN); } }); } + this.totalWorkUnits = totalWorkUnits; } public void worked(final int work) { - // final int totalWorkUnits = this.totalWorkUnits; + worked((double) work); + } + + public void worked(final double work) { guiRun(new Runnable() { public void run() { - if (!progressBar.isDisposed()) { - progressSelection = (int) (progressBar.getMaximum() * ((double) work / (double) totalWorkUnits)); - // progressBar.setSelection(progress); + if (!SchedulerTableItem.this.progressBar.isDisposed()) { + SchedulerTableItem.this.progressSelection = (int) ( + SchedulerTableItem.this.progressBar.getMaximum() * + (work / AlgorithmProgressMonitor.this.totalWorkUnits)); } } }); + refresh(); } } Modified: trunk/clients/gui/org.cishell.reference.gui.scheduler/src/org/cishell/reference/gui/scheduler/SchedulerView.java =================================================================== --- trunk/clients/gui/org.cishell.reference.gui.scheduler/src/org/cishell/reference/gui/scheduler/SchedulerView.java 2010-09-30 14:55:41 UTC (rev 1140) +++ trunk/clients/gui/org.cishell.reference.gui.scheduler/src/org/cishell/reference/gui/scheduler/SchedulerView.java 2010-10-01 17:30:59 UTC (rev 1141) @@ -338,8 +338,8 @@ .getProperty(AlgorithmProperty.LABEL); } - SchedulerTableItem schedulerTableItem = new SchedulerTableItem( - algorithmLabel, algorithm, cal); + SchedulerTableItem schedulerTableItem = + new SchedulerTableItem(algorithmLabel, cal, algorithm); schedulerTableItem.initTableEntry(table, 0); algorithmToGuiItemMap.put(algorithm, schedulerTableItem); Modified: trunk/core/org.cishell.framework/src/org/cishell/framework/algorithm/ProgressMonitor.java =================================================================== --- trunk/core/org.cishell.framework/src/org/cishell/framework/algorithm/ProgressMonitor.java 2010-09-30 14:55:41 UTC (rev 1140) +++ trunk/core/org.cishell.framework/src/org/cishell/framework/algorithm/ProgressMonitor.java 2010-10-01 17:30:59 UTC (rev 1141) @@ -19,8 +19,6 @@ * description of current work during execution. Except for the setter methods, * the methods are generally only called by the algorithm with the CIShell * application providing the progress monitor implementation. - * - * @author Bruce Herr (bh...@bh...) */ public interface ProgressMonitor { /** @@ -37,7 +35,10 @@ public void setCanceled(boolean value) {} public void setPaused(boolean value) {} public void start(int capabilities, int totalWorkUnits) {} - public void worked(int work) {}}; + public void start(int capabilities, double totalWorkUnits) {} + public void worked(int work) {} + public void worked(double work) {} + }; /** * Capability constant specifying that this algorithm can @@ -69,6 +70,7 @@ * algorithm does not provide progress information */ public void start(int capabilities, int totalWorkUnits); + public void start(int capabilities, double totalWorkUnits); /** * Notifies that a certain number of units of work has been completed @@ -77,6 +79,7 @@ * */ public void worked(int work); + public void worked(double work); /** * The algorithm is finished executing This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pat...@us...> - 2010-10-19 22:08:31
|
Revision: 1143 http://cishell.svn.sourceforge.net/cishell/?rev=1143&view=rev Author: pataphil Date: 2010-10-19 22:08:25 +0000 (Tue, 19 Oct 2010) Log Message: ----------- * mutateParameters can now throw AllParametersMutatedOutException if the AlgorithmFactory wishes to not present the user with any input options. * Reviewed by Micah. Modified Paths: -------------- trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/menu/AlgorithmWrapper.java Added Paths: ----------- trunk/core/org.cishell.framework/src/org/cishell/framework/algorithm/AllParametersMutatedOutException.java Modified: trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/menu/AlgorithmWrapper.java =================================================================== --- trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/menu/AlgorithmWrapper.java 2010-10-04 21:57:32 UTC (rev 1142) +++ trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/menu/AlgorithmWrapper.java 2010-10-19 22:08:25 UTC (rev 1143) @@ -31,6 +31,7 @@ import org.cishell.framework.algorithm.AlgorithmExecutionException; import org.cishell.framework.algorithm.AlgorithmFactory; import org.cishell.framework.algorithm.AlgorithmProperty; +import org.cishell.framework.algorithm.AllParametersMutatedOutException; import org.cishell.framework.algorithm.DataValidator; import org.cishell.framework.algorithm.ParameterMutator; import org.cishell.framework.algorithm.ProgressMonitor; @@ -373,16 +374,22 @@ if ((factory instanceof ParameterMutator) && (provider != null)) { try { - ObjectClassDefinition ocd = provider.getObjectClassDefinition(metatypePID, null); + ObjectClassDefinition objectClassDefinition = + provider.getObjectClassDefinition(metatypePID, null); - if (ocd == null) { + if (objectClassDefinition == null) { logNullOCDWarning(pid, metatypePID); } - ocd = ((ParameterMutator) factory).mutateParameters(data, ocd); + try { + objectClassDefinition = + ((ParameterMutator) factory).mutateParameters(data, objectClassDefinition); - if (ocd != null) { - provider = new BasicMetaTypeProvider(ocd); + if (objectClassDefinition != null) { + provider = new BasicMetaTypeProvider(objectClassDefinition); + } + } catch (AllParametersMutatedOutException e) { + provider = null; } } catch (IllegalArgumentException e) { log(LogService.LOG_DEBUG, pid + " has an invalid metatype id: " + metatypePID, e); Added: trunk/core/org.cishell.framework/src/org/cishell/framework/algorithm/AllParametersMutatedOutException.java =================================================================== --- trunk/core/org.cishell.framework/src/org/cishell/framework/algorithm/AllParametersMutatedOutException.java (rev 0) +++ trunk/core/org.cishell.framework/src/org/cishell/framework/algorithm/AllParametersMutatedOutException.java 2010-10-19 22:08:25 UTC (rev 1143) @@ -0,0 +1,21 @@ +package org.cishell.framework.algorithm; + +public class AllParametersMutatedOutException extends RuntimeException { + private static final long serialVersionUID = 9017277008277139930L; + + public AllParametersMutatedOutException(String message, Throwable exception) { + super(message, exception); + } + + public AllParametersMutatedOutException(Throwable exception) { + super(exception); + } + + public AllParametersMutatedOutException(String message) { + super(message); + } + + public AllParametersMutatedOutException() { + this("Algorithm canceled by user."); + } +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pat...@us...> - 2010-11-04 21:35:02
|
Revision: 1150 http://cishell.svn.sourceforge.net/cishell/?rev=1150&view=rev Author: pataphil Date: 2010-11-04 21:34:56 +0000 (Thu, 04 Nov 2010) Log Message: ----------- * Added R icon for use in the Data Manager. Modified Paths: -------------- trunk/clients/gui/org.cishell.reference.gui.datamanager/src/org/cishell/reference/gui/datamanager/DataGUIItem.java trunk/core/org.cishell.framework/src/org/cishell/framework/data/DataProperty.java Added Paths: ----------- trunk/clients/gui/org.cishell.reference.gui.brand.cishell/icons/r.png Added: trunk/clients/gui/org.cishell.reference.gui.brand.cishell/icons/r.png =================================================================== (Binary files differ) Property changes on: trunk/clients/gui/org.cishell.reference.gui.brand.cishell/icons/r.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Modified: trunk/clients/gui/org.cishell.reference.gui.datamanager/src/org/cishell/reference/gui/datamanager/DataGUIItem.java =================================================================== --- trunk/clients/gui/org.cishell.reference.gui.datamanager/src/org/cishell/reference/gui/datamanager/DataGUIItem.java 2010-11-02 17:48:25 UTC (rev 1149) +++ trunk/clients/gui/org.cishell.reference.gui.datamanager/src/org/cishell/reference/gui/datamanager/DataGUIItem.java 2010-11-04 21:34:56 UTC (rev 1150) @@ -44,6 +44,7 @@ private Image rasterImageIcon; private Image vectorImageIcon; private Image modelIcon; + private Image rIcon; private Map typeToImageMapping; @@ -75,6 +76,7 @@ rasterImageIcon = getImage("raster_image.jpg", this.brandPluginID); vectorImageIcon = getImage("vector_image.jpg", this.brandPluginID); modelIcon = getImage("model.jpg", this.brandPluginID); + rIcon = getImage("r.png", this.brandPluginID); typeToImageMapping = new HashMap(); registerImage(DataProperty.OTHER_TYPE, unknownIcon); @@ -96,6 +98,7 @@ registerImage(DataProperty.RASTER_IMAGE_TYPE, rasterImageIcon); registerImage(DataProperty.VECTOR_IMAGE_TYPE, vectorImageIcon); registerImage(DataProperty.MODEL_TYPE, modelIcon); + registerImage(DataProperty.R_INSTANCE_TYPE, rIcon); } /** Modified: trunk/core/org.cishell.framework/src/org/cishell/framework/data/DataProperty.java =================================================================== --- trunk/core/org.cishell.framework/src/org/cishell/framework/data/DataProperty.java 2010-11-02 17:48:25 UTC (rev 1149) +++ trunk/core/org.cishell.framework/src/org/cishell/framework/data/DataProperty.java 2010-11-04 21:34:56 UTC (rev 1150) @@ -93,4 +93,7 @@ /** Says this data model is a 'model' object */ public static String MODEL_TYPE = "Model"; + + /** Says this data model is an 'R instance' object */ + public static String R_INSTANCE_TYPE = "R Instance"; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pat...@us...> - 2010-12-28 03:10:56
|
Revision: 1185 http://cishell.svn.sourceforge.net/cishell/?rev=1185&view=rev Author: pataphil Date: 2010-12-28 03:10:49 +0000 (Tue, 28 Dec 2010) Log Message: ----------- * Changed nwb.slis.indiana.edu to nwb.cns.iu.edu to try to fix the builds. Modified Paths: -------------- trunk/core/org.cishell.algorithm.convertergraph/OSGI-INF/algorithm.properties trunk/core/org.cishell.docs.draft-spec/src/draft-specification/draft-spec.tex trunk/core/org.cishell.docs.intro/src/resources.tex trunk/deployment/org.cishell.reference.releng/build-files/fetchSvnAll.xml Added Paths: ----------- trunk/clients/scripting/org.cishell.reference.scripting/.pydevproject Added: trunk/clients/scripting/org.cishell.reference.scripting/.pydevproject =================================================================== --- trunk/clients/scripting/org.cishell.reference.scripting/.pydevproject (rev 0) +++ trunk/clients/scripting/org.cishell.reference.scripting/.pydevproject 2010-12-28 03:10:49 UTC (rev 1185) @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<?eclipse-pydev version="1.0"?> + +<pydev_project> +<pydev_property name="org.python.pydev.PYTHON_PROJECT_INTERPRETER">Default</pydev_property> +<pydev_property name="org.python.pydev.PYTHON_PROJECT_VERSION">python 2.7</pydev_property> +</pydev_project> Modified: trunk/core/org.cishell.algorithm.convertergraph/OSGI-INF/algorithm.properties =================================================================== --- trunk/core/org.cishell.algorithm.convertergraph/OSGI-INF/algorithm.properties 2010-12-22 21:52:31 UTC (rev 1184) +++ trunk/core/org.cishell.algorithm.convertergraph/OSGI-INF/algorithm.properties 2010-12-28 03:10:49 UTC (rev 1185) @@ -9,4 +9,4 @@ author=Chintan Tank implementers=Chintan Tank integrators=Chintan Tank -documentation_url=https://nwb.slis.indiana.edu/community/?n=File.ConverterGraph \ No newline at end of file +documentation_url=https://nwb.cns.iu.edu/community/?n=File.ConverterGraph \ No newline at end of file Modified: trunk/core/org.cishell.docs.draft-spec/src/draft-specification/draft-spec.tex =================================================================== --- trunk/core/org.cishell.docs.draft-spec/src/draft-specification/draft-spec.tex 2010-12-22 21:52:31 UTC (rev 1184) +++ trunk/core/org.cishell.docs.draft-spec/src/draft-specification/draft-spec.tex 2010-12-28 03:10:49 UTC (rev 1185) @@ -422,7 +422,7 @@ \end{figure} \footnotetext[5]{http://sourceforge.net/projects/ivc} -\footnotetext[6]{http://nwb.slis.indiana.edu} +\footnotetext[6]{http://nwb.cns.iu.edu} The CIShell Framework should work beautifully with a GUI client. The previous iterations of this project were all GUI based, so by far this is the most Modified: trunk/core/org.cishell.docs.intro/src/resources.tex =================================================================== --- trunk/core/org.cishell.docs.intro/src/resources.tex 2010-12-22 21:52:31 UTC (rev 1184) +++ trunk/core/org.cishell.docs.intro/src/resources.tex 2010-12-28 03:10:49 UTC (rev 1185) @@ -1,7 +1,7 @@ \begin{thebibliography}{3} \bibitem{cishell}{CIShell Homepage: http://cishell.org} -\bibitem{nwb}{NWB Homepage: http://nwb.slis.indiana.edu} -\bibitem{nwbCommunityWiki}{NWB Community: https://nwb.slis.indiana.edu/community} +\bibitem{nwb}{NWB Homepage: http://nwb.cns.iu.edu} +\bibitem{nwbCommunityWiki}{NWB Community: https://nwb.cns.iu.edu/community} \bibitem{osgi}{OSGi: http://www.osgi.org} \bibitem{eclipse}{Eclipse: http://www.eclipse.org} \end{thebibliography} \ No newline at end of file Modified: trunk/deployment/org.cishell.reference.releng/build-files/fetchSvnAll.xml =================================================================== --- trunk/deployment/org.cishell.reference.releng/build-files/fetchSvnAll.xml 2010-12-22 21:52:31 UTC (rev 1184) +++ trunk/deployment/org.cishell.reference.releng/build-files/fetchSvnAll.xml 2010-12-28 03:10:49 UTC (rev 1185) @@ -191,7 +191,7 @@ <param name="target" value="plugins"/> <param name="element.id" value="org.prefuse.lib"/> <param name="project.name" value="/plugins/libs/prefuselib"/> - <param name="url" value="http://nwb.slis.indiana.edu/svn/nwb/trunk"/> + <param name="url" value="http://nwb.cns.iu.edu/svn/nwb/trunk"/> </antcall> <antcall target="svn.co"> <param name="target" value="plugins"/> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pat...@us...> - 2011-02-08 17:28:03
|
Revision: 1197 http://cishell.svn.sourceforge.net/cishell/?rev=1197&view=rev Author: pataphil Date: 2011-02-08 17:27:54 +0000 (Tue, 08 Feb 2011) Log Message: ----------- * Added drag-and-drop file loading functionality. * Reviewed by Micah. * Refactored file loading to be done via service instead of explicitly through an algorithm. Modified Paths: -------------- trunk/clients/gui/org.cishell.reference.gui.datamanager/META-INF/MANIFEST.MF trunk/clients/gui/org.cishell.reference.gui.datamanager/src/org/cishell/reference/gui/datamanager/AbstractDataManagerView.java trunk/clients/gui/org.cishell.reference.gui.datamanager/src/org/cishell/reference/gui/datamanager/Activator.java trunk/clients/gui/org.cishell.reference.gui.persistence/META-INF/MANIFEST.MF trunk/clients/gui/org.cishell.reference.gui.persistence/OSGI-INF/load.properties trunk/clients/gui/org.cishell.reference.gui.persistence/OSGI-INF/load.xml trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/load/FileLoadAlgorithm.java trunk/core/org.cishell.framework/META-INF/MANIFEST.MF trunk/core/org.cishell.framework/src/org/cishell/framework/data/DataProperty.java trunk/core/org.cishell.reference/META-INF/MANIFEST.MF trunk/core/org.cishell.reference/build.properties Added Paths: ----------- trunk/clients/gui/org.cishell.reference.gui.persistence/OSGI-INF/fileloader.properties trunk/clients/gui/org.cishell.reference.gui.persistence/OSGI-INF/fileloader.xml trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/load/FileLoaderAlgorithm.java trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/load/FileLoaderAlgorithmFactory.java trunk/core/org.cishell.framework/src/org/cishell/app/service/fileloader/ trunk/core/org.cishell.framework/src/org/cishell/app/service/fileloader/FileLoadException.java trunk/core/org.cishell.framework/src/org/cishell/app/service/fileloader/FileLoadListener.java trunk/core/org.cishell.framework/src/org/cishell/app/service/fileloader/FileLoaderService.java trunk/core/org.cishell.framework/src/org/cishell/framework/CIShellContextDelegate.java trunk/core/org.cishell.framework/src/org/cishell/framework/LogServiceDelegate.java trunk/core/org.cishell.framework/src/org/cishell/framework/ServiceReferenceDelegate.java trunk/core/org.cishell.framework/src/org/cishell/framework/algorithm/AlgorithmFactory2.java trunk/core/org.cishell.reference/OSGI-INF/ trunk/core/org.cishell.reference/OSGI-INF/fileloader.properties trunk/core/org.cishell.reference/OSGI-INF/fileloader.xml trunk/core/org.cishell.reference/src/org/cishell/reference/app/service/fileloader/ trunk/core/org.cishell.reference/src/org/cishell/reference/app/service/fileloader/FileFormatSelector.java trunk/core/org.cishell.reference/src/org/cishell/reference/app/service/fileloader/FileLoaderServiceImpl.java trunk/core/org.cishell.reference/src/org/cishell/reference/app/service/fileloader/FileSelectorRunnable.java trunk/core/org.cishell.reference/src/org/cishell/reference/app/service/fileloader/FileValidator.java trunk/core/org.cishell.reference/src/org/cishell/reference/app/service/fileloader/PrettyLabeler.java trunk/core/org.cishell.reference/src/org/cishell/reference/app/service/fileloader/ValidatorSelectorRunnable.java Modified: trunk/clients/gui/org.cishell.reference.gui.datamanager/META-INF/MANIFEST.MF =================================================================== --- trunk/clients/gui/org.cishell.reference.gui.datamanager/META-INF/MANIFEST.MF 2011-02-04 16:25:21 UTC (rev 1196) +++ trunk/clients/gui/org.cishell.reference.gui.datamanager/META-INF/MANIFEST.MF 2011-02-08 17:27:54 UTC (rev 1197) @@ -13,6 +13,7 @@ org.cishell.reference.gui.datamanager, org.cishell.reference.gui.workspace, org.cishell.service.guibuilder;version="1.0.0", + org.cishell.utilities, org.osgi.service.log;version="1.3.0" Export-Package: org.cishell.reference.gui.datamanager Bundle-ActivationPolicy: lazy Modified: trunk/clients/gui/org.cishell.reference.gui.datamanager/src/org/cishell/reference/gui/datamanager/AbstractDataManagerView.java =================================================================== --- trunk/clients/gui/org.cishell.reference.gui.datamanager/src/org/cishell/reference/gui/datamanager/AbstractDataManagerView.java 2011-02-04 16:25:21 UTC (rev 1196) +++ trunk/clients/gui/org.cishell.reference.gui.datamanager/src/org/cishell/reference/gui/datamanager/AbstractDataManagerView.java 2011-02-08 17:27:54 UTC (rev 1197) @@ -13,6 +13,9 @@ * ***************************************************************************/ package org.cishell.reference.gui.datamanager; +import java.io.File; +import java.util.ArrayList; +import java.util.Collection; import java.util.Dictionary; import java.util.HashMap; import java.util.HashSet; @@ -23,13 +26,16 @@ import org.cishell.app.service.datamanager.DataManagerListener; import org.cishell.app.service.datamanager.DataManagerService; +import org.cishell.framework.LocalCIShellContext; import org.cishell.framework.algorithm.Algorithm; -import org.cishell.framework.algorithm.AlgorithmCanceledException; 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.framework.data.DataProperty; import org.cishell.reference.gui.workspace.CIShellApplication; +import org.cishell.utilities.AlgorithmUtilities; +import org.cishell.utilities.StringUtilities; import org.eclipse.jface.action.ActionContributionItem; import org.eclipse.jface.action.IMenuManager; import org.eclipse.jface.viewers.ISelection; @@ -41,6 +47,12 @@ import org.eclipse.jface.viewers.TreeViewer; import org.eclipse.swt.SWT; import org.eclipse.swt.custom.TreeEditor; +import org.eclipse.swt.dnd.DND; +import org.eclipse.swt.dnd.DropTarget; +import org.eclipse.swt.dnd.DropTargetAdapter; +import org.eclipse.swt.dnd.DropTargetEvent; +import org.eclipse.swt.dnd.FileTransfer; +import org.eclipse.swt.dnd.Transfer; import org.eclipse.swt.events.FocusAdapter; import org.eclipse.swt.events.FocusEvent; import org.eclipse.swt.events.KeyAdapter; @@ -185,7 +197,89 @@ } getSite().setSelectionProvider(new DataModelSelectionProvider()); + + DropTarget dropTarget = + new DropTarget(parent.getParent(), DND.DROP_DEFAULT | DND.DROP_MOVE); + dropTarget.setTransfer(new Transfer[] { FileTransfer.getInstance() }); + dropTarget.addDropListener(new DropTargetAdapter() { + @Override + public void drop(DropTargetEvent event) { + String fileNames[] = null; + FileTransfer fileTransfer = FileTransfer.getInstance(); + + if (fileTransfer.isSupportedType(event.currentDataType)) { + fileNames = (String[]) event.data; + Collection<File> flattenedFileStructure = + flattenDraggedFileStructures(fileNames); + Collection<Data> dataForProcessing = new ArrayList<Data>(); + + for (File file : flattenedFileStructure) { + dataForProcessing.add(new BasicData(file, "")); + } + + AlgorithmFactory fileLoaderFactory = + AlgorithmUtilities.getAlgorithmFactoryByPID( + "org.cishell.reference.gui.persistence.load.FileLoaderAlgorithm", + Activator.context); + DataManagerService dataManager = + (DataManagerService) Activator.context.getService( + Activator.context.getServiceReference( + DataManagerService.class.getName())); + + try { + Data[] inputData = fileLoaderFactory.createAlgorithm( + dataForProcessing.toArray(new Data[0]), + new Hashtable<String, Object>(), + new LocalCIShellContext(Activator.context)).execute(); + + for (Data inputDatum : inputData) { + dataManager.addData(inputDatum); + } + } catch (Throwable e) { + String format = + "An error occurred when loading your files.%n" + + "Please include the following when reporting this:%n%s"; + String logMessage = + String.format(format, StringUtilities.getStackTraceAsString(e)); + AbstractDataManagerView.this.logger.log(LogService.LOG_ERROR, logMessage); + } + } + } + }); } + + private Collection<File> flattenDraggedFileStructures(String[] fileNames) { + Collection<File> flattenedFileStructure = new ArrayList<File>(); + + for (String fileName : fileNames) { + flattenedFileStructure.addAll(flattenDraggedFileStructure(fileName)); + } + + return flattenedFileStructure; + } + + private Collection<File> flattenDraggedFileStructure(String fileName) { + File file = new File(fileName); + + if (file.isFile()) { + Collection<File> flattenedFileStructure = new ArrayList<File>(); + flattenedFileStructure.add(file); + + return flattenedFileStructure; + } else if (file.isDirectory()) { + Collection<File> flattenedFileStructure = new ArrayList<File>(); + + for (String childFileName : file.list()) { + String completeChildFileName = String.format( + "%s%s%s", fileName, File.separator, childFileName); + flattenedFileStructure.addAll(flattenDraggedFileStructure(completeChildFileName)); + } + + return flattenedFileStructure; + } else { + return new ArrayList<File>(); + } + } public void bundleChanged(BundleEvent event) { if (event.getType() == BundleEvent.STARTED) { Modified: trunk/clients/gui/org.cishell.reference.gui.datamanager/src/org/cishell/reference/gui/datamanager/Activator.java =================================================================== --- trunk/clients/gui/org.cishell.reference.gui.datamanager/src/org/cishell/reference/gui/datamanager/Activator.java 2011-02-04 16:25:21 UTC (rev 1196) +++ trunk/clients/gui/org.cishell.reference.gui.datamanager/src/org/cishell/reference/gui/datamanager/Activator.java 2011-02-08 17:27:54 UTC (rev 1197) @@ -18,7 +18,7 @@ // The plug-in ID public static final String PLUGIN_ID = "org.cishell.reference.gui.datamanager"; - private static BundleContext context; + public static BundleContext context; // The shared instance private static Activator plugin; 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 2011-02-04 16:25:21 UTC (rev 1196) +++ trunk/clients/gui/org.cishell.reference.gui.persistence/META-INF/MANIFEST.MF 2011-02-08 17:27:54 UTC (rev 1197) @@ -5,6 +5,7 @@ Bundle-Version: 1.0.0 Bundle-ClassPath: . Import-Package: org.cishell.app.service.datamanager, + org.cishell.app.service.fileloader, org.cishell.framework;version="1.0.0", org.cishell.framework.algorithm;version="1.0.0", org.cishell.framework.data;version="1.0.0", @@ -23,7 +24,7 @@ org.osgi.service.metatype;version="1.1.0", org.osgi.service.prefs;version="1.1.0" X-AutoStart: true -Service-Component: OSGI-INF/load.xml, OSGI-INF/save.xml, OSGI-INF/view.xml, OSGI-INF/viewwith.xml +Service-Component: OSGI-INF/load.xml, OSGI-INF/save.xml, OSGI-INF/view.xml, OSGI-INF/viewwith.xml, OSGI-INF/fileloader.xml Require-Bundle: org.eclipse.swt, org.eclipse.ui Bundle-RequiredExecutionEnvironment: J2SE-1.5 Added: trunk/clients/gui/org.cishell.reference.gui.persistence/OSGI-INF/fileloader.properties =================================================================== --- trunk/clients/gui/org.cishell.reference.gui.persistence/OSGI-INF/fileloader.properties (rev 0) +++ trunk/clients/gui/org.cishell.reference.gui.persistence/OSGI-INF/fileloader.properties 2011-02-08 17:27:54 UTC (rev 1197) @@ -0,0 +1,8 @@ +#menu_path=File/start +label=File Loader +description=This does the actual loading of files from the file system and loads them to Data Model window. +in_data=null +out_data=java.lang.Object +service.pid=org.cishell.reference.gui.persistence.load.FileLoaderAlgorithm +remoteable=true +documentation_url=http://wiki.slis.indiana.edu:8080/display/ALGDOC/Data+Formats \ No newline at end of file Added: trunk/clients/gui/org.cishell.reference.gui.persistence/OSGI-INF/fileloader.xml =================================================================== --- trunk/clients/gui/org.cishell.reference.gui.persistence/OSGI-INF/fileloader.xml (rev 0) +++ trunk/clients/gui/org.cishell.reference.gui.persistence/OSGI-INF/fileloader.xml 2011-02-08 17:27:54 UTC (rev 1197) @@ -0,0 +1,11 @@ +<?xml version="1.0" encoding="UTF-8"?> +<component name="org.cishell.reference.gui.persistence.load.FileLoaderAlgorithm.component" immediate="false"> + <implementation class="org.cishell.reference.gui.persistence.load.FileLoaderAlgorithmFactory"/> + <properties entry="OSGI-INF/fileloader.properties"/> + <reference name="LOG" interface="org.osgi.service.log.LogService"/> + <reference name="MTS" interface="org.osgi.service.metatype.MetaTypeService"/> + + <service> + <provide interface="org.cishell.framework.algorithm.AlgorithmFactory"/> + </service> +</component> \ No newline at end of file Modified: trunk/clients/gui/org.cishell.reference.gui.persistence/OSGI-INF/load.properties =================================================================== --- trunk/clients/gui/org.cishell.reference.gui.persistence/OSGI-INF/load.properties 2011-02-04 16:25:21 UTC (rev 1196) +++ trunk/clients/gui/org.cishell.reference.gui.persistence/OSGI-INF/load.properties 2011-02-08 17:27:54 UTC (rev 1197) @@ -1,7 +1,7 @@ menu_path=File/start label=Load... shortcut=ctrl+alt+o -description=This allows users to select file from the file system and load it to Data Model window +description=This allows users to select files from the file system and load them to Data Model window. in_data=null out_data=java.lang.Object service.pid=org.cishell.reference.gui.persistence.load.FileLoadAlgorithm Modified: trunk/clients/gui/org.cishell.reference.gui.persistence/OSGI-INF/load.xml =================================================================== --- trunk/clients/gui/org.cishell.reference.gui.persistence/OSGI-INF/load.xml 2011-02-04 16:25:21 UTC (rev 1196) +++ trunk/clients/gui/org.cishell.reference.gui.persistence/OSGI-INF/load.xml 2011-02-08 17:27:54 UTC (rev 1197) @@ -1,14 +1,14 @@ -<?xml version="1.0" encoding="UTF-8"?> -<component name="org.cishell.reference.gui.persistence.load.FileLoadAlgorithm.component" immediate="false"> - <implementation class="org.cishell.reference.gui.persistence.load.FileLoadFactory"/> - <properties entry="OSGI-INF/load.properties"/> - <reference name="LOG" interface="org.osgi.service.log.LogService"/> - <reference name="MTS" interface="org.osgi.service.metatype.MetaTypeService"/> - - <service> - <provide interface= - "org.cishell.framework.algorithm.AlgorithmFactory"/> - <provide interface= - "org.osgi.service.cm.ManagedService"/> - </service> +<?xml version="1.0" encoding="UTF-8"?> +<component name="org.cishell.reference.gui.persistence.load.FileLoadAlgorithm.component" immediate="false"> + <implementation class="org.cishell.reference.gui.persistence.load.FileLoadFactory"/> + <properties entry="OSGI-INF/load.properties"/> + <reference name="LOG" interface="org.osgi.service.log.LogService"/> + <reference name="MTS" interface="org.osgi.service.metatype.MetaTypeService"/> + + <service> + <provide interface= + "org.cishell.framework.algorithm.AlgorithmFactory"/> + <provide interface= + "org.osgi.service.cm.ManagedService"/> + </service> </component> \ No newline at end of file Modified: trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/load/FileLoadAlgorithm.java =================================================================== --- trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/load/FileLoadAlgorithm.java 2011-02-04 16:25:21 UTC (rev 1196) +++ trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/load/FileLoadAlgorithm.java 2011-02-08 17:27:54 UTC (rev 1197) @@ -1,15 +1,13 @@ package org.cishell.reference.gui.persistence.load; import java.io.File; -import java.io.UnsupportedEncodingException; -import java.util.ArrayList; -import java.util.Collection; import java.util.Dictionary; +import org.cishell.app.service.fileloader.FileLoadException; +import org.cishell.app.service.fileloader.FileLoaderService; 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.ProgressMonitor; import org.cishell.framework.algorithm.ProgressTrackable; import org.cishell.framework.data.Data; @@ -26,6 +24,7 @@ public static String defaultLoadDirectory; private final LogService logger; + private FileLoaderService fileLoader; private BundleContext bundleContext; private CIShellContext ciShellContext; private ProgressMonitor progressMonitor = ProgressMonitor.NULL_MONITOR; @@ -34,7 +33,9 @@ CIShellContext ciShellContext, BundleContext bundleContext, Dictionary<String, Object> preferences) { - this.logger = (LogService)ciShellContext.getService(LogService.class.getName()); + this.logger = (LogService) ciShellContext.getService(LogService.class.getName()); + this.fileLoader = + (FileLoaderService) ciShellContext.getService(FileLoaderService.class.getName()); this.ciShellContext = ciShellContext; this.bundleContext = bundleContext; @@ -45,26 +46,37 @@ } public Data[] execute() throws AlgorithmExecutionException { - IWorkbenchWindow window = getFirstWorkbenchWindow(); - Display display = PlatformUI.getWorkbench().getDisplay(); - File[] files = getFilesToLoadFromUser(window, display); - - if ((files != null) && (files.length != 0)) { - Collection<Data> finalLabeledFileData = new ArrayList<Data>(); - - for (File file : files) { - Data[] validatedFileData = validateFile(window, display, file); - Data[] labeledFileData = labelFileData(file, validatedFileData); - - for (Data data : labeledFileData) { - finalLabeledFileData.add(data); - } - } - - return finalLabeledFileData.toArray(new Data[0]); - } else { - return null; + try { + return this.fileLoader.loadFilesFromUserSelection( + this.bundleContext, this.ciShellContext, this.logger, this.progressMonitor); + } catch (FileLoadException e) { + throw new AlgorithmExecutionException(e.getMessage(), e); } +// IWorkbenchWindow window = getFirstWorkbenchWindow(); +// Display display = PlatformUI.getWorkbench().getDisplay(); +// File[] files = getFilesToLoadFromUser(window, display); +// +// if (files != null) { +//// try { +// return new FileLoaderAlgorithm( +// this.bundleContext, +// files, +// this.ciShellContext, +// this.logger, +// this.progressMonitor).execute(); +//// } catch (Throwable e) { +//// String format = +//// "The chosen file is not compatible with this format. " + +//// "Check that your file is correctly formatted or try another validator. " + +//// "The reason is: %s"; +//// String logMessage = String.format(format, e.getMessage()); +//// this.logger.log(LogService.LOG_ERROR, logMessage, e); +//// +//// return null; +//// } +// } else { +// return null; +// } } public ProgressMonitor getProgressMonitor() { @@ -101,62 +113,4 @@ return fileSelector.getFiles(); } - - private Data[] validateFile(IWorkbenchWindow window, Display display, File file) { - AlgorithmFactory validator = null; - - try { - validator = getValidatorFromUser(window, display, file); - - if ((file == null) || (validator == null)) { - String logMessage = "File loading canceled"; - this.logger.log(LogService.LOG_WARNING, logMessage); - } else { - try { - return FileValidator.validateFile( - file, validator, this.progressMonitor, this.ciShellContext, this.logger); - } catch (AlgorithmExecutionException e) { - if ((e.getCause() != null) - && (e.getCause() instanceof UnsupportedEncodingException)) { - String format = - "This file cannot be loaded; it uses the unsupported character " + - "encoding %s."; - String logMessage = String.format(format, e.getCause().getMessage()); - this.logger.log(LogService.LOG_ERROR, logMessage); - } else { - throw e; - } - } - } - } catch (Throwable e) { - String logMessage = - "The chosen file is not compatible with this format. " + - "Check that your file is correctly formatted or try another validator. " + - "The reason is: " + e.getMessage(); - this.logger.log(LogService.LOG_ERROR, logMessage); - } - - return new Data[0]; - } - - private Data[] labelFileData(File file, Data[] validatedFileData) { - Data[] labeledFileData = PrettyLabeler.relabelWithFileNameHierarchy( - validatedFileData, file); - - return labeledFileData; - } - - private AlgorithmFactory getValidatorFromUser( - IWorkbenchWindow window, Display display, File file) { - ValidatorSelectorRunnable validatorSelector = - new ValidatorSelectorRunnable(window, this.bundleContext, file); - - if (Thread.currentThread() != display.getThread()) { - display.syncExec(validatorSelector); - } else { - validatorSelector.run(); - } - - return validatorSelector.getValidator(); - } } \ No newline at end of file Added: trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/load/FileLoaderAlgorithm.java =================================================================== --- trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/load/FileLoaderAlgorithm.java (rev 0) +++ trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/load/FileLoaderAlgorithm.java 2011-02-08 17:27:54 UTC (rev 1197) @@ -0,0 +1,131 @@ +package org.cishell.reference.gui.persistence.load; + +import java.io.File; +import java.io.UnsupportedEncodingException; +import java.util.ArrayList; +import java.util.Collection; + +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.ProgressMonitor; +import org.cishell.framework.data.Data; +import org.eclipse.swt.widgets.Display; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.PlatformUI; +import org.osgi.framework.BundleContext; +import org.osgi.service.log.LogService; + +public class FileLoaderAlgorithm implements Algorithm { + private BundleContext bundleContext; + private File[] filesToLoad; + private CIShellContext ciShellContext; + private LogService logger; + private ProgressMonitor progressMonitor; + + public FileLoaderAlgorithm( + BundleContext bundleContext, + File[] filesToLoad, + CIShellContext ciShellContext, + LogService logger, + ProgressMonitor progressMonitor) { + this.bundleContext = bundleContext; + this.filesToLoad = filesToLoad; + this.ciShellContext = ciShellContext; + this.logger = logger; + this.progressMonitor = progressMonitor; + } + + public Data[] execute() throws AlgorithmExecutionException { + IWorkbenchWindow window = getFirstWorkbenchWindow(); + Display display = PlatformUI.getWorkbench().getDisplay(); + + if ((this.filesToLoad != null) && (this.filesToLoad.length != 0)) { + Collection<Data> finalLabeledFileData = new ArrayList<Data>(); + + for (File file : this.filesToLoad) { + try { + Data[] validatedFileData = validateFile(window, display, file); + Data[] labeledFileData = labelFileData(file, validatedFileData); + + for (Data data : labeledFileData) { + finalLabeledFileData.add(data); + } + } catch (Throwable e) { + String format = + "The chosen file is not compatible with this format. " + + "Check that your file is correctly formatted or try another validator. " + + "The reason is: %s"; + String logMessage = String.format(format, e.getMessage()); + this.logger.log(LogService.LOG_ERROR, logMessage, e); + } + } + + return finalLabeledFileData.toArray(new Data[0]); + } else { + return null; + } + } + + private IWorkbenchWindow getFirstWorkbenchWindow() throws AlgorithmExecutionException { + final IWorkbenchWindow[] windows = PlatformUI.getWorkbench().getWorkbenchWindows(); + + if (windows.length == 0) { + throw new AlgorithmExecutionException( + "Cannot obtain workbench window needed to open dialog."); + } else { + return windows[0]; + } + } + + private Data[] validateFile(IWorkbenchWindow window, Display display, File file) + throws AlgorithmExecutionException { + AlgorithmFactory validator = null; + validator = getValidatorFromUser(window, display, file); + + if ((file == null) || (validator == null)) { + String logMessage = "File loading canceled"; + this.logger.log(LogService.LOG_WARNING, logMessage); + } else { + try { + return FileValidator.validateFile( + file, validator, this.progressMonitor, this.ciShellContext, this.logger); + } catch (AlgorithmExecutionException e) { + if ((e.getCause() != null) + && (e.getCause() instanceof UnsupportedEncodingException)) { + String format = + "This file cannot be loaded; it uses the unsupported character " + + "encoding %s."; + String logMessage = String.format(format, e.getCause().getMessage()); + this.logger.log(LogService.LOG_ERROR, logMessage); + } else { + throw e; + } + } + } + + return new Data[0]; + } + + private Data[] labelFileData(File file, Data[] validatedFileData) { + Data[] labeledFileData = + PrettyLabeler.relabelWithFileNameHierarchy(validatedFileData, file); + + return labeledFileData; + } + + private AlgorithmFactory getValidatorFromUser( + IWorkbenchWindow window, Display display, File file) { + ValidatorSelectorRunnable validatorSelector = + new ValidatorSelectorRunnable(window, this.bundleContext, file); + + if (Thread.currentThread() != display.getThread()) { + display.syncExec(validatorSelector); + } else { + validatorSelector.run(); + } + + return validatorSelector.getValidator(); + } +} \ No newline at end of file Added: trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/load/FileLoaderAlgorithmFactory.java =================================================================== --- trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/load/FileLoaderAlgorithmFactory.java (rev 0) +++ trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/load/FileLoaderAlgorithmFactory.java 2011-02-08 17:27:54 UTC (rev 1197) @@ -0,0 +1,40 @@ +package org.cishell.reference.gui.persistence.load; + +import java.io.File; +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.ProgressMonitor; +import org.cishell.framework.data.Data; +import org.osgi.framework.BundleContext; +import org.osgi.service.component.ComponentContext; +import org.osgi.service.log.LogService; + +public class FileLoaderAlgorithmFactory implements AlgorithmFactory { + private BundleContext bundleContext; + private LogService logger; + + protected void activate(ComponentContext componentContext) { + this.bundleContext = componentContext.getBundleContext(); + this.logger = (LogService) this.bundleContext.getService( + this.bundleContext.getServiceReference(LogService.class.getName())); + } + + public Algorithm createAlgorithm( + Data[] data, Dictionary<String, Object> parameters, CIShellContext ciShellContext) { + File[] filesToLoad = new File[data.length]; + + for (int ii = 0; ii < data.length; ii++) { + filesToLoad[ii] = (File) data[ii].getData(); + } + + return new FileLoaderAlgorithm( + this.bundleContext, + filesToLoad, + ciShellContext, + this.logger, + ProgressMonitor.NULL_MONITOR); + } +} \ No newline at end of file Modified: trunk/core/org.cishell.framework/META-INF/MANIFEST.MF =================================================================== --- trunk/core/org.cishell.framework/META-INF/MANIFEST.MF 2011-02-04 16:25:21 UTC (rev 1196) +++ trunk/core/org.cishell.framework/META-INF/MANIFEST.MF 2011-02-08 17:27:54 UTC (rev 1197) @@ -5,11 +5,13 @@ Bundle-Version: 1.0.0 Bundle-Vendor: Cyberinfrastructure for Network Science Center Bundle-RequiredExecutionEnvironment: J2SE-1.5 -Import-Package: org.osgi.framework, +Import-Package: org.eclipse.osgi.framework.internal.core, + org.osgi.framework, org.osgi.service.log, org.osgi.service.metatype, org.osgi.service.prefs Export-Package: org.cishell.app.service.datamanager;version="1.0.0", + org.cishell.app.service.fileloader, org.cishell.app.service.scheduler;version="1.0.0", org.cishell.framework;version="1.0.0", org.cishell.framework.algorithm;version="1.0.0", Added: trunk/core/org.cishell.framework/src/org/cishell/app/service/fileloader/FileLoadException.java =================================================================== --- trunk/core/org.cishell.framework/src/org/cishell/app/service/fileloader/FileLoadException.java (rev 0) +++ trunk/core/org.cishell.framework/src/org/cishell/app/service/fileloader/FileLoadException.java 2011-02-08 17:27:54 UTC (rev 1197) @@ -0,0 +1,21 @@ +package org.cishell.app.service.fileloader; + +public class FileLoadException extends Exception { + private static final long serialVersionUID = 1L; + + public FileLoadException(String message, Throwable exception) { + super(message, exception); + } + + public FileLoadException(Throwable exception) { + super(exception); + } + + public FileLoadException(String message) { + super(message); + } + + public FileLoadException() { + this("Algorithm canceled by user."); + } +} Added: trunk/core/org.cishell.framework/src/org/cishell/app/service/fileloader/FileLoadListener.java =================================================================== --- trunk/core/org.cishell.framework/src/org/cishell/app/service/fileloader/FileLoadListener.java (rev 0) +++ trunk/core/org.cishell.framework/src/org/cishell/app/service/fileloader/FileLoadListener.java 2011-02-08 17:27:54 UTC (rev 1197) @@ -0,0 +1,7 @@ +package org.cishell.app.service.fileloader; + +import java.io.File; + +public interface FileLoadListener { + void fileLoaded(File file); +} \ No newline at end of file Added: trunk/core/org.cishell.framework/src/org/cishell/app/service/fileloader/FileLoaderService.java =================================================================== --- trunk/core/org.cishell.framework/src/org/cishell/app/service/fileloader/FileLoaderService.java (rev 0) +++ trunk/core/org.cishell.framework/src/org/cishell/app/service/fileloader/FileLoaderService.java 2011-02-08 17:27:54 UTC (rev 1197) @@ -0,0 +1,32 @@ +package org.cishell.app.service.fileloader; + +import java.io.File; + +import org.cishell.framework.CIShellContext; +import org.cishell.framework.algorithm.ProgressMonitor; +import org.cishell.framework.data.Data; +import org.osgi.framework.BundleContext; +import org.osgi.service.log.LogService; + +public interface FileLoaderService { + public void registerListener(FileLoadListener listener); + public void unregisterListener(FileLoadListener listener); + + public Data[] loadFilesFromUserSelection( + BundleContext bundleContext, + CIShellContext ciShellContext, + LogService logger, + ProgressMonitor progressMonitor) throws FileLoadException; + public Data[] loadFiles( + BundleContext bundleContext, + CIShellContext ciShellContext, + LogService logger, + ProgressMonitor progressMonitor, + File[] files) throws FileLoadException; + public Data[] loadFile( + BundleContext bundleContext, + CIShellContext ciShellContext, + LogService logger, + ProgressMonitor progressMonitor, + File file) throws FileLoadException; +} \ No newline at end of file Added: trunk/core/org.cishell.framework/src/org/cishell/framework/CIShellContextDelegate.java =================================================================== --- trunk/core/org.cishell.framework/src/org/cishell/framework/CIShellContextDelegate.java (rev 0) +++ trunk/core/org.cishell.framework/src/org/cishell/framework/CIShellContextDelegate.java 2011-02-08 17:27:54 UTC (rev 1197) @@ -0,0 +1,25 @@ +package org.cishell.framework; + +import org.osgi.framework.ServiceReference; +import org.osgi.service.log.LogService; + +public class CIShellContextDelegate implements CIShellContext { + private ServiceReference uniqueServiceReference; + private CIShellContext actualCIShellContext; + + public CIShellContextDelegate( + ServiceReference uniqueServiceReference, CIShellContext actualCIShellContext) { + this.uniqueServiceReference = uniqueServiceReference; + this.actualCIShellContext = actualCIShellContext; + } + + public Object getService(String service) { + if (LogService.class.getName().equals(service)) { + return new LogServiceDelegate( + this.uniqueServiceReference, + (LogService) this.actualCIShellContext.getService(service)); + } else { + return this.actualCIShellContext.getService(service); + } + } +} \ No newline at end of file Added: trunk/core/org.cishell.framework/src/org/cishell/framework/LogServiceDelegate.java =================================================================== --- trunk/core/org.cishell.framework/src/org/cishell/framework/LogServiceDelegate.java (rev 0) +++ trunk/core/org.cishell.framework/src/org/cishell/framework/LogServiceDelegate.java 2011-02-08 17:27:54 UTC (rev 1197) @@ -0,0 +1,32 @@ +package org.cishell.framework; + +import org.osgi.framework.ServiceReference; +import org.osgi.service.log.LogService; + +public class LogServiceDelegate implements LogService { + private ServiceReference uniqueServiceReference; + private LogService actualLogService; + + public LogServiceDelegate( + ServiceReference uniqueServiceReference, LogService actualLogService) { + this.uniqueServiceReference = uniqueServiceReference; + this.actualLogService = actualLogService; + } + + public void log(int level, String message) { + this.actualLogService.log(this.uniqueServiceReference, level, message); + } + + public void log(int level, String message, Throwable exception) { + this.actualLogService.log(this.uniqueServiceReference, level, message, exception); + } + + public void log(ServiceReference serviceReference, int level, String message) { + this.actualLogService.log(serviceReference, level, message); + } + + public void log( + ServiceReference serviceReference, int level, String message, Throwable exception) { + this.actualLogService.log(serviceReference, level, message, exception); + } +} \ No newline at end of file Added: trunk/core/org.cishell.framework/src/org/cishell/framework/ServiceReferenceDelegate.java =================================================================== --- trunk/core/org.cishell.framework/src/org/cishell/framework/ServiceReferenceDelegate.java (rev 0) +++ trunk/core/org.cishell.framework/src/org/cishell/framework/ServiceReferenceDelegate.java 2011-02-08 17:27:54 UTC (rev 1197) @@ -0,0 +1,86 @@ +package org.cishell.framework; + +import java.lang.reflect.Field; + +import org.eclipse.osgi.framework.internal.core.ServiceReferenceImpl; +import org.eclipse.osgi.framework.internal.core.ServiceRegistrationImpl; +import org.osgi.framework.Bundle; +import org.osgi.framework.ServiceReference; + +public class ServiceReferenceDelegate extends ServiceReferenceImpl { + public static final String REGISTRATION_FIELD_NAME = + "org.eclipse.osgi.framework.internal.core.ServiceReferenceImpl.registration"; + + private static int nextUniqueID = 0; + + private ServiceReference actualServiceReference; + private int uniqueID; + + public ServiceReferenceDelegate(ServiceReference actualServiceReference) { + super(getServiceRegistration(actualServiceReference)); + this.actualServiceReference = actualServiceReference; + this.uniqueID = nextUniqueID; + nextUniqueID++; + + } + + public Object getProperty(String key) { + return this.actualServiceReference.getProperty(key); + } + + public String[] getPropertyKeys() { + return this.actualServiceReference.getPropertyKeys(); + } + + public Bundle getBundle() { + return this.actualServiceReference.getBundle(); + } + + public Bundle[] getUsingBundles() { + return this.actualServiceReference.getUsingBundles(); + } + + public boolean isAssignableTo(Bundle bundle, String className) { + return this.actualServiceReference.isAssignableTo(bundle, className); + } + + @Override + public int compareTo(Object reference) { + if (reference instanceof ServiceReferenceDelegate) { + ServiceReferenceDelegate otherDelegate = (ServiceReferenceDelegate) reference; + + return new Integer(this.uniqueID).compareTo(new Integer(otherDelegate.uniqueID)); + } else { + return this.actualServiceReference.compareTo(reference); + } + } + + @Override + public int hashCode() { + return this.actualServiceReference.hashCode() + new Integer(this.uniqueID).hashCode(); + } + + // TODO: Totally, disginstingly hacky. + private static ServiceRegistrationImpl getServiceRegistration( + ServiceReference actualServiceReference) { + try { + Field[] fields = actualServiceReference.getClass().getDeclaredFields(); + +// for (Field field : fields) { +// System.err.println(field); +// } + Field registrationField = fields[0]; +// actualServiceReference.getClass().getField(REGISTRATION_FIELD_NAME); + boolean isAccessible = registrationField.isAccessible(); + registrationField.setAccessible(true); + Object serviceRegistration = registrationField.get(actualServiceReference); + registrationField.setAccessible(isAccessible); + + return (ServiceRegistrationImpl) serviceRegistration; + } catch (IllegalAccessException e) { + throw new RuntimeException(e.getMessage(), e); + } /* catch (NoSuchFieldException e) { + throw new RuntimeException(e.getMessage(), e); + } */ + } +} \ No newline at end of file Added: trunk/core/org.cishell.framework/src/org/cishell/framework/algorithm/AlgorithmFactory2.java =================================================================== --- trunk/core/org.cishell.framework/src/org/cishell/framework/algorithm/AlgorithmFactory2.java (rev 0) +++ trunk/core/org.cishell.framework/src/org/cishell/framework/algorithm/AlgorithmFactory2.java 2011-02-08 17:27:54 UTC (rev 1197) @@ -0,0 +1,7 @@ +package org.cishell.framework.algorithm; + +import org.osgi.framework.ServiceReference; + +public interface AlgorithmFactory2 { + public void setServiceReference(ServiceReference serviceReference); +} \ No newline at end of file Modified: trunk/core/org.cishell.framework/src/org/cishell/framework/data/DataProperty.java =================================================================== --- trunk/core/org.cishell.framework/src/org/cishell/framework/data/DataProperty.java 2011-02-04 16:25:21 UTC (rev 1196) +++ trunk/core/org.cishell.framework/src/org/cishell/framework/data/DataProperty.java 2011-02-08 17:27:54 UTC (rev 1197) @@ -60,6 +60,9 @@ * it. The type associated with this property is of type {@link Boolean}. */ public static final String MODIFIED = "Modified"; + + // TODO: Document me. + public static final String SERVICE_REFERENCE = "ServiceReference"; /** Says this data model is abstractly a matrix */ public static String MATRIX_TYPE = "Matrix"; Modified: trunk/core/org.cishell.reference/META-INF/MANIFEST.MF =================================================================== --- trunk/core/org.cishell.reference/META-INF/MANIFEST.MF 2011-02-04 16:25:21 UTC (rev 1196) +++ trunk/core/org.cishell.reference/META-INF/MANIFEST.MF 2011-02-08 17:27:54 UTC (rev 1197) @@ -3,21 +3,28 @@ Bundle-SymbolicName: org.cishell.reference Bundle-Version: 1.0.0 Import-Package: org.cishell.app.service.datamanager;version="1.0.0", + org.cishell.app.service.fileloader, org.cishell.app.service.scheduler;version="1.0.0", 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.service.conversion;version="1.0.0", org.cishell.service.guibuilder;version="1.0.0", org.osgi.framework, + org.osgi.service.cm;version="1.2.0", org.osgi.service.log, org.osgi.service.metatype;version="1.1.0", org.osgi.service.prefs Export-Package: org.cishell.reference.app.service.algorithminvocation, org.cishell.reference.app.service.datamanager, + org.cishell.reference.app.service.fileloader, org.cishell.reference.app.service.scheduler, org.cishell.reference.service.conversion, org.cishell.reference.service.metatype -Eclipse-LazyStart: true -Require-Bundle: edu.uci.ics.jung +Require-Bundle: edu.uci.ics.jung, + org.eclipse.swt, + org.eclipse.ui +Service-Component: OSGI-INF/fileloader.xml Bundle-RequiredExecutionEnvironment: J2SE-1.5 +X-AutoStart: true Added: trunk/core/org.cishell.reference/OSGI-INF/fileloader.properties =================================================================== --- trunk/core/org.cishell.reference/OSGI-INF/fileloader.properties (rev 0) +++ trunk/core/org.cishell.reference/OSGI-INF/fileloader.properties 2011-02-08 17:27:54 UTC (rev 1197) @@ -0,0 +1,11 @@ +#menu_path=File/start +#label=Load... +#shortcut=ctrl+alt+o +#description=This allows users to select files from the file system and load them to Data Model window. +#in_data=null +#out_data=java.lang.Object +service.pid=org.cishell.reference.app.service.fileloader.FileLoadServiceImpl +remoteable=true +prefs_published=local +receive_prefs=true +#documentation_url=http://wiki.slis.indiana.edu:8080/display/ALGDOC/Data+Formats \ No newline at end of file Added: trunk/core/org.cishell.reference/OSGI-INF/fileloader.xml =================================================================== --- trunk/core/org.cishell.reference/OSGI-INF/fileloader.xml (rev 0) +++ trunk/core/org.cishell.reference/OSGI-INF/fileloader.xml 2011-02-08 17:27:54 UTC (rev 1197) @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="UTF-8"?> +<component name="org.cishell.reference.app.service.fileloader.FileLoaderServiceImpl.component" immediate="true"> + <implementation class="org.cishell.reference.app.service.fileloader.FileLoaderServiceImpl"/> + <service> + <provide interface="org.osgi.service.cm.ManagedService"/> + <provide interface="org.cishell.app.service.fileloader.FileLoaderService"/> + </service> +</component> \ No newline at end of file Modified: trunk/core/org.cishell.reference/build.properties =================================================================== --- trunk/core/org.cishell.reference/build.properties 2011-02-04 16:25:21 UTC (rev 1196) +++ trunk/core/org.cishell.reference/build.properties 2011-02-08 17:27:54 UTC (rev 1197) @@ -1,4 +1,5 @@ source.. = src/ output.. = bin/ bin.includes = META-INF/,\ - . + .,\ + OSGI-INF/ Added: trunk/core/org.cishell.reference/src/org/cishell/reference/app/service/fileloader/FileFormatSelector.java =================================================================== --- trunk/core/org.cishell.reference/src/org/cishell/reference/app/service/fileloader/FileFormatSelector.java (rev 0) +++ trunk/core/org.cishell.reference/src/org/cishell/reference/app/service/fileloader/FileFormatSelector.java 2011-02-08 17:27:54 UTC (rev 1197) @@ -0,0 +1,190 @@ +package org.cishell.reference.app.service.fileloader; + +import java.io.File; + +import org.cishell.framework.algorithm.AlgorithmFactory; +import org.cishell.reference.gui.common.AbstractDialog; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.MouseAdapter; +import org.eclipse.swt.events.MouseEvent; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.layout.FillLayout; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Group; +import org.eclipse.swt.widgets.List; +import org.eclipse.swt.widgets.Shell; +import org.osgi.framework.BundleContext; +import org.osgi.framework.ServiceReference; + +public class FileFormatSelector extends AbstractDialog { + private BundleContext bundleContext; + private AlgorithmFactory validator; + private ServiceReference[] validatorReferences; + private List validatorList; + +// private static final String[] DETAILS_ITEM_KEY = +// {"format_name", "supported_file_extension", "format_description" }; + + /* + * Other possible keys could be restorable_model_name, restorable_model_description + * */ + +// private static final String[] DETAILS_ITEM_KEY_DISPLAY_VALUE = +// {"Format name", "Supported file extension", "Format description"}; + + /* + * Other possible keys display values could be "Restorable model name", + * "Restorable model description" + */ + + public FileFormatSelector( + String title, + Shell parent, + BundleContext bundleContext, + ServiceReference[] validatorReferences, + File file) { + super(parent, title, AbstractDialog.QUESTION); + this.bundleContext = bundleContext; + this.validatorReferences = validatorReferences; + + // Shall this part be moved out of the code? + String descriptionFormat = + "The file \'%s\' can be loaded using one or more of the following formats.%n" + + "Please select the format you would like to try."; + setDescription(String.format(descriptionFormat, file.getAbsolutePath())); + setDetails( + "This dialog allows the user to choose among all available " + + "formats for loading the selected data model. Choose any of the formats " + + "to continue loading the dataset."); + } + + public AlgorithmFactory getValidator() { + return this.validator; + } + + private Composite initializeGUI(Composite parent) { + Composite content = new Composite(parent, SWT.NONE); + + GridLayout layout = new GridLayout(); + layout.numColumns = 1; + content.setLayout(layout); + + Group validatorGroup = new Group(content, SWT.NONE); + // Shall this label be moved out of the code? + validatorGroup.setText("Load as..."); + validatorGroup.setLayout(new FillLayout()); + GridData validatorListGridData = new GridData(GridData.FILL_BOTH); + validatorListGridData.widthHint = 200; + validatorGroup.setLayoutData(validatorListGridData); + + this.validatorList = new List(validatorGroup, SWT.H_SCROLL |SWT.V_SCROLL | SWT.SINGLE); + // initPersisterArray(); + initializePersisterList(); + this.validatorList.addMouseListener(new MouseAdapter() { + public void mouseDoubleClick(MouseEvent mouseEvent) { + List list = (List)mouseEvent.getSource(); + int selection = list.getSelectionIndex(); + + if (selection != -1) { + selectionMade(selection); + } + } + }); + + this.validatorList.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent selectionEvent) { + List list = (List)selectionEvent.getSource(); + int selection = list.getSelectionIndex(); + + if (selection != -1) { + // updateDetailPane(validatorReferences[selection]); + } + } + }); + + validatorList.setSelection(0); + + return content; + } + + private void initializePersisterList() { + for (int ii = 0; ii < this.validatorReferences.length; ++ii) { + String name = (String)this.validatorReferences[ii].getProperty("label"); + + /* + * If someone was sloppy enough to not provide a name, then use the name of the + * class instead. + */ + if (name == null || name.length() == 0) { + name = this.validatorReferences[ii].getClass().getName(); + } + + this.validatorList.add(name); + } + } + + private void selectionMade(int selectedIndex) { + this.validator = + (AlgorithmFactory)this.bundleContext.getService(this.validatorReferences[selectedIndex]); + close(true); +// AlgorithmFactory validator = +// (AlgorithmFactory)this.bundleContext.getService(this.persisterArray[selectedIndex]); +// Data[] data = null; +// boolean loadSuccess = false; +// +// try { +// data = +// new Data[] { new BasicData(this.selectedFile.getPath(), String.class.getName()) }; +// data = validator.createAlgorithm(data, null, this.ciShellContext).execute(); +// loadSuccess = true; +// } catch (Throwable exception) { +// this.logger.log( +// LogService.LOG_ERROR, "Error occurred while executing selection", exception); +// exception.printStackTrace(); +// loadSuccess = false; +// } +// +// if ((data != null) && loadSuccess) { +// this.logger.log(LogService.LOG_INFO, "Loaded: " + this.selectedFile.getPath()); +// +// for (int ii = 0; ii < data.length; ii++) { +// this.returnList.add(data[ii]); +// } +// +// close(true); +// } else { +// this.logger.log(LogService.LOG_ERROR, "Unable to load with selected loader"); +// } + } + + public void createDialogButtons(Composite parent) { + Button select = new Button(parent, SWT.PUSH); + select.setText("Select"); + select.addSelectionListener(new SelectionAdapter(){ + public void widgetSelected(SelectionEvent selectionEvent) { + int index = FileFormatSelector.this.validatorList.getSelectionIndex(); + + if (index != -1) { + selectionMade(index); + } + } + }); + select.setFocus(); + + Button cancel = new Button(parent, SWT.NONE); + cancel.setText("Cancel"); + cancel.addSelectionListener(new SelectionAdapter(){ + public void widgetSelected(SelectionEvent selectionEvent) { + close(false); + } + }); + } + + public Composite createContent(Composite parent) { + return initializeGUI(parent); + } +} Added: trunk/core/org.cishell.reference/src/org/cishell/reference/app/service/fileloader/FileLoaderServiceImpl.java =================================================================== --- trunk/core/org.cishell.reference/src/org/cishell/reference/app/service/fileloader/FileLoaderServiceImpl.java (rev 0) +++ trunk/core/org.cishell.reference/src/org/cishell/reference/app/service/fileloader/FileLoaderServiceImpl.java 2011-02-08 17:27:54 UTC (rev 1197) @@ -0,0 +1,223 @@ +package org.cishell.reference.app.service.fileloader; + +import java.io.File; +import java.io.UnsupportedEncodingException; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Dictionary; +import java.util.HashSet; + +import org.cishell.app.service.fileloader.FileLoadException; +import org.cishell.app.service.fileloader.FileLoadListener; +import org.cishell.app.service.fileloader.FileLoaderService; +import org.cishell.framework.CIShellContext; +import org.cishell.framework.algorithm.AlgorithmExecutionException; +import org.cishell.framework.algorithm.AlgorithmFactory; +import org.cishell.framework.algorithm.ProgressMonitor; +import org.cishell.framework.data.Data; +import org.eclipse.swt.widgets.Display; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.PlatformUI; +import org.osgi.framework.BundleContext; +import org.osgi.service.cm.ConfigurationException; +import org.osgi.service.cm.ManagedService; +import org.osgi.service.log.LogService; + +public class FileLoaderServiceImpl implements FileLoaderService, ManagedService { + public static final String LOAD_DIRECTORY_PREFERENCE_KEY = "loadDir"; + public static String defaultLoadDirectory = ""; + + private Dictionary preferences; + private Collection<FileLoadListener> listeners = new HashSet<FileLoadListener>(); + + public void registerListener(FileLoadListener listener) { + this.listeners.add(listener); + } + + public void unregisterListener(FileLoadListener listener) { + if (this.listeners.contains(listener)) { + this.listeners.remove(listener); + } + } + + public Data[] loadFilesFromUserSelection( + BundleContext bundleContext, + CIShellContext ciShellContext, + LogService logger, + ProgressMonitor progressMonitor) throws FileLoadException { + if ("".equals(defaultLoadDirectory)) { + defaultLoadDirectory = determineDefaultLoadDirectory(); + } + + IWorkbenchWindow window = getFirstWorkbenchWindow(); + Display display = PlatformUI.getWorkbench().getDisplay(); + File[] files = getFilesToLoadFromUser(window, display); + + if (files != null) { + return loadFiles(bundleContext, ciShellContext, logger, progressMonitor, files); + } else { + return null; + } + } + + public Data[] loadFiles( + BundleContext bundleContext, + CIShellContext ciShellContext, + LogService logger, + ProgressMonitor progressMonitor, + File[] files) throws FileLoadException { + return loadFilesInternal(bundleContext, ciShellContext, logger, progressMonitor, files); + } + + public Data[] loadFile( + BundleContext bundleContext, + CIShellContext ciShellContext, + LogService logger, + ProgressMonitor progressMonitor, + File file) throws FileLoadException { + return loadFiles( + bundleContext, ciShellContext, logger, progressMonitor, new File[] { file }); + } + + public void updated(Dictionary preferences) throws ConfigurationException { + if (preferences != null) { + this.preferences = preferences; + } + } + + private String determineDefaultLoadDirectory() { + if (this.preferences != null) { + Object directoryPreference = preferences.get(LOAD_DIRECTORY_PREFERENCE_KEY); + + if (directoryPreference != null) { + return directoryPreference.toString(); + } else { + return ""; + } + } else { + return ""; + } + } + + private Data[] loadFilesInternal( + BundleContext bundleContext, + CIShellContext ciShellContext, + LogService logger, + ProgressMonitor progressMonitor, + File[] files) throws FileLoadException { + IWorkbenchWindow window = getFirstWorkbenchWindow(); + Display display = PlatformUI.getWorkbench().getDisplay(); + + if ((files != null) && (files.length != 0)) { + Collection<Data> finalLabeledFileData = new ArrayList<Data>(); + + for (File file : files) { + try { + Data[] validatedFileData = validateFile( + bundleContext, + ciShellContext, + logger, + progressMonitor, + window, + display, + file); + Data[] labeledFileData = labelFileData(file, validatedFileData); + + for (Data data : labeledFileData) { + finalLabeledFileData.add(data); + } + } catch (Throwable e) { + String format = + "The chosen file is not compatible with this format. " + + "Check that your file is correctly formatted or try another validator. " + + "The reason is: %s"; + String logMessage = String.format(format, e.getMessage()); + logger.log(LogService.LOG_ERROR, logMessage, e); + } + } + + return finalLabeledFileData.toArray(new Data[0]); + } else { + return null; + } + } + + private IWorkbenchWindow getFirstWorkbenchWindow() throws FileLoadException { + final IWorkbenchWindow[] windows = PlatformUI.getWorkbench().getWorkbenchWindows(); + + if (windows.length == 0) { + throw new FileLoadException( + "Cannot obtain workbench window needed to open dialog."); + } else { + return windows[0]; + } + } + + private File[] getFilesToLoadFromUser(IWorkbenchWindow window, Display display) { + FileSelectorRunnable fileSelector = new FileSelectorRunnable(window); + + if (Thread.currentThread() != display.getThread()) { + display.syncExec(fileSelector); + } else { + fileSelector.run(); + } + + return fileSelector.getFiles(); + } + + private Data[] validateFile( + BundleContext bundleContext, + CIShellContext ciShellContext, + LogService logger, + ProgressMonitor progressMonitor, + IWorkbenchWindow window, + Display display, + File file) throws AlgorithmExecutionException { + AlgorithmFactory validator = null; + validator = getValidatorFromUser(bundleContext, window, display, file); + + if ((file == null) || (validator == null)) { + String logMessage = "File loading canceled"; + logger.log(LogService.LOG_WARNING, logMessage); + } else { + try { + return FileValidator.validateFile( + file, validator, progressMonitor, ciShellContext, logger); + } catch (AlgorithmExecutionException e) { + if ((e.getCause() != null) + && (e.getCause() instanceof UnsupportedEncodingException)) { + String format = + "This file cannot be loaded; it uses the unsupported character " + + "encoding %s."; + String logMessage = String.format(format, e.getCause().getMessage()); + logger.log(LogService.LOG_ERROR, logMessage); + } else { + throw e; + } + } + } + + return new Data[0]; + } + + private Data[] labelFileData(File file, Data[] validatedFileData) { + Data[] labeledFileData = + PrettyLabeler.relabelWithFileNameHierarchy(validatedFileData, file); + + return labeledFileData; + } + + private AlgorithmFactory getValidatorFromUser( + BundleContext bundleContext, IWorkbenchWindow window, Display display, File file) { + ValidatorSelectorRunnable validatorSelector = + new ValidatorSelectorRunnable(window, bundleContext, file); + + if (Thread.currentThread() != display.getThread()) { + display.syncExec(validatorSelector); + } else { + validatorSelector.run(); + } + + return validatorSelector.getValidator(); + } +} \ No newline at end of file Added: trunk/core/org.cishell.reference/src/org/cishell/reference/app/service/fileloader/FileSelectorRunnable.java =================================================================== --- trunk/core/org.cishell.reference/src/org/cishell/reference/app/service/fileloader/FileSelectorRunnable.java (rev 0) +++ trunk/core/org.cishell.reference/src/org/cishell/reference/app/service/fileloader/FileSelectorRunnable.java 2011-02-08 17:27:54 UTC (rev 1197) @@ -0,0 +1,63 @@ +package org.cishell.reference.app.service.fileloader; + +import java.io.File; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.widgets.FileDialog; +import org.eclipse.ui.IWorkbenchWindow; + +public final class FileSelectorRunnable implements Runnable { + private IWorkbenchWindow window; + + private File[] files; + + public FileSelectorRunnable(IWorkbenchWindow window) { + this.window = window; + } + + public File[] getFiles() { + return this.files; + } + + public void run() { + this.files = getFilesFromUser(); + + if (this.files.length == 0) { + return; + } else { + FileLoaderServiceImpl.defaultLoadDirectory = + this.files[0].getParentFile().getAbsolutePath(); + } + } + + private File[] getFilesFromUser() { + FileDialog fileDialog = createFileDialog(); + fileDialog.open(); + String path = fileDialog.getFilterPath(); + String[] fileNames = fileDialog.getFileNames(); + // TODO: Ask Angela about the order here, i.e. should they be sorted alphabetically? + + if ((fileNames == null) || (fileNames.length == 0)) { + return new File[0]; + } else { + File[] files = new File[fileNames.length]; + + for (int ii = 0; ii < fileNames.length; ii++) { + String fullFileName = path + File.separator + fileNames[ii]; + files[ii] = new File(fullFileName); + } + + return files; + } + } + + private FileDialog createFileDialog() { + File currentDirectory = new File(FileLoaderServiceImpl.defaultLoadDirectory); + String absolutePath = currentDirectory.getAbsolutePath(); + FileDialog fileDialog = new FileDialog(this.window.getShell(), SWT.OPEN | SWT.MULTI); + fileDialog.setFilterPath(absolutePath); + fileDialog.setText("Select Files"); + + return fileDialog; + } +} \ No newline at end of file Added: trunk/core/org.cishell.reference/src/org/cishell/reference/app/service/fileloader/FileValidator.java =================================================================== --- trunk/core/org.cis... [truncated message content] |
From: <jrb...@us...> - 2011-02-22 18:04:25
|
Revision: 1229 http://cishell.svn.sourceforge.net/cishell/?rev=1229&view=rev Author: jrbibers Date: 2011-02-22 18:04:19 +0000 (Tue, 22 Feb 2011) Log Message: ----------- Standardizing name of google_guava plugin on underscores. CISHELL-18 Modified Paths: -------------- trunk/deployment/org.cishell.reference.releng/build-files/fetchSvnAll.xml trunk/libs/google_guava/.project trunk/libs/google_guava/META-INF/MANIFEST.MF Modified: trunk/deployment/org.cishell.reference.releng/build-files/fetchSvnAll.xml =================================================================== --- trunk/deployment/org.cishell.reference.releng/build-files/fetchSvnAll.xml 2011-02-22 17:59:13 UTC (rev 1228) +++ trunk/deployment/org.cishell.reference.releng/build-files/fetchSvnAll.xml 2011-02-22 18:04:19 UTC (rev 1229) @@ -219,8 +219,8 @@ </antcall> <antcall target="svn.co"> <param name="target" value="plugins"/> - <param name="element.id" value="google-guava"/> - <param name="project.name" value="/libs/google-guava"/> + <param name="element.id" value="google_guava"/> + <param name="project.name" value="/libs/google_guava"/> <param name="url" value="https://cishell.svn.sourceforge.net/svnroot/cishell/trunk"/> </antcall> Modified: trunk/libs/google_guava/.project =================================================================== --- trunk/libs/google_guava/.project 2011-02-22 17:59:13 UTC (rev 1228) +++ trunk/libs/google_guava/.project 2011-02-22 18:04:19 UTC (rev 1229) @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <projectDescription> - <name>google-guava</name> + <name>google_guava</name> <comment></comment> <projects> </projects> Modified: trunk/libs/google_guava/META-INF/MANIFEST.MF =================================================================== --- trunk/libs/google_guava/META-INF/MANIFEST.MF 2011-02-22 17:59:13 UTC (rev 1228) +++ trunk/libs/google_guava/META-INF/MANIFEST.MF 2011-02-22 18:04:19 UTC (rev 1229) @@ -1,7 +1,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 -Bundle-Name: google-guava -Bundle-SymbolicName: google-guava +Bundle-Name: google_guava +Bundle-SymbolicName: google_guava Bundle-Version: 0.8.0 Bundle-ClassPath: guava-r08.jar Export-Package: com.google.common.annotations, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pat...@us...> - 2011-03-02 21:54:28
|
Revision: 1233 http://cishell.svn.sourceforge.net/cishell/?rev=1233&view=rev Author: pataphil Date: 2011-03-02 21:54:21 +0000 (Wed, 02 Mar 2011) Log Message: ----------- * Fixed a bug when trying to parse out a file extension from a file name. Modified Paths: -------------- trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/save/Save.java trunk/core/org.cishell.framework/src/org/cishell/app/service/filesaver/AbstractFileSaverService.java trunk/core/org.cishell.framework/src/org/cishell/app/service/filesaver/FileSaverService.java trunk/core/org.cishell.reference/src/org/cishell/reference/app/service/filesaver/SaveAsController.java 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 2011-03-01 20:14:29 UTC (rev 1232) +++ trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/save/Save.java 2011-03-02 21:54:21 UTC (rev 1233) @@ -12,7 +12,6 @@ import org.osgi.service.log.LogService; public class Save implements Algorithm { - public static final String ANY_FILE_EXTENSION = "file-ext:*"; public static final String SAVE_DIALOG_TITLE = "Save"; private Data data; @@ -30,7 +29,7 @@ } public Data[] execute() throws AlgorithmExecutionException { - tryToSave(this.data, ANY_FILE_EXTENSION); + tryToSave(this.data, FileSaverService.ANY_FILE_EXTENSION); return null; } @@ -67,7 +66,8 @@ String logMessage = String.format( "Error occurred while converting data to saved format:\n %s", e.getMessage()); this.logger.log(LogService.LOG_ERROR, logMessage, e); - throw new AlgorithmExecutionException(e.getMessage(), e); +// throw new AlgorithmExecutionException(e.getMessage(), e); + throw new RuntimeException(e.getMessage(), e); } } } \ No newline at end of file Modified: trunk/core/org.cishell.framework/src/org/cishell/app/service/filesaver/AbstractFileSaverService.java =================================================================== --- trunk/core/org.cishell.framework/src/org/cishell/app/service/filesaver/AbstractFileSaverService.java 2011-03-01 20:14:29 UTC (rev 1232) +++ trunk/core/org.cishell.framework/src/org/cishell/app/service/filesaver/AbstractFileSaverService.java 2011-03-02 21:54:21 UTC (rev 1233) @@ -1,13 +1,32 @@ package org.cishell.app.service.filesaver; import java.io.File; +import java.util.Arrays; import java.util.Collection; +import java.util.Collections; +import java.util.Dictionary; +import java.util.HashSet; import org.cishell.framework.data.Data; +import org.cishell.framework.data.DataProperty; import org.cishell.service.conversion.ConversionException; import org.cishell.service.conversion.Converter; public abstract class AbstractFileSaverService implements FileSaverService { + public static final Collection<Character> INVALID_FILENAME_CHARACTERS = + Collections.unmodifiableSet(new HashSet<Character>(Arrays.asList( + new Character('\\'), + new Character('/'), + new Character(':'), + new Character('*'), + new Character('?'), + new Character('"'), + new Character('<'), + new Character('>'), + new Character('|'), + new Character('%')))); + public static final char FILENAME_CHARACTER_REPLACEMENT = '#'; + private Collection<FileSaveListener> listeners; public void registerListener(FileSaveListener listener) { @@ -23,11 +42,17 @@ } public File promptForTargetFile(Data datum) throws FileSaveException { - return promptForTargetFile((File) datum.getData()); + Object dataObject = datum.getData(); + + if (dataObject instanceof File) { + return promptForTargetFile((File) datum.getData()); + } else { + return promptForTargetFile(suggestFileName(datum)); + } } public File promptForTargetFile(File outputFile) throws FileSaveException { - return promptForTargetFile(outputFile.getAbsolutePath()); // TODO getName? + return promptForTargetFile(outputFile.getName()); } public File save(Data sourceDatum) throws FileSaveException { @@ -77,4 +102,36 @@ throw new FileSaveException(e.getMessage(), e); } } + + public String suggestFileName(Data datum) { + return replaceInvalidFilenameCharacters(getLabel(datum)); + } + + private static String getLabel(Data datum) { + Dictionary<String, Object> metadata = datum.getMetadata(); + Object labelObject = metadata.get(DataProperty.LABEL); + + if (labelObject != null) { + return labelObject.toString(); + } else { + Object shortLabelObject = metadata.get(DataProperty.SHORT_LABEL); + + if (shortLabelObject != null) { + return shortLabelObject.toString(); + } else { + return datum.toString(); + } + } + } + + private static String replaceInvalidFilenameCharacters(String fileName) { + String cleanedFilename = fileName; + + for (Character invalidCharacter : INVALID_FILENAME_CHARACTERS) { + cleanedFilename = + cleanedFilename.replace(invalidCharacter, FILENAME_CHARACTER_REPLACEMENT); + } + + return cleanedFilename; + } } \ No newline at end of file Modified: trunk/core/org.cishell.framework/src/org/cishell/app/service/filesaver/FileSaverService.java =================================================================== --- trunk/core/org.cishell.framework/src/org/cishell/app/service/filesaver/FileSaverService.java 2011-03-01 20:14:29 UTC (rev 1232) +++ trunk/core/org.cishell.framework/src/org/cishell/app/service/filesaver/FileSaverService.java 2011-03-02 21:54:21 UTC (rev 1233) @@ -10,6 +10,8 @@ * Then FileSaverServiceImpl extends the abstract class. */ public interface FileSaverService { + public static final String ANY_FILE_EXTENSION = "file-ext:*"; + public void registerListener(FileSaveListener listener); public void unregisterListener(FileSaveListener listener); @@ -37,4 +39,6 @@ public Data save(Converter converter, Data sourceDatum) throws FileSaveException; public Data save( Converter converter, Data sourceDatum, File targetFile) throws FileSaveException; + + public String suggestFileName(Data datum); } \ No newline at end of file Modified: trunk/core/org.cishell.reference/src/org/cishell/reference/app/service/filesaver/SaveAsController.java =================================================================== --- trunk/core/org.cishell.reference/src/org/cishell/reference/app/service/filesaver/SaveAsController.java 2011-03-01 20:14:29 UTC (rev 1232) +++ trunk/core/org.cishell.reference/src/org/cishell/reference/app/service/filesaver/SaveAsController.java 2011-03-02 21:54:21 UTC (rev 1233) @@ -28,7 +28,7 @@ } public File open(String fileName) { - String fileExtension = getFileExtension(fileName).substring(1); + String fileExtension = getFileExtension(fileName); return open(fileName, fileExtension); } @@ -95,7 +95,7 @@ int periodPosition = filePath.lastIndexOf("."); if ((periodPosition != -1) && ((periodPosition + 1) < filePath.length())) { - return filePath.substring(periodPosition); + return filePath.substring(periodPosition + 1); } else { return ""; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pat...@us...> - 2011-03-07 19:35:53
|
Revision: 1238 http://cishell.svn.sourceforge.net/cishell/?rev=1238&view=rev Author: pataphil Date: 2011-03-07 19:35:47 +0000 (Mon, 07 Mar 2011) Log Message: ----------- * Trying to clean up the File IO Services, but there are still some issues. See the wiki. Modified Paths: -------------- trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/save/Save.java trunk/core/org.cishell.framework/src/org/cishell/app/service/filesaver/AbstractFileSaverService.java trunk/core/org.cishell.framework/src/org/cishell/app/service/filesaver/FileSaverService.java trunk/core/org.cishell.reference/src/org/cishell/reference/app/service/filesaver/FileSaverServiceImpl.java trunk/core/org.cishell.reference/src/org/cishell/reference/app/service/filesaver/SaveAsController.java 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 2011-03-07 19:35:10 UTC (rev 1237) +++ trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/save/Save.java 2011-03-07 19:35:47 UTC (rev 1238) @@ -8,7 +8,6 @@ import org.cishell.framework.algorithm.AlgorithmCanceledException; import org.cishell.framework.algorithm.AlgorithmExecutionException; import org.cishell.framework.data.Data; -import org.cishell.service.conversion.Converter; import org.osgi.service.log.LogService; public class Save implements Algorithm { @@ -37,30 +36,31 @@ private void tryToSave(final Data outData, String outFormat) throws AlgorithmExecutionException { try { - Converter userChosenConverter = - this.fileSaver.promptForConverter(outData, outFormat); - - if (userChosenConverter == null) { + File outputFile = this.fileSaver.saveData(outData); +// Converter userChosenConverter = +// this.fileSaver.promptForConverter(outData, outFormat); +// +// if (userChosenConverter == null) { +// throw new AlgorithmCanceledException( +// "User canceled file saving when choosing what kind of file to save as."); +// } +// +// File userChosenFile = this.fileSaver.promptForTargetFile(outData); +// + if (outputFile == null) { throw new AlgorithmCanceledException( - "User canceled file saving when choosing what kind of file to save as."); - } - - File userChosenFile = this.fileSaver.promptForTargetFile(outData); - - if (userChosenFile == null) { - throw new AlgorithmCanceledException( "User canceled file saving when choosing the destination of the file."); } +// +// Data outputDatum = +// this.fileSaver.save(userChosenConverter, outData, userChosenFile); +// +// // TODO: Should we bother handling this? sure, why not. maybe algexec would be appropriate +// if (outputDatum == null) { +// return; +// } - Data outputDatum = - this.fileSaver.save(userChosenConverter, outData, userChosenFile); - - // TODO: Should we bother handling this? sure, why not. maybe algexec would be appropriate - if (outputDatum == null) { - return; - } - - String logMessage = String.format("Saved: %s", userChosenFile.getPath()); + String logMessage = String.format("Saved: %s", outputFile.getPath()); this.logger.log(LogService.LOG_INFO, logMessage); } catch (FileSaveException e) { String logMessage = String.format( Modified: trunk/core/org.cishell.framework/src/org/cishell/app/service/filesaver/AbstractFileSaverService.java =================================================================== --- trunk/core/org.cishell.framework/src/org/cishell/app/service/filesaver/AbstractFileSaverService.java 2011-03-07 19:35:10 UTC (rev 1237) +++ trunk/core/org.cishell.framework/src/org/cishell/app/service/filesaver/AbstractFileSaverService.java 2011-03-07 19:35:47 UTC (rev 1238) @@ -7,6 +7,7 @@ import java.util.Dictionary; import java.util.HashSet; +import org.cishell.framework.algorithm.AlgorithmProperty; import org.cishell.framework.data.Data; import org.cishell.framework.data.DataProperty; import org.cishell.service.conversion.ConversionException; @@ -26,6 +27,8 @@ new Character('|'), new Character('%')))); public static final char FILENAME_CHARACTER_REPLACEMENT = '#'; + public static final String FILE_EXTENSION_PREFIX = "file-ext:"; + public static final String FILE_PREFIX = "file:"; private Collection<FileSaveListener> listeners; @@ -41,68 +44,77 @@ return promptForTargetFile(""); } - public File promptForTargetFile(Data datum) throws FileSaveException { + public File promptForTargetFile(String defaultFileExtension) throws FileSaveException { + return promptForTargetFile("", defaultFileExtension); + } + + public File promptForTargetFile( + Data datum, String defaultFileExtension) throws FileSaveException { Object dataObject = datum.getData(); if (dataObject instanceof File) { - return promptForTargetFile((File) datum.getData()); + String fileName = ((File) datum.getData()).getName(); + return promptForTargetFile(fileName, defaultFileExtension); } else { - return promptForTargetFile(suggestFileName(datum)); + return promptForTargetFile(suggestFileName(datum), defaultFileExtension); } } public File promptForTargetFile(File outputFile) throws FileSaveException { - return promptForTargetFile(outputFile.getName()); + return promptForTargetFile(outputFile.getName(), ""); } - public File save(Data sourceDatum) throws FileSaveException { - return save((File) sourceDatum.getData()); + public File saveData(Data sourceDatum) throws FileSaveException { + return saveData(sourceDatum, ANY_FILE_EXTENSION); } - public File save(File sourceFile) throws FileSaveException { - File targetFile = promptForTargetFile(sourceFile); - saveTo(sourceFile, targetFile); - - return targetFile; - } - - public Data save(Data sourceDatum, String targetMimeType) + public File saveData(Data sourceDatum, String targetMimeType) throws FileSaveException { Converter converter = promptForConverter(sourceDatum, targetMimeType); if (converter != null) { - return save(converter, sourceDatum); + return saveData(sourceDatum, converter); } else { // TODO: CanceledException? return null; } } - // TODO: What to actually return here? Maybe Pair<Data, File> (LOL)? - public Data save(Converter converter, Data sourceDatum) - throws FileSaveException { - File targetFile = promptForTargetFile(sourceDatum); + public File saveData(Data sourceDatum, Converter converter) throws FileSaveException { + String outputMimeType = + converter.getProperties().get(AlgorithmProperty.OUT_DATA).toString(); + System.err.println("outputMimeType: " + outputMimeType); + String suggestedFileExtension = suggestFileExtension(outputMimeType); + System.err.println("suggestedFileExtension: " + suggestedFileExtension); + File targetFile = promptForTargetFile(sourceDatum, suggestedFileExtension); if (targetFile != null) { - return save(converter, sourceDatum, targetFile); + return saveData(sourceDatum, converter, targetFile); } else { // TODO: CanceledException? return null; } } - public Data save( - Converter converter, Data sourceDatum, File targetFile) throws FileSaveException { + public File saveData(Data sourceDatum, Converter converter, File targetFile) + throws FileSaveException { try { Data convertedDatum = converter.convert(sourceDatum); saveTo((File) convertedDatum.getData(), targetFile); - return convertedDatum; + return targetFile; } catch (ConversionException e) { throw new FileSaveException(e.getMessage(), e); } } + public File save(File sourceFile) throws FileSaveException { + File targetFile = promptForTargetFile(sourceFile); + saveTo(sourceFile, targetFile); + + return targetFile; + } + public String suggestFileName(Data datum) { return replaceInvalidFilenameCharacters(getLabel(datum)); } @@ -134,4 +146,26 @@ return cleanedFilename; } + + private static String suggestFileExtension(String targetMimeType) { + if (targetMimeType.startsWith(FILE_EXTENSION_PREFIX)) { + return targetMimeType.substring(FILE_EXTENSION_PREFIX.length()); + } else if (targetMimeType.startsWith(FILE_PREFIX)) { + int forwardSlashCharacterIndex = targetMimeType.indexOf('/'); + + if (forwardSlashCharacterIndex != -1) { + int parsedOutFileExtensionStart = (forwardSlashCharacterIndex + 1); + + if (parsedOutFileExtensionStart < targetMimeType.length()) { + return targetMimeType.substring(parsedOutFileExtensionStart); + } else { + return ""; + } + } else { + return ""; + } + } else { + return targetMimeType; + } + } } \ No newline at end of file Modified: trunk/core/org.cishell.framework/src/org/cishell/app/service/filesaver/FileSaverService.java =================================================================== --- trunk/core/org.cishell.framework/src/org/cishell/app/service/filesaver/FileSaverService.java 2011-03-07 19:35:10 UTC (rev 1237) +++ trunk/core/org.cishell.framework/src/org/cishell/app/service/filesaver/FileSaverService.java 2011-03-07 19:35:47 UTC (rev 1238) @@ -19,26 +19,21 @@ throws FileSaveException; public File promptForTargetFile() throws FileSaveException; - public File promptForTargetFile(Data datum) throws FileSaveException; + public File promptForTargetFile(String defaultFileExtension) throws FileSaveException; + public File promptForTargetFile( + Data datum, String defaultFileExtension) throws FileSaveException; public File promptForTargetFile(File outputFile) throws FileSaveException; - public File promptForTargetFile(String fileName) throws FileSaveException; + public File promptForTargetFile( + String suggestedFileName, String defaultFileExtension) throws FileSaveException; - /* TODO I'm seriously tempted to recommend that all methods beyond this point be called - * "save" or "saveToFile" or something, and just have a bit of very concise Javadoc that - * explains what may be prompted for? Alternatively, ask another dev about doing the null - * arguments idea. - */ - // TODO (NEW): Just Javadoc these really well? - public File save(Data sourceDatum) throws FileSaveException; + public File saveData(Data sourceDatum) throws FileSaveException; + public File saveData(Data sourceDatum, String targetMimeType) throws FileSaveException; + public File saveData(Data sourceDatum, Converter converter) throws FileSaveException; + public File saveData( + Data sourceDatum, Converter converter, File targetFile) throws FileSaveException; + public File save(File sourceFile) throws FileSaveException; public void saveTo(File sourceFile, File targetFile) throws FileSaveException; - // TODO: What to actually return here? the File object for the one on disk - /* TODO sourceDatum always first, targetType/File last */ - public Data save(Data sourceDatum, String targetMimeType) throws FileSaveException; - public Data save(Converter converter, Data sourceDatum) throws FileSaveException; - public Data save( - Converter converter, Data sourceDatum, File targetFile) throws FileSaveException; - public String suggestFileName(Data datum); } \ No newline at end of file Modified: trunk/core/org.cishell.reference/src/org/cishell/reference/app/service/filesaver/FileSaverServiceImpl.java =================================================================== --- trunk/core/org.cishell.reference/src/org/cishell/reference/app/service/filesaver/FileSaverServiceImpl.java 2011-03-07 19:35:10 UTC (rev 1237) +++ trunk/core/org.cishell.reference/src/org/cishell/reference/app/service/filesaver/FileSaverServiceImpl.java 2011-03-07 19:35:47 UTC (rev 1238) @@ -75,7 +75,9 @@ } } - public File promptForTargetFile(final String fileName) throws FileSaveException { + public File promptForTargetFile( + final String suggestedFileName, + final String defaultFileExtension) throws FileSaveException { final File[] resultFile = new File[1]; try { @@ -84,7 +86,7 @@ SaveAsController saveAs = new SaveAsController(FileSaverServiceImpl.this.guiBuilder); - resultFile[0] = saveAs.open(fileName); + resultFile[0] = saveAs.open(suggestedFileName, defaultFileExtension); } }); Modified: trunk/core/org.cishell.reference/src/org/cishell/reference/app/service/filesaver/SaveAsController.java =================================================================== --- trunk/core/org.cishell.reference/src/org/cishell/reference/app/service/filesaver/SaveAsController.java 2011-03-07 19:35:10 UTC (rev 1237) +++ trunk/core/org.cishell.reference/src/org/cishell/reference/app/service/filesaver/SaveAsController.java 2011-03-07 19:35:47 UTC (rev 1238) @@ -27,13 +27,8 @@ this.guiBuilder = guiBuilder; } - public File open(String fileName) { - String fileExtension = getFileExtension(fileName); - - return open(fileName, fileExtension); - } - - public File open(String suggestedFileName, String fileExtension) { + public File open(String suggestedFileName, String suggestedFileExtension) { + String fileExtension = determineFileExtension(suggestedFileName, suggestedFileExtension); Shell parentShell = PlatformUI.getWorkbench().getWorkbenchWindows()[0].getShell(); FileDialog dialog = new FileDialog(parentShell, SWT.SAVE); @@ -45,6 +40,8 @@ dialog.setFilterPath(currentDirectory.getPath()); if ((fileExtension != null) && !"*".equals(fileExtension) && !"".equals(fileExtension)) { + String isolatedFileName = stripFileExtension(suggestedFileName); + suggestedFileName = String.format("%s.%s", suggestedFileName, suggestedFileExtension); dialog.setFilterExtensions(new String[] { String.format("*.%s", fileExtension) }); } @@ -70,6 +67,30 @@ } } + private String determineFileExtension( + String suggestedFileName, String suggestedFileExtension) { + if ((suggestedFileExtension != null) && !"".equals(suggestedFileExtension)) { + return suggestedFileExtension; + } else { + String fileExtension = getFileExtension(suggestedFileName); + + if (!"".equals(fileExtension)) { + return fileExtension; + } else { + return ""; + } + } +// if (!"".equals(fileExtension)) { +// return fileExtension; +// } else { +// if (defaultFileExtension != null) { +// return defaultFileExtension; +// } else { +// return ""; +// } +// } + } + private boolean confirmFileOverwrite(File file) { String message = "The file:\n" + file.getPath() + "\nalready exists. Are you sure you want to overwrite it?"; @@ -112,4 +133,15 @@ return cleanedFilename; } + + // TODO: Use cns-utilities when that's done. + private static String stripFileExtension(String filePath) { + int periodPosition = filePath.lastIndexOf("."); + + if ((periodPosition != -1) && ((periodPosition + 1) < filePath.length())) { + return filePath.substring(0, periodPosition); + } else { + return filePath; + } + } } \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jrb...@us...> - 2011-04-01 20:57:36
|
Revision: 1241 http://cishell.svn.sourceforge.net/cishell/?rev=1241&view=rev Author: jrbibers Date: 2011-04-01 20:57:29 +0000 (Fri, 01 Apr 2011) Log Message: ----------- Welcome text URLs. Changed method of hyperlinking from welcome text. Previously we attempted to detect URLs in bare strings. This is a hard problem; consider cases like "(URL)", "(URL).", "(text URL)", and "(URL text)", especially when URL may contain infrequent-but-valid characters like parentheses. See http://www.codinghorror.com/blog/2008/10/the-problem-with-urls.html . Now we do not attempt URL detection. Strings in a piece of welcome text intended for formatting as a clickable link should be enclosed in "url" tags as in "Visit our website ([url]http://example.com[/url]) for more details". Reviewed by Micah. Modified Paths: -------------- trunk/clients/gui/org.cishell.reference.gui.brand.cishell/plugin.properties trunk/clients/gui/org.cishell.reference.gui.log/src/org/cishell/reference/gui/log/LogView.java trunk/core/org.cishell.utility.swt/src/org/cishell/utility/swt/SWTUtilities.java Modified: trunk/clients/gui/org.cishell.reference.gui.brand.cishell/plugin.properties =================================================================== --- trunk/clients/gui/org.cishell.reference.gui.brand.cishell/plugin.properties 2011-03-31 20:10:14 UTC (rev 1240) +++ trunk/clients/gui/org.cishell.reference.gui.brand.cishell/plugin.properties 2011-04-01 20:57:29 UTC (rev 1241) @@ -2,6 +2,7 @@ appName = CIShellApplication aboutImage = icons/about.gif windowImages = icons/alt16.gif,icons/alt32.gif,icons/alt64.gif +# Mark up URLs with url tags, like [url]http://example.com[/url]. blurb = Welcome to the Cyberinfrastructure Shell (CIShell) \ developed at the InfoVis Lab and the CI for Network Science Center \ at Indiana University.\n\n\ @@ -9,5 +10,5 @@ Bruce Herr, Weixia Huang, Shashikant Penumarthy, and Katy Borner. (in press). \ Designing Highly Flexible and Usable Cyberinfrastructures for Convergence. \ William S. Bainbridge (Ed.) Progress in Convergence. Annals of the New York Academy of Sciences.\n\ -http://cishell.org/papers/06-cishell.pdf +[url]http://cishell.org/papers/06-cishell.pdf[/url] Modified: trunk/clients/gui/org.cishell.reference.gui.log/src/org/cishell/reference/gui/log/LogView.java =================================================================== --- trunk/clients/gui/org.cishell.reference.gui.log/src/org/cishell/reference/gui/log/LogView.java 2011-03-31 20:10:14 UTC (rev 1240) +++ trunk/clients/gui/org.cishell.reference.gui.log/src/org/cishell/reference/gui/log/LogView.java 2011-04-01 20:57:29 UTC (rev 1241) @@ -127,8 +127,8 @@ for (StyleRange highlightStyle : highlights) { int start = nonHighlightStyle.start; - if ((start >= highlightStyle.start) && - (start < (highlightStyle.start + highlightStyle.length))) { + if ((start >= highlightStyle.start) + && (start < (highlightStyle.start + highlightStyle.length))) { newStyle = (StyleRange) newStyle.clone(); newStyle.background = HIGHLIGHTED_BACKGROUND_COLOR; } @@ -208,7 +208,8 @@ @SuppressWarnings("unchecked") public void createPartControl(Composite parent) { this.parent = parent; - this.textField = new StyledText(parent, SWT.BORDER | SWT.V_SCROLL | SWT.WRAP | SWT.READ_ONLY); + this.textField = + new StyledText(parent, SWT.BORDER | SWT.V_SCROLL | SWT.WRAP | SWT.READ_ONLY); this.textField.setEditable(false); this.textField.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_WHITE)); this.textField.getCaret().setVisible(false); @@ -261,11 +262,10 @@ Enumeration backLogEntries = logReaderService.getLog(); while (backLogEntries.hasMoreElements()) { - LogEntry logEntry = (LogEntry)backLogEntries.nextElement(); + LogEntry logEntry = (LogEntry) backLogEntries.nextElement(); this.logged(logEntry); } - } - else { + } else { System.out.println("reader is null"); } @@ -328,7 +328,7 @@ } } - Collection<StyleRange> styles = SWTUtilities.appendStringWithURL( + Collection<StyleRange> styles = SWTUtilities.urlifyUrls( LogView.this.textField, LogView.this.urlListener, LogView.this.urlCursorListener, @@ -348,10 +348,10 @@ } private boolean goodMessage(String msg) { - if (msg == null || - msg.startsWith("ServiceEvent ") || - msg.startsWith("BundleEvent ") || - msg.startsWith("FrameworkEvent ")) { + if (msg == null + || msg.startsWith("ServiceEvent ") + || msg.startsWith("BundleEvent ") + || msg.startsWith("FrameworkEvent ")) { return false; } else { return true; Modified: trunk/core/org.cishell.utility.swt/src/org/cishell/utility/swt/SWTUtilities.java =================================================================== --- trunk/core/org.cishell.utility.swt/src/org/cishell/utility/swt/SWTUtilities.java 2011-03-31 20:10:14 UTC (rev 1240) +++ trunk/core/org.cishell.utility.swt/src/org/cishell/utility/swt/SWTUtilities.java 2011-04-01 20:57:29 UTC (rev 1241) @@ -2,6 +2,7 @@ import java.util.Collection; import java.util.HashSet; +import java.util.regex.Pattern; import org.eclipse.swt.SWT; import org.eclipse.swt.custom.StyleRange; @@ -10,131 +11,90 @@ import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Display; -/** TODO: The URL (http://-prefixed) parsing utilities in this class need to be updated to handle - * https as well. - */ public class SWTUtilities { - public static final Color DEFAULT_BACKGROUND_COLOR = - new Color(Display.getDefault(), 255, 255, 255); - /* - * Append the given string to the console with the given color, this will do the job of - * checking for URLs within the string and registering the proper listeners on them as well. + public static final String URL_START_TAG = "[url]"; + public static final String URL_END_TAG = "[/url]"; + + /** Do not instantiate utilities. */ + protected SWTUtilities() { + throw new UnsupportedOperationException(); + } + + /** + * Style text within URL_START_TAG and URL_END_TAG like URLs and make them clickable links. */ - public static Collection<StyleRange> appendStringWithURL( + public static Collection<StyleRange> urlifyUrls( StyledText textField, URLClickedListener urlListener, URLMouseCursorListener urlCursorListener, String message, Color normalColor, Color urlColor) { - return appendStringWithURL( - textField, - urlListener, - urlCursorListener, - message, - DEFAULT_BACKGROUND_COLOR, - normalColor, - urlColor); - } - - public static Collection<StyleRange> appendStringWithURL( - StyledText textField, - URLClickedListener urlListener, - URLMouseCursorListener urlCursorListener, - String message, - Color backgroundColor, - Color normalColor, - Color urlColor) { - - //find a URL in the message - - int index = message.indexOf("http://"); - if (index == -1) { - index = message.indexOf("https://"); - } - if (index == -1) { - index = message.indexOf("www."); - } - - if (index > -1) { - String url = message.substring(index); - if (url.indexOf(") ") > -1) { - url = url.substring(0, url.indexOf(") ")); - } - else if (url.indexOf(" ") > -1) { - url = url.substring(0, url.indexOf(" ")); - if (url.trim().endsWith(".") ){ - url=url.substring(0, url.length()-1); - } - } - if (url.endsWith(".\n") || url.endsWith(".\t")){ - url=url.substring(0, url.length()-2); - } - if (url.indexOf("\n") > -1) { - url = url.substring(0, url.indexOf("\n")); - } - if (url.indexOf("\t") > -1) { - url = url.substring(0, url.indexOf("\n")); - } - - - StyleRange preURLStyle = syncedStyledPrint( - textField, message.substring(0, index), backgroundColor, normalColor, SWT.NORMAL); - urlListener.addURL(textField.getText().length(), url); - urlCursorListener.addURL(textField.getText().length(), url); - StyleRange urlStyle = - syncedStyledPrint(textField, url, backgroundColor, urlColor, SWT.BOLD); - Collection<StyleRange> postURLStyles = appendStringWithURL( - textField, - urlListener, - urlCursorListener, - message.substring(index + url.length()), - backgroundColor, - normalColor, - urlColor); - - Collection<StyleRange> finalStyles = new HashSet<StyleRange>(); - - if (preURLStyle != null) { - finalStyles.add(preURLStyle); - } - - if (urlStyle != null) { - finalStyles.add(urlStyle); - } - - finalStyles.addAll(postURLStyles); - - return finalStyles; - } else { - StyleRange style = syncedStyledPrint( - textField, message, backgroundColor, normalColor, SWT.NORMAL); - - if (style != null) { - Collection<StyleRange> finalStyles = new HashSet<StyleRange>(); - finalStyles.add(style); - - return finalStyles; - } else { - return new HashSet<StyleRange>(); - } - } + int startTagIndex = message.indexOf(URL_START_TAG); + int endTagIndex = message.indexOf(URL_END_TAG); + + boolean urlDetected = startTagIndex >= 0 && endTagIndex >= 0; + if (urlDetected) { + String urlWithTags = + message.substring(startTagIndex, endTagIndex + URL_END_TAG.length()); + String url = + urlWithTags.substring( + URL_START_TAG.length(), + urlWithTags.length() - URL_END_TAG.length()); + + String messageWithFirstUrlDetagged = + message.replaceFirst(Pattern.quote(urlWithTags), url); + + String messageBeforeUrl = messageWithFirstUrlDetagged.substring(0, startTagIndex); + StyleRange preURLStyle = syncedStyledPrint( + textField, messageBeforeUrl, normalColor, SWT.NORMAL); + urlListener.addURL(textField.getText().length(), url); + urlCursorListener.addURL(textField.getText().length(), url); + StyleRange urlStyle = + syncedStyledPrint(textField, url, urlColor, SWT.BOLD); + String messageBeyondFirstUrl = + messageWithFirstUrlDetagged.substring(startTagIndex + url.length()); + Collection<StyleRange> postURLStyles = urlifyUrls( + textField, + urlListener, + urlCursorListener, + messageBeyondFirstUrl, + normalColor, + urlColor); + + Collection<StyleRange> finalStyles = new HashSet<StyleRange>(); + + if (preURLStyle != null) { + finalStyles.add(preURLStyle); + } + + if (urlStyle != null) { + finalStyles.add(urlStyle); + } + + finalStyles.addAll(postURLStyles); + + return finalStyles; + } else { + StyleRange style = syncedStyledPrint(textField, message, normalColor, SWT.NORMAL); + + if (style != null) { + Collection<StyleRange> finalStyles = new HashSet<StyleRange>(); + finalStyles.add(style); + + return finalStyles; + } else { + return new HashSet<StyleRange>(); + } + } } - /* - * Helper to actually format the string with a style range and - * append it to the StyledText control. + /** + * Format the string with a style range and append it to the StyledText control. */ - public static StyleRange syncedStyledPrint( - StyledText textField, String message, Color color, int style) { - return syncedStyledPrint(textField, message, DEFAULT_BACKGROUND_COLOR, color, style); - } - - public static StyleRange syncedStyledPrint( final StyledText textField, final String message, - final Color backgroundColor, final Color color, final int style) { final StyleRange[] styleRange = new StyleRange[1]; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <re...@us...> - 2011-12-20 22:45:57
|
Revision: 1296 http://cishell.svn.sourceforge.net/cishell/?rev=1296&view=rev Author: rescdsk Date: 2011-12-20 22:45:48 +0000 (Tue, 20 Dec 2011) Log Message: ----------- Undo Maven stuff that should have been on a branch Modified Paths: -------------- trunk/clients/gui/org.cishell.reference.gui.brand.cishell/.classpath trunk/clients/gui/org.cishell.reference.gui.brand.cishell/.project trunk/core/org.cishell.framework/.classpath trunk/core/org.cishell.framework/.project trunk/core/org.cishell.framework/.settings/org.eclipse.jdt.core.prefs trunk/core/org.cishell.reference/.classpath trunk/core/org.cishell.reference/.project trunk/core/org.cishell.reference/.settings/org.eclipse.jdt.core.prefs trunk/deployment/org.cishell.environment.equinox.feature/.project trunk/deployment/org.cishell.feature/.project trunk/deployment/org.cishell.feature/feature.xml trunk/deployment/org.cishell.reference.releng/.project trunk/deployment/org.cishell.reference.releng/cishell.product Added Paths: ----------- trunk/clients/gui/org.cishell.reference.gui.brand.cishell/extra-files/ Removed Paths: ------------- trunk/clients/gui/org.cishell.reference.gui.brand.cishell/.settings/ trunk/clients/gui/org.cishell.reference.gui.brand.cishell/pom.xml trunk/core/org.cishell.framework/.settings/org.eclipse.core.resources.prefs trunk/core/org.cishell.framework/.settings/org.eclipse.m2e.core.prefs trunk/core/org.cishell.framework/pom.xml trunk/core/org.cishell.reference/.settings/org.eclipse.m2e.core.prefs trunk/core/org.cishell.reference/pom.xml trunk/deployment/org.cishell.environment.equinox.feature/.settings/ trunk/deployment/org.cishell.environment.equinox.feature/pom.xml trunk/deployment/org.cishell.feature/.settings/ trunk/deployment/org.cishell.feature/pom.xml trunk/deployment/org.cishell.reference.releng/.settings/ trunk/deployment/org.cishell.reference.releng/pom.xml trunk/deployment/org.cishell.reference.releng/workspace/ Property Changed: ---------------- trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/load/FileLoadAlgorithm.java trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/view/core/ViewDataChooser.java trunk/clients/gui/org.cishell.reference.gui.workspace/src/org/cishell/reference/gui/workspace/common/ trunk/core/org.cishell.framework/src/org/cishell/service/algorithminvocation/FakeAlgorithmInvocationService.java trunk/core/org.cishell.reference/src/org/cishell/reference/app/service/algorithminvocation/FakeAlgorithmInvocationServiceImpl.java trunk/core/org.cishell.reference/src/org/cishell/reference/app/service/persistence/AbstractDialog.java trunk/core/org.cishell.reference.service.database/src/org/cishell/reference/service/database/DerbyDatabaseService.java trunk/core/org.cishell.reference.service.database/src/org/cishell/reference/service/database/ExternalDatabase.java trunk/core/org.cishell.utility.datastructure/src/org/cishell/utility/datastructure/ trunk/core/org.cishell.utility.datastructure/src/org/cishell/utility/datastructure/ObjectContainer.java trunk/core/org.cishell.utility.datastructure/src/org/cishell/utility/datastructure/datamodel/ModelDataSynchronizer.java trunk/core/org.cishell.utility.datastructure/src/org/cishell/utility/datastructure/datamodel/field/validation/FieldValidationAction.java trunk/core/org.cishell.utility.datastructure/src/org/cishell/utility/datastructure/datamodel/field/validation/FieldValidationRule.java trunk/core/org.cishell.utility.swt/src/org/cishell/utility/swt/ExpandableComponentWidget.java trunk/core/org.cishell.utility.swt/src/org/cishell/utility/swt/FileSaveAs.java trunk/core/org.cishell.utility.swt/src/org/cishell/utility/swt/GUIBuilderUtilities.java trunk/core/org.cishell.utility.swt/src/org/cishell/utility/swt/GUICanceledException.java trunk/core/org.cishell.utility.swt/src/org/cishell/utility/swt/GridContainer.java trunk/core/org.cishell.utility.swt/src/org/cishell/utility/swt/SWTUtilities.java trunk/core/org.cishell.utility.swt/src/org/cishell/utility/swt/ScrolledComponentFactory.java trunk/core/org.cishell.utility.swt/src/org/cishell/utility/swt/URLClickedListener.java trunk/core/org.cishell.utility.swt/src/org/cishell/utility/swt/URLMouseCursorListener.java trunk/core/org.cishell.utility.swt/src/org/cishell/utility/swt/model/ModelFieldException.java trunk/core/org.cishell.utility.swt/src/org/cishell/utility/swt/model/SWTModel.java trunk/core/org.cishell.utility.swt/src/org/cishell/utility/swt/model/SWTModelField.java trunk/core/org.cishell.utility.swt/src/org/cishell/utility/swt/model/datasynchronizer/ trunk/core/org.cishell.utility.swt/src/org/cishell/utility/swt/model/datasynchronizer/CheckBoxDataSynchronizer.java trunk/core/org.cishell.utility.swt/src/org/cishell/utility/swt/model/datasynchronizer/DateDataSynchronizer.java trunk/core/org.cishell.utility.swt/src/org/cishell/utility/swt/model/datasynchronizer/DropDownDataSynchronizer.java trunk/core/org.cishell.utility.swt/src/org/cishell/utility/swt/model/datasynchronizer/SingleListSelectionDataSynchronizer.java trunk/core/org.cishell.utility.swt/src/org/cishell/utility/swt/model/datasynchronizer/TextDataSynchronizer.java trunk/core/org.cishell.utility.swt/src/org/cishell/utility/swt/model/datasynchronizer/TimeDataSynchronizer.java trunk/deployment/org.cishell.reference.releng/ trunk/templates/org.cishell.templates.wizards/src/org/cishell/templates/staticexecutable/optiontypes/PlatformOption.java Modified: trunk/clients/gui/org.cishell.reference.gui.brand.cishell/.classpath =================================================================== --- trunk/clients/gui/org.cishell.reference.gui.brand.cishell/.classpath 2011-12-20 18:49:16 UTC (rev 1295) +++ trunk/clients/gui/org.cishell.reference.gui.brand.cishell/.classpath 2011-12-20 22:45:48 UTC (rev 1296) @@ -1,7 +1,7 @@ -<?xml version="1.0" encoding="UTF-8"?> -<classpath> - <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> - <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> - <classpathentry kind="src" path="src/"/> - <classpathentry kind="output" path="target/classes"/> -</classpath> +<?xml version="1.0" encoding="UTF-8"?> +<classpath> + <classpathentry kind="src" path="src"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> + <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> + <classpathentry kind="output" path="bin"/> +</classpath> Modified: trunk/clients/gui/org.cishell.reference.gui.brand.cishell/.project =================================================================== --- trunk/clients/gui/org.cishell.reference.gui.brand.cishell/.project 2011-12-20 18:49:16 UTC (rev 1295) +++ trunk/clients/gui/org.cishell.reference.gui.brand.cishell/.project 2011-12-20 22:45:48 UTC (rev 1296) @@ -1,40 +1,34 @@ -<?xml version="1.0" encoding="UTF-8"?> -<projectDescription> - <name>org.cishell.reference.gui.brand.cishell</name> - <comment></comment> - <projects> - </projects> - <buildSpec> - <buildCommand> - <name>org.eclipse.jdt.core.javabuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>org.eclipse.pde.ManifestBuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>org.eclipse.pde.SchemaBuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>net.sourceforge.metrics.builder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>org.eclipse.m2e.core.maven2Builder</name> - <arguments> - </arguments> - </buildCommand> - </buildSpec> - <natures> - <nature>org.eclipse.m2e.core.maven2Nature</nature> - <nature>org.eclipse.pde.PluginNature</nature> - <nature>org.eclipse.jdt.core.javanature</nature> - <nature>net.sourceforge.metrics.nature</nature> - </natures> -</projectDescription> +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>org.cishell.reference.gui.brand.cishell</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.jdt.core.javabuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.pde.ManifestBuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.pde.SchemaBuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>net.sourceforge.metrics.builder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.pde.PluginNature</nature> + <nature>org.eclipse.jdt.core.javanature</nature> + <nature>net.sourceforge.metrics.nature</nature> + </natures> +</projectDescription> Deleted: trunk/clients/gui/org.cishell.reference.gui.brand.cishell/pom.xml =================================================================== --- trunk/clients/gui/org.cishell.reference.gui.brand.cishell/pom.xml 2011-12-20 18:49:16 UTC (rev 1295) +++ trunk/clients/gui/org.cishell.reference.gui.brand.cishell/pom.xml 2011-12-20 22:45:48 UTC (rev 1296) @@ -1,18 +0,0 @@ -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - <artifactId>org.cishell.reference.gui.brand.cishell</artifactId> - <packaging>eclipse-plugin</packaging> - <version>0.4.0</version> - <parent> - <groupId>org.cishell</groupId> - <artifactId>plugin-parent</artifactId> - <version>0.0.1</version> - <relativePath>../plugin-parent/pom.xml</relativePath> - </parent> - - <build> - <sourceDirectory>src</sourceDirectory> - </build> - -</project> \ No newline at end of file Property changes on: trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/load/FileLoadAlgorithm.java ___________________________________________________________________ Deleted: svn:mergeinfo - Property changes on: trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/view/core/ViewDataChooser.java ___________________________________________________________________ Deleted: svn:mergeinfo - Property changes on: trunk/clients/gui/org.cishell.reference.gui.workspace/src/org/cishell/reference/gui/workspace/common ___________________________________________________________________ Deleted: svn:mergeinfo - Modified: trunk/core/org.cishell.framework/.classpath =================================================================== --- trunk/core/org.cishell.framework/.classpath 2011-12-20 18:49:16 UTC (rev 1295) +++ trunk/core/org.cishell.framework/.classpath 2011-12-20 22:45:48 UTC (rev 1296) @@ -2,6 +2,6 @@ <classpath> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/> <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> - <classpathentry kind="src" path="src/"/> - <classpathentry kind="output" path="target/classes"/> + <classpathentry kind="src" path="src"/> + <classpathentry kind="output" path="bin"/> </classpath> Modified: trunk/core/org.cishell.framework/.project =================================================================== --- trunk/core/org.cishell.framework/.project 2011-12-20 18:49:16 UTC (rev 1295) +++ trunk/core/org.cishell.framework/.project 2011-12-20 22:45:48 UTC (rev 1296) @@ -1,34 +1,28 @@ -<?xml version="1.0" encoding="UTF-8"?> -<projectDescription> - <name>org.cishell.framework</name> - <comment></comment> - <projects> - </projects> - <buildSpec> - <buildCommand> - <name>org.eclipse.jdt.core.javabuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>org.eclipse.pde.ManifestBuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>org.eclipse.pde.SchemaBuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>org.eclipse.m2e.core.maven2Builder</name> - <arguments> - </arguments> - </buildCommand> - </buildSpec> - <natures> - <nature>org.eclipse.m2e.core.maven2Nature</nature> - <nature>org.eclipse.pde.PluginNature</nature> - <nature>org.eclipse.jdt.core.javanature</nature> - </natures> -</projectDescription> +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>org.cishell.framework</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.jdt.core.javabuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.pde.ManifestBuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.pde.SchemaBuilder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.pde.PluginNature</nature> + <nature>org.eclipse.jdt.core.javanature</nature> + </natures> +</projectDescription> Deleted: trunk/core/org.cishell.framework/.settings/org.eclipse.core.resources.prefs =================================================================== --- trunk/core/org.cishell.framework/.settings/org.eclipse.core.resources.prefs 2011-12-20 18:49:16 UTC (rev 1295) +++ trunk/core/org.cishell.framework/.settings/org.eclipse.core.resources.prefs 2011-12-20 22:45:48 UTC (rev 1296) @@ -1,3 +0,0 @@ -#Thu Dec 15 14:05:43 EST 2011 -eclipse.preferences.version=1 -encoding/src=UTF-8 Modified: trunk/core/org.cishell.framework/.settings/org.eclipse.jdt.core.prefs =================================================================== --- trunk/core/org.cishell.framework/.settings/org.eclipse.jdt.core.prefs 2011-12-20 18:49:16 UTC (rev 1295) +++ trunk/core/org.cishell.framework/.settings/org.eclipse.jdt.core.prefs 2011-12-20 22:45:48 UTC (rev 1296) @@ -1,4 +1,4 @@ -#Fri Dec 09 14:04:21 EST 2011 +#Fri Jun 11 22:41:08 EDT 2010 eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 @@ -9,5 +9,4 @@ org.eclipse.jdt.core.compiler.debug.sourceFile=generate org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning org.eclipse.jdt.core.compiler.source=1.5 Deleted: trunk/core/org.cishell.framework/.settings/org.eclipse.m2e.core.prefs =================================================================== --- trunk/core/org.cishell.framework/.settings/org.eclipse.m2e.core.prefs 2011-12-20 18:49:16 UTC (rev 1295) +++ trunk/core/org.cishell.framework/.settings/org.eclipse.m2e.core.prefs 2011-12-20 22:45:48 UTC (rev 1296) @@ -1,5 +0,0 @@ -#Fri Dec 09 13:55:42 EST 2011 -activeProfiles= -eclipse.preferences.version=1 -resolveWorkspaceProjects=true -version=1 Deleted: trunk/core/org.cishell.framework/pom.xml =================================================================== --- trunk/core/org.cishell.framework/pom.xml 2011-12-20 18:49:16 UTC (rev 1295) +++ trunk/core/org.cishell.framework/pom.xml 2011-12-20 22:45:48 UTC (rev 1296) @@ -1,18 +0,0 @@ -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - <artifactId>org.cishell.framework</artifactId> - <packaging>eclipse-plugin</packaging> - <version>1.0.0</version> - <parent> - <groupId>org.cishell</groupId> - <artifactId>plugin-parent</artifactId> - <version>0.0.1</version> - <relativePath>../plugin-parent/pom.xml</relativePath> - </parent> - - <build> - <sourceDirectory>src</sourceDirectory> - </build> - -</project> \ No newline at end of file Property changes on: trunk/core/org.cishell.framework/src/org/cishell/service/algorithminvocation/FakeAlgorithmInvocationService.java ___________________________________________________________________ Deleted: svn:mergeinfo - Modified: trunk/core/org.cishell.reference/.classpath =================================================================== --- trunk/core/org.cishell.reference/.classpath 2011-12-20 18:49:16 UTC (rev 1295) +++ trunk/core/org.cishell.reference/.classpath 2011-12-20 22:45:48 UTC (rev 1296) @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <classpath> - <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/> + <classpathentry kind="src" path="src"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> - <classpathentry kind="src" path="src/"/> - <classpathentry kind="output" path="target/classes"/> + <classpathentry kind="output" path="bin"/> </classpath> Modified: trunk/core/org.cishell.reference/.project =================================================================== --- trunk/core/org.cishell.reference/.project 2011-12-20 18:49:16 UTC (rev 1295) +++ trunk/core/org.cishell.reference/.project 2011-12-20 22:45:48 UTC (rev 1296) @@ -1,34 +1,28 @@ -<?xml version="1.0" encoding="UTF-8"?> -<projectDescription> - <name>org.cishell.reference</name> - <comment></comment> - <projects> - </projects> - <buildSpec> - <buildCommand> - <name>org.eclipse.jdt.core.javabuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>org.eclipse.pde.ManifestBuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>org.eclipse.pde.SchemaBuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>org.eclipse.m2e.core.maven2Builder</name> - <arguments> - </arguments> - </buildCommand> - </buildSpec> - <natures> - <nature>org.eclipse.m2e.core.maven2Nature</nature> - <nature>org.eclipse.pde.PluginNature</nature> - <nature>org.eclipse.jdt.core.javanature</nature> - </natures> -</projectDescription> +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>org.cishell.reference</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.jdt.core.javabuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.pde.ManifestBuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.pde.SchemaBuilder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.pde.PluginNature</nature> + <nature>org.eclipse.jdt.core.javanature</nature> + </natures> +</projectDescription> Modified: trunk/core/org.cishell.reference/.settings/org.eclipse.jdt.core.prefs =================================================================== --- trunk/core/org.cishell.reference/.settings/org.eclipse.jdt.core.prefs 2011-12-20 18:49:16 UTC (rev 1295) +++ trunk/core/org.cishell.reference/.settings/org.eclipse.jdt.core.prefs 2011-12-20 22:45:48 UTC (rev 1296) @@ -1,4 +1,4 @@ -#Thu Dec 15 14:43:35 EST 2011 +#Wed Jul 21 20:42:37 EDT 2010 eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 @@ -9,5 +9,4 @@ org.eclipse.jdt.core.compiler.debug.sourceFile=generate org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning org.eclipse.jdt.core.compiler.source=1.5 Deleted: trunk/core/org.cishell.reference/.settings/org.eclipse.m2e.core.prefs =================================================================== --- trunk/core/org.cishell.reference/.settings/org.eclipse.m2e.core.prefs 2011-12-20 18:49:16 UTC (rev 1295) +++ trunk/core/org.cishell.reference/.settings/org.eclipse.m2e.core.prefs 2011-12-20 22:45:48 UTC (rev 1296) @@ -1,5 +0,0 @@ -#Thu Dec 15 14:43:34 EST 2011 -activeProfiles= -eclipse.preferences.version=1 -resolveWorkspaceProjects=true -version=1 Deleted: trunk/core/org.cishell.reference/pom.xml =================================================================== --- trunk/core/org.cishell.reference/pom.xml 2011-12-20 18:49:16 UTC (rev 1295) +++ trunk/core/org.cishell.reference/pom.xml 2011-12-20 22:45:48 UTC (rev 1296) @@ -1,26 +0,0 @@ -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - <artifactId>org.cishell.reference</artifactId> - <version>1.0.0</version> - <packaging>eclipse-plugin</packaging> - <parent> - <groupId>org.cishell</groupId> - <artifactId>plugin-parent</artifactId> - <version>0.0.1</version> - <relativePath>../plugin-parent/pom.xml</relativePath> - </parent> - - <build> - <sourceDirectory>src</sourceDirectory> - - </build> - <dependencies> - <dependency> - <groupId>jung</groupId> - <artifactId>jung</artifactId> - <version>1.7.5</version> - </dependency> - </dependencies> - -</project> \ No newline at end of file Property changes on: trunk/core/org.cishell.reference/src/org/cishell/reference/app/service/algorithminvocation/FakeAlgorithmInvocationServiceImpl.java ___________________________________________________________________ Deleted: svn:mergeinfo - Property changes on: trunk/core/org.cishell.reference/src/org/cishell/reference/app/service/persistence/AbstractDialog.java ___________________________________________________________________ Deleted: svn:mergeinfo - Property changes on: trunk/core/org.cishell.reference.service.database/src/org/cishell/reference/service/database/DerbyDatabaseService.java ___________________________________________________________________ Deleted: svn:mergeinfo - Property changes on: trunk/core/org.cishell.reference.service.database/src/org/cishell/reference/service/database/ExternalDatabase.java ___________________________________________________________________ Deleted: svn:mergeinfo - Property changes on: trunk/core/org.cishell.utility.datastructure/src/org/cishell/utility/datastructure ___________________________________________________________________ Deleted: svn:mergeinfo - Property changes on: trunk/core/org.cishell.utility.datastructure/src/org/cishell/utility/datastructure/ObjectContainer.java ___________________________________________________________________ Deleted: svn:mergeinfo - Property changes on: trunk/core/org.cishell.utility.datastructure/src/org/cishell/utility/datastructure/datamodel/ModelDataSynchronizer.java ___________________________________________________________________ Deleted: svn:mergeinfo - Property changes on: trunk/core/org.cishell.utility.datastructure/src/org/cishell/utility/datastructure/datamodel/field/validation/FieldValidationAction.java ___________________________________________________________________ Deleted: svn:mergeinfo - Property changes on: trunk/core/org.cishell.utility.datastructure/src/org/cishell/utility/datastructure/datamodel/field/validation/FieldValidationRule.java ___________________________________________________________________ Deleted: svn:mergeinfo - Property changes on: trunk/core/org.cishell.utility.swt/src/org/cishell/utility/swt/ExpandableComponentWidget.java ___________________________________________________________________ Deleted: svn:mergeinfo - Property changes on: trunk/core/org.cishell.utility.swt/src/org/cishell/utility/swt/FileSaveAs.java ___________________________________________________________________ Deleted: svn:mergeinfo - Property changes on: trunk/core/org.cishell.utility.swt/src/org/cishell/utility/swt/GUIBuilderUtilities.java ___________________________________________________________________ Deleted: svn:mergeinfo - Property changes on: trunk/core/org.cishell.utility.swt/src/org/cishell/utility/swt/GUICanceledException.java ___________________________________________________________________ Deleted: svn:mergeinfo - Property changes on: trunk/core/org.cishell.utility.swt/src/org/cishell/utility/swt/GridContainer.java ___________________________________________________________________ Deleted: svn:mergeinfo - Property changes on: trunk/core/org.cishell.utility.swt/src/org/cishell/utility/swt/SWTUtilities.java ___________________________________________________________________ Deleted: svn:mergeinfo - Property changes on: trunk/core/org.cishell.utility.swt/src/org/cishell/utility/swt/ScrolledComponentFactory.java ___________________________________________________________________ Deleted: svn:mergeinfo - Property changes on: trunk/core/org.cishell.utility.swt/src/org/cishell/utility/swt/URLClickedListener.java ___________________________________________________________________ Deleted: svn:mergeinfo - Property changes on: trunk/core/org.cishell.utility.swt/src/org/cishell/utility/swt/URLMouseCursorListener.java ___________________________________________________________________ Deleted: svn:mergeinfo - Property changes on: trunk/core/org.cishell.utility.swt/src/org/cishell/utility/swt/model/ModelFieldException.java ___________________________________________________________________ Deleted: svn:mergeinfo - Property changes on: trunk/core/org.cishell.utility.swt/src/org/cishell/utility/swt/model/SWTModel.java ___________________________________________________________________ Deleted: svn:mergeinfo - Property changes on: trunk/core/org.cishell.utility.swt/src/org/cishell/utility/swt/model/SWTModelField.java ___________________________________________________________________ Deleted: svn:mergeinfo - Property changes on: trunk/core/org.cishell.utility.swt/src/org/cishell/utility/swt/model/datasynchronizer ___________________________________________________________________ Deleted: svn:mergeinfo - Property changes on: trunk/core/org.cishell.utility.swt/src/org/cishell/utility/swt/model/datasynchronizer/CheckBoxDataSynchronizer.java ___________________________________________________________________ Deleted: svn:mergeinfo - Property changes on: trunk/core/org.cishell.utility.swt/src/org/cishell/utility/swt/model/datasynchronizer/DateDataSynchronizer.java ___________________________________________________________________ Deleted: svn:mergeinfo - Property changes on: trunk/core/org.cishell.utility.swt/src/org/cishell/utility/swt/model/datasynchronizer/DropDownDataSynchronizer.java ___________________________________________________________________ Deleted: svn:mergeinfo - Property changes on: trunk/core/org.cishell.utility.swt/src/org/cishell/utility/swt/model/datasynchronizer/SingleListSelectionDataSynchronizer.java ___________________________________________________________________ Deleted: svn:mergeinfo - Property changes on: trunk/core/org.cishell.utility.swt/src/org/cishell/utility/swt/model/datasynchronizer/TextDataSynchronizer.java ___________________________________________________________________ Deleted: svn:mergeinfo - Property changes on: trunk/core/org.cishell.utility.swt/src/org/cishell/utility/swt/model/datasynchronizer/TimeDataSynchronizer.java ___________________________________________________________________ Deleted: svn:mergeinfo - Modified: trunk/deployment/org.cishell.environment.equinox.feature/.project =================================================================== --- trunk/deployment/org.cishell.environment.equinox.feature/.project 2011-12-20 18:49:16 UTC (rev 1295) +++ trunk/deployment/org.cishell.environment.equinox.feature/.project 2011-12-20 22:45:48 UTC (rev 1296) @@ -1,23 +1,17 @@ -<?xml version="1.0" encoding="UTF-8"?> -<projectDescription> - <name>org.cishell.environment.equinox.feature</name> - <comment></comment> - <projects> - </projects> - <buildSpec> - <buildCommand> - <name>org.eclipse.pde.FeatureBuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>org.eclipse.m2e.core.maven2Builder</name> - <arguments> - </arguments> - </buildCommand> - </buildSpec> - <natures> - <nature>org.eclipse.m2e.core.maven2Nature</nature> - <nature>org.eclipse.pde.FeatureNature</nature> - </natures> -</projectDescription> +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>org.cishell.environment.equinox.feature</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.pde.FeatureBuilder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.pde.FeatureNature</nature> + </natures> +</projectDescription> Deleted: trunk/deployment/org.cishell.environment.equinox.feature/pom.xml =================================================================== --- trunk/deployment/org.cishell.environment.equinox.feature/pom.xml 2011-12-20 18:49:16 UTC (rev 1295) +++ trunk/deployment/org.cishell.environment.equinox.feature/pom.xml 2011-12-20 22:45:48 UTC (rev 1296) @@ -1,18 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<project - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" - xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> - - <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>org.cishell</groupId> - <artifactId>parent</artifactId> - <version>0.0.1</version> - <relativePath>../parent/pom.xml</relativePath> - </parent> - - <artifactId>org.cishell.environment.equinox.feature</artifactId> - <version>1.0.0</version> - <packaging>eclipse-feature</packaging> - -</project> \ No newline at end of file Modified: trunk/deployment/org.cishell.feature/.project =================================================================== --- trunk/deployment/org.cishell.feature/.project 2011-12-20 18:49:16 UTC (rev 1295) +++ trunk/deployment/org.cishell.feature/.project 2011-12-20 22:45:48 UTC (rev 1296) @@ -1,23 +1,17 @@ -<?xml version="1.0" encoding="UTF-8"?> -<projectDescription> - <name>org.cishell.feature</name> - <comment></comment> - <projects> - </projects> - <buildSpec> - <buildCommand> - <name>org.eclipse.pde.FeatureBuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>org.eclipse.m2e.core.maven2Builder</name> - <arguments> - </arguments> - </buildCommand> - </buildSpec> - <natures> - <nature>org.eclipse.m2e.core.maven2Nature</nature> - <nature>org.eclipse.pde.FeatureNature</nature> - </natures> -</projectDescription> +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>org.cishell.feature</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.pde.FeatureBuilder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.pde.FeatureNature</nature> + </natures> +</projectDescription> Modified: trunk/deployment/org.cishell.feature/feature.xml =================================================================== --- trunk/deployment/org.cishell.feature/feature.xml 2011-12-20 18:49:16 UTC (rev 1295) +++ trunk/deployment/org.cishell.feature/feature.xml 2011-12-20 22:45:48 UTC (rev 1296) @@ -1,18 +1,18 @@ -<?xml version="1.0" encoding="UTF-8"?> -<feature - id="org.cishell.feature" - label="CIShell Framework API Feature" - version="1.0.0"> - - <description url="http://cishell.org"> - CIShell Framework API - </description> - - <copyright> - Copyright 2006 Indiana University - </copyright> - - <license url="http://www.apache.org/licenses/LICENSE-2.0"> +<?xml version="1.0" encoding="UTF-8"?> +<feature + id="org.cishell.feature" + label="CIShell Framework API Feature" + version="1.0.0"> + + <description url="http://cishell.org"> + CIShell Framework API + </description> + + <copyright> + Copyright 2006 Indiana University + </copyright> + + <license url="http://www.apache.org/licenses/LICENSE-2.0"> CIShell: Cyberinfrastructure Shell Copyright 2006 Indiana University Licensed under the Apache License, Version 2.0 (the "License"); @@ -28,19 +28,19 @@ Bruce Herr (bh...@bh...) Weixia Huang (hu...@in...) Shashikant Penumarthy (sp...@in...) -Dr. Katy Borner (ka...@in...) - </license> - - <url> - <update label="CIShell Update Site" url="http://cishell.org/update"/> - <discovery label="CIShell Update Site" url="http://cishell.org/update"/> - </url> - - <plugin - id="org.cishell.framework" - download-size="0" - install-size="0" - version="0.0.0" - unpack="false"/> - -</feature> +Dr. Katy Borner (ka...@in...) + </license> + + <url> + <update label="CIShell Update Site" url="http://cishell.org/update"/> + <discovery label="CIShell Update Site" url="http://cishell.org/update"/> + </url> + + <plugin + id="org.cishell.framework" + download-size="0" + install-size="0" + version="0.0.0" + unpack="false"/> + +</feature> Deleted: trunk/deployment/org.cishell.feature/pom.xml =================================================================== --- trunk/deployment/org.cishell.feature/pom.xml 2011-12-20 18:49:16 UTC (rev 1295) +++ trunk/deployment/org.cishell.feature/pom.xml 2011-12-20 22:45:48 UTC (rev 1296) @@ -1,18 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<project - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" - xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> - - <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>org.cishell</groupId> - <artifactId>parent</artifactId> - <version>0.0.1</version> - <relativePath>../parent/pom.xml</relativePath> - </parent> - - <artifactId>org.cishell.feature</artifactId> - <version>1.0.0</version> - <packaging>eclipse-feature</packaging> - -</project> \ No newline at end of file Property changes on: trunk/deployment/org.cishell.reference.releng ___________________________________________________________________ Deleted: svn:ignore - target Modified: trunk/deployment/org.cishell.reference.releng/.project =================================================================== --- trunk/deployment/org.cishell.reference.releng/.project 2011-12-20 18:49:16 UTC (rev 1295) +++ trunk/deployment/org.cishell.reference.releng/.project 2011-12-20 22:45:48 UTC (rev 1296) @@ -1,18 +1,12 @@ -<?xml version="1.0" encoding="UTF-8"?> -<projectDescription> - <name>org.cishell.reference.releng</name> - <comment></comment> - <projects> - </projects> - <buildSpec> - <buildCommand> - <name>org.eclipse.m2e.core.maven2Builder</name> - <arguments> - </arguments> - </buildCommand> - </buildSpec> - <natures> - <nature>org.eclipse.m2e.core.maven2Nature</nature> - <nature>org.pluginbuilder.core.pluginBuilderNature</nature> - </natures> -</projectDescription> +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>org.cishell.reference.releng</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + </buildSpec> + <natures> + <nature>org.pluginbuilder.core.pluginBuilderNature</nature> + </natures> +</projectDescription> Modified: trunk/deployment/org.cishell.reference.releng/cishell.product =================================================================== --- trunk/deployment/org.cishell.reference.releng/cishell.product 2011-12-20 18:49:16 UTC (rev 1295) +++ trunk/deployment/org.cishell.reference.releng/cishell.product 2011-12-20 22:45:48 UTC (rev 1296) @@ -1,64 +1,53 @@ -<?xml version="1.0" encoding="UTF-8"?> -<?pde version="3.5"?> - -<product name="Cyberinfrastructure Shell" uid="cishell" id="org.cishell.reference.gui.brand.cishell.cishell" application="org.cishell.reference.gui.workspace.CIShellApplication" version="0.0.1" useFeatures="true" includeLaunchers="true"> - - <aboutInfo> - <image path="icons/about.gif"/> - <text> - %blurb - </text> - </aboutInfo> - - <configIni use="default"> - <linux>/org.cishell.reference.gui.brand.cishell/extra-files/configuration/config.ini</linux> - <macosx>/org.cishell.reference.gui.brand.cishell/extra-files/configuration/config.ini</macosx> - <solaris>/org.cishell.reference.gui.brand.cishell/extra-files/configuration/config.ini</solaris> - <win32>/org.cishell.reference.gui.brand.cishell/extra-files/configuration/config.ini</win32> - </configIni> - - <configurations> - <plugin id="org.eclipse.core.runtime" autoStart="true" startLevel="4" /> - <plugin id="org.eclipse.equinox.log" autoStart="true" startLevel="4" /> - </configurations> - <launcherArgs> - </launcherArgs> - - <windowImages/> - - <splash - location="org.cishell.reference.gui.brand.cishell" - startupProgressRect="0,163,500,10" /> - <launcher name="cishell"> - <linux icon="/org.cishell.reference.gui.brand.cishell/icons/cishell.xpm"/> - <macosx icon="/org.cishell.reference.gui.brand.cishell/icons/cishell.icns"/> - <solaris/> - <win useIco="true"> - <ico path="/org.cishell.reference.gui.brand.cishell/icons/cishell.ico"/> - <bmp - winSmallHigh="icons/ivc_sm_32.bmp" - winSmallLow="icons/ivc_sm_16.bmp" - winMediumHigh="icons/ivc_lg_32.bmp" - winMediumLow="icons/ivc_lg_16.bmp" - winLargeHigh="icons/ivc_xlg_32.bmp" - winLargeLow="icons/ivc_xlg_16.bmp"/> - </win> - </launcher> - - <vm> - </vm> - - <plugins> - </plugins> - - <features> - <feature id="org.cishell.environment.equinox.feature"/> - <feature id="org.cishell.feature" version="1.0.0"/> - <feature id="org.cishell.reference.feature"/> - <feature id="org.cishell.reference.gui.feature"/> - <feature id="org.cishell.reference.gui.brand.feature"/> - </features> - - - -</product> +<?xml version="1.0" encoding="UTF-8"?> +<?pde version="3.1"?> + +<product name="Cyberinfrastructure Shell" id="org.cishell.reference.gui.brand.cishell.cishell" application="org.cishell.reference.gui.workspace.CIShellApplication" useFeatures="true"> + + <aboutInfo> + <image path="icons/about.gif"/> + <text> + %blurb + </text> + </aboutInfo> + + <configIni use="custom" path="/org.cishell.reference.gui.brand.cishell/extra-files/configuration/config.ini"/> + + <launcherArgs> + </launcherArgs> + + <windowImages/> + + <splash + location="org.cishell.reference.gui.brand.cishell" + startupProgressRect="0,163,500,10" /> + <launcher name="cishell"> + <linux icon="/org.cishell.reference.gui.brand.cishell/icons/cishell.xpm"/> + <macosx icon="/org.cishell.reference.gui.brand.cishell/icons/cishell.icns"/> + <solaris/> + <win useIco="true"> + <ico path="/org.cishell.reference.gui.brand.cishell/icons/cishell.ico"/> + <bmp + winSmallHigh="icons/ivc_sm_32.bmp" + winSmallLow="icons/ivc_sm_16.bmp" + winMediumHigh="icons/ivc_lg_32.bmp" + winMediumLow="icons/ivc_lg_16.bmp" + winLargeHigh="icons/ivc_xlg_32.bmp" + winLargeLow="icons/ivc_xlg_16.bmp"/> + </win> + </launcher> + + <vm> + </vm> + + <plugins> + </plugins> + + <features> + <feature id="org.cishell.environment.equinox.feature" version="0.0.0"/> + <feature id="org.cishell.feature" version="0.3.0"/> + <feature id="org.cishell.reference.feature" version="0.4.0"/> + <feature id="org.cishell.reference.gui.feature" version="0.4.0"/> + <feature id="org.cishell.reference.gui.brand.feature" version="0.8.0"/> + </features> + +</product> Deleted: trunk/deployment/org.cishell.reference.releng/pom.xml =================================================================== --- trunk/deployment/org.cishell.reference.releng/pom.xml 2011-12-20 18:49:16 UTC (rev 1295) +++ trunk/deployment/org.cishell.reference.releng/pom.xml 2011-12-20 22:45:48 UTC (rev 1296) @@ -1,39 +0,0 @@ -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - <parent> - <artifactId>plugin-parent</artifactId> - <groupId>org.cishell</groupId> - <version>0.0.1</version> - </parent> - <artifactId>cishell</artifactId> - <version>0.0.1</version> - <packaging>eclipse-repository</packaging> - - <build> - <plugins> - <plugin> - <groupId>org.eclipse.tycho</groupId> - <artifactId>tycho-p2-director-plugin</artifactId> - <version>${tychoVersion}</version> - <executions> - <execution> - <id>materialize-products</id> - <goals> - <goal>materialize-products</goal> - </goals> - </execution> - <execution> - <id>archive-products</id> - <goals> - <goal>archive-products</goal> - </goals> - </execution> - </executions> - <configuration> - <includeAllDependencies>true</includeAllDependencies> - </configuration> - </plugin> - </plugins> - </build> -</project> \ No newline at end of file Property changes on: trunk/templates/org.cishell.templates.wizards/src/org/cishell/templates/staticexecutable/optiontypes/PlatformOption.java ___________________________________________________________________ Deleted: svn:mergeinfo - This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jrb...@us...> - 2012-02-24 00:49:58
|
Revision: 1307 http://cishell.svn.sourceforge.net/cishell/?rev=1307&view=rev Author: jrbibers Date: 2012-02-24 00:49:51 +0000 (Fri, 24 Feb 2012) Log Message: ----------- Updating Guava from 8 from 11.0.1. Renaming project from "google_guava" to "com.google.guava". Modified Paths: -------------- trunk/deployment/org.cishell.reference.releng/build-files/fetchSvnAll.xml trunk/libs/google_guava/.classpath trunk/libs/google_guava/.project trunk/libs/google_guava/META-INF/MANIFEST.MF trunk/libs/google_guava/Updating.txt trunk/libs/google_guava/build.properties Added Paths: ----------- trunk/libs/google_guava/com.google.guava.source_11.0.1.jar trunk/libs/google_guava/com.google.guava_11.0.1.jar Removed Paths: ------------- trunk/libs/google_guava/guava-r08.jar trunk/libs/google_guava/guava-src-r08.zip Modified: trunk/deployment/org.cishell.reference.releng/build-files/fetchSvnAll.xml =================================================================== --- trunk/deployment/org.cishell.reference.releng/build-files/fetchSvnAll.xml 2012-02-01 23:12:12 UTC (rev 1306) +++ trunk/deployment/org.cishell.reference.releng/build-files/fetchSvnAll.xml 2012-02-24 00:49:51 UTC (rev 1307) @@ -228,7 +228,7 @@ </antcall> <antcall target="svn.co"> <param name="target" value="plugins" /> - <param name="element.id" value="google_guava" /> + <param name="element.id" value="com.google.guava" /> <param name="project.name" value="libs/google_guava" /> <param name="url" value="https://cishell.svn.sourceforge.net/svnroot/cishell/trunk" /> Modified: trunk/libs/google_guava/.classpath =================================================================== --- trunk/libs/google_guava/.classpath 2012-02-01 23:12:12 UTC (rev 1306) +++ trunk/libs/google_guava/.classpath 2012-02-24 00:49:51 UTC (rev 1307) @@ -2,9 +2,9 @@ <classpath> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/> <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> - <classpathentry exported="true" kind="lib" path="guava-r08.jar" sourcepath="guava-src-r08.zip"> - <attributes> - <attribute name="javadoc_location" value="http://guava-libraries.googlecode.com/svn/tags/release08/javadoc"/> + <classpathentry exported="true" kind="lib" path="com.google.guava_11.0.1.jar" sourcepath="com.google.guava.source_11.0.1.jar"> + <attributes> + <attribute name="javadoc_location" value="http://docs.guava-libraries.googlecode.com/git-history/v11.0.1/javadoc"/> </attributes> <accessrules> <accessrule kind="discouraged" pattern="com/google/common/base/internal/*"/> Modified: trunk/libs/google_guava/.project =================================================================== --- trunk/libs/google_guava/.project 2012-02-01 23:12:12 UTC (rev 1306) +++ trunk/libs/google_guava/.project 2012-02-24 00:49:51 UTC (rev 1307) @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <projectDescription> - <name>google_guava</name> + <name>com.google.guava</name> <comment></comment> <projects> </projects> Modified: trunk/libs/google_guava/META-INF/MANIFEST.MF =================================================================== --- trunk/libs/google_guava/META-INF/MANIFEST.MF 2012-02-01 23:12:12 UTC (rev 1306) +++ trunk/libs/google_guava/META-INF/MANIFEST.MF 2012-02-24 00:49:51 UTC (rev 1307) @@ -1,15 +1,19 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 -Bundle-Name: google_guava -Bundle-SymbolicName: google_guava -Bundle-Version: 8.0.0 -Bundle-ClassPath: guava-r08.jar -Export-Package: com.google.common.annotations;version="8.0.0", - com.google.common.base;version="8.0.0", - com.google.common.base.internal;version="8.0.0", - com.google.common.collect;version="8.0.0", - com.google.common.io;version="8.0.0", - com.google.common.net;version="8.0.0", - com.google.common.primitives;version="8.0.0", - com.google.common.util.concurrent;version="8.0.0" +Bundle-Name: com.google.guava +Bundle-SymbolicName: com.google.guava +Bundle-Version: 11.0.1 +Bundle-ClassPath: com.google.guava_11.0.1.jar +Export-Package: com.google.common.annotations;version="11.0.1", + com.google.common.base;version="11.0.1", + com.google.common.base.internal;version="11.0.1", + com.google.common.cache;version="11.0.1", + com.google.common.collect;version="11.0.1", + com.google.common.eventbus;version="11.0.1", + com.google.common.hash;version="11.0.1", + com.google.common.io;version="11.0.1", + com.google.common.math;version="11.0.1", + com.google.common.net;version="11.0.1", + com.google.common.primitives;version="11.0.1", + com.google.common.util.concurrent;version="11.0.1" Bundle-RequiredExecutionEnvironment: J2SE-1.5 Modified: trunk/libs/google_guava/Updating.txt =================================================================== --- trunk/libs/google_guava/Updating.txt 2012-02-01 23:12:12 UTC (rev 1306) +++ trunk/libs/google_guava/Updating.txt 2012-02-24 00:49:51 UTC (rev 1307) @@ -4,4 +4,8 @@ http://code.google.com/p/guava-osgi/ We've set up the Export-Package: part of the Manifest to use -version numbers that are compatible with that project. \ No newline at end of file +version numbers that are compatible with that project. + +Last updated 2012-02-23 from: +http://guava-osgi.googlecode.com/svn/trunk/repository/plugins/com.google.guava_11.0.1.jar +http://guava-osgi.googlecode.com/svn/trunk/repository/plugins/com.google.guava.source_11.0.1.jar \ No newline at end of file Modified: trunk/libs/google_guava/build.properties =================================================================== --- trunk/libs/google_guava/build.properties 2012-02-01 23:12:12 UTC (rev 1306) +++ trunk/libs/google_guava/build.properties 2012-02-24 00:49:51 UTC (rev 1307) @@ -1,2 +1,2 @@ bin.includes = META-INF/,\ - guava-r08.jar + com.google.guava_11.0.1.jar Added: trunk/libs/google_guava/com.google.guava.source_11.0.1.jar =================================================================== (Binary files differ) Property changes on: trunk/libs/google_guava/com.google.guava.source_11.0.1.jar ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/libs/google_guava/com.google.guava_11.0.1.jar =================================================================== (Binary files differ) Property changes on: trunk/libs/google_guava/com.google.guava_11.0.1.jar ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Deleted: trunk/libs/google_guava/guava-r08.jar =================================================================== (Binary files differ) Deleted: trunk/libs/google_guava/guava-src-r08.zip =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <kon...@us...> - 2012-03-22 21:36:45
|
Revision: 1320 http://cishell.svn.sourceforge.net/cishell/?rev=1320&view=rev Author: kongchinhua Date: 2012-03-22 21:36:39 +0000 (Thu, 22 Mar 2012) Log Message: ----------- Added Paths: ----------- trunk/README.MOVED Removed Paths: ------------- trunk/README.txt Copied: trunk/README.MOVED (from rev 1319, trunk/README.txt) =================================================================== --- trunk/README.MOVED (rev 0) +++ trunk/README.MOVED 2012-03-22 21:36:39 UTC (rev 1320) @@ -0,0 +1,2 @@ +As of 2012/03/22 active development of this project will be maintained using a +GitHub repository located at http://github.com/CIShell/CIShell/ Deleted: trunk/README.txt =================================================================== --- trunk/README.txt 2012-03-22 17:10:21 UTC (rev 1319) +++ trunk/README.txt 2012-03-22 21:36:39 UTC (rev 1320) @@ -1,2 +0,0 @@ -As of 2012/03/22 active development of this project will be maintained using a -GitHub repository located at http://github.com/CIShell/CIShell/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |