From 1b00461a114bb8feb9e077b01dbe9e98d9c85ff4 Mon Sep 17 00:00:00 2001
From: tjc <tjc@ee4ac58c-ac51-4696-9907-e4b3aa274f04>
Date: Thu, 22 Apr 2010 10:46:16 +0000
Subject: [PATCH] handle reading from zipped files

git-svn-id: svn+ssh://svn.internal.sanger.ac.uk/repos/svn/pathsoft/artemis/trunk@13729 ee4ac58c-ac51-4696-9907-e4b3aa274f04
---
 uk/ac/sanger/artemis/components/ViewMenu.java | 19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)

diff --git a/uk/ac/sanger/artemis/components/ViewMenu.java b/uk/ac/sanger/artemis/components/ViewMenu.java
index c68835de9..4572ddc30 100644
--- a/uk/ac/sanger/artemis/components/ViewMenu.java
+++ b/uk/ac/sanger/artemis/components/ViewMenu.java
@@ -1396,19 +1396,28 @@ public class ViewMenu extends SelectionMenu
           // ./fasta/abc.seq.00001.out
           final File dir_name = new File(program_name);
 
+          File rootFile;
+          if(root_document.getLocation() instanceof File)
+            rootFile = (File)root_document.getLocation();
+          else
+            rootFile = new File(".");
+          
           final Document[] possible_documents = new Document[] {
+              new ZipFileDocument(new File(rootFile, program_name+File.separatorChar+program_name+".zip"), file_name),
+              new ZipFileDocument(new File(rootFile, program_name+".zip"), file_name),
+              new ZipFileDocument(new File(program_name+".zip"), file_name),
+              new ZipFileDocument(new File(program_name, program_name+".zip"), file_name),
               root_document.append(program_name).append(file_name),
               root_document.append(file_name),
               new FileDocument(new File(file_name)),
               new FileDocument(dir_name).append(file_name),
               new FileDocument(new File(System.getProperty("user.dir")))
-                  .append(program_name).append(file_name) };
+                  .append(program_name).append(file_name),
+              };
 
-          for(int possible_document_index = 0; possible_document_index < possible_documents.length; ++possible_document_index)
+          for(int k = 0; k < possible_documents.length; ++k)
           {
-
-            final Document this_document = possible_documents[possible_document_index];
-
+            final Document this_document = possible_documents[k];
             if(this_document.readable())
             {
               document = this_document;
-- 
GitLab