Index: tmp/org.txm.searchengine.cqp.rcp/plugin.xml
===================================================================
--- tmp/org.txm.searchengine.cqp.rcp/plugin.xml	(revision 2491)
+++ tmp/org.txm.searchengine.cqp.rcp/plugin.xml	(revision 2492)
@@ -15,8 +15,8 @@
             name="%command.name.52">
       </command>
       <command
-            defaultHandler="org.txm.searchengine.cqp.rcp.handlers.base.CreatePartition"
-            id="org.txm.searchengine.cqp.rcp.handlers.base.CreatePartition"
+            defaultHandler="org.txm.searchengine.cqp.rcp.handlers.base.ComputePartition"
+            id="org.txm.searchengine.cqp.rcp.handlers.base.ComputePartition"
             name="%command.name.2">
          <commandParameter
                id="CorpusParameter"
@@ -155,7 +155,7 @@
             </visibleWhen>
          </command>
          <command
-               commandId="org.txm.searchengine.cqp.rcp.handlers.base.CreatePartition"
+               commandId="org.txm.searchengine.cqp.rcp.handlers.base.ComputePartition"
                icon="icons/functions/partition.png"
                style="push">
             <visibleWhen
@@ -196,7 +196,7 @@
             </visibleWhen>
          </command>
          <command
-               commandId="org.txm.searchengine.cqp.rcp.handlers.base.CreatePartition"
+               commandId="org.txm.searchengine.cqp.rcp.handlers.base.ComputePartition"
                icon="icons/functions/partition.png"
                style="push">
             <visibleWhen
@@ -271,7 +271,7 @@
             </visibleWhen>
          </command>
                         <command
-                  commandId="org.txm.searchengine.cqp.rcp.handlers.base.CreatePartition"
+                  commandId="org.txm.searchengine.cqp.rcp.handlers.base.ComputePartition"
                   icon="icons/functions/partition.png"
                   style="push"
                   tooltip="%command.tooltip.4">
Index: tmp/org.txm.searchengine.cqp.rcp/src/org/txm/searchengine/cqp/rcp/handlers/base/CreatePartition.java
===================================================================
--- tmp/org.txm.searchengine.cqp.rcp/src/org/txm/searchengine/cqp/rcp/handlers/base/CreatePartition.java	(revision 2491)
+++ tmp/org.txm.searchengine.cqp.rcp/src/org/txm/searchengine/cqp/rcp/handlers/base/CreatePartition.java	(revision 2492)
@@ -1,138 +0,0 @@
-// 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.searchengine.cqp.rcp.handlers.base;
-
-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.viewers.IStructuredSelection;
-import org.eclipse.jface.window.Window;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.handlers.HandlerUtil;
-import org.txm.rcp.JobsTimer;
-import org.txm.rcp.actions.CreatePartitionDialog;
-import org.txm.rcp.messages.TXMUIMessages;
-import org.txm.rcp.utils.JobHandler;
-import org.txm.rcp.views.corpora.CorporaView;
-import org.txm.searchengine.cqp.corpus.CQPCorpus;
-import org.txm.searchengine.cqp.corpus.Partition;
-import org.txm.utils.logger.Log;
-
-/**
- * Command which creates a Partition from a Corpus.
- * 
- * @author mdecorde
- */
-public class CreatePartition extends AbstractHandler {
-	
-	/** The window. */
-	private IWorkbenchWindow window;
-	
-	/** The selection. */
-	private IStructuredSelection selection;
-	
-	/*
-	 * (non-Javadoc)
-	 * @see
-	 * org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands
-	 * .ExecutionEvent)
-	 */
-	@Override
-	public Object execute(ExecutionEvent event) throws ExecutionException {
-		selection = (IStructuredSelection) HandlerUtil.getCurrentSelection(event);
-		
-		final CQPCorpus corpus = (CQPCorpus) selection.getFirstElement();
-		Shell shell = HandlerUtil.getActiveWorkbenchWindowChecked(event).getShell();
-		final CreatePartitionDialog d = new CreatePartitionDialog(shell, corpus);
-		int code = d.open();
-		if (code == Window.OK) {
-			try {
-				JobHandler jobhandler = new JobHandler(NLS.bind(TXMUIMessages.creatingANewPartitionWithP0, corpus.getName())) {
-					
-					@Override
-					protected IStatus run(IProgressMonitor monitor) {
-						this.runInit(monitor);
-						try {
-							JobsTimer.start();
-							monitor.beginTask(NLS.bind(TXMUIMessages.creatingANewPartitionWithP0, corpus.getName()), 100);
-							
-							final Partition partition = d.getPartition();
-							if (partition == null) {
-								monitor.done();
-								Log.severe(TXMUIMessages.errorColonThePartitionWasNotCreated);
-								return Status.CANCEL_STATUS;
-							}
-							try {
-								partition.compute(monitor);
-								
-								if (partition.getPartsCount() == 0) {
-									Log.severe(TXMUIMessages.errorColonThePartitionCreatedHasNoPart);
-									return null;
-								}
-							}
-							catch (Exception e) {
-								Log.printStackTrace(e);
-							}
-							monitor.worked(95);
-							
-							monitor.subTask(TXMUIMessages.refreshingCorpora);
-							syncExec(new Runnable() {
-								
-								@Override
-								public void run() {
-									CorporaView.refresh();
-									CorporaView.expand(partition.getParent());
-								}
-							});
-							monitor.worked(100);
-						}
-						catch (ThreadDeath td) {
-							return Status.CANCEL_STATUS;
-						}
-						finally {
-							monitor.done();
-							JobsTimer.stopAndPrint();
-						}
-						return Status.OK_STATUS;
-					}
-				};
-				jobhandler.startJob();
-				
-			}
-			catch (Exception e) {
-				Log.severe(NLS.bind(TXMUIMessages.errorWhileCreatingAPartitionColonP0, e));
-			}
-		}
-		return null;
-	}
-}
Index: tmp/org.txm.searchengine.cqp.rcp/src/org/txm/searchengine/cqp/rcp/handlers/base/ComputePartition.java
===================================================================
--- tmp/org.txm.searchengine.cqp.rcp/src/org/txm/searchengine/cqp/rcp/handlers/base/ComputePartition.java	(revision 0)
+++ tmp/org.txm.searchengine.cqp.rcp/src/org/txm/searchengine/cqp/rcp/handlers/base/ComputePartition.java	(revision 2492)
@@ -0,0 +1,156 @@
+// 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.searchengine.cqp.rcp.handlers.base;
+
+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.viewers.IStructuredSelection;
+import org.eclipse.jface.window.Window;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.handlers.HandlerUtil;
+import org.txm.rcp.JobsTimer;
+import org.txm.rcp.actions.CreatePartitionDialog;
+import org.txm.rcp.messages.TXMUIMessages;
+import org.txm.rcp.utils.JobHandler;
+import org.txm.rcp.views.corpora.CorporaView;
+import org.txm.searchengine.cqp.corpus.CQPCorpus;
+import org.txm.searchengine.cqp.corpus.Part;
+import org.txm.searchengine.cqp.corpus.Partition;
+import org.txm.utils.logger.Log;
+
+/**
+ * Command which creates a Partition from a Corpus.
+ * 
+ * @author mdecorde
+ */
+public class ComputePartition extends AbstractHandler {
+	
+	/** The window. */
+	private IWorkbenchWindow window;
+	
+	/** The selection. */
+	private IStructuredSelection selection;
+	
+	/*
+	 * (non-Javadoc)
+	 * @see
+	 * org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands
+	 * .ExecutionEvent)
+	 */
+	@Override
+	public Object execute(ExecutionEvent event) throws ExecutionException {
+		selection = (IStructuredSelection) HandlerUtil.getCurrentSelection(event);
+		
+		final CQPCorpus corpus = (CQPCorpus) selection.getFirstElement();
+		Shell shell = HandlerUtil.getActiveWorkbenchWindowChecked(event).getShell();
+		final CreatePartitionDialog d = new CreatePartitionDialog(shell, corpus);
+		int code = d.open();
+		if (code == Window.OK) {
+			try {
+				JobHandler jobhandler = new JobHandler(NLS.bind(TXMUIMessages.creatingANewPartitionWithP0, corpus.getName())) {
+					
+					@Override
+					protected IStatus run(IProgressMonitor monitor) {
+						this.runInit(monitor);
+						try {
+							JobsTimer.start();
+							monitor.beginTask(NLS.bind(TXMUIMessages.creatingANewPartitionWithP0, corpus.getName()), 100);
+							
+							final Partition partition = d.getPartition();
+							if (partition == null) {
+								monitor.done();
+								Log.warning(TXMUIMessages.errorColonThePartitionWasNotCreated);
+								return Status.CANCEL_STATUS;
+							}
+							try {
+								partition.compute(monitor);
+								
+								// ensure the partition viability
+								if (partition.getPartsCount() == 0) {
+									Log.warning(TXMUIMessages.errorColonThePartitionCreatedHasNoPart);
+									return Status.CANCEL_STATUS;
+								}
+								ArrayList<Part> emptyParts = new ArrayList<>();
+								for (Part p : partition.getParts()) {
+									if (p.getNMatch() == 0) {
+										emptyParts.add(p);
+									}
+								}
+								if (emptyParts.size() == partition.getPartsCount()) {
+									Log.warning(NLS.bind("Error: all parts {0} are all empty.", partition.getPartsCount()));
+									return Status.CANCEL_STATUS;
+								}
+								else if (emptyParts.size() != 0) {
+									Log.warning(NLS.bind("Warning: some parts are empty: {0}", emptyParts));
+								}
+							}
+							catch (Exception e) {
+								Log.printStackTrace(e);
+								return Status.CANCEL_STATUS;
+							}
+							monitor.worked(95);
+							
+							monitor.subTask(TXMUIMessages.refreshingCorpora);
+							syncExec(new Runnable() {
+								
+								@Override
+								public void run() {
+									CorporaView.refresh();
+									CorporaView.expand(partition.getParent());
+								}
+							});
+							monitor.worked(100);
+						}
+						catch (ThreadDeath td) {
+							return Status.CANCEL_STATUS;
+						}
+						finally {
+							monitor.done();
+							JobsTimer.stopAndPrint();
+						}
+						return Status.OK_STATUS;
+					}
+				};
+				jobhandler.startJob();
+				
+			}
+			catch (Exception e) {
+				Log.severe(NLS.bind(TXMUIMessages.errorWhileCreatingAPartitionColonP0, e));
+			}
+		}
+		return null;
+	}
+}

Property changes on: tmp/org.txm.searchengine.cqp.rcp/src/org/txm/searchengine/cqp/rcp/handlers/base/ComputePartition.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

