|
From: jistrawn <jis...@us...> - 2006-10-24 21:45:22
|
Update of /cvsroot/modelwizard/source/Model Wizard Plugin/src/net/sourceforge/modelWizard/utilities In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv4368/src/net/sourceforge/modelWizard/utilities Modified Files: ProfileUtilities.java PathUtilties.java XslTransformer.java Log Message: removed unused imports or reformatted import order (ctrl-shift-o) Index: PathUtilties.java =================================================================== RCS file: /cvsroot/modelwizard/source/Model Wizard Plugin/src/net/sourceforge/modelWizard/utilities/PathUtilties.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** PathUtilties.java 6 Oct 2005 15:59:05 -0000 1.2 --- PathUtilties.java 24 Oct 2006 21:45:18 -0000 1.3 *************** *** 1,49 **** ! /* ! * Created on Sep 29, 2005 ! * @author stjerman ! * <copyright> ! * ! * Copyright (c) 2005 Cisco Systems Inc, ! * All rights reserved. This program and the accompanying materials ! * are made available under the terms of the BSD License ! * which accompanies this distribution. ! * ! * Contributors: ! * CISCO - Initial API and implementation ! * ! * </copyright> ! */ ! package net.sourceforge.modelWizard.utilities; ! ! import net.sourceforge.modelWizard.modelAbstraction.ModelAccess; ! ! import org.eclipse.core.resources.IResource; ! import org.eclipse.core.resources.ResourcesPlugin; ! import org.eclipse.core.runtime.Path; ! import org.eclipse.emf.common.util.URI; ! ! /** ! * @author stjerman ! * Date: Sep 29, 2005 ! */ ! public class PathUtilties { ! ! /** ! * converts a *local* resource ot File URI to a File path ! */ ! public static String convertLocalURItoFile(URI folder) { ! String f = ""; ! ! if (folder.isFile()) { ! return folder.toFileString(); ! } ! if (folder.scheme().equals("platform")) { ! IResource c = ResourcesPlugin.getWorkspace().getRoot().findMember( ! new Path(folder.path()).removeFirstSegments(1)); ! f = c.getLocation().toOSString(); ! } ! return f; ! ! } ! ! } --- 1,47 ---- ! /* ! * Created on Sep 29, 2005 ! * @author stjerman ! * <copyright> ! * ! * Copyright (c) 2005 Cisco Systems Inc, ! * All rights reserved. This program and the accompanying materials ! * are made available under the terms of the BSD License ! * which accompanies this distribution. ! * ! * Contributors: ! * CISCO - Initial API and implementation ! * ! * </copyright> ! */ ! package net.sourceforge.modelWizard.utilities; ! ! import org.eclipse.core.resources.IResource; ! import org.eclipse.core.resources.ResourcesPlugin; ! import org.eclipse.core.runtime.Path; ! import org.eclipse.emf.common.util.URI; ! ! /** ! * @author stjerman ! * Date: Sep 29, 2005 ! */ ! public class PathUtilties { ! ! /** ! * converts a *local* resource ot File URI to a File path ! */ ! public static String convertLocalURItoFile(URI folder) { ! String f = ""; ! ! if (folder.isFile()) { ! return folder.toFileString(); ! } ! if (folder.scheme().equals("platform")) { ! IResource c = ResourcesPlugin.getWorkspace().getRoot().findMember( ! new Path(folder.path()).removeFirstSegments(1)); ! f = c.getLocation().toOSString(); ! } ! return f; ! ! } ! ! } Index: ProfileUtilities.java =================================================================== RCS file: /cvsroot/modelwizard/source/Model Wizard Plugin/src/net/sourceforge/modelWizard/utilities/ProfileUtilities.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** ProfileUtilities.java 6 May 2006 22:47:33 -0000 1.7 --- ProfileUtilities.java 24 Oct 2006 21:45:17 -0000 1.8 *************** *** 44,47 **** --- 44,48 ---- import org.eclipse.core.runtime.Path; import org.eclipse.core.runtime.Status; + import org.eclipse.emf.common.ui.URIEditorInput; import org.eclipse.emf.common.util.EList; import org.eclipse.emf.common.util.TreeIterator; *************** *** 63,67 **** import org.eclipse.ui.PlatformUI; import org.eclipse.ui.internal.WorkbenchPlugin; - import org.eclipse.emf.common.ui.URIEditorInput; ; --- 64,67 ---- Index: XslTransformer.java =================================================================== RCS file: /cvsroot/modelwizard/source/Model Wizard Plugin/src/net/sourceforge/modelWizard/utilities/XslTransformer.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** XslTransformer.java 7 Dec 2005 18:19:17 -0000 1.2 --- XslTransformer.java 24 Oct 2006 21:45:18 -0000 1.3 *************** *** 1,172 **** ! /* ! * Created on Sep 27, 2005 ! * @author stjerman ! * <copyright> ! * ! * Copyright (c) 2005 Cisco Systems Inc, ! * All rights reserved. This program and the accompanying materials ! * are made available under the terms of the BSD License ! * which accompanies this distribution. ! * ! * Contributors: ! * CISCO - Initial API and implementation ! * ! * </copyright> ! */ ! package net.sourceforge.modelWizard.utilities; ! ! import java.io.File; ! import java.io.IOException; ! import java.io.InputStream; ! import java.net.URL; ! import java.text.SimpleDateFormat; ! import java.util.Calendar; ! ! import javax.xml.transform.Result; ! import javax.xml.transform.Source; ! import javax.xml.transform.Transformer; ! import javax.xml.transform.TransformerConfigurationException; ! import javax.xml.transform.TransformerException; ! import javax.xml.transform.TransformerFactory; ! import javax.xml.transform.stream.StreamResult; ! import javax.xml.transform.stream.StreamSource; ! ! import net.sourceforge.modelWizard.ModelWizardPlugin; ! ! import org.eclipse.core.runtime.Path; ! import org.eclipse.emf.common.util.URI; ! import org.eclipse.emf.ecore.resource.impl.URIConverterImpl; ! ! public class XslTransformer { ! ! private TransformerFactory factory; ! ! private Transformer transform; ! ! private URIConverterImpl conv = new URIConverterImpl(); ! ! private void createTransformer(URL xsl) throws IOException, ! TransformerConfigurationException { ! factory = TransformerFactory.newInstance(); ! Source xslSource; ! xslSource = new StreamSource(xsl.openStream()); ! transform = factory.newTransformer(xslSource); ! } ! ! /** ! * Constructor. Pass in a URL for an XSL file. ! * ! * @param xsl ! * @throws IOException ! * @throws TransformerConfigurationException ! * @throws CimWizardTransformException ! * @throws IOException ! * @throws TransformerConfigurationException ! */ ! public XslTransformer(URL xsl) throws TransformerConfigurationException, ! IOException { ! createTransformer(xsl); ! } ! ! /** ! * Change the XSL for the transformation. ! * ! * @param xsl ! * @throws CimWizardTransformException ! * @throws IOException ! * @throws TransformerConfigurationException ! */ ! public void setXsl(URL xsl) throws IOException, ! TransformerConfigurationException { ! Source xslSource; ! xslSource = new StreamSource(xsl.openStream()); ! transform = null; ! transform = factory.newTransformer(xslSource); ! } ! ! /** ! * Clear the parameters for the XSL tranformation. ! * ! */ ! public void clearParameters() { ! transform.clearParameters(); ! } ! ! private void transform(URI resultFile, Source source) throws IOException, ! TransformerException { ! Result result; ! result = new StreamResult(conv.createOutputStream(resultFile)); ! transform.transform(source, result); ! result = null; ! } ! ! /** ! * Transform an input stream. Put result at URI ! * (org.eclipse.emf.common.util.URI) specified by resultFile. ! * ! * @param resultFile ! * @param in ! * @throws TransformerException ! * @throws IOException ! * @throws CimWizardTransformException ! */ ! public void transformStream(URI resultFile, InputStream in) ! throws IOException, TransformerException { ! Source xmlSource = new StreamSource(in); ! transform(resultFile, xmlSource); ! } ! ! /** ! * Set a parameter 'name' for the transformation to value. ! * ! * @param name ! * @param value ! */ ! public void setParameter(String name, String value) { ! transform.setParameter(name, value); ! } ! ! /** ! * Transform a File. Put result at URI (org.eclipse.emf.common.util.URI) ! * specified by resultFile. ! * ! * @param resultFile ! * @param in ! * @throws TransformerException ! * @throws IOException ! * @throws CimWizardTransformException ! */ ! public void transformFile(URI resultFile, File in) throws IOException, ! TransformerException { ! Source source = new StreamSource(in); ! transform(resultFile, source); ! } ! ! /** ! * Transform the contents of a File. Put result at URI ! * (org.eclipse.emf.common.util.URI) specified by resultFile. ! * ! * @param resultFile ! * @param in ! * @throws CimWizardTransformException ! * @throws IOException ! * @throws TransformerException ! */ ! public void transformUri(URI resultFile, URI in) throws IOException, ! TransformerException { ! Source source; ! source = new StreamSource(conv.createInputStream(in)); ! transform(resultFile, source); ! } ! ! /** ! * Set a parameter for the transformation called version. The format for the ! * parameter is "'3.0.'yyyyMMdd" ! * ! */ ! public void setVersionParameter() { ! SimpleDateFormat sd = new SimpleDateFormat("'3.0.'yyyyMMdd"); ! String v = sd.format(Calendar.getInstance().getTime()); ! transform.setParameter("version", v); ! } ! } --- 1,169 ---- ! /* ! * Created on Sep 27, 2005 ! * @author stjerman ! * <copyright> ! * ! * Copyright (c) 2005 Cisco Systems Inc, ! * All rights reserved. This program and the accompanying materials ! * are made available under the terms of the BSD License ! * which accompanies this distribution. ! * ! * Contributors: ! * CISCO - Initial API and implementation ! * ! * </copyright> ! */ ! package net.sourceforge.modelWizard.utilities; ! ! import java.io.File; ! import java.io.IOException; ! import java.io.InputStream; ! import java.net.URL; ! import java.text.SimpleDateFormat; ! import java.util.Calendar; ! ! import javax.xml.transform.Result; ! import javax.xml.transform.Source; ! import javax.xml.transform.Transformer; ! import javax.xml.transform.TransformerConfigurationException; ! import javax.xml.transform.TransformerException; ! import javax.xml.transform.TransformerFactory; ! import javax.xml.transform.stream.StreamResult; ! import javax.xml.transform.stream.StreamSource; ! ! import org.eclipse.emf.common.util.URI; ! import org.eclipse.emf.ecore.resource.impl.URIConverterImpl; ! ! public class XslTransformer { ! ! private TransformerFactory factory; ! ! private Transformer transform; ! ! private URIConverterImpl conv = new URIConverterImpl(); ! ! private void createTransformer(URL xsl) throws IOException, ! TransformerConfigurationException { ! factory = TransformerFactory.newInstance(); ! Source xslSource; ! xslSource = new StreamSource(xsl.openStream()); ! transform = factory.newTransformer(xslSource); ! } ! ! /** ! * Constructor. Pass in a URL for an XSL file. ! * ! * @param xsl ! * @throws IOException ! * @throws TransformerConfigurationException ! * @throws CimWizardTransformException ! * @throws IOException ! * @throws TransformerConfigurationException ! */ ! public XslTransformer(URL xsl) throws TransformerConfigurationException, ! IOException { ! createTransformer(xsl); ! } ! ! /** ! * Change the XSL for the transformation. ! * ! * @param xsl ! * @throws CimWizardTransformException ! * @throws IOException ! * @throws TransformerConfigurationException ! */ ! public void setXsl(URL xsl) throws IOException, ! TransformerConfigurationException { ! Source xslSource; ! xslSource = new StreamSource(xsl.openStream()); ! transform = null; ! transform = factory.newTransformer(xslSource); ! } ! ! /** ! * Clear the parameters for the XSL tranformation. ! * ! */ ! public void clearParameters() { ! transform.clearParameters(); ! } ! ! private void transform(URI resultFile, Source source) throws IOException, ! TransformerException { ! Result result; ! result = new StreamResult(conv.createOutputStream(resultFile)); ! transform.transform(source, result); ! result = null; ! } ! ! /** ! * Transform an input stream. Put result at URI ! * (org.eclipse.emf.common.util.URI) specified by resultFile. ! * ! * @param resultFile ! * @param in ! * @throws TransformerException ! * @throws IOException ! * @throws CimWizardTransformException ! */ ! public void transformStream(URI resultFile, InputStream in) ! throws IOException, TransformerException { ! Source xmlSource = new StreamSource(in); ! transform(resultFile, xmlSource); ! } ! ! /** ! * Set a parameter 'name' for the transformation to value. ! * ! * @param name ! * @param value ! */ ! public void setParameter(String name, String value) { ! transform.setParameter(name, value); ! } ! ! /** ! * Transform a File. Put result at URI (org.eclipse.emf.common.util.URI) ! * specified by resultFile. ! * ! * @param resultFile ! * @param in ! * @throws TransformerException ! * @throws IOException ! * @throws CimWizardTransformException ! */ ! public void transformFile(URI resultFile, File in) throws IOException, ! TransformerException { ! Source source = new StreamSource(in); ! transform(resultFile, source); ! } ! ! /** ! * Transform the contents of a File. Put result at URI ! * (org.eclipse.emf.common.util.URI) specified by resultFile. ! * ! * @param resultFile ! * @param in ! * @throws CimWizardTransformException ! * @throws IOException ! * @throws TransformerException ! */ ! public void transformUri(URI resultFile, URI in) throws IOException, ! TransformerException { ! Source source; ! source = new StreamSource(conv.createInputStream(in)); ! transform(resultFile, source); ! } ! ! /** ! * Set a parameter for the transformation called version. The format for the ! * parameter is "'3.0.'yyyyMMdd" ! * ! */ ! public void setVersionParameter() { ! SimpleDateFormat sd = new SimpleDateFormat("'3.0.'yyyyMMdd"); ! String v = sd.format(Calendar.getInstance().getTime()); ! transform.setParameter("version", v); ! } ! } |