diff options
author | Sean Muir | 2017-09-29 12:56:32 +0000 |
---|---|---|
committer | Sean Muir | 2017-09-29 12:56:32 +0000 |
commit | e0902147bf52e3ff9d586375c5273b370491e793 (patch) | |
tree | 44716bca039cc6f036d39b59fe6e82a01ac4a9b7 | |
parent | 65db17ad42972aec30a7121f21b07aad025a60a9 (diff) | |
download | org.eclipse.mdht-site.tar.gz org.eclipse.mdht-site.tar.xz org.eclipse.mdht-site.zip |
Update Open using style sheetsite
Added check for C32 versus Consolidated and then use appropriate style sheet
-rw-r--r-- | cda/plugins/org.eclipse.mdht.cda.xml.ui/src/org/eclipse/mdht/cda/xml/ui/handlers/OpenUsingStyleSheet.java | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/cda/plugins/org.eclipse.mdht.cda.xml.ui/src/org/eclipse/mdht/cda/xml/ui/handlers/OpenUsingStyleSheet.java b/cda/plugins/org.eclipse.mdht.cda.xml.ui/src/org/eclipse/mdht/cda/xml/ui/handlers/OpenUsingStyleSheet.java index 3d06cbba..6607bc2b 100644 --- a/cda/plugins/org.eclipse.mdht.cda.xml.ui/src/org/eclipse/mdht/cda/xml/ui/handlers/OpenUsingStyleSheet.java +++ b/cda/plugins/org.eclipse.mdht.cda.xml.ui/src/org/eclipse/mdht/cda/xml/ui/handlers/OpenUsingStyleSheet.java @@ -40,9 +40,13 @@ import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.mdht.cda.xml.ui.Activator; import org.eclipse.mdht.cda.xml.ui.internal.Logger; +import org.eclipse.mdht.uml.cda.ClinicalDocument; +import org.eclipse.mdht.uml.cda.util.CDAUtil; import org.eclipse.ui.PlatformUI; import org.eclipse.ui.browser.IWebBrowser; import org.eclipse.ui.handlers.HandlerUtil; +import org.openhealthtools.mdht.uml.cda.consol.ConsolPackage; +import org.openhealthtools.mdht.uml.cda.consol.GeneralHeaderConstraints; import org.osgi.framework.Bundle; /** @@ -63,8 +67,25 @@ public class OpenUsingStyleSheet extends AbstractHandler { */ private static void open(final IWebBrowser browser, IFile sourceFile) throws Exception { + ConsolPackage.eINSTANCE.getContinuityOfCareDocument(); + // HITSPPackage.eINSTANCE.getPatientSummary(); + + org.eclipse.emf.common.util.URI cdaURI = org.eclipse.emf.common.util.URI.createFileURI( + sourceFile.getLocation().toOSString()); + ClinicalDocument clinicalDocument = CDAUtil.load(cdaURI); + + String xslEntry = null; + String xslFolder = null; + if (clinicalDocument instanceof GeneralHeaderConstraints) { + xslEntry = "resources/xsl/vha/cda.xsl"; + xslFolder = "resources/xsl/vha"; + } else { + xslEntry = "resources/xsl/CDA.xsl"; + xslFolder = "resources/xsl"; + } + Bundle bundle = Platform.getBundle(Activator.PLUGIN_ID); - URL fileURL = bundle.getEntry("resources/xsl/vha/cda.xsl"); // "resources/xsl/CDA.xsl"); + URL fileURL = bundle.getEntry(xslEntry); // Create Temporary File File tempFile = File.createTempFile(sourceFile.getName(), ".html"); @@ -73,7 +94,7 @@ public class OpenUsingStyleSheet extends AbstractHandler { Path temporaryDirectory = Paths.get(tempFile.getParent()); // Get folder for xsl - URI csspath = URIUtil.toURI(FileLocator.toFileURL(bundle.getEntry("resources/xsl/vha"))); + URI csspath = URIUtil.toURI(FileLocator.toFileURL(bundle.getEntry(xslFolder))); // Copy any css files - these need to be in the same directory as the temporary file DirectoryStream<Path> stream = Files.newDirectoryStream(Paths.get(csspath), "*.css"); |