Index: tmp/org.txm.rcp.feature/feature.xml
===================================================================
--- tmp/org.txm.rcp.feature/feature.xml	(revision 760)
+++ tmp/org.txm.rcp.feature/feature.xml	(revision 761)
@@ -194,18 +194,6 @@
       <import plugin="org.eclipse.e4.ui.workbench.addons.swt" version="0.10.0" match="greaterOrEqual"/>
       <import plugin="org.eclipse.emf.ecore" version="2.7.0" match="greaterOrEqual"/>
       <import plugin="org.txm.ca.core"/>
-      <import plugin="org.eclipse.jdt.core"/>
-      <import plugin="org.eclipse.jdt.ui"/>
-      <import plugin="org.eclipse.debug.ui"/>
-      <import plugin="org.eclipse.jdt.debug"/>
-      <import plugin="org.eclipse.jdt.launching"/>
-      <import plugin="org.eclipse.jdt.debug.ui"/>
-      <import plugin="org.eclipse.ltk.core.refactoring" version="3.5.0" match="greaterOrEqual"/>
-      <import plugin="org.eclipse.ltk.ui.refactoring" version="3.4.100" match="greaterOrEqual"/>
-      <import plugin="org.eclipse.jdt.core.manipulation" version="1.3.0" match="greaterOrEqual"/>
-      <import plugin="org.eclipse.ui.views"/>
-      <import plugin="org.eclipse.core.variables"/>
-      <import plugin="org.eclipse.search" version="3.6.0" match="greaterOrEqual"/>
    </requires>
 
    <plugin
Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/workspace/LoadBinaryCorporaDirectory.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/workspace/LoadBinaryCorporaDirectory.java	(revision 0)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/workspace/LoadBinaryCorporaDirectory.java	(revision 761)
@@ -0,0 +1,193 @@
+// Copyright © 2010-2013 ENS de Lyon.
+// Copyright © 2007-2010 ENS de Lyon, CNRS, INRP, University of
+// Lyon 2, University of Franche-Comté, University of Nice
+// Sophia Antipolis, University of Paris 3.
+// 
+// The TXM platform is free software: you can redistribute it
+// and/or modify it under the terms of the GNU General Public
+// License as published by the Free Software Foundation,
+// either version 2 of the License, or (at your option) any
+// later version.
+// 
+// The TXM platform is distributed in the hope that it will be
+// useful, but WITHOUT ANY WARRANTY; without even the implied
+// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+// PURPOSE. See the GNU General Public License for more
+// details.
+// 
+// You should have received a copy of the GNU General
+// Public License along with the TXM platform. If not, see
+// http://www.gnu.org/licenses.
+// 
+// 
+// 
+// $LastChangedDate:$
+// $LastChangedRevision:$
+// $LastChangedBy:$ 
+//
+package org.txm.rcp.commands.workspace;
+
+import java.io.File;
+import java.util.ArrayList;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.DirectoryDialog;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.FileDialog;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.handlers.HandlerUtil;
+import org.txm.EngineType;
+import org.txm.Toolbox;
+import org.txm.Toolbox;
+import org.txm.core.preferences.TBXPreferences;
+import org.txm.objects.Base;
+import org.txm.objects.Project;
+import org.txm.objects.Workspace;
+import org.txm.rcp.StatusLine;
+import org.txm.rcp.commands.RestartTXM;
+import org.txm.rcp.messages.TXMUIMessages;
+import org.txm.rcp.swt.dialog.LastOpened;
+import org.txm.rcp.utils.JobHandler;
+import org.txm.rcp.views.corpora.CorporaView;
+import org.txm.searchengine.cqp.corpus.Corpus;
+import org.txm.searchengine.cqp.corpus.MainCorpus;
+import org.txm.utils.DeleteDir;
+import org.txm.utils.io.FileCopy;
+import org.txm.utils.logger.Log;
+import org.txm.utils.zip.Zip;
+
+// TODO: Auto-generated Javadoc
+/**
+ * Create a base from binary files of a base.
+ *
+ * @author mdecorde
+ */
+public class LoadBinaryCorporaDirectory extends AbstractHandler {
+
+	private static final String ID = LoadBinaryCorporaDirectory.class.getName();
+
+	@Override
+	/**
+	 * calling this command will : open a directory dialog and try to load the content of the selected directory
+	 */
+	public Object execute(ExecutionEvent event) throws ExecutionException {
+
+		// create dialog to get the corpus directory
+		Shell shell = HandlerUtil.getActiveWorkbenchWindowChecked(event).getShell();
+		DirectoryDialog dialog = new DirectoryDialog(shell, SWT.OPEN);
+		if (LastOpened.getFile(ID) != null) {
+			dialog.setFilterPath(LastOpened.getFolder(ID));
+		}
+
+		if (dialog.open() != null) {
+
+			File directory = new File(dialog.getFilterPath());
+
+			if (directory.exists()) {
+
+				LastOpened.set(ID, directory);
+				return loadBinaryCorporaDirectory(directory);
+			}
+		}
+		return null;
+	}
+
+	/**
+	 * stop engines, load binary corpora from a directory, restart engines and refresh views
+	 * 
+	 * @param directory
+	 * @return
+	 */
+	public static JobHandler loadBinaryCorporaDirectory(final File directory) {
+
+		JobHandler jobhandler = new JobHandler("Scanning "+directory+"...", true) {
+			@Override
+			protected IStatus run(IProgressMonitor monitor) {
+				this.runInit(monitor);
+
+				File corporaDirectory = new File(Toolbox.getTXMHOMEPATH(), "corpora");
+				if (!corporaDirectory.exists()) {
+					System.out.println("Corpora directory not found. Aborting.");
+					return Status.CANCEL_STATUS;
+				}
+				try {
+					monitor.beginTask(TXMUIMessages.AddBase_27, 100);
+					this.acquireSemaphore();
+					Toolbox.getEngineManager(EngineType.SEARCH).stopEngines();
+					this.releaseSemaphore();
+
+					monitor.subTask(TXMUIMessages.AddBase_32);
+					for (File corpusDirectory : directory.listFiles()) {
+
+						if (corpusDirectory.isDirectory() && new File(corpusDirectory, "import.xml").exists()) {
+							// seems like a binary corpus directory
+							// copy files in the new current corpora directory
+							File destDir = new File(corporaDirectory, corpusDirectory.getName());
+							if (destDir.exists()) {
+								System.out.println("Le répertoire "+destDir+" existe déjà. Chargement du corpus du répertoire "+corpusDirectory+" ignoré.");
+								continue;
+							}
+
+							FileCopy.copyFiles(corpusDirectory, destDir);
+
+							corpusDirectory = destDir;
+						} else if (corpusDirectory.getName().endsWith(".txm")) {
+							// corpusDirectory is a TXM archive
+							String basedirname = Zip.getRoot(corpusDirectory); 
+							Zip.decompress(corpusDirectory.getAbsolutePath(), corporaDirectory.getAbsolutePath(), false, this);
+							corpusDirectory = new File(corporaDirectory, basedirname);
+						} else {
+							continue; // not a corpus
+						}
+
+						if (!corpusDirectory.exists()) {
+							continue;
+						}
+
+						Base base = LoadBinaryCorpus.loadBinaryCorpus(corpusDirectory);
+						if (base == null) {
+							System.out.println("Fail to load binary corpus: "+corpusDirectory);
+						}
+					}
+
+					monitor.subTask(TXMUIMessages.AddBase_33);
+
+					this.acquireSemaphore();
+					org.txm.Toolbox.restartWorkspace(monitor);
+					Toolbox.getEngineManager(EngineType.SEARCH).restartEngines();
+					this.releaseSemaphore();
+
+
+					syncExec(new Runnable() {
+						@Override
+						public void run() {
+							RestartTXM.reloadViews();
+							System.err.println(TXMUIMessages.AddBase_10);
+							StatusLine.setMessage(TXMUIMessages.AddBase_10);
+						}
+					});
+				} catch (ThreadDeath td) { 
+					return Status.CANCEL_STATUS;
+				} catch (Exception e2) {
+					org.txm.rcp.utils.Logger.printStackTrace(e2);
+					return Status.CANCEL_STATUS;
+				} finally {
+					monitor.done();
+				}
+
+				return Status.OK_STATUS;
+			}
+		};
+
+		jobhandler.schedule();
+		return jobhandler;
+	}
+}

Property changes on: tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/workspace/LoadBinaryCorporaDirectory.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/workspace/LoadBinaryCorpus.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/workspace/LoadBinaryCorpus.java	(revision 760)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/workspace/LoadBinaryCorpus.java	(revision 761)
@@ -28,7 +28,6 @@
 package org.txm.rcp.commands.workspace;
 
 import java.io.File;
-import java.util.ArrayList;
 
 import org.eclipse.core.commands.AbstractHandler;
 import org.eclipse.core.commands.ExecutionEvent;
@@ -45,8 +44,6 @@
 import org.eclipse.ui.handlers.HandlerUtil;
 import org.txm.EngineType;
 import org.txm.Toolbox;
-import org.txm.Toolbox;
-import org.txm.core.preferences.TBXPreferences;
 import org.txm.objects.Base;
 import org.txm.objects.Project;
 import org.txm.objects.Workspace;
@@ -56,7 +53,6 @@
 import org.txm.rcp.swt.dialog.LastOpened;
 import org.txm.rcp.utils.JobHandler;
 import org.txm.rcp.views.corpora.CorporaView;
-import org.txm.searchengine.cqp.corpus.Corpus;
 import org.txm.searchengine.cqp.corpus.MainCorpus;
 import org.txm.utils.DeleteDir;
 import org.txm.utils.logger.Log;
@@ -70,7 +66,7 @@
  */
 public class LoadBinaryCorpus extends AbstractHandler {
 
-	private static final String ID = "org.txm.rcp.commands.workspace.AddBase"; //$NON-NLS-1$
+	private static final String ID = LoadBinaryCorpus.class.getName();
 
 	File corpusdir;
 	private File zipFile;
Index: tmp/org.txm.rcp/plugin.xml
===================================================================
--- tmp/org.txm.rcp/plugin.xml	(revision 760)
+++ tmp/org.txm.rcp/plugin.xml	(revision 761)
@@ -487,12 +487,25 @@
                      visible="false">
                </separator>
             </menu>
-            <command
-                  commandId="org.txm.rcp.commands.workspace.AddBase"
-                  label="%command.label.50"
-                  style="push">
-            </command>
             <menu
+                  id="menu.file.load"
+                  label="Charger">
+               <command
+                     commandId="org.txm.rcp.commands.workspace.LoadBinaryCorpus"
+                     label="un corpus (.txm)..."
+                     style="push">
+               </command>
+               <command
+                     commandId="org.txm.rcp.commands.workspace.LoadBinaryCorporaDirectory"
+                     label="un répertoire de corpus binaires...."
+                     style="push">
+               </command>
+               <separator
+                     name="menu.file.load.separator.end"
+                     visible="false">
+               </separator>
+            </menu>
+            <menu
                   icon="icons/functions/export.png"
                   id="menu.file.export"
                   label="%menu.label.5">
@@ -2484,10 +2497,15 @@
       </command>
       <command
             defaultHandler="org.txm.rcp.commands.workspace.LoadBinaryCorpus"
-            id="org.txm.rcp.commands.workspace.AddBase"
+            id="org.txm.rcp.commands.workspace.LoadBinaryCorpus"
             name="%command.name.13">
       </command>
       <command
+            defaultHandler="org.txm.rcp.commands.workspace.LoadBinaryCorporaDirectory"
+            id="org.txm.rcp.commands.workspace.LoadBinaryCorporaDirectory"
+            name="Add bases">
+      </command>
+      <command
             defaultHandler="org.txm.rcp.commands.workspace.RemoveBase"
             id="org.txm.rcp.commands.workspace.RemoveBase"
             name="%command.name.14">
Index: tmp/org.txm.setups/shared/debian/DEBIAN/preinst
===================================================================
--- tmp/org.txm.setups/shared/debian/DEBIAN/preinst	(revision 760)
+++ tmp/org.txm.setups/shared/debian/DEBIAN/preinst	(revision 761)
@@ -1,11 +1,28 @@
 #!/bin/bash
 
-rm -rf "/usr/lib/TXM"
-rm -rf "/usr/share/doc/txm"
-rm -rf "/usr/share/lintian/overrides/txm"
-rm -rf "/usr/share/TXM"
-rm "/usr/share/applications/TXM.desktop"
-rm "/usr/share/applications/TXM debug.desktop"
-rm "/usr/bin/TXM"
+if [ ! -d "/usr/lib/TXM" ]; then
+	rm -rf "/usr/lib/TXM"
+fi
 
+if [ ! -d "/usr/share/doc/txm" ]; then
+	rm -rf "/usr/share/doc/txm"
+fi
 
+if [ ! -d "/usr/share/lintian/overrides/txm" ]; then
+	rm -rf "/usr/share/lintian/overrides/txm"
+fi
+
+if [ ! -d "/usr/share/TXM" ]; then
+	rm -rf "/usr/share/TXM"
+fi
+
+if [ ! -f "/usr/share/applications/TXM.desktop" ]; then
+	rm "/usr/share/applications/TXM.desktop"
+	rm "/usr/share/applications/TXM debug.desktop"
+fi
+
+if [ ! -f "/usr/bin/TXM" ]; then
+	rm "/usr/bin/TXM"
+fi
+
+echo "/usr/lib/TXM pre-installation done."
\ No newline at end of file

Property changes on: tmp/org.txm.setups/shared/win/jre
___________________________________________________________________
Added: svn:ignore
   + **


