Index: TXM/trunk/bundles/org.txm.rcp.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/IUDetailsGroup.java
===================================================================
--- TXM/trunk/bundles/org.txm.rcp.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/IUDetailsGroup.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.rcp.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/IUDetailsGroup.java	(revision 3659)
@@ -0,0 +1,155 @@
+/******************************************************************************* 
+* Copyright (c) 2009, 2010 EclipseSource and others. All rights reserved. This
+* program and the accompanying materials are made available under the terms of
+* the Eclipse Public License v1.0 which accompanies this distribution, and is
+* available at http://www.eclipse.org/legal/epl-v10.html
+*
+* Contributors:
+*   EclipseSource - initial API and implementation
+*   IBM Corporation - ongoing development
+******************************************************************************/
+package org.eclipse.equinox.internal.p2.ui.dialogs;
+
+import org.eclipse.equinox.internal.p2.ui.ProvUIMessages;
+import org.eclipse.equinox.internal.p2.ui.actions.PropertyDialogAction;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.resource.JFaceResources;
+import org.eclipse.jface.viewers.ISelectionProvider;
+import org.eclipse.jface.window.SameShellProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.browser.Browser;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.events.KeyListener;
+import org.eclipse.swt.graphics.FontMetrics;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.*;
+
+/**
+ * Creates a details group for a list of IUs.
+ */
+public class IUDetailsGroup {
+
+	private static final String LINKACTION = "linkAction"; //$NON-NLS-1$
+
+	private GridLayout layout;
+	private Browser detailsArea;
+	private GridData gd;
+	private Link propLink;
+	private ISelectionProvider selectionProvider;
+	private int widthHint;
+	private boolean scrollable;
+	private String lastText;
+
+	/**
+	 * 
+	 */
+	public IUDetailsGroup(Composite parent, ISelectionProvider selectionProvider, int widthHint, boolean scrollable) {
+		this.selectionProvider = selectionProvider;
+		this.widthHint = widthHint;
+		this.scrollable = scrollable;
+		createGroupComposite(parent);
+	}
+
+	/**
+	 * Creates the group composite that holds the details area
+	 * @param parent The parent composite
+	 */
+	void createGroupComposite(Composite parent) {
+		Group detailsComposite = new Group(parent, SWT.NONE);
+		GC gc = new GC(parent);
+		gc.setFont(JFaceResources.getDialogFont());
+		FontMetrics fontMetrics = gc.getFontMetrics();
+		gc.dispose();
+
+		detailsComposite.setText(ProvUIMessages.ProfileModificationWizardPage_DetailsLabel);
+		layout = new GridLayout();
+		layout.marginWidth = 0;
+		layout.marginHeight = 0;
+		detailsComposite.setLayout(layout);
+		gd = new GridData(SWT.FILL, SWT.FILL, true, true);
+		detailsComposite.setLayoutData(gd);
+
+		gd = new GridData(SWT.FILL, SWT.FILL, true, true);
+		gd.verticalIndent = Dialog.convertVerticalDLUsToPixels(fontMetrics, IDialogConstants.VERTICAL_SPACING);
+		gd.heightHint = Dialog.convertHeightInCharsToPixels(fontMetrics, ILayoutConstants.DEFAULT_DESCRIPTION_HEIGHT);
+		gd.minimumHeight = Dialog.convertHeightInCharsToPixels(fontMetrics, ILayoutConstants.MINIMUM_DESCRIPTION_HEIGHT);
+		gd.widthHint = widthHint;
+		if (scrollable)
+			detailsArea = new Browser(detailsComposite, SWT.WRAP);
+		else
+			detailsArea = new Browser(detailsComposite, SWT.WRAP);
+		
+		detailsArea.setLayoutData(gd);
+		detailsArea.addKeyListener(new KeyListener() {
+			@Override
+			public void keyReleased(KeyEvent e) { }
+			
+			@Override
+			public void keyPressed(KeyEvent e) {
+				//System.out.println("key: "+e);
+				if (e.keyCode == SWT.BS || e.keyCode == SWT.F5) {
+					detailsArea.setText(lastText);
+				}
+			}
+		});
+
+		gd = new GridData(SWT.END, SWT.BOTTOM, true, false);
+		gd.horizontalIndent = Dialog.convertHorizontalDLUsToPixels(fontMetrics, IDialogConstants.HORIZONTAL_MARGIN);
+		propLink = createLink(detailsComposite, new PropertyDialogAction(new SameShellProvider(parent.getShell()), selectionProvider), ProvUIMessages.AvailableIUsPage_GotoProperties);
+		propLink.setLayoutData(gd);
+
+		// set the initial state based on selection
+		propLink.setVisible(!selectionProvider.getSelection().isEmpty());
+	}
+
+	/**
+	 * Set the detail text
+	 */
+	public void setDetailText(String text) {
+		// If the string is the same but the user has scrolled, the text
+		// widget will reset the selection.  This makes it look like the text
+		// has changed when it hasn't.  For this reason, we check equality first.
+		
+		// MD removed :) 
+		//if (lastText == null || !lastText.equals(text))
+			detailsArea.setText(text);
+		lastText = text;
+	}
+
+	/**
+	 * Toggles the property link for the details area.
+	 */
+	public void enablePropertyLink(boolean enable) {
+		propLink.setVisible(enable);
+	}
+
+	private Link createLink(Composite parent, IAction action, String text) {
+		Link link = new Link(parent, SWT.PUSH);
+		link.setText(text);
+
+		link.addListener(SWT.Selection, new Listener() {
+			public void handleEvent(Event event) {
+				IAction linkAction = getLinkAction(event.widget);
+				if (linkAction != null) {
+					linkAction.runWithEvent(event);
+				}
+			}
+		});
+		link.setToolTipText(action.getToolTipText());
+		link.setData(LINKACTION, action);
+		return link;
+	}
+
+	IAction getLinkAction(Widget widget) {
+		Object data = widget.getData(LINKACTION);
+		if (data == null || !(data instanceof IAction)) {
+			return null;
+		}
+		return (IAction) data;
+	}
+
+}

Property changes on: TXM/trunk/bundles/org.txm.rcp.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/IUDetailsGroup.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.rcp.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/UpdateWizardPage.java
===================================================================
--- TXM/trunk/bundles/org.txm.rcp.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/UpdateWizardPage.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.rcp.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/UpdateWizardPage.java	(revision 3659)
@@ -0,0 +1,95 @@
+/*******************************************************************************
+ *  Copyright (c) 2007, 2010 IBM Corporation and others.
+ *  All rights reserved. This program and the accompanying materials
+ *  are made available under the terms of the Eclipse Public License v1.0
+ *  which accompanies this distribution, and is available at
+ *  http://www.eclipse.org/legal/epl-v10.html
+ * 
+ *  Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.internal.p2.ui.dialogs;
+
+import org.eclipse.equinox.internal.p2.ui.ProvUIMessages;
+import org.eclipse.equinox.internal.p2.ui.model.IUElementListRoot;
+import org.eclipse.equinox.p2.metadata.IInstallableUnit;
+import org.eclipse.equinox.p2.metadata.IUpdateDescriptor;
+import org.eclipse.equinox.p2.operations.UpdateOperation;
+import org.eclipse.equinox.p2.ui.ProvisioningUI;
+import org.eclipse.jface.viewers.IContentProvider;
+import org.eclipse.swt.widgets.TreeItem;
+
+public class UpdateWizardPage extends SizeComputingWizardPage {
+
+	public UpdateWizardPage(ProvisioningUI ui, ProvisioningOperationWizard wizard, IUElementListRoot root, UpdateOperation operation) {
+		super(ui, wizard, root, operation);
+		//System.out.println("Init, root="+Arrays.asList(root));
+		setTitle(ProvUIMessages.UpdateWizardPage_Title);
+		setDescription(ProvUIMessages.UpdateWizardPage_Description);
+	}
+
+	/**
+	 * Specialized version for TXM that shows the feature description instead of the product description
+	 */
+	protected String getIUDescription(IInstallableUnit iu) {
+		//TODO Sélectionner TXM product par défaut 
+		if (iu != null) {
+			//System.out.println("IInstallableUnit.getId() " +iu.getId());
+			if (iu.getId().equals("org.txm.rcp.product")) { // TXM product is selected
+				//System.out.println("TXM product is selected");
+				TreeItem[] treeitems = treeViewer.getTree().getSelection();
+				for (TreeItem item : treeitems) { // find it in the Tree selection
+					Object data = item.getData();
+					//System.out.println("TreeElem: "+data+" class="+data.getClass());
+					if (data instanceof org.eclipse.equinox.internal.p2.ui.model.AvailableUpdateElement) {
+						org.eclipse.equinox.internal.p2.ui.model.AvailableUpdateElement iunit = (org.eclipse.equinox.internal.p2.ui.model.AvailableUpdateElement) data;
+						//System.out.println(" iunit found "+iunit);
+						if (iunit.getIU().getId().equals(iu.getId())) { // this is the TXM product
+							//System.out.println(" TXM product found in Tree "+iunit);
+							//System.out.println("Input: "+treeViewer.getInput());
+							IContentProvider cp = treeViewer.getContentProvider();
+							//System.out.println("content provider: "+treeViewer.getContentProvider());
+							org.eclipse.equinox.internal.p2.ui.viewers.ProvElementContentProvider pecp = (org.eclipse.equinox.internal.p2.ui.viewers.ProvElementContentProvider)cp;
+							Object[] children = pecp.getChildren(data);
+							//System.out.println("Children: "+Arrays.asList(children));
+							for (Object child : children) {
+								//System.out.println("Child: "+child);
+								//if (child != null) System.out.println("Child class: "+child.getClass());
+								if (child instanceof org.eclipse.equinox.internal.p2.ui.model.AvailableIUElement) {
+									org.eclipse.equinox.internal.p2.ui.model.AvailableIUElement riu = (org.eclipse.equinox.internal.p2.ui.model.AvailableIUElement) child;
+									//System.out.println("riu found "+riu);
+									if (riu.getIU().getId().equals("org.txm.rcp.feature.feature.group")) {
+										//System.out.println("org.txm.rcp.feature.feature.group description found "+riu.getIU().getUpdateDescriptor().getDescription());
+										String desc = riu.getIU().getUpdateDescriptor().getDescription();
+										if (desc != null) {
+											return desc;
+										} else {
+											return super.getIUDescription(riu.getIU());
+										}
+									}
+								}
+							}
+
+
+						}
+					}
+				}
+			} else {
+				IUpdateDescriptor updateDescriptor = iu.getUpdateDescriptor();
+				if (updateDescriptor != null && updateDescriptor.getDescription() != null && updateDescriptor.getDescription().length() > 0) {
+					return updateDescriptor.getDescription();
+				}
+			}
+		}
+		//String defaultDesc = super.getIUDescription(iu);
+		return super.getIUDescription(iu);
+	}
+
+	protected String getOperationLabel() {
+		return ProvUIMessages.UpdateIUOperationLabel;
+	}
+
+	protected String getOperationTaskName() {
+		return ProvUIMessages.UpdateIUOperationTask;
+	}
+}

Property changes on: TXM/trunk/bundles/org.txm.rcp.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/UpdateWizardPage.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.rcp.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/ILayoutConstants.java
===================================================================
--- TXM/trunk/bundles/org.txm.rcp.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/ILayoutConstants.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.rcp.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/ILayoutConstants.java	(revision 3659)
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ *  Copyright (c) 2008, 2009 IBM Corporation and others.
+ *  All rights reserved. This program and the accompanying materials
+ *  are made available under the terms of the Eclipse Public License v1.0
+ *  which accompanies this distribution, and is available at
+ *  http://www.eclipse.org/legal/epl-v10.html
+ * 
+ *  Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.internal.p2.ui.dialogs;
+
+/**
+ * ILayoutConstants defines common dialog constants used when laying
+ * out dialogs.  Units of measurement are character widths and heights
+ * unless otherwise specified.
+ * 
+ * This interface is not intended to be implemented
+ * 
+ * @noimplement This interface is not intended to be implemented by clients.
+ * @noextend This interface is not intended to be extended by clients.
+ * @since 3.5
+ */
+public interface ILayoutConstants {
+	public static final int DEFAULT_DESCRIPTION_HEIGHT = 4;
+	public static final int MINIMUM_DESCRIPTION_HEIGHT = 1;
+	public static final int DEFAULT_SITEDETAILS_HEIGHT = 2;
+	public static final int DEFAULT_PRIMARY_COLUMN_WIDTH = 60;
+	public static final int DEFAULT_COLUMN_WIDTH = 40;
+	public static final int DEFAULT_SMALL_COLUMN_WIDTH = 20;
+	public static final int DEFAULT_TABLE_HEIGHT = 10;
+	public static final int DEFAULT_TABLE_WIDTH = 80;
+	public static final int[] IUS_TO_DETAILS_WEIGHTS = new int[] {50, 50};
+}

Property changes on: TXM/trunk/bundles/org.txm.rcp.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/ILayoutConstants.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.rcp.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/ResolutionResultsWizardPage.java
===================================================================
--- TXM/trunk/bundles/org.txm.rcp.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/ResolutionResultsWizardPage.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.rcp.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/ResolutionResultsWizardPage.java	(revision 3659)
@@ -0,0 +1,350 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2013 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     EclipseSource - ongoing development
+ *     Sonatype, Inc. - ongoing development
+ *     Red Hat, Inc. - support for remediation page
+ *******************************************************************************/
+package org.eclipse.equinox.internal.p2.ui.dialogs;
+
+import java.util.Collection;
+
+import org.eclipse.core.runtime.*;
+import org.eclipse.equinox.internal.p2.ui.*;
+import org.eclipse.equinox.internal.p2.ui.model.*;
+import org.eclipse.equinox.internal.p2.ui.viewers.*;
+import org.eclipse.equinox.p2.engine.IProvisioningPlan;
+import org.eclipse.equinox.p2.metadata.IInstallableUnit;
+import org.eclipse.equinox.p2.operations.ProfileChangeOperation;
+import org.eclipse.equinox.p2.operations.ProvisioningJob;
+import org.eclipse.equinox.p2.query.IQueryable;
+import org.eclipse.equinox.p2.ui.ProvisioningUI;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.jface.viewers.*;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.SashForm;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.*;
+import org.eclipse.swt.widgets.*;
+import org.eclipse.ui.statushandlers.StatusManager;
+
+
+/**
+ * A wizard page that shows detailed information about a resolved install
+ * operation.  It allows drill down into the elements that will be installed.
+ * 
+ * @since 3.4
+ *
+ */
+public abstract class ResolutionResultsWizardPage extends ResolutionStatusPage {
+
+	private static final String DIALOG_SETTINGS_SECTION = "ResolutionResultsPage"; //$NON-NLS-1$
+
+	protected IUElementListRoot input;
+	ProfileChangeOperation resolvedOperation;
+	TreeViewer treeViewer;
+	ProvElementContentProvider contentProvider;
+	IUDetailsLabelProvider labelProvider;
+	protected Display display;
+	private IUDetailsGroup iuDetailsGroup;
+	SashForm sashForm;
+
+	protected ResolutionResultsWizardPage(ProvisioningUI ui, ProvisioningOperationWizard wizard, IUElementListRoot input, ProfileChangeOperation operation) {
+		super("ResolutionPage", ui, wizard); //$NON-NLS-1$
+		this.resolvedOperation = operation;
+		if (input == null)
+			this.input = new IUElementListRoot();
+		else
+			this.input = input;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
+	 */
+	public void createControl(Composite parent) {
+		display = parent.getDisplay();
+		sashForm = new SashForm(parent, SWT.VERTICAL);
+		FillLayout layout = new FillLayout();
+		sashForm.setLayout(layout);
+		GridData data = new GridData(GridData.FILL_BOTH);
+		sashForm.setLayoutData(data);
+		initializeDialogUnits(sashForm);
+
+		Composite composite = new Composite(sashForm, SWT.NONE);
+		GridLayout gridLayout = new GridLayout();
+		gridLayout.marginWidth = 0;
+		gridLayout.marginHeight = 0;
+		composite.setLayout(gridLayout);
+
+		treeViewer = createTreeViewer(composite);
+		data = new GridData(GridData.FILL_BOTH);
+		data.heightHint = convertHeightInCharsToPixels(ILayoutConstants.DEFAULT_TABLE_HEIGHT);
+		data.widthHint = convertWidthInCharsToPixels(ILayoutConstants.DEFAULT_TABLE_WIDTH);
+		Tree tree = treeViewer.getTree();
+		tree.setLayoutData(data);
+		tree.setHeaderVisible(true);
+		activateCopy(tree);
+		TreeViewerColumn nameColumn = new TreeViewerColumn(treeViewer, SWT.LEFT);
+		nameColumn.getColumn().setText(ProvUIMessages.ProvUI_NameColumnTitle);
+		nameColumn.getColumn().setWidth(400);
+		nameColumn.getColumn().setMoveable(true);
+		nameColumn.setLabelProvider(new ColumnLabelProvider() {
+			public String getText(Object element) {
+				IInstallableUnit iu = ProvUI.getAdapter(element, IInstallableUnit.class);
+				String label = iu.getProperty(IInstallableUnit.PROP_NAME, null);
+				if (label == null)
+					label = iu.getId();
+				return label;
+			}
+
+			public Image getImage(Object element) {
+				if (element instanceof ProvElement)
+					return ((ProvElement) element).getImage(element);
+				if (ProvUI.getAdapter(element, IInstallableUnit.class) != null)
+					return ProvUIImages.getImage(ProvUIImages.IMG_IU);
+				return null;
+			}
+
+			public String getToolTipText(Object element) {
+				if (element instanceof AvailableIUElement && ((AvailableIUElement) element).getImageOverlayId(null) == ProvUIImages.IMG_INFO)
+					return ProvUIMessages.RemedyElementNotHighestVersion;
+				return super.getToolTipText(element);
+			}
+		});
+		TreeViewerColumn versionColumn = new TreeViewerColumn(treeViewer, SWT.LEFT);
+		versionColumn.getColumn().setText(ProvUIMessages.ProvUI_VersionColumnTitle);
+		versionColumn.getColumn().setWidth(200);
+		versionColumn.setLabelProvider(new ColumnLabelProvider() {
+			public String getText(Object element) {
+				IInstallableUnit iu = ProvUI.getAdapter(element, IInstallableUnit.class);
+				if (element instanceof IIUElement) {
+					if (((IIUElement) element).shouldShowVersion())
+						return iu.getVersion().toString();
+					return ""; //$NON-NLS-1$
+				}
+				return iu.getVersion().toString();
+			}
+		});
+		TreeViewerColumn idColumn = new TreeViewerColumn(treeViewer, SWT.LEFT);
+		idColumn.getColumn().setText(ProvUIMessages.ProvUI_IdColumnTitle);
+		idColumn.getColumn().setWidth(200);
+
+		idColumn.setLabelProvider(new ColumnLabelProvider() {
+			public String getText(Object element) {
+				IInstallableUnit iu = ProvUI.getAdapter(element, IInstallableUnit.class);
+				return iu.getId();
+			}
+		});
+
+		// Filters and sorters before establishing content, so we don't refresh unnecessarily.
+		IUComparator comparator = new IUComparator(IUComparator.IU_NAME);
+		comparator.useColumnConfig(getColumnConfig());
+		treeViewer.setComparator(comparator);
+		treeViewer.setComparer(new ProvElementComparer());
+		ColumnViewerToolTipSupport.enableFor(treeViewer);
+		contentProvider = new ProvElementContentProvider();
+		treeViewer.setContentProvider(contentProvider);
+		//		labelProvider = new IUDetailsLabelProvider(null, getColumnConfig(), getShell());
+		//		treeViewer.setLabelProvider(labelProvider);
+
+		// Optional area to show the size
+		createSizingInfo(composite);
+
+		// The text area shows a description of the selected IU, or error detail if applicable.
+		iuDetailsGroup = new IUDetailsGroup(sashForm, treeViewer, 2*convertWidthInCharsToPixels(ILayoutConstants.DEFAULT_TABLE_WIDTH), true);
+
+		setControl(sashForm);
+		sashForm.setWeights(getSashWeights());
+		Dialog.applyDialogFont(sashForm);
+
+		// Controls for filtering/presentation/site selection
+		Composite controlsComposite = new Composite(composite, SWT.NONE);
+		gridLayout = new GridLayout();
+		gridLayout.marginWidth = 0;
+		gridLayout.marginHeight = 0;
+		gridLayout.numColumns = 2;
+		gridLayout.makeColumnsEqualWidth = true;
+		gridLayout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
+		controlsComposite.setLayout(layout);
+		GridData gd = new GridData(SWT.FILL, SWT.FILL, true, false);
+		controlsComposite.setLayoutData(gd);
+		
+		final Runnable runnable = new Runnable() {
+			public void run() {
+				treeViewer.addSelectionChangedListener(new ISelectionChangedListener() {
+					public void selectionChanged(SelectionChangedEvent event) {
+						setDetailText(resolvedOperation);
+					}
+				});
+				setDrilldownElements(input, resolvedOperation);
+				treeViewer.setInput(input);
+//				treeViewer.expandAll();
+//				for (TreeItem item : treeViewer.getTree().getItems()) {
+//					System.out.println("SELECT FIRST ITEM for: "+item.getData());
+//					
+//					treeViewer.getTree().select(item);
+//					getIUDescription(item.getData());
+//				}
+				setDetailText(resolvedOperation);
+			}
+		};
+
+		if (resolvedOperation != null && !resolvedOperation.hasResolved()) {
+			try {
+				getContainer().run(true, false, new IRunnableWithProgress() {
+					public void run(IProgressMonitor monitor) {
+						resolvedOperation.resolveModal(monitor);
+						display.asyncExec(runnable);
+					}
+				});
+			} catch (Exception e) {
+				StatusManager.getManager().handle(new Status(IStatus.ERROR, ProvUIActivator.PLUGIN_ID, e.getMessage(), e));
+			}
+		} else {
+			runnable.run();
+		}
+	}
+
+	@Override
+	public void updateStatus(IUElementListRoot newRoot, ProfileChangeOperation op) {
+		super.updateStatus(newRoot, op);
+	}
+
+	protected void createSizingInfo(Composite parent) {
+		// Default is to do nothing
+	}
+
+	public boolean performFinish() {
+		if (resolvedOperation.getResolutionResult().getSeverity() != IStatus.ERROR) {
+			getProvisioningUI().schedule(resolvedOperation.getProvisioningJob(null), StatusManager.SHOW | StatusManager.LOG);
+			return true;
+		}
+		return false;
+	}
+
+	protected TreeViewer getTreeViewer() {
+		return treeViewer;
+	}
+
+	public IProvisioningPlan getCurrentPlan() {
+		if (resolvedOperation != null)
+			return resolvedOperation.getProvisioningPlan();
+		return null;
+	}
+
+	protected Object[] getSelectedElements() {
+		return ((IStructuredSelection) treeViewer.getSelection()).toArray();
+	}
+
+	protected IInstallableUnit getSelectedIU() {
+		java.util.List<IInstallableUnit> units = ElementUtils.elementsToIUs(getSelectedElements());
+		if (units.size() == 0)
+			return null;
+		return units.get(0);
+	}
+
+	protected boolean shouldCompleteOnCancel() {
+		return false;
+	}
+
+	protected Collection<IInstallableUnit> getIUs() {
+		return ElementUtils.elementsToIUs(input.getChildren(input));
+	}
+
+	void setDrilldownElements(IUElementListRoot root, ProfileChangeOperation operation) {
+		if (operation == null || operation.getProvisioningPlan() == null)
+			return;
+		Object[] elements = root.getChildren(root);
+		for (int i = 0; i < elements.length; i++) {
+			if (elements[i] instanceof QueriedElement) {
+				((QueriedElement) elements[i]).setQueryable(getQueryable(operation.getProvisioningPlan()));
+			}
+		}
+	}
+
+	protected abstract String getOperationLabel();
+
+	/**
+	 * Returns the restart policy for this operation.
+	 * 
+	 * @return an integer constant describing whether the running profile
+	 * needs to be restarted. 
+	 * 
+	 * @see ProvisioningJob#RESTART_NONE
+	 * @see ProvisioningJob#RESTART_ONLY
+	 * @see ProvisioningJob#RESTART_OR_APPLY
+	 *
+	 */
+	protected int getRestartPolicy() {
+		return ProvisioningJob.RESTART_OR_APPLY;
+	}
+
+	/**
+	 * Returns the task name for this operation, or <code>null</code> to display
+	 * a generic task name.
+	 */
+	protected String getOperationTaskName() {
+		return null;
+	}
+
+	protected TreeViewer createTreeViewer(Composite parent) {
+		return new TreeViewer(parent, SWT.BORDER | SWT.MULTI | SWT.FULL_SELECTION) {
+//			public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+//				for (TreeItem item : treeViewer.getTree().getItems()) {
+//					System.out.println("SELECT FIRST ITEM for: "+item.getData());
+//					treeViewer.getTree().select(item);
+//					getIUDescription(item.getData());
+//				}
+//			}
+		};
+	}
+
+	protected abstract IQueryable<IInstallableUnit> getQueryable(IProvisioningPlan plan);
+
+	protected String getClipboardText(Control control) {
+		return CopyUtils.getIndentedClipboardText(getSelectedElements(), labelProvider);
+	}
+
+	protected IUDetailsGroup getDetailsGroup() {
+		return iuDetailsGroup;
+	}
+
+	protected boolean isCreated() {
+		return treeViewer != null;
+	}
+
+	protected void updateCaches(IUElementListRoot newRoot, ProfileChangeOperation op) {
+		resolvedOperation = op;
+		if (newRoot != null) {
+			setDrilldownElements(newRoot, resolvedOperation);
+			if (treeViewer != null) {
+				if (input != newRoot)
+					treeViewer.setInput(newRoot);
+				else
+					treeViewer.refresh();
+			}
+			input = newRoot;
+		}
+	}
+
+	protected String getDialogSettingsName() {
+		return getWizard().getClass().getName() + "." + DIALOG_SETTINGS_SECTION; //$NON-NLS-1$
+	}
+
+	protected int getColumnWidth(int index) {
+		return treeViewer.getTree().getColumn(index).getWidth();
+	}
+
+	protected SashForm getSashForm() {
+		return sashForm;
+	}
+}
\ No newline at end of file

Property changes on: TXM/trunk/bundles/org.txm.rcp.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/ResolutionResultsWizardPage.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.rcp.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/UpdateWizard.java
===================================================================
--- TXM/trunk/bundles/org.txm.rcp.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/UpdateWizard.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.rcp.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/UpdateWizard.java	(revision 3659)
@@ -0,0 +1,206 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2013 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     Genuitec, LLC - added license support
+ *     Sonatype, Inc. - ongoing development
+ *     Red Hat, Inc. - support for remediation page
+ *******************************************************************************/
+package org.eclipse.equinox.internal.p2.ui.dialogs;
+
+import java.util.*;
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.equinox.internal.p2.ui.ProvUIImages;
+import org.eclipse.equinox.internal.p2.ui.ProvUIMessages;
+import org.eclipse.equinox.internal.p2.ui.model.*;
+import org.eclipse.equinox.p2.engine.IProfile;
+import org.eclipse.equinox.p2.engine.IProfileRegistry;
+import org.eclipse.equinox.p2.metadata.IInstallableUnit;
+import org.eclipse.equinox.p2.operations.*;
+import org.eclipse.equinox.p2.ui.LoadMetadataRepositoryJob;
+import org.eclipse.equinox.p2.ui.ProvisioningUI;
+import org.eclipse.jface.wizard.IWizardPage;
+
+/**
+ * @since 3.4
+ */
+public class UpdateWizard extends WizardWithLicenses {
+	IInstallableUnit[] iusToReplace;
+	boolean skipSelectionsPage = false;
+	IUElementListRoot firstPageRoot;
+	Update[] initialSelections;
+
+	public static Collection<IInstallableUnit> getIUsToReplace(Object[] elements) {
+		Set<IInstallableUnit> iusToReplace = new HashSet<IInstallableUnit>();
+		for (int i = 0; i < elements.length; i++) {
+			if (elements[i] instanceof AvailableUpdateElement) {
+				iusToReplace.add(((AvailableUpdateElement) elements[i]).getIUToBeUpdated());
+			}
+		}
+		return iusToReplace;
+	}
+
+	public static IInstallableUnit[] getReplacementIUs(Object[] elements) {
+		Set<IInstallableUnit> replacements = new HashSet<IInstallableUnit>();
+		for (int i = 0; i < elements.length; i++) {
+			if (elements[i] instanceof AvailableUpdateElement) {
+				replacements.add(((AvailableUpdateElement) elements[i]).getIU());
+			}
+		}
+		return replacements.toArray(new IInstallableUnit[replacements.size()]);
+	}
+
+	public static Update[] makeUpdatesFromElements(Object[] elements) {
+		Set<Update> updates = new HashSet<Update>();
+		for (int i = 0; i < elements.length; i++) {
+			if (elements[i] instanceof AvailableUpdateElement) {
+				updates.add(((AvailableUpdateElement) elements[i]).getUpdate());
+			}
+		}
+		return updates.toArray(new Update[updates.size()]);
+	}
+
+	/**
+	 * Open an update wizard.  For update wizards, the operation must have been resolved in advanced.
+	 * This prevents searching for updates in the UI thread.
+	 * 
+	 * @param ui the provisioning UI
+	 * @param operation the update operation.  Must already be resolved!
+	 * @param initialSelections initial selections for the wizard (can be null)
+	 * @param preloadJob a job that has been used to preload metadata repositories (can be null)
+	 */
+	public UpdateWizard(ProvisioningUI ui, UpdateOperation operation, Object[] initialSelections, LoadMetadataRepositoryJob preloadJob) {
+		super(ui, operation, initialSelections, preloadJob);
+		this.initialSelections = (Update[]) initialSelections;
+		Assert.isLegal(operation.hasResolved(), "Cannot create an update wizard on an unresolved operation"); //$NON-NLS-1$
+		setWindowTitle(ProvUIMessages.UpdateAction_UpdatesAvailableTitle);
+		setDefaultPageImageDescriptor(ProvUIImages.getImageDescriptor(ProvUIImages.WIZARD_BANNER_UPDATE));
+	}
+
+	private boolean isLocked(IProfile profile, IInstallableUnit iuToBeUpdated) {
+		return Boolean.valueOf(profile.getInstallableUnitProperty(iuToBeUpdated, IProfile.PROP_PROFILE_LOCKED_IU)).booleanValue();
+	}
+
+	public void deselectLockedIUs() {
+		IProfileRegistry profileRegistry = (IProfileRegistry) ui.getSession().getProvisioningAgent().getService(IProfileRegistry.SERVICE_NAME);
+		IProfile profile = profileRegistry.getProfile(ui.getProfileId());
+
+		ArrayList<Update> newSelection = new ArrayList<Update>(initialSelections.length);
+		for (int i = 0; i < initialSelections.length; i++) {
+			if (!isLocked(profile, initialSelections[i].toUpdate)) {
+				newSelection.add(initialSelections[i]);
+			}
+		}
+
+		((UpdateOperation) operation).setSelectedUpdates(newSelection.toArray(new Update[newSelection.size()]));
+		recomputePlan(getContainer());
+	}
+
+	protected ISelectableIUsPage createMainPage(IUElementListRoot input, Object[] selections) {
+		mainPage = new SelectableIUsPage(ui, this, getAllPossibleUpdatesRoot(), selections);
+		mainPage.setTitle(ProvUIMessages.UpdateAction_UpdatesAvailableTitle+" - TXM");
+		mainPage.setDescription(ProvUIMessages.UpdateAction_UpdatesAvailableMessage);
+		((SelectableIUsPage) mainPage).updateStatus(getAllPossibleUpdatesRoot(), operation);
+		return mainPage;
+	}
+
+	protected ResolutionResultsWizardPage createResolutionPage() {
+		return new UpdateWizardPage(ui, this, root, (UpdateOperation) operation);
+	}
+
+	protected void initializeResolutionModelElements(Object[] selectedElements) {
+		if (selectedElements == null)
+			return;
+		root = new IUElementListRoot();
+		if (operation instanceof RemediationOperation) {
+			AvailableIUElement[] elements = ElementUtils.requestToElement(((RemediationOperation) operation).getCurrentRemedy(), false);
+			root.setChildren(elements);
+			//planSelections = elements;
+		} else {
+			ArrayList<AvailableUpdateElement> list = new ArrayList<AvailableUpdateElement>(selectedElements.length);
+			ArrayList<AvailableUpdateElement> selected = new ArrayList<AvailableUpdateElement>(selectedElements.length);
+			for (int i = 0; i < selectedElements.length; i++) {
+				if (selectedElements[i] instanceof AvailableUpdateElement) {
+					AvailableUpdateElement element = (AvailableUpdateElement) selectedElements[i];
+					AvailableUpdateElement newElement = new AvailableUpdateElement(root, element.getIU(), element.getIUToBeUpdated(), getProfileId(), shouldShowProvisioningPlanChildren());
+					list.add(newElement);
+					selected.add(newElement);
+				} else if (selectedElements[i] instanceof Update) {
+					Update update = (Update) selectedElements[i];
+					AvailableUpdateElement newElement = new AvailableUpdateElement(root, update.replacement, update.toUpdate, getProfileId(), shouldShowProvisioningPlanChildren());
+					list.add(newElement);
+					selected.add(newElement);
+				}
+			}
+			root.setChildren(list.toArray());
+			planSelections = selected.toArray();
+		}
+	}
+
+	protected IResolutionErrorReportingPage createErrorReportingPage() {
+		return (SelectableIUsPage) mainPage;
+	}
+
+	public void setSkipSelectionsPage(boolean skipSelectionsPage) {
+		this.skipSelectionsPage = skipSelectionsPage;
+	}
+
+	public IWizardPage getStartingPage() {
+		//if (skipSelectionsPage) {
+			// TODO see https://bugs.eclipse.org/bugs/show_bug.cgi?id=276963
+			IWizardPage page = getNextPage(mainPage);
+			if (page != null)
+				return page;
+			else 
+				return mainPage;
+//		}
+//		return mainPage;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.equinox.internal.p2.ui.dialogs.ProvisioningOperationWizard#getProfileChangeOperation(java.lang.Object[])
+	 */
+	protected ProfileChangeOperation getProfileChangeOperation(Object[] elements) {
+		if (operation == null) {
+			operation = new UpdateOperation(ui.getSession(), getIUsToReplace(elements));
+			operation.setProfileId(getProfileId());
+			//			operation.setRootMarkerKey(getRootMarkerKey());
+		} else {
+			((UpdateOperation) operation).setSelectedUpdates(makeUpdatesFromElements(elements));
+		}
+		return operation;
+	}
+
+	private IUElementListRoot getAllPossibleUpdatesRoot() {
+		if (firstPageRoot == null) {
+			firstPageRoot = new IUElementListRoot();
+			if (operation != null && operation instanceof UpdateOperation) {
+				Update[] updates;
+				if (getPolicy().getShowLatestVersionsOnly()) {
+					updates = ((UpdateOperation) operation).getSelectedUpdates();
+				} else {
+					updates = ((UpdateOperation) operation).getPossibleUpdates();
+				}
+				ArrayList<AvailableUpdateElement> allPossible = new ArrayList<AvailableUpdateElement>(updates.length);
+				for (int i = 0; i < updates.length; i++) {
+					AvailableUpdateElement newElement = new AvailableUpdateElement(firstPageRoot, updates[i].replacement, updates[i].toUpdate, getProfileId(), shouldShowProvisioningPlanChildren());
+					allPossible.add(newElement);
+				}
+				firstPageRoot.setChildren(allPossible.toArray());
+			}
+		}
+		return firstPageRoot;
+	}
+
+	@Override
+	protected RemediationPage createRemediationPage() {
+		remediationPage = new RemediationPage(ui, this, root, operation);
+		return remediationPage;
+	}
+
+}

Property changes on: TXM/trunk/bundles/org.txm.rcp.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/UpdateWizard.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.rcp.p2.ui/src/org/eclipse/equinox/internal/p2/ui/messages_fr.properties
===================================================================
--- TXM/trunk/bundles/org.txm.rcp.p2.ui/src/org/eclipse/equinox/internal/p2/ui/messages_fr.properties	(revision 0)
+++ TXM/trunk/bundles/org.txm.rcp.p2.ui/src/org/eclipse/equinox/internal/p2/ui/messages_fr.properties	(revision 3659)
@@ -0,0 +1,248 @@
+#/home/mdecorde/workspace047/org.eclipse.equinox.p2.ui.nl_fr/org/eclipse/equinox/internal/p2/ui/messages_fr.properties + /home/mdecorde/workspace047/org.txm.rcp.p2.ui/src/org/eclipse/equinox/internal/p2/ui/messages_fr.properties
+#Tue Apr 15 11:45:28 CEST 2014
+QueryableMetadataRepositoryManager_LoadRepositoryProgress=Prise de contact avec {0}
+RevertIUCommandTooltip=Revenir � une pr�c�dente configuration install�e
+RepositoryManipulationPage_Edit=&Editer
+UpdateIUCommandTooltip=Voir si des mises � jour sont disponibles pour les �l�ments s�lectionn�s
+IUGeneralInfoPropertyPage_IdentifierLabel=Identificateur \:
+UninstallIUOperationLabel=D�sinstaller
+RevertDialog_ConfigsLabel=Configurations &pr�c�dentes\:
+RepositoryManipulationPage_RefreshConnection=&Recharger
+QueryableUpdates_UpdateListProgress=Assembling list of updates
+RemedyElementInstalledVersion=Version install�e \: 
+RepositorySelectionGroup_PrefPageName=Sites de logiciels
+TrustCertificateDialog_Title=Faites-vous confiance � ces certificats�?
+RevertProfilePage_ProfileTagColumn=Balise
+UpdateManagerCompatibility_InvalidSitesTitle=Invalid Sites File
+RepositoryManipulationPage_Add=&Ajouter...
+RepositoryNameAndLocationDialog_Title=Modifier le site
+UpdateIUProgress=Mise � jour...
+RepositoryManipulationPage_LocationColumnTitle=Emplacement
+UpdateManagerCompatibility_InvalidSiteFileMessage=L''emplacement s�lectionn� ne contient pas de site de mise � jour. Veuillez choisir un autre dossier.
+AvailableIUsPage_RepoFilterInstructions=Vous pouvez entrer l''emplacement du site de mise � jour. En appuyant sur "Entr�e" le contenu du site est affich�.
+UpdateIUOperationTask=Mise � jour logicielle en cours
+RepositoryGroup_SelectRepositoryDirectory=S�lectionnez un dossier racine de r�f�rentiel�\:
+AvailableIUsPage_SingleSelectionCount={0} objet s�lectionn�
+ResolutionWizardPage_Canceled=L''op�ration a �t� annul�e.
+AvailableIUsPage_SelectASite=S�lectionnez un site ou entrez l''adresse d''un site
+AddRepositoryDialog_LocationLabel=Emp&lacement \:
+UpdateRemediationPage_Description=La mise � jour n''a pas pu se finir.
+ProvUI_IdColumnTitle=ID
+RemediationPage_SubDescription= Veuillez choisir une de ces solution alternative.
+RevertProfilePage_ProfileTimestampColumn=Date
+RepositoryManipulationPage_Description=Les sites activ�s seront utilis�s pour trouver les logiciels disponibles. Les sites d�sactiv�s sont ignor�s.
+RepositoryManipulatorDropTarget_DragAndDropJobLabel=Op�ration de glisser-d�poser
+ColocatedRepositoryTracker_PromptForSiteLocationEdit=Pas de site de mise � jour trouv� � l''emplacement {0}. Voulez-vous modifier l''emplacement ?
+QueriedElementWrapper_NoItemsExplanation=Pas de mise � jour disponible
+AvailableIUsPage_LocalSites=--Sites de mise � jour locaux--
+InstallIUOperationLabel=Installer
+IUGeneralInfoPropertyPage_DescriptionLabel=Description
+RemediationPage_SolutionDetails=D�tails de la solution
+ProvisioningOperationRunner_CannotApplyChanges=Les changements ne peuvent pas �tre appliqu�s pendant que l''application est en cours d''ex�cution. Vous devez red�marrer l''application pour que les changements prennent effet.
+InstallIUCommandLabel=&Installer
+RepositoryManipulationPage_RefreshOperationCanceled=Op�ration annul�e.
+RemedyElementRequestedVersion=Version demand�e \:
+RevertProfilePage_CompareTooltip=Comparer les configurations d''installation s�lectionn�es
+RevertProfilePage_RevertLabel=R�&tablir
+RepositoryManipulationPage_Export=E&xporter...
+RevertProfilePage_DeleteMultipleConfigurationsTitle=Supprimer les configurations
+UpdateWizardPage_Description=V�rifier les mises � jour.
+Label_Repositories=Sites connus
+RepositoryGroup_ArchivedRepoBrowseButton=&Archive
+UpdateIUOperationLabel=Mettre � jour
+ResolutionWizardPage_ErrorStatus=L''op�ration ne peut pas �tre termin�e. Voir les d�tails.
+Label_Profiles=All Software Profiles
+ProvUIMessages_SavedNotAccepted_EnterFor_0=Saved login details were not accepted. Please provide login details for {0}
+RemedyCategoryChanged=Sera mis � jour
+ResolutionWizardPage_RelaxedConstraints=Install software with with relaxed constraints.
+UninstallIUCommandLabel=&D�sinstaller
+ResolutionWizardPage_RelaxedConstraintsTip=Instructs p2 to install the selected software with with relaxed constraints.
+AddRepositoryDialog_NameLabel=&Nom \:
+AddRepositoryDialog_Title=Ajouter un repository
+RepositorySelectionGroup_NameAndLocationSeparator=\ - 
+MetadataRepositoryElement_RepositoryLoadError=Erreur lors du chargement du site {0}
+ProvUIMessages_NotAccepted_EnterFor_0=Login details were not accepted. Please provide login details for {0}
+RepositoryManipulationPage_NameColumnTitle=Nom
+IULicensePropertyPage_NoLicense=Aucune information de licence n''a �t� fournie.
+AvailableIUGroup_LoadingRepository=Chargement {0}
+IUGeneralInfoPropertyPage_ProviderLabel=Fournisseur \:
+RepositorySelectionGroup_GenericSiteLinkTitle=<a>Modifier la liste des sites logiciels</a>
+RemoveColocatedRepositoryAction_Label=&Retirer des sites
+IUGeneralInfoPropertyPage_CouldNotOpenBrowser=Impossible d''ouvrir le navigateur.
+RemediationPage_NoSolutionFound=Pas de solution trouv�e.
+ApplyProfileChangesDialog_Restart=&Red�marrer maintenant
+AcceptLicensesWizardPage_LicenseTextLabel=&Texte de la licence \:
+RepositoryDetailsLabelProvider_Disabled=D�sactiv�
+AcceptLicensesWizardPage_AcceptMultiple=J''&accepte les termes des licences
+ApplyProfileChangesDialog_NotYet=&Pas maintenant
+AvailableIUsPage_GotoProperties=<a>Plus...</a>
+RepositoryManipulationPage_Import=&Importer...
+IUDetailsLabelProvider_ComputingSize=Calcul de la taille
+RemedyCategoryNotAdded=Ne sera pas install�
+RepositoryManipulationPage_DefaultFilterString=entrer le texte du filtre
+RevertIUCommandLabel=&Revenir
+RemedyCategoryRemoved=Sera desinstall�
+AvailableIUsPage_AllSites=--Sites de mise � jour--
+UpdateManagerCompatibility_ExportSitesTitle=Exporter les sites
+UpdateSingleIUPage_SingleUpdateDescription=Une mise � jour a �t� trouv�e pour {0}.
+IUGeneralInfoPropertyPage_VersionLabel=Version \:
+UpdateActionRemediationJobTask=La mise � jour n''a pas pu �tre compl�t�e. Recherche de solution alternative...
+UserValidationDialog_SavePasswordButton=Sauve&garder le mot de passe
+QueriedElementWrapper_NoCategorizedItemsExplanation=Il n''y a pas d''item cat�goris�.
+LoadMetadataRepositoryJob_ContactSitesProgress=Contact du site de mise � jour...
+AvailableIUWrapper_AllAreInstalled=tous les items sont install�s.
+UserValidationDialog_UsernameLabel=&Username\:
+PreselectedIUInstallWizard_Title=Installer
+UninstallWizardPage_Title=D�tails de d�sinstallation
+UpdateManagerCompatibility_ImportSitesTitle=Importer des sites
+AcceptLicensesWizardPage_ReviewLicensesDescription=Les licences doivent �tre accept�es avant que l''installation puisse commencer.
+OptionalPlatformRestartMessage=Vous aurez besoin de red�marrer {0} pour que les effets de la mise � jour prennent effet.
+RefreshAction_Label=&Actualiser
+PlatformRestartMessage=Vous aurez besoin de red�marrer {0} pour que les effets de la mise � jour prennent effet. Voulez-vous red�marrer maintenant ?
+AvailableIUGroup_NoSitesConfiguredExplanation=Il n''y a pas de site de mise � jour disponible
+QueryableProfileRegistry_QueryProfileProgress=R�cup�ration des profils
+ColocatedRepositoryTracker_SiteNotFoundTitle=Erreur lors du contact du site de mise � jour
+RevertProfilePage_ConfirmDeleteSingleConfig=Deleting the configuration from the installation history will free up the disk space used to store it.  However, you will no longer be able to revert your installation to this configuration.  Are you sure you want to delete it?
+ResolutionWizardPage_WarningInfoStatus=Your original request has been modified. See the details.
+PreselectedIUInstallWizard_Description=S�lectionner les items � installer.
+RevertProfilePage_NoProfile=This installation has not been configured properly for accessing the installation history.  See the error log for details.
+RemediationPage_InstalledSection_AllowInstalledUpdate=Update items already installed
+RepositorySelectionGroup_PrefPageLink=Trouvez plus de logiciels en modifiant les pr�f�rences de <a>"{0}"</a>.
+RemediationPage_BestSolutionBeingInstalledRelaxed=Keep my installation the same and modify the items being installed to be compatible
+ProvDropAdapter_UnsupportedDropOperation=Op�ration de d�pose non support�e
+RemediationPage_InstalledSection=How do you want to alter the current installation?
+IUCopyrightPropertyPage_ViewLinkLabel=Voir les mentions compl�tes de droit d''auteur�\:
+IUViewQueryContext_NoCategorizedItemsDescription=You can uncheck the ''Group items by category'' check box to see items without categories.
+ProvUI_NameColumnTitle=Nom
+UpdateIUCommandLabel=&Mise � jour
+RemediationPage_InstalledSection_AllowInstalledRemoval=Remove items already installed
+RepositoryTracker_DuplicateLocation=Emplacement en double
+UpdateManagerCompatibility_UnableToOpenManageConfiguration=Unable to open the Classic Update Manager ''Manage Configuration'' dialog.
+ProvElementContentProvider_FetchJobTitle=R�cup�ration des �l�ments
+ProvUI_ErrorDuringApplyConfig=Error while attempting to apply changes.  You must restart the application for changes to take effect.
+Policy_RequiresUpdateManagerTitle=Installation non support�e
+AcceptLicensesWizardPage_ItemsLabel=&Licences\:
+AvailableIUsPage_ResolveAllCheckbox=&Contact all update sites during install to find required software
+RepositoryManipulationPage_DisableButton=&D�sactiver
+RepositoryGroup_URLRequired=Vous devez indiquer un emplacement
+IUDetailsLabelProvider_Bytes={0} octets
+QueriedElementWrapper_SiteNotFound=N''a pas pu trouver {0}
+UpdateManagerCompatibility_UnableToOpenFindAndInstall=Unable to open the Classic Update Manager ''Find and Install'' wizard.
+RepositoryManipulationPage_EnabledColumnTitle=Activ�
+RemedyElementBeingInstalledVersion=Version en cours d''installation \: 
+RepositoryManipulationPage_Title=Sites de logiciels disponibles
+ApplyProfileChangesDialog_ApplyChanges=&Appliquer les changements tout de suite
+ResolutionWizardPage_NoSelections=There were no installable units selected when the plan was computed.
+IUCopyrightPropertyPage_NoCopyright=Aucune information de droits d''auteur n''a �t� fournie.
+ProvUI_InformationTitle=Information
+Policy_RequiresUpdateManagerMessage=A feature that you have selected uses install procedures that are not compatible with the current installation support.  This feature can only be installed by the older Update Manager.  Do you want to launch the older Update Manager?
+AvailableIUsPage_FilterOnEnvCheckBox=Show only software applicable to target environment
+ServiceUI_unsigned_message=Avertissement \: Vous installez un logiciel qui contient du contenu non sign�. L''authenticit� ou la validit� de ce logiciel ne peut �tre �tablie. Voulez-vous continuer l''installation ?
+InstallIUOperationTask=Installation de logiciel en cours
+ProvisioningOperationWizard_Remediation_Operation=Compute remediation operation
+UpdateActionRemediationJobName=Recherche de solution alternatives...
+AcceptLicensesWizardPage_RejectSingle=J&e n''accepte pas les termes du contrat de licence
+IUDetailsLabelProvider_KB={0} Ko
+ProfileSnapshots_Label=Historique d''installation
+ProvUI_ProviderColumnTitle=Fournisseur
+RevertDialog_RevertOperationLabel=Revenir � une configuration ant�rieure
+UninstallDialog_UninstallMessage=V�rifiez les �l�ments que vous souhaitez d�sinstaller.
+RevertProfilePage_ConfirmDeleteMultipleConfigs=Deleting the selected configurations from the installation history will free up the disk space used to store the configurations.  However, you will no longer be able to revert your installation to these configurations.  Are you sure you want to delete the configurations?
+ProvUI_InstallDialogError=Erreur lors de l''ouverture des informations d''installation.
+ServiceUI_warning_title=Avertissement de s�curit�
+RevertDialog_ConfirmRestartMessage=Cette op�ration requiert la relance du programme. Voulez-vous continuer ?
+AcceptLicensesWizardPage_SingleLicenseTextLabel=&Texte de la licence (pour {0})\:
+AcceptLicensesWizardPage_Title=Valider les licenses
+RevertProfilePage_CompareLabel=Co&mparer
+RemediationPage_BeingInstalledSection=How do you want to change the software being installed?
+InstallWizardPage_Title=D�tails de l''installation
+IULicensePropertyPage_ViewLicenseLabel=Voir la licence compl�te�\:
+RepositoryManipulationPage_TestConnectionSuccess=Information for "{0}" has been reloaded from the server.
+RemedyElementNotHighestVersion=This is not the highest version
+AvailableIUsPage_GotoInstallInfo=Voir ce qui est <a>d�j� install�</a>?
+AvailableIUsPage_Title=Mise � jour disponible
+ProvisioningOperationWizard_UnexpectedFailureToResolve=Erreur inattendue
+IUGeneralInfoPropertyPage_DocumentationLink=La documentation est disponible \:
+RepositoryManipulationPage_RemoveConfirmTitle=Supprimer les sites
+ProfileModificationAction_InvalidSelections=Problem determining user request.  Profile id\: {0}, Selection count\: {1}
+AvailableIUsPage_NoSites=Entrer un site ou s�lectioner un site
+UpdateOrInstallWizardPage_Size=Taille \: {0}
+UpdateWizardPage_Title=D�tails des mises � jour
+AvailableIUsPage_HideInstalledItems=Cac&her les items d�j� install�s
+RepositoryManipulationPage_RemoveConfirmMessage=Voulez-vous vraiment supprimer les �l�ments s�lectionn�s�?
+ProvDropAdapter_InvalidDropTarget=Cible de d�pose invalide
+AvailableIUsPage_AddButton=&Ajouter...
+UninstallWizardPage_Description=Passez en revue et confirmez les �l�ments � d�sinstaller.
+AvailableIUsPage_GroupByCategory=Re&grouper les items par categorie
+LoadMetadataRepositoryJob_SitesMissingError=Some sites could not be found.  See the error log for more detail.
+IUGeneralInfoPropertyPage_NameLabel=Nom \:
+AvailableIUsPage_NameWithLocation={0}{1}{2}
+SelectableIUsPage_Select_All=S�&lectionner tout
+AvailableIUsPage_RepoFilterLabel=&Travailler avec \:
+RevertDialog_Title=Retour � une configuration ant�rieure
+RepositoryDetailsLabelProvider_Enabled=Activ�
+ProvDropAdapter_NoIUsToDrop=Aucun �l�ment n''est disponible pour �tre d�pos�
+InstalledSoftwarePage_NoProfile=Cette installation n''a pas �t� configur�e pour montrer les logiciels install�s. Voir le journal des erreurs pour plus de d�tails.
+UserValidationDialog_PasswordLabel=Mot de p&asse \:
+UninstallIUOperationTask=D�sinstallation en cours
+UninstallIUCommandTooltip=D�sinstaller les �l�ments s�lectionn�s
+ApplicationInRestartDialog=L''application
+RepositoryManipulationPage_RemoveConfirmSingleMessage=�tes-vous s�r de vouloir supprimer {0} ?
+UpdateAction_UpdatesAvailableTitle=Mises � jour disponibles
+ProfileModificationWizardPage_DetailsLabel=D�tails
+UpdateAction_UpdatesAvailableMessage=S�lectionner les mises � jour � installer.
+AvailableIUsPage_Description=S�lectionner les items � installer.
+AvailableIUGroup_NoSitesExplanation=Pas de site s�lectionn�
+AcceptLicensesWizardPage_ReviewExtraLicensesDescription=Les licences doivent �tre v�rifi�es avant de continuer l''installation. Cela inclu les licences des d�pendances qui doivent �tre install�es.
+AcceptLicensesWizardPage_RejectMultiple=Je n''accepte pas les c&onditions des licences
+SizeComputingWizardPage_SizeJobTitle=Calcul de la taille
+IUDetailsLabelProvider_Unknown=Inconnu
+RepositoryGroup_LocalRepoBrowseButton=L&ocal
+UpdateRemediationPage_Title=Page de rem�diation de mise � jour
+UninstallIUProgress=D�sinstallation
+UpdateManagerCompatibility_ItemRequiresUpdateManager=The items selected for install include software ({0}) that requires install procedures from the older Eclipse Update Manager.  The installation cannot continue.
+AvailableIUGroup_NoSitesConfiguredDescription=This product was not configured with any software sites.  Contact your systems administrator.
+ProvUI_VersionColumnTitle=Version
+InstallRemediationPage_Title=Page de rem�diation d''installation
+AddRepositoryDialog_InvalidURL=L''emplacement n''est pas valide
+ProvUI_WarningTitle=Attention
+RemediationPage_BestSolutionBuilt=Show original error and build my own solution\:
+RemediationPage_BeingInstalledSection_AllowPartialInstall=Install less item than originally requested
+LaunchUpdateManagerButton=Lancement...
+AcceptLicensesWizardPage_AcceptSingle=J''&accepte les termes du contrat de licence
+InstallWizardPage_NoCheckboxDescription=V�rifier les items � installer.
+PlatformUpdateTitle=Mises � jour logicielles
+RepositoryManipulationPage_ContactingSiteMessage=Prise de contact avec {0}
+RemediationPage_BeingInstalledSection_AllowDifferentVersion=Install different version than originally requested
+AvailableIUsPage_MultipleSelectionCount={0} items s�lectionn�s
+ColocatedRepositoryManipulator_NoContentExplanation=You may select a site in the combo box at the top.  You may also type or paste a site name into the combo box and press Enter.  You may also drag a site URL into the combo box or software list.
+RevertProfilePage_DeleteSingleConfigurationTitle=Delete Configuration
+TrustCertificateDialog_Details=D�tails
+IUGeneralInfoPropertyPage_ContactLabel=Contact \:
+RefreshAction_Tooltip=R�g�n�rer
+RepositoryManipulationPage_TestConnectionTitle=Recharger
+RepositoryGroup_RepositoryFile=Archive de r�f�rentiel
+RollbackProfileElement_CurrentInstallation=Installation actuelle
+RemedyCategoryAdded=Sera install�
+RevertProfilePage_Delete=Supprimer
+ServiceUI_LoginRequired=Vous devez �tre connect�
+InstallRemediationPage_Description=L''installation n''a pas pu �tre compl�t�e.
+RevertDialog_ConfigContentsLabel=Contenu de ma con&figuration \:
+RemoveColocatedRepositoryAction_Tooltip=Retirer les sites s�lectionn�s de la liste des logiciels disponibles
+RemediationPage_BestSolutionInstallationRelaxed=Update my installation to be compatible with the items being installed
+RevertProfilePage_RevertTooltip=Revenir � l''�tat du logiciel de la configuration s�lectionn�e.
+AvailableIUsPage_ShowLatestVersions=Afficher uniquement la &derni�re version des logiciels disponibles
+AcceptLicensesWizardPage_NoLicensesDescription=Pas de licence � accepter.
+ColocatedRepositoryManipulator_AddSiteOperationLabel=Ajouter le site
+SelectableIUsPage_Deselect_All=&D�selectionner tout
+RepositoryElement_NotFound=Le site est indisponible.
+IUViewQueryContext_AllAreInstalledDescription=You can uncheck the ''Hide items that are already installed'' check box to see all items.
+RepositoryManipulationPage_EnableButton=Ac&tiver
+IUPropertyPage_NoIUSelected=Il n''y a rien de s�lectionn� � afficher dans les propri�t�s.
+RepositoryManipulatorDropTarget_DragSourceNotValid={0} n''a pas �t� accept� comme un emplacement de site logiciel valide. V�rifiez les d�tails.
+InstallIUCommandTooltip=Installer les �l�ments s�lectionn�s
+ResolutionStatusPage_ErrorIULocked=Vos droits utilisateur sont insuffisant pour appliquer cette mise � jour.\n\n{0}
+ServiceUI_LoginDetails=Veuillez fournir les d�tails de connexion pour {0}
+RepositoryManipulationPage_Remove=&Supprimer
+RevertProfilePage_DeleteTooltip=Supprimer la configuration s�lectionn�e.
+Updates_Label=Mises � jour disponibles

Property changes on: TXM/trunk/bundles/org.txm.rcp.p2.ui/src/org/eclipse/equinox/internal/p2/ui/messages_fr.properties
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.rcp.p2.ui/build.properties
===================================================================
--- TXM/trunk/bundles/org.txm.rcp.p2.ui/build.properties	(revision 0)
+++ TXM/trunk/bundles/org.txm.rcp.p2.ui/build.properties	(revision 3659)
@@ -0,0 +1,5 @@
+bin.includes = META-INF/,\
+               library.jar,\
+               OSGI-INF/
+source.library.jar = src/
+jars.compile.order = library.jar

Property changes on: TXM/trunk/bundles/org.txm.rcp.p2.ui/build.properties
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.rcp.p2.ui/OSGI-INF/l10n/bundle.properties
===================================================================
--- TXM/trunk/bundles/org.txm.rcp.p2.ui/OSGI-INF/l10n/bundle.properties	(revision 0)
+++ TXM/trunk/bundles/org.txm.rcp.p2.ui/OSGI-INF/l10n/bundle.properties	(revision 3659)
@@ -0,0 +1,2 @@
+#Properties file for org.txm.rcp.p2.ui
+Bundle-Name = Ui
\ No newline at end of file

Property changes on: TXM/trunk/bundles/org.txm.rcp.p2.ui/OSGI-INF/l10n/bundle.properties
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.rcp.p2.ui/.settings/org.eclipse.core.resources.prefs
===================================================================
--- TXM/trunk/bundles/org.txm.rcp.p2.ui/.settings/org.eclipse.core.resources.prefs	(revision 0)
+++ TXM/trunk/bundles/org.txm.rcp.p2.ui/.settings/org.eclipse.core.resources.prefs	(revision 3659)
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+encoding//src/org/eclipse/equinox/internal/p2/ui/messages_fr.properties=ISO-8859-1

Property changes on: TXM/trunk/bundles/org.txm.rcp.p2.ui/.settings/org.eclipse.core.resources.prefs
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.rcp.p2.ui/.classpath
===================================================================
--- TXM/trunk/bundles/org.txm.rcp.p2.ui/.classpath	(revision 0)
+++ TXM/trunk/bundles/org.txm.rcp.p2.ui/.classpath	(revision 3659)
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="con"
+		path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6" />
+	<classpathentry kind="con"
+		path="org.eclipse.pde.core.requiredPlugins" />
+	<classpathentry kind="src" path="src" />
+	<classpathentry kind="output" path="bin" />
+</classpath>

Property changes on: TXM/trunk/bundles/org.txm.rcp.p2.ui/.classpath
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.rcp.p2.ui/META-INF/MANIFEST.MF
===================================================================
--- TXM/trunk/bundles/org.txm.rcp.p2.ui/META-INF/MANIFEST.MF	(revision 0)
+++ TXM/trunk/bundles/org.txm.rcp.p2.ui/META-INF/MANIFEST.MF	(revision 3659)
@@ -0,0 +1,14 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Ui
+Bundle-SymbolicName: org.txm.rcp.p2.ui
+Bundle-Version: 1.0.0.qualifier
+Fragment-Host: org.eclipse.equinox.p2.ui;bundle-version="2.3.0"
+Bundle-RequiredExecutionEnvironment: JavaSE-1.8
+Eclipse-PatchFragment: true
+Bundle-ClassPath: library.jar,
+ .
+Export-Package: org.eclipse.equinox.internal.p2.ui,
+ org.eclipse.equinox.internal.p2.ui.dialogs
+Bundle-Vendor: Textometrie.org
+Automatic-Module-Name: org.txm.rcp.p2.ui

Property changes on: TXM/trunk/bundles/org.txm.rcp.p2.ui/META-INF/MANIFEST.MF
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.rcp.p2.ui/tmp/UpdateWizardPage.java
===================================================================
--- TXM/trunk/bundles/org.txm.rcp.p2.ui/tmp/UpdateWizardPage.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.rcp.p2.ui/tmp/UpdateWizardPage.java	(revision 3659)
@@ -0,0 +1,95 @@
+/*******************************************************************************
+ *  Copyright (c) 2007, 2010 IBM Corporation and others.
+ *  All rights reserved. This program and the accompanying materials
+ *  are made available under the terms of the Eclipse Public License v1.0
+ *  which accompanies this distribution, and is available at
+ *  http://www.eclipse.org/legal/epl-v10.html
+ * 
+ *  Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.internal.p2.ui.dialogs;
+
+import org.eclipse.equinox.internal.p2.ui.ProvUIMessages;
+import org.eclipse.equinox.internal.p2.ui.model.IUElementListRoot;
+import org.eclipse.equinox.p2.metadata.IInstallableUnit;
+import org.eclipse.equinox.p2.metadata.IUpdateDescriptor;
+import org.eclipse.equinox.p2.operations.UpdateOperation;
+import org.eclipse.equinox.p2.ui.ProvisioningUI;
+import org.eclipse.jface.viewers.IContentProvider;
+import org.eclipse.swt.widgets.TreeItem;
+
+public class UpdateWizardPage extends SizeComputingWizardPage {
+
+	public UpdateWizardPage(ProvisioningUI ui, ProvisioningOperationWizard wizard, IUElementListRoot root, UpdateOperation operation) {
+		super(ui, wizard, root, operation);
+		//System.out.println("Init, root="+Arrays.asList(root));
+		setTitle(ProvUIMessages.UpdateWizardPage_Title);
+		setDescription(ProvUIMessages.UpdateWizardPage_Description);
+	}
+
+	/**
+	 * Specialized version for TXM that shows the feature description instead of the product description
+	 */
+	protected String getIUDescription(IInstallableUnit iu) {
+
+		if (iu != null) {
+			//System.out.println("IInstallableUnit.getId() " +iu.getId());
+			if (iu.getId().equals("org.txm.rcp.product")) { // TXM product is selected
+				//System.out.println("TXM product is selected");
+				TreeItem[] treeitems = treeViewer.getTree().getSelection();
+				for (TreeItem item : treeitems) { // find it in the Tree selection
+					Object data = item.getData();
+					//System.out.println("TreeElem: "+data+" class="+data.getClass());
+					if (data instanceof org.eclipse.equinox.internal.p2.ui.model.AvailableUpdateElement) {
+						org.eclipse.equinox.internal.p2.ui.model.AvailableUpdateElement iunit = (org.eclipse.equinox.internal.p2.ui.model.AvailableUpdateElement) data;
+						//System.out.println(" iunit found "+iunit);
+						if (iunit.getIU().getId().equals(iu.getId())) { // this is the TXM product
+							//System.out.println(" TXM product found in Tree "+iunit);
+							//System.out.println("Input: "+treeViewer.getInput());
+							IContentProvider cp = treeViewer.getContentProvider();
+							//System.out.println("content provider: "+treeViewer.getContentProvider());
+							org.eclipse.equinox.internal.p2.ui.viewers.ProvElementContentProvider pecp = (org.eclipse.equinox.internal.p2.ui.viewers.ProvElementContentProvider)cp;
+							Object[] children = pecp.getChildren(data);
+							//System.out.println("Children: "+Arrays.asList(children));
+							for (Object child : children) {
+								//System.out.println("Child: "+child);
+								//if (child != null) System.out.println("Child class: "+child.getClass());
+								if (child instanceof org.eclipse.equinox.internal.p2.ui.model.AvailableIUElement) {
+									org.eclipse.equinox.internal.p2.ui.model.AvailableIUElement riu = (org.eclipse.equinox.internal.p2.ui.model.AvailableIUElement) child;
+									//System.out.println("riu found "+riu);
+									if (riu.getIU().getId().equals("org.txm.rcp.feature.feature.group")) {
+										//System.out.println("org.txm.rcp.feature.feature.group description found "+riu.getIU().getUpdateDescriptor().getDescription());
+										String desc = riu.getIU().getUpdateDescriptor().getDescription();
+										if (desc != null) {
+											return desc;
+										} else {
+											return super.getIUDescription(riu.getIU());
+										}
+									}
+								}
+							}
+
+
+						}
+					}
+				}
+			} else {
+				IUpdateDescriptor updateDescriptor = iu.getUpdateDescriptor();
+				if (updateDescriptor != null && updateDescriptor.getDescription() != null && updateDescriptor.getDescription().length() > 0) {
+					return updateDescriptor.getDescription();
+				}
+			}
+		}
+		//String defaultDesc = super.getIUDescription(iu);
+		return super.getIUDescription(iu);
+	}
+
+	protected String getOperationLabel() {
+		return ProvUIMessages.UpdateIUOperationLabel;
+	}
+
+	protected String getOperationTaskName() {
+		return ProvUIMessages.UpdateIUOperationTask;
+	}
+}

Property changes on: TXM/trunk/bundles/org.txm.rcp.p2.ui/tmp/UpdateWizardPage.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.rcp.p2.ui/tmp/ResolutionResultsWizardPage.java
===================================================================
--- TXM/trunk/bundles/org.txm.rcp.p2.ui/tmp/ResolutionResultsWizardPage.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.rcp.p2.ui/tmp/ResolutionResultsWizardPage.java	(revision 3659)
@@ -0,0 +1,332 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2013 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     EclipseSource - ongoing development
+ *     Sonatype, Inc. - ongoing development
+ *     Red Hat, Inc. - support for remediation page
+ *******************************************************************************/
+package org.eclipse.equinox.internal.p2.ui.dialogs;
+
+import java.util.Collection;
+import org.eclipse.core.runtime.*;
+import org.eclipse.equinox.internal.p2.ui.*;
+import org.eclipse.equinox.internal.p2.ui.model.*;
+import org.eclipse.equinox.internal.p2.ui.viewers.*;
+import org.eclipse.equinox.p2.engine.IProvisioningPlan;
+import org.eclipse.equinox.p2.metadata.IInstallableUnit;
+import org.eclipse.equinox.p2.operations.ProfileChangeOperation;
+import org.eclipse.equinox.p2.operations.ProvisioningJob;
+import org.eclipse.equinox.p2.query.IQueryable;
+import org.eclipse.equinox.p2.ui.ProvisioningUI;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.jface.viewers.*;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.SashForm;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.*;
+import org.eclipse.swt.widgets.*;
+import org.eclipse.ui.statushandlers.StatusManager;
+
+/**
+ * A wizard page that shows detailed information about a resolved install
+ * operation.  It allows drill down into the elements that will be installed.
+ * 
+ * @since 3.4
+ *
+ */
+public abstract class ResolutionResultsWizardPage extends ResolutionStatusPage {
+
+	private static final String DIALOG_SETTINGS_SECTION = "ResolutionResultsPage"; //$NON-NLS-1$
+
+	protected IUElementListRoot input;
+	ProfileChangeOperation resolvedOperation;
+	TreeViewer treeViewer;
+	ProvElementContentProvider contentProvider;
+	IUDetailsLabelProvider labelProvider;
+	protected Display display;
+	private IUDetailsGroup iuDetailsGroup;
+	SashForm sashForm;
+
+	protected ResolutionResultsWizardPage(ProvisioningUI ui, ProvisioningOperationWizard wizard, IUElementListRoot input, ProfileChangeOperation operation) {
+		super("ResolutionPage", ui, wizard); //$NON-NLS-1$
+		this.resolvedOperation = operation;
+		if (input == null)
+			this.input = new IUElementListRoot();
+		else
+			this.input = input;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
+	 */
+	public void createControl(Composite parent) {
+		display = parent.getDisplay();
+		sashForm = new SashForm(parent, SWT.VERTICAL);
+		FillLayout layout = new FillLayout();
+		sashForm.setLayout(layout);
+		GridData data = new GridData(GridData.FILL_BOTH);
+		sashForm.setLayoutData(data);
+		initializeDialogUnits(sashForm);
+
+		Composite composite = new Composite(sashForm, SWT.NONE);
+		GridLayout gridLayout = new GridLayout();
+		gridLayout.marginWidth = 0;
+		gridLayout.marginHeight = 0;
+		composite.setLayout(gridLayout);
+
+		treeViewer = createTreeViewer(composite);
+		data = new GridData(GridData.FILL_BOTH);
+		data.heightHint = convertHeightInCharsToPixels(ILayoutConstants.DEFAULT_TABLE_HEIGHT);
+		data.widthHint = convertWidthInCharsToPixels(ILayoutConstants.DEFAULT_TABLE_WIDTH);
+		Tree tree = treeViewer.getTree();
+		tree.setLayoutData(data);
+		tree.setHeaderVisible(true);
+		activateCopy(tree);
+		TreeViewerColumn nameColumn = new TreeViewerColumn(treeViewer, SWT.LEFT);
+		nameColumn.getColumn().setText(ProvUIMessages.ProvUI_NameColumnTitle);
+		nameColumn.getColumn().setWidth(400);
+		nameColumn.getColumn().setMoveable(true);
+		nameColumn.setLabelProvider(new ColumnLabelProvider() {
+			public String getText(Object element) {
+				IInstallableUnit iu = ProvUI.getAdapter(element, IInstallableUnit.class);
+				String label = iu.getProperty(IInstallableUnit.PROP_NAME, null);
+				if (label == null)
+					label = iu.getId();
+				return label;
+			}
+
+			public Image getImage(Object element) {
+				if (element instanceof ProvElement)
+					return ((ProvElement) element).getImage(element);
+				if (ProvUI.getAdapter(element, IInstallableUnit.class) != null)
+					return ProvUIImages.getImage(ProvUIImages.IMG_IU);
+				return null;
+			}
+
+			public String getToolTipText(Object element) {
+				if (element instanceof AvailableIUElement && ((AvailableIUElement) element).getImageOverlayId(null) == ProvUIImages.IMG_INFO)
+					return ProvUIMessages.RemedyElementNotHighestVersion;
+				return super.getToolTipText(element);
+			}
+		});
+		TreeViewerColumn versionColumn = new TreeViewerColumn(treeViewer, SWT.LEFT);
+		versionColumn.getColumn().setText(ProvUIMessages.ProvUI_VersionColumnTitle);
+		versionColumn.getColumn().setWidth(200);
+		versionColumn.setLabelProvider(new ColumnLabelProvider() {
+			public String getText(Object element) {
+				IInstallableUnit iu = ProvUI.getAdapter(element, IInstallableUnit.class);
+				if (element instanceof IIUElement) {
+					if (((IIUElement) element).shouldShowVersion())
+						return iu.getVersion().toString();
+					return ""; //$NON-NLS-1$
+				}
+				return iu.getVersion().toString();
+			}
+		});
+		TreeViewerColumn idColumn = new TreeViewerColumn(treeViewer, SWT.LEFT);
+		idColumn.getColumn().setText(ProvUIMessages.ProvUI_IdColumnTitle);
+		idColumn.getColumn().setWidth(200);
+
+		idColumn.setLabelProvider(new ColumnLabelProvider() {
+			public String getText(Object element) {
+				IInstallableUnit iu = ProvUI.getAdapter(element, IInstallableUnit.class);
+				return iu.getId();
+			}
+		});
+
+		// Filters and sorters before establishing content, so we don't refresh unnecessarily.
+		IUComparator comparator = new IUComparator(IUComparator.IU_NAME);
+		comparator.useColumnConfig(getColumnConfig());
+		treeViewer.setComparator(comparator);
+		treeViewer.setComparer(new ProvElementComparer());
+		ColumnViewerToolTipSupport.enableFor(treeViewer);
+		contentProvider = new ProvElementContentProvider();
+		treeViewer.setContentProvider(contentProvider);
+		//		labelProvider = new IUDetailsLabelProvider(null, getColumnConfig(), getShell());
+		//		treeViewer.setLabelProvider(labelProvider);
+
+		// Optional area to show the size
+		createSizingInfo(composite);
+
+		// The text area shows a description of the selected IU, or error detail if applicable.
+		iuDetailsGroup = new IUDetailsGroup(sashForm, treeViewer, 2*convertWidthInCharsToPixels(ILayoutConstants.DEFAULT_TABLE_WIDTH), true);
+
+		setControl(sashForm);
+		sashForm.setWeights(getSashWeights());
+		Dialog.applyDialogFont(sashForm);
+
+		// Controls for filtering/presentation/site selection
+		Composite controlsComposite = new Composite(composite, SWT.NONE);
+		gridLayout = new GridLayout();
+		gridLayout.marginWidth = 0;
+		gridLayout.marginHeight = 0;
+		gridLayout.numColumns = 2;
+		gridLayout.makeColumnsEqualWidth = true;
+		gridLayout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
+		controlsComposite.setLayout(layout);
+		GridData gd = new GridData(SWT.FILL, SWT.FILL, true, false);
+		controlsComposite.setLayoutData(gd);
+
+		final Runnable runnable = new Runnable() {
+			public void run() {
+				treeViewer.addSelectionChangedListener(new ISelectionChangedListener() {
+					public void selectionChanged(SelectionChangedEvent event) {
+						setDetailText(resolvedOperation);
+					}
+				});
+				setDrilldownElements(input, resolvedOperation);
+				treeViewer.setInput(input);
+			}
+		};
+
+		if (resolvedOperation != null && !resolvedOperation.hasResolved()) {
+			try {
+				getContainer().run(true, false, new IRunnableWithProgress() {
+					public void run(IProgressMonitor monitor) {
+						resolvedOperation.resolveModal(monitor);
+						display.asyncExec(runnable);
+					}
+				});
+			} catch (Exception e) {
+				StatusManager.getManager().handle(new Status(IStatus.ERROR, ProvUIActivator.PLUGIN_ID, e.getMessage(), e));
+			}
+		} else {
+			runnable.run();
+		}
+	}
+
+	@Override
+	public void updateStatus(IUElementListRoot newRoot, ProfileChangeOperation op) {
+		super.updateStatus(newRoot, op);
+	}
+
+	protected void createSizingInfo(Composite parent) {
+		// Default is to do nothing
+	}
+
+	public boolean performFinish() {
+		if (resolvedOperation.getResolutionResult().getSeverity() != IStatus.ERROR) {
+			getProvisioningUI().schedule(resolvedOperation.getProvisioningJob(null), StatusManager.SHOW | StatusManager.LOG);
+			return true;
+		}
+		return false;
+	}
+
+	protected TreeViewer getTreeViewer() {
+		return treeViewer;
+	}
+
+	public IProvisioningPlan getCurrentPlan() {
+		if (resolvedOperation != null)
+			return resolvedOperation.getProvisioningPlan();
+		return null;
+	}
+
+	protected Object[] getSelectedElements() {
+		return ((IStructuredSelection) treeViewer.getSelection()).toArray();
+	}
+
+	protected IInstallableUnit getSelectedIU() {
+		java.util.List<IInstallableUnit> units = ElementUtils.elementsToIUs(getSelectedElements());
+		if (units.size() == 0)
+			return null;
+		return units.get(0);
+	}
+
+	protected boolean shouldCompleteOnCancel() {
+		return false;
+	}
+
+	protected Collection<IInstallableUnit> getIUs() {
+		return ElementUtils.elementsToIUs(input.getChildren(input));
+	}
+
+	void setDrilldownElements(IUElementListRoot root, ProfileChangeOperation operation) {
+		if (operation == null || operation.getProvisioningPlan() == null)
+			return;
+		Object[] elements = root.getChildren(root);
+		for (int i = 0; i < elements.length; i++) {
+			if (elements[i] instanceof QueriedElement) {
+				((QueriedElement) elements[i]).setQueryable(getQueryable(operation.getProvisioningPlan()));
+			}
+		}
+	}
+
+	protected abstract String getOperationLabel();
+
+	/**
+	 * Returns the restart policy for this operation.
+	 * 
+	 * @return an integer constant describing whether the running profile
+	 * needs to be restarted. 
+	 * 
+	 * @see ProvisioningJob#RESTART_NONE
+	 * @see ProvisioningJob#RESTART_ONLY
+	 * @see ProvisioningJob#RESTART_OR_APPLY
+	 *
+	 */
+	protected int getRestartPolicy() {
+		return ProvisioningJob.RESTART_OR_APPLY;
+	}
+
+	/**
+	 * Returns the task name for this operation, or <code>null</code> to display
+	 * a generic task name.
+	 */
+	protected String getOperationTaskName() {
+		return null;
+	}
+
+	protected TreeViewer createTreeViewer(Composite parent) {
+		return new TreeViewer(parent, SWT.BORDER | SWT.MULTI | SWT.FULL_SELECTION);
+	}
+
+	protected abstract IQueryable<IInstallableUnit> getQueryable(IProvisioningPlan plan);
+
+	protected String getClipboardText(Control control) {
+		return CopyUtils.getIndentedClipboardText(getSelectedElements(), labelProvider);
+	}
+
+	protected IUDetailsGroup getDetailsGroup() {
+		return iuDetailsGroup;
+	}
+
+	protected boolean isCreated() {
+		return treeViewer != null;
+	}
+
+	protected void updateCaches(IUElementListRoot newRoot, ProfileChangeOperation op) {
+		resolvedOperation = op;
+		if (newRoot != null) {
+			setDrilldownElements(newRoot, resolvedOperation);
+			if (treeViewer != null) {
+				if (input != newRoot)
+					treeViewer.setInput(newRoot);
+				else
+					treeViewer.refresh();
+			}
+			input = newRoot;
+		}
+	}
+
+	protected String getDialogSettingsName() {
+		return getWizard().getClass().getName() + "." + DIALOG_SETTINGS_SECTION; //$NON-NLS-1$
+	}
+
+	protected int getColumnWidth(int index) {
+		return treeViewer.getTree().getColumn(index).getWidth();
+	}
+
+	protected SashForm getSashForm() {
+		return sashForm;
+	}
+}
\ No newline at end of file

Property changes on: TXM/trunk/bundles/org.txm.rcp.p2.ui/tmp/ResolutionResultsWizardPage.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.rcp.p2.ui/tmp/UpdateWizard.java
===================================================================
--- TXM/trunk/bundles/org.txm.rcp.p2.ui/tmp/UpdateWizard.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.rcp.p2.ui/tmp/UpdateWizard.java	(revision 3659)
@@ -0,0 +1,206 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2013 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     Genuitec, LLC - added license support
+ *     Sonatype, Inc. - ongoing development
+ *     Red Hat, Inc. - support for remediation page
+ *******************************************************************************/
+package org.eclipse.equinox.internal.p2.ui.dialogs;
+
+import java.util.*;
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.equinox.internal.p2.ui.ProvUIImages;
+import org.eclipse.equinox.internal.p2.ui.ProvUIMessages;
+import org.eclipse.equinox.internal.p2.ui.model.*;
+import org.eclipse.equinox.p2.engine.IProfile;
+import org.eclipse.equinox.p2.engine.IProfileRegistry;
+import org.eclipse.equinox.p2.metadata.IInstallableUnit;
+import org.eclipse.equinox.p2.operations.*;
+import org.eclipse.equinox.p2.ui.LoadMetadataRepositoryJob;
+import org.eclipse.equinox.p2.ui.ProvisioningUI;
+import org.eclipse.jface.wizard.IWizardPage;
+
+/**
+ * @since 3.4
+ */
+public class UpdateWizard extends WizardWithLicenses {
+	IInstallableUnit[] iusToReplace;
+	boolean skipSelectionsPage = false;
+	IUElementListRoot firstPageRoot;
+	Update[] initialSelections;
+
+	public static Collection<IInstallableUnit> getIUsToReplace(Object[] elements) {
+		Set<IInstallableUnit> iusToReplace = new HashSet<IInstallableUnit>();
+		for (int i = 0; i < elements.length; i++) {
+			if (elements[i] instanceof AvailableUpdateElement) {
+				iusToReplace.add(((AvailableUpdateElement) elements[i]).getIUToBeUpdated());
+			}
+		}
+		return iusToReplace;
+	}
+
+	public static IInstallableUnit[] getReplacementIUs(Object[] elements) {
+		Set<IInstallableUnit> replacements = new HashSet<IInstallableUnit>();
+		for (int i = 0; i < elements.length; i++) {
+			if (elements[i] instanceof AvailableUpdateElement) {
+				replacements.add(((AvailableUpdateElement) elements[i]).getIU());
+			}
+		}
+		return replacements.toArray(new IInstallableUnit[replacements.size()]);
+	}
+
+	public static Update[] makeUpdatesFromElements(Object[] elements) {
+		Set<Update> updates = new HashSet<Update>();
+		for (int i = 0; i < elements.length; i++) {
+			if (elements[i] instanceof AvailableUpdateElement) {
+				updates.add(((AvailableUpdateElement) elements[i]).getUpdate());
+			}
+		}
+		return updates.toArray(new Update[updates.size()]);
+	}
+
+	/**
+	 * Open an update wizard.  For update wizards, the operation must have been resolved in advanced.
+	 * This prevents searching for updates in the UI thread.
+	 * 
+	 * @param ui the provisioning UI
+	 * @param operation the update operation.  Must already be resolved!
+	 * @param initialSelections initial selections for the wizard (can be null)
+	 * @param preloadJob a job that has been used to preload metadata repositories (can be null)
+	 */
+	public UpdateWizard(ProvisioningUI ui, UpdateOperation operation, Object[] initialSelections, LoadMetadataRepositoryJob preloadJob) {
+		super(ui, operation, initialSelections, preloadJob);
+		this.initialSelections = (Update[]) initialSelections;
+		Assert.isLegal(operation.hasResolved(), "Cannot create an update wizard on an unresolved operation"); //$NON-NLS-1$
+		setWindowTitle(ProvUIMessages.UpdateAction_UpdatesAvailableTitle);
+		setDefaultPageImageDescriptor(ProvUIImages.getImageDescriptor(ProvUIImages.WIZARD_BANNER_UPDATE));
+	}
+
+	private boolean isLocked(IProfile profile, IInstallableUnit iuToBeUpdated) {
+		return Boolean.valueOf(profile.getInstallableUnitProperty(iuToBeUpdated, IProfile.PROP_PROFILE_LOCKED_IU)).booleanValue();
+	}
+
+	public void deselectLockedIUs() {
+		IProfileRegistry profileRegistry = (IProfileRegistry) ui.getSession().getProvisioningAgent().getService(IProfileRegistry.SERVICE_NAME);
+		IProfile profile = profileRegistry.getProfile(ui.getProfileId());
+
+		ArrayList<Update> newSelection = new ArrayList<Update>(initialSelections.length);
+		for (int i = 0; i < initialSelections.length; i++) {
+			if (!isLocked(profile, initialSelections[i].toUpdate)) {
+				newSelection.add(initialSelections[i]);
+			}
+		}
+
+		((UpdateOperation) operation).setSelectedUpdates(newSelection.toArray(new Update[newSelection.size()]));
+		recomputePlan(getContainer());
+	}
+
+	protected ISelectableIUsPage createMainPage(IUElementListRoot input, Object[] selections) {
+		mainPage = new SelectableIUsPage(ui, this, getAllPossibleUpdatesRoot(), selections);
+		mainPage.setTitle(ProvUIMessages.UpdateAction_UpdatesAvailableTitle+" - TXM");
+		mainPage.setDescription(ProvUIMessages.UpdateAction_UpdatesAvailableMessage);
+		((SelectableIUsPage) mainPage).updateStatus(getAllPossibleUpdatesRoot(), operation);
+		return mainPage;
+	}
+
+	protected ResolutionResultsWizardPage createResolutionPage() {
+		return new UpdateWizardPage(ui, this, root, (UpdateOperation) operation);
+	}
+
+	protected void initializeResolutionModelElements(Object[] selectedElements) {
+		if (selectedElements == null)
+			return;
+		root = new IUElementListRoot();
+		if (operation instanceof RemediationOperation) {
+			AvailableIUElement[] elements = ElementUtils.requestToElement(((RemediationOperation) operation).getCurrentRemedy(), false);
+			root.setChildren(elements);
+			//planSelections = elements;
+		} else {
+			ArrayList<AvailableUpdateElement> list = new ArrayList<AvailableUpdateElement>(selectedElements.length);
+			ArrayList<AvailableUpdateElement> selected = new ArrayList<AvailableUpdateElement>(selectedElements.length);
+			for (int i = 0; i < selectedElements.length; i++) {
+				if (selectedElements[i] instanceof AvailableUpdateElement) {
+					AvailableUpdateElement element = (AvailableUpdateElement) selectedElements[i];
+					AvailableUpdateElement newElement = new AvailableUpdateElement(root, element.getIU(), element.getIUToBeUpdated(), getProfileId(), shouldShowProvisioningPlanChildren());
+					list.add(newElement);
+					selected.add(newElement);
+				} else if (selectedElements[i] instanceof Update) {
+					Update update = (Update) selectedElements[i];
+					AvailableUpdateElement newElement = new AvailableUpdateElement(root, update.replacement, update.toUpdate, getProfileId(), shouldShowProvisioningPlanChildren());
+					list.add(newElement);
+					selected.add(newElement);
+				}
+			}
+			root.setChildren(list.toArray());
+			planSelections = selected.toArray();
+		}
+	}
+
+	protected IResolutionErrorReportingPage createErrorReportingPage() {
+		return (SelectableIUsPage) mainPage;
+	}
+
+	public void setSkipSelectionsPage(boolean skipSelectionsPage) {
+		this.skipSelectionsPage = skipSelectionsPage;
+	}
+
+	public IWizardPage getStartingPage() {
+		//if (skipSelectionsPage) {
+			// TODO see https://bugs.eclipse.org/bugs/show_bug.cgi?id=276963
+			IWizardPage page = getNextPage(mainPage);
+			if (page != null)
+				return page;
+			else 
+				return mainPage;
+//		}
+//		return mainPage;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.equinox.internal.p2.ui.dialogs.ProvisioningOperationWizard#getProfileChangeOperation(java.lang.Object[])
+	 */
+	protected ProfileChangeOperation getProfileChangeOperation(Object[] elements) {
+		if (operation == null) {
+			operation = new UpdateOperation(ui.getSession(), getIUsToReplace(elements));
+			operation.setProfileId(getProfileId());
+			//			operation.setRootMarkerKey(getRootMarkerKey());
+		} else {
+			((UpdateOperation) operation).setSelectedUpdates(makeUpdatesFromElements(elements));
+		}
+		return operation;
+	}
+
+	private IUElementListRoot getAllPossibleUpdatesRoot() {
+		if (firstPageRoot == null) {
+			firstPageRoot = new IUElementListRoot();
+			if (operation != null && operation instanceof UpdateOperation) {
+				Update[] updates;
+				if (getPolicy().getShowLatestVersionsOnly()) {
+					updates = ((UpdateOperation) operation).getSelectedUpdates();
+				} else {
+					updates = ((UpdateOperation) operation).getPossibleUpdates();
+				}
+				ArrayList<AvailableUpdateElement> allPossible = new ArrayList<AvailableUpdateElement>(updates.length);
+				for (int i = 0; i < updates.length; i++) {
+					AvailableUpdateElement newElement = new AvailableUpdateElement(firstPageRoot, updates[i].replacement, updates[i].toUpdate, getProfileId(), shouldShowProvisioningPlanChildren());
+					allPossible.add(newElement);
+				}
+				firstPageRoot.setChildren(allPossible.toArray());
+			}
+		}
+		return firstPageRoot;
+	}
+
+	@Override
+	protected RemediationPage createRemediationPage() {
+		remediationPage = new RemediationPage(ui, this, root, operation);
+		return remediationPage;
+	}
+
+}

Property changes on: TXM/trunk/bundles/org.txm.rcp.p2.ui/tmp/UpdateWizard.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.rcp.p2.ui/.project
===================================================================
--- TXM/trunk/bundles/org.txm.rcp.p2.ui/.project	(revision 0)
+++ TXM/trunk/bundles/org.txm.rcp.p2.ui/.project	(revision 3659)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>org.txm.rcp.p2.ui</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.pde.ManifestBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.pde.SchemaBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.pde.PluginNature</nature>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+	</natures>
+</projectDescription>

Property changes on: TXM/trunk/bundles/org.txm.rcp.p2.ui/.project
___________________________________________________________________
Added: svn:mime-type
   + text/plain


Property changes on: TXM/trunk/bundles/org.txm.rcp.p2.ui
___________________________________________________________________
Added: svn:ignore
   + bin


Index: TXM/trunk/bundles/org.txm.referencer.rcp/OSGI-INF/l10n/bundle_ru.properties
===================================================================
--- TXM/trunk/bundles/org.txm.referencer.rcp/OSGI-INF/l10n/bundle_ru.properties	(revision 0)
+++ TXM/trunk/bundles/org.txm.referencer.rcp/OSGI-INF/l10n/bundle_ru.properties	(revision 3659)
@@ -0,0 +1,5 @@
+#TXM OSGI messages generated by the PluginMessagesManager class
+#Fri Jun 10 16:36:03 CEST 2022
+command.name.44=ÐÐ´ÑÐµÑÐ° Ð²ÑÐ¾Ð¶Ð´ÐµÐ½Ð¸Ð¹
+editor.name.14=ÐÐ°ÑÑÐµÑ Ð°Ð´ÑÐµÑÐ¾Ð² Ð²ÑÐ¾Ð¶Ð´ÐµÐ½Ð¸Ð¹
+page.name=ÐÐ°ÑÑÐµÑ Ð°Ð´ÑÐµÑÐ¾Ð² Ð²ÑÐ¾Ð¶Ð´ÐµÐ½Ð¸Ð¹

Property changes on: TXM/trunk/bundles/org.txm.referencer.rcp/OSGI-INF/l10n/bundle_ru.properties
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.referencer.rcp/OSGI-INF/l10n/bundle_fr.properties
===================================================================
--- TXM/trunk/bundles/org.txm.referencer.rcp/OSGI-INF/l10n/bundle_fr.properties	(revision 0)
+++ TXM/trunk/bundles/org.txm.referencer.rcp/OSGI-INF/l10n/bundle_fr.properties	(revision 3659)
@@ -0,0 +1,8 @@
+#TXM OSGI messages generated by the PluginMessagesManager class
+#Fri Jun 10 16:36:03 CEST 2022
+command.label=Copier
+command.name=Copier
+command.name.44=R�f�rences
+command.name.57=Vers les concordances
+editor.name.14=R�f�rences
+page.name=R�f�rences

Property changes on: TXM/trunk/bundles/org.txm.referencer.rcp/OSGI-INF/l10n/bundle_fr.properties
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.referencer.rcp/OSGI-INF/l10n/bundle.properties
===================================================================
--- TXM/trunk/bundles/org.txm.referencer.rcp/OSGI-INF/l10n/bundle.properties	(revision 0)
+++ TXM/trunk/bundles/org.txm.referencer.rcp/OSGI-INF/l10n/bundle.properties	(revision 3659)
@@ -0,0 +1,9 @@
+#TXM OSGI messages generated by the PluginMessagesManager class
+#Fri Jun 10 16:36:03 CEST 2022
+Bundle-Name=Referencer RCP
+command.label=Copy
+command.name=Copy
+command.name.44=References
+command.name.57=To concordances
+editor.name.14=References
+page.name=References

Property changes on: TXM/trunk/bundles/org.txm.referencer.rcp/OSGI-INF/l10n/bundle.properties
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.referencer.rcp/icons/functions/referencer.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: TXM/trunk/bundles/org.txm.referencer.rcp/icons/functions/referencer.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: TXM/trunk/bundles/org.txm.referencer.rcp/plugin.xml
===================================================================
--- TXM/trunk/bundles/org.txm.referencer.rcp/plugin.xml	(revision 0)
+++ TXM/trunk/bundles/org.txm.referencer.rcp/plugin.xml	(revision 3659)
@@ -0,0 +1,154 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>  
+   <extension
+         point="org.eclipse.ui.editors">
+               <editor
+            class="org.txm.referencer.rcp.editors.ReferencerEditor"
+            default="false"
+            icon="icons/functions/referencer.png"
+            id="org.txm.referencer.rcp.editors.ReferencerEditor"
+            name="%editor.name.14">
+      </editor>
+   </extension>
+   <extension
+         point="org.eclipse.ui.menus">
+               <menuContribution
+                     locationURI="menu:menu.tools?after=menu.tools.separator.misc">
+                     <command
+                  commandId="org.txm.referencer.rcp.handlers.ComputeReferencer"
+                  icon="icons/functions/referencer.png"
+                  style="push">
+               <visibleWhen
+                     checkEnabled="false">
+                  <reference
+                        definitionId="OneCorpusSelected">
+                  </reference>
+               </visibleWhen>
+            </command>
+               </menuContribution>
+               <menuContribution
+                     allPopups="false"
+                     locationURI="toolbar:org.txm.rcp.toolbartools?after=org.txm.progression.rcp.handlers.ComputeProgression">
+                  <command
+                        commandId="org.txm.referencer.rcp.handlers.ComputeReferencer"
+                        icon="icons/functions/referencer.png"
+                        style="push">
+                     <visibleWhen
+                           checkEnabled="false">
+                        <reference
+                              definitionId="OneCorpusSelected">
+                        </reference>
+                     </visibleWhen>
+                  </command>
+               </menuContribution>
+               <menuContribution
+                     allPopups="false"
+                     locationURI="popup:org.txm.rcp.views.corpora.CorporaView?after=org.txm.progression.rcp.handlers.ComputeProgression">
+                  <command
+                        commandId="org.txm.referencer.rcp.handlers.ComputeReferencer"
+                        icon="icons/functions/referencer.png"
+                        style="push">
+                     <visibleWhen
+                           checkEnabled="false">
+                        <reference
+                              definitionId="OneCorpusSelected">
+                        </reference>
+                     </visibleWhen>
+                  </command>
+               </menuContribution>
+               <menuContribution
+                     locationURI="popup:org.txm.referencer.rcp.editors.ReferencerEditor">
+                  <command
+                        commandId="org.txm.referencer.rcp.handlers.CopyLines"
+                        icon="platform:/plugin/org.eclipse.ui/icons/full/etool16/copy_edit.png"
+                        label="%command.label"
+                        style="push">
+                  </command>
+               </menuContribution>
+   </extension>
+   <extension
+         point="org.eclipse.ui.commands">
+      
+            <command
+                  categoryId="org.txm.rcp.category.txm"
+                  defaultHandler="org.txm.referencer.rcp.handlers.ComputeReferencer"
+                  id="org.txm.referencer.rcp.handlers.ComputeReferencer"
+                  name="%command.name.44"
+                  returnTypeId="org.txm.referencer.core.functions.Referencer">
+      </command>
+            <command
+                  defaultHandler="org.txm.referencer.rcp.handlers.CopyLines"
+                  id="org.txm.referencer.rcp.handlers.CopyLines"
+                  name="%command.name">
+            </command>
+   </extension>
+   <extension
+         point="org.eclipse.core.expressions.definitions">
+       <definition
+                  id="OneReferencerSelected">
+               <with
+                     variable="corporaSelection">
+                  <iterate
+                        ifEmpty="false"
+                        operator="and">
+                     <instanceof
+                           value="org.txm.referencer.core.functions.Referencer">
+                     </instanceof>
+                  </iterate>
+               </with>
+            </definition>
+       <definition
+             id="ReferencerEditorActive">
+          <with
+                variable="activePart">
+             <instanceof
+                   value="org.txm.referencer.rcp.editors.ReferencerEditor">
+             </instanceof>
+          </with>
+       </definition>
+   </extension>
+   <extension
+         point="org.eclipse.core.runtime.adapters">
+       <factory
+       adaptableType="org.txm.referencer.core.functions.Referencer"
+       class="org.txm.referencer.rcp.adapters.ReferencerAdapterFactory">
+    <adapter
+          type="org.eclipse.ui.model.IWorkbenchAdapter">
+    </adapter>
+    <adapter
+          type="org.eclipse.ui.model.IWorkbenchAdapter2">
+    </adapter>
+ </factory>
+   </extension>
+   <extension
+         point="org.eclipse.ui.preferencePages">
+            <page
+            category="org.txm.rcp.preferences.UserPreferencePage"
+            class="org.txm.referencer.rcp.preferences.ReferencerPreferencePage"
+            id="org.txm.referencer.rcp.preferences.ReferencerPreferencePage"
+            name="%page.name">
+      </page>
+   </extension>
+   <extension
+         point="org.eclipse.ui.handlers">
+      <handler
+            class="org.txm.referencer.rcp.handlers.SendReferencerTo"
+            commandId="org.txm.concordance.rcp.handlers.ComputeConcordance">
+         <activeWhen>
+         <and>
+            <reference
+                  definitionId="ReferencerEditorActive">
+            </reference>
+            <reference
+                     definitionId="SelectionIsNotEmpty">
+               </reference>
+            <reference
+                  definitionId="SendSelectionContextNotActive">
+            </reference>
+            </and>
+         </activeWhen>
+      </handler>
+   </extension>
+
+</plugin>

Property changes on: TXM/trunk/bundles/org.txm.referencer.rcp/plugin.xml
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.referencer.rcp/.settings/org.eclipse.core.resources.prefs
===================================================================
--- TXM/trunk/bundles/org.txm.referencer.rcp/.settings/org.eclipse.core.resources.prefs	(revision 0)
+++ TXM/trunk/bundles/org.txm.referencer.rcp/.settings/org.eclipse.core.resources.prefs	(revision 3659)
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+encoding//src/org/txm/referencer/rcp/messages/messages_fr.properties=UTF-8

Property changes on: TXM/trunk/bundles/org.txm.referencer.rcp/.settings/org.eclipse.core.resources.prefs
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.referencer.rcp/.classpath
===================================================================
--- TXM/trunk/bundles/org.txm.referencer.rcp/.classpath	(revision 0)
+++ TXM/trunk/bundles/org.txm.referencer.rcp/.classpath	(revision 3659)
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="con"
+		path="org.eclipse.jdt.launching.JRE_CONTAINER" />
+	<classpathentry kind="con"
+		path="org.eclipse.pde.core.requiredPlugins">
+		<accessrules>
+			<accessrule kind="accessible" pattern="**" />
+		</accessrules>
+	</classpathentry>
+	<classpathentry kind="src" path="src" />
+	<classpathentry kind="output" path="bin" />
+</classpath>
\ No newline at end of file

Property changes on: TXM/trunk/bundles/org.txm.referencer.rcp/.classpath
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.referencer.rcp/META-INF/MANIFEST.MF
===================================================================
--- TXM/trunk/bundles/org.txm.referencer.rcp/META-INF/MANIFEST.MF	(revision 0)
+++ TXM/trunk/bundles/org.txm.referencer.rcp/META-INF/MANIFEST.MF	(revision 3659)
@@ -0,0 +1,17 @@
+Manifest-Version: 1.0
+Export-Package: org.txm.referencer.rcp.adapters,org.txm.referencer.rcp
+ .editors,org.txm.referencer.rcp.handlers,org.txm.referencer.rcp.messa
+ ges,org.txm.referencer.rcp.preferences
+Bundle-SymbolicName: org.txm.referencer.rcp;singleton:=true
+Bundle-Version: 1.0.0.qualifier
+Bundle-Name: %Bundle-Name
+Require-Bundle: org.txm.concordance.rcp;bundle-version="1.0.0";visibil
+ ity:=reexport,org.txm.referencer.core;bundle-version="1.0.0";visibili
+ ty:=reexport,org.txm.links.rcp;bundle-version="1.0.0";visibility:=ree
+ xport
+Bundle-ActivationPolicy: lazy
+Bundle-ManifestVersion: 2
+Bundle-RequiredExecutionEnvironment: JavaSE-16
+Bundle-Vendor: Textometrie.org
+Automatic-Module-Name: org.txm.referencer.rcp
+

Property changes on: TXM/trunk/bundles/org.txm.referencer.rcp/META-INF/MANIFEST.MF
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.referencer.rcp/.project
===================================================================
--- TXM/trunk/bundles/org.txm.referencer.rcp/.project	(revision 0)
+++ TXM/trunk/bundles/org.txm.referencer.rcp/.project	(revision 3659)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>org.txm.referencer.rcp</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.pde.ManifestBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.pde.SchemaBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.pde.PluginNature</nature>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+	</natures>
+</projectDescription>

Property changes on: TXM/trunk/bundles/org.txm.referencer.rcp/.project
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.referencer.rcp/src/org/txm/referencer/rcp/messages/messages.properties
===================================================================
--- TXM/trunk/bundles/org.txm.referencer.rcp/src/org/txm/referencer/rcp/messages/messages.properties	(revision 0)
+++ TXM/trunk/bundles/org.txm.referencer.rcp/src/org/txm/referencer/rcp/messages/messages.properties	(revision 3659)
@@ -0,0 +1,11 @@
+#TXM messages generated by the PluginMessagesManager class
+#Fri Jun 10 16:36:03 CEST 2022
+orderReferencesByFrequency=Order references by frequency
+referencePattern=Reference pattern
+referencer=Referencer
+references=References
+showCounts=Show counts
+showingFirstResultPage=Showing the first page of results
+showingLastResultPage=Showing the last page of results
+showingNextResultPage=Showing the next page of results
+showingPreviousResultPage=Showing the previous page of results

Property changes on: TXM/trunk/bundles/org.txm.referencer.rcp/src/org/txm/referencer/rcp/messages/messages.properties
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.referencer.rcp/src/org/txm/referencer/rcp/messages/ReferencerUIMessages.java
===================================================================
--- TXM/trunk/bundles/org.txm.referencer.rcp/src/org/txm/referencer/rcp/messages/ReferencerUIMessages.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.referencer.rcp/src/org/txm/referencer/rcp/messages/ReferencerUIMessages.java	(revision 3659)
@@ -0,0 +1,34 @@
+package org.txm.referencer.rcp.messages;
+
+import org.eclipse.osgi.util.NLS;
+import org.txm.utils.messages.Utf8NLS;
+
+/**
+ * Referencer UI messages. 
+ * 
+ * @author mdecorde
+ * @author sjacquot
+ *
+ */
+public class ReferencerUIMessages extends NLS {
+	
+	private static final String BUNDLE_NAME = "org.txm.referencer.rcp.messages.messages"; //$NON-NLS-1$
+	
+	public static String references; 
+	public static String showingFirstResultPage; 
+	public static String showingLastResultPage; 
+	public static String showingNextResultPage; 
+	public static String showingPreviousResultPage; 
+	public static String referencePattern; 
+	public static String referencer; 
+	public static String orderReferencesByFrequency;
+	public static String showCounts; 
+
+	static {
+		// initialize resource bundle
+		Utf8NLS.initializeMessages(BUNDLE_NAME, ReferencerUIMessages.class);
+	}
+
+	private ReferencerUIMessages() {
+	}
+}

Property changes on: TXM/trunk/bundles/org.txm.referencer.rcp/src/org/txm/referencer/rcp/messages/ReferencerUIMessages.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.referencer.rcp/src/org/txm/referencer/rcp/messages/messages_fr.properties
===================================================================
--- TXM/trunk/bundles/org.txm.referencer.rcp/src/org/txm/referencer/rcp/messages/messages_fr.properties	(revision 0)
+++ TXM/trunk/bundles/org.txm.referencer.rcp/src/org/txm/referencer/rcp/messages/messages_fr.properties	(revision 3659)
@@ -0,0 +1,11 @@
+#TXM messages generated by the PluginMessagesManager class
+#Fri Jun 10 16:36:03 CEST 2022
+orderReferencesByFrequency=Ordonner les références par fréquence
+referencePattern=Patron des références 
+referencer=Références
+references=Références
+showCounts=Show counts
+showingFirstResultPage=Affichage de la première page de résultats
+showingLastResultPage=Affichage de la dernière page de résultats
+showingNextResultPage=Affichage de la page de résultats suivante 
+showingPreviousResultPage=Affichage de la page de résultats précédente 

Property changes on: TXM/trunk/bundles/org.txm.referencer.rcp/src/org/txm/referencer/rcp/messages/messages_fr.properties
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.referencer.rcp/src/org/txm/referencer/rcp/editors/LineContentProvider.java
===================================================================
--- TXM/trunk/bundles/org.txm.referencer.rcp/src/org/txm/referencer/rcp/editors/LineContentProvider.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.referencer.rcp/src/org/txm/referencer/rcp/editors/LineContentProvider.java	(revision 3659)
@@ -0,0 +1,82 @@
+// Copyright © 2010-2020 ENS de Lyon., University of Franche-Comté
+// 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.referencer.rcp.editors;
+
+import java.util.List;
+
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.Viewer;
+import org.txm.referencer.core.functions.Referencer;
+
+
+// TODO: Auto-generated Javadoc
+/**
+ * The IStructuredContentProvider used by the reference and line tables.
+ *
+ * @author mdecorde
+ */
+public class LineContentProvider implements IStructuredContentProvider {
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java
+	 * .lang.Object)
+	 */
+	@Override
+	public Object[] getElements(Object inputElement) {
+		@SuppressWarnings("unchecked")
+		List<Referencer.Line> lines = (List<Referencer.Line>) inputElement;
+		return lines.toArray();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.jface.viewers.IContentProvider#dispose()
+	 */
+	@Override
+	public void dispose() {
+		// TODO Auto-generated method stub
+
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface
+	 * .viewers.Viewer, java.lang.Object, java.lang.Object)
+	 */
+	@Override
+	public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+		// TODO Auto-generated method stub
+	}
+
+}

Property changes on: TXM/trunk/bundles/org.txm.referencer.rcp/src/org/txm/referencer/rcp/editors/LineContentProvider.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.referencer.rcp/src/org/txm/referencer/rcp/editors/LineLabelProvider.java
===================================================================
--- TXM/trunk/bundles/org.txm.referencer.rcp/src/org/txm/referencer/rcp/editors/LineLabelProvider.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.referencer.rcp/src/org/txm/referencer/rcp/editors/LineLabelProvider.java	(revision 3659)
@@ -0,0 +1,114 @@
+// Copyright © 2010-2020 ENS de Lyon., University of Franche-Comté
+// 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.referencer.rcp.editors;
+
+import org.eclipse.jface.viewers.ILabelProviderListener;
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.swt.graphics.Image;
+import org.txm.referencer.core.functions.Referencer;
+
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class LineLabelProvider.
+ */
+public class LineLabelProvider implements ITableLabelProvider {
+
+	Referencer referencer;
+	
+	public LineLabelProvider(Referencer referencer) {
+		this.referencer = referencer;
+	}
+	
+	/* (non-Javadoc)
+	 * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnImage(java.lang.Object, int)
+	 */
+	@Override
+	public Image getColumnImage(Object element, int columnIndex) {
+		return null;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnText(java.lang.Object, int)
+	 */
+	@Override
+	public String getColumnText(Object element, int columnIndex) {
+		Referencer.Line line = (Referencer.Line) element;
+		switch (columnIndex) {
+		case 0:
+			return ""; //$NON-NLS-1$
+		case 1:
+			return line.getPropValue();
+		case 2:
+			StringBuffer str = new StringBuffer();
+			for (String ref : line.getReferences()) {
+				if (this.referencer.getShowCounts()) {
+					str.append(", "+ref+"("+line.getCount(ref)+")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+				} else {
+					str.append(", "+ref); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+				}
+			}
+			return str.substring(2); 
+		default:
+			return ""; //$NON-NLS-1$
+		}
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.jface.viewers.IBaseLabelProvider#addListener(org.eclipse.jface.viewers.ILabelProviderListener)
+	 */
+	@Override
+	public void addListener(ILabelProviderListener listener) {
+		// TODO Auto-generated method stub
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.jface.viewers.IBaseLabelProvider#dispose()
+	 */
+	@Override
+	public void dispose() {
+		// TODO Auto-generated method stub
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.jface.viewers.IBaseLabelProvider#isLabelProperty(java.lang.Object, java.lang.String)
+	 */
+	@Override
+	public boolean isLabelProperty(Object element, String property) {
+		// TODO Auto-generated method stub
+		return false;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.jface.viewers.IBaseLabelProvider#removeListener(org.eclipse.jface.viewers.ILabelProviderListener)
+	 */
+	@Override
+	public void removeListener(ILabelProviderListener listener) {
+		// TODO Auto-generated method stub
+	}
+}

Property changes on: TXM/trunk/bundles/org.txm.referencer.rcp/src/org/txm/referencer/rcp/editors/LineLabelProvider.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.referencer.rcp/src/org/txm/referencer/rcp/editors/ReferencerTreeNode.java
===================================================================
--- TXM/trunk/bundles/org.txm.referencer.rcp/src/org/txm/referencer/rcp/editors/ReferencerTreeNode.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.referencer.rcp/src/org/txm/referencer/rcp/editors/ReferencerTreeNode.java	(revision 3659)
@@ -0,0 +1,20 @@
+package org.txm.referencer.rcp.editors;
+
+import java.util.ArrayList;
+
+import org.eclipse.jface.viewers.TreeNode;
+import org.txm.referencer.core.functions.Referencer;
+
+
+public class ReferencerTreeNode extends TreeNode {
+
+	public ReferencerTreeNode(Referencer.Line line) {
+		
+		super(line);
+	}
+	
+	public static ArrayList<ReferencerTreeNode> buildTree(ArrayList<ReferencerTreeNode> nodes) {
+		return nodes;
+	}
+	
+}

Property changes on: TXM/trunk/bundles/org.txm.referencer.rcp/src/org/txm/referencer/rcp/editors/ReferencerTreeNode.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.referencer.rcp/src/org/txm/referencer/rcp/editors/ReferencerEditor.java
===================================================================
--- TXM/trunk/bundles/org.txm.referencer.rcp/src/org/txm/referencer/rcp/editors/ReferencerEditor.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.referencer.rcp/src/org/txm/referencer/rcp/editors/ReferencerEditor.java	(revision 3659)
@@ -0,0 +1,491 @@
+// Copyright © 2010-2020 ENS de Lyon., University of Franche-Comté
+// 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.referencer.rcp.editors;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.TableColumn;
+import org.txm.core.messages.TXMCoreMessages;
+import org.txm.core.results.Parameter;
+import org.txm.rcp.StatusLine;
+import org.txm.rcp.editors.TXMEditor;
+import org.txm.rcp.editors.TableKeyListener;
+import org.txm.rcp.editors.listeners.ComputeKeyListener;
+import org.txm.rcp.editors.listeners.ComputeSelectionListener;
+import org.txm.rcp.messages.TXMUIMessages;
+import org.txm.rcp.swt.GLComposite;
+import org.txm.rcp.swt.widget.AssistedChoiceQueryWidget;
+import org.txm.rcp.swt.widget.NavigationWidget;
+import org.txm.rcp.swt.widget.PropertiesSelector;
+import org.txm.rcp.swt.widget.QueryWidget;
+import org.txm.referencer.core.functions.Referencer;
+import org.txm.referencer.core.functions.Referencer.Line;
+import org.txm.referencer.core.preferences.ReferencerPreferences;
+import org.txm.referencer.rcp.messages.ReferencerUIMessages;
+import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
+import org.txm.searchengine.cqp.corpus.CQPCorpus;
+import org.txm.searchengine.cqp.corpus.Property;
+import org.txm.searchengine.cqp.corpus.StructuralUnitProperty;
+
+/**
+ * The Class ReferencerEditor display&update a Referencer TXMResult
+ */
+public class ReferencerEditor extends TXMEditor<Referencer> {
+	
+	/** The Constant ID. */
+	public static final String ID = ReferencerEditor.class.getName();
+	
+	/** The corpus. */
+	CQPCorpus corpus;
+	
+	/** The referencer. */
+	Referencer referencer;
+	
+	
+	/** The navigation area. */
+	NavigationWidget navigationArea;
+	
+	/** The line table viewer. */
+	protected TableViewer viewer;
+	
+	/** The n column. */
+	protected TableColumn nColumn;
+	
+	/** The unit column. */
+	protected TableColumn unitColumn;
+	
+	/** The freq column. */
+	protected TableColumn freqColumn;
+	
+	/** The separator column. */
+	protected TableColumn separatorColumn;
+	
+	/** The lineperpage. */
+	int lineperpage = 100;
+	
+	/** The top line. */
+	int topLine = 0;
+	
+	/** The bottom line. */
+	int bottomLine;
+	
+	
+	
+	/** The mess. */
+	String mess;
+	
+	
+	
+	/** The querywidget. */
+	@Parameter(key = ReferencerPreferences.QUERY)
+	protected AssistedChoiceQueryWidget querywidget;
+	
+	/**
+	 * Word property selector.
+	 */
+	@Parameter(key = ReferencerPreferences.UNIT_PROPERTY)
+	protected PropertiesSelector<Property> propertiesSelector;
+	
+	/**
+	 * Show counts button
+	 */
+	@Parameter(key = ReferencerPreferences.SHOW_COUNTS)
+	protected Button showCountsButton;
+	
+	/** The pattern area. */
+	@Parameter(key = ReferencerPreferences.PATTERN)
+	protected PropertiesSelector<StructuralUnitProperty> patternArea;
+	
+	
+	
+	
+	@Override
+	public void _createPartControl() {
+		
+		this.referencer = (this.getResult());
+		this.corpus = referencer.getCorpus();
+		
+		// Computing listener
+		ComputeSelectionListener computeSelectionListener = new ComputeSelectionListener(this);
+		ComputeKeyListener computeKeyListener = new ComputeKeyListener(this);
+		
+		Composite paramArea = getExtendedParametersGroup();
+		paramArea.setLayout(new GridLayout(3, false));
+		
+		getMainParametersComposite().getLayout().numColumns = 3;
+		getMainParametersComposite().setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false));
+		
+		Label queryLabel = new Label(getMainParametersComposite(), SWT.NONE);
+		queryLabel.setText(TXMUIMessages.ampQuery);
+		queryLabel.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
+		
+		querywidget = new AssistedChoiceQueryWidget(getMainParametersComposite(), SWT.None, this.corpus);
+		querywidget.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false));
+		querywidget.addKeyListener(computeKeyListener);
+		
+		// [Edit]
+		propertiesSelector = new PropertiesSelector<>(getMainParametersComposite(), SWT.NONE);
+		propertiesSelector.setMaxPropertyNumber(1);
+		propertiesSelector.setLayoutData(new GridData(GridData.FILL, GridData.FILL, false, false));
+		propertiesSelector.setLayout(new GridLayout(3, false));
+		propertiesSelector.addSelectionListener(computeSelectionListener);
+		
+		// [Search]
+		// Button go = new Button(paramArea, SWT.PUSH);
+		// go.setText(TXMUIMessages.SEARCH);
+		// go.setLayoutData(new GridData(GridData.FILL, GridData.FILL,
+		// false, false));
+		// Font f = go.getFont();
+		// FontData defaultFont = f.getFontData()[0];
+		// defaultFont.setStyle(SWT.BOLD);
+		// Font newf = new Font(go.getDisplay(), defaultFont);
+		// go.setFont(newf);
+		//
+		// go.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
+		// go.addSelectionListener(computeSelectionListener);
+		
+		// [pattern : ... ]
+		patternArea = new PropertiesSelector<>(paramArea, SWT.NONE);
+		patternArea.setLayoutData(new GridData(GridData.FILL, GridData.FILL, false, false, 3, 1));
+		patternArea.setLayout(new GridLayout(3, false));
+		patternArea.setTitle(ReferencerUIMessages.referencePattern);
+		patternArea.addSelectionListener(computeSelectionListener);
+		
+		// [show counts]
+		showCountsButton = new Button(paramArea, SWT.CHECK);
+		showCountsButton.setText(ReferencerUIMessages.showCounts);
+		showCountsButton.setSelection(referencer.getShowCounts());
+		
+		
+		// pagination
+		GLComposite navigationComposite = getBottomToolbar().installGLComposite("navigation", 1, false);
+		navigationComposite.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false));
+		
+		navigationArea = new NavigationWidget(navigationComposite, SWT.BORDER);
+		navigationArea.setLayoutData(new GridData(GridData.CENTER, GridData.FILL, true, false));
+		
+		navigationArea.addFirstListener(new SelectionListener() {
+			
+			@Override
+			public void widgetDefaultSelected(SelectionEvent e) {}
+			
+			@Override
+			public void widgetSelected(SelectionEvent e) {
+				StatusLine.setMessage(ReferencerUIMessages.showingFirstResultPage);
+				fillDisplayArea(0, lineperpage);
+				viewer.getTable().select(0);
+				viewer.getTable().showSelection();
+				StatusLine.setMessage(""); //$NON-NLS-1$
+			}
+		});
+		navigationArea.addLastListener(new SelectionListener() {
+			
+			@Override
+			public void widgetDefaultSelected(SelectionEvent e) {}
+			
+			@Override
+			public void widgetSelected(SelectionEvent e) {
+				StatusLine.setMessage(ReferencerUIMessages.showingLastResultPage);
+				fillDisplayArea(referencer.getNLines()
+						- lineperpage, referencer.getNLines());
+				viewer.getTable().select(0);
+				viewer.getTable().showSelection();
+				StatusLine.setMessage(""); //$NON-NLS-1$
+			}
+		});
+		navigationArea.addNextListener(new SelectionListener() {
+			
+			@Override
+			public void widgetDefaultSelected(SelectionEvent e) {}
+			
+			@Override
+			public void widgetSelected(SelectionEvent e) {
+				StatusLine.setMessage(ReferencerUIMessages.showingNextResultPage);
+				fillDisplayArea(topLine + lineperpage,
+						bottomLine + lineperpage);
+				viewer.getTable().select(0);
+				viewer.getTable().showSelection();
+				StatusLine.setMessage(""); //$NON-NLS-1$
+			}
+		});
+		navigationArea.addPreviousListener(new SelectionListener() {
+			
+			@Override
+			public void widgetDefaultSelected(SelectionEvent e) {}
+			
+			@Override
+			public void widgetSelected(SelectionEvent e) {
+				StatusLine.setMessage(ReferencerUIMessages.showingPreviousResultPage);
+				fillDisplayArea(topLine - lineperpage,
+						bottomLine - lineperpage);
+				viewer.getTable().select(0);
+				viewer.getTable().showSelection();
+				StatusLine.setMessage(""); //$NON-NLS-1$
+			}
+		});
+		
+		// result
+		
+		Composite resultArea = getResultArea();
+		
+		viewer = new TableViewer(resultArea, SWT.MULTI | SWT.FULL_SELECTION | SWT.BORDER | SWT.VIRTUAL);
+		viewer.getTable().addKeyListener(new TableKeyListener(viewer));
+		if (corpus != null && corpus.getFont() != null && corpus.getFont().length() > 0) {
+			Font old = viewer.getTable().getFont();
+			FontData fD = old.getFontData()[0];
+			// Font f = new Font(old.getDevice(), corpus.getFont(), fD.getHeight(), fD.getStyle());
+			Font font = new Font(Display.getCurrent(), corpus.getFont(), fD.getHeight(), fD.getStyle());
+			viewer.getTable().setFont(font);
+		}
+		
+		viewer.getTable().setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true));
+		viewer.getTable().setLinesVisible(true);
+		viewer.getTable().setHeaderVisible(true);
+		
+		viewer.setLabelProvider(new LineLabelProvider(this.referencer));
+		viewer.setContentProvider(new LineContentProvider());
+		viewer.setInput(new ArrayList<Property>());
+		
+		// viewer.getTable().addMouseListener(new MouseAdapter() {
+		// @Override
+		// public void mouseDoubleClick(MouseEvent e) {
+		//
+		// Point mouseposition = new Point(e.x
+		// + viewer.getTable().getHorizontalBar()
+		// .getSelection(), e.y);
+		// int col = getPointedColumn(mouseposition);
+		// if (col == 1) {
+		// StatusLine.setMessage(ReferencerUIMessages.ReferencerEditor_25);
+		// sendSelectionToConc();
+		// } else if (col == 2) {
+		// //System.out.println("Send to edition ?"); //$NON-NLS-1$
+		// }
+		// }
+		// });
+		
+		nColumn = new TableColumn(viewer.getTable(), SWT.LEFT);
+		nColumn.setText(" "); //$NON-NLS-1$
+		nColumn.pack();
+		
+		unitColumn = new TableColumn(viewer.getTable(), SWT.LEFT);
+		unitColumn.setText(TXMCoreMessages.common_units);
+		unitColumn.setToolTipText(TXMCoreMessages.common_units);
+		unitColumn.setWidth(200);
+		
+		freqColumn = new TableColumn(viewer.getTable(), SWT.LEFT);
+		freqColumn.setText(ReferencerUIMessages.references);
+		freqColumn.setToolTipText(ReferencerUIMessages.references);
+		freqColumn.setWidth(100);
+		
+		initializeFields();
+		
+		
+		// Add double click, "Send to" command
+		TXMEditor.addDoubleClickCommandListener(viewer.getTable(), "org.txm.concordance.rcp.handlers.ComputeConcordance"); //$NON-NLS-1$
+		
+		// Register the context menu
+		TXMEditor.initContextMenu(this.viewer.getTable(), this.getSite(), this.viewer);
+		
+		
+	}
+	
+	@Override
+	public void updateEditorFromResult(boolean update) {
+		
+		fillDisplayArea(0, lineperpage);
+		
+		viewer.getTable().setFocus();
+	}
+	
+	
+	
+	/**
+	 * Fill display area.
+	 *
+	 * @param from the from
+	 * @param to the to
+	 */
+	public void fillDisplayArea(int from, int to) {
+		from = Math.max(from, 0);
+		to = Math.min(to, referencer.getNLines());
+		List<Line> lines = null;
+		if (referencer.getNLines() > 0) {
+			try {
+				lines = referencer.getLines(from, to);
+			}
+			catch (Exception e) {
+				org.txm.utils.logger.Log.printStackTrace(e);
+				lines = new ArrayList<>();
+			}
+		}
+		else {
+			lines = new ArrayList<>();
+		}
+		
+		navigationArea.setInfoLineText("" + (from + 1), //$NON-NLS-1$
+				"-" + (to) + " / " + referencer.getNLines()); //$NON-NLS-1$ //$NON-NLS-2$
+		navigationArea.setPreviousEnabled(from > 0);
+		navigationArea.setFirstEnabled(from > 0);
+		navigationArea.setNextEnabled(to < referencer.getNLines() - 1);
+		navigationArea.setLastEnabled(to < referencer.getNLines() - 1);
+		
+		unitColumn.setText(referencer.getProperty().getName());
+		
+		String unitColumnHeader = ""; //$NON-NLS-1$
+		for (Property p : referencer.getPattern())
+			unitColumnHeader += p.getName() + ", "; //$NON-NLS-1$
+		if (unitColumnHeader.length() > 0)
+			unitColumnHeader = unitColumnHeader.substring(0, unitColumnHeader
+					.length() - 2);
+		freqColumn.setText(unitColumnHeader);
+		
+		viewer.setInput(lines);
+		viewer.refresh();
+		// System.out.println("table refreshed from "+from+" to "+to+" with : "+lines);
+		topLine = from;
+		bottomLine = to;
+		for (TableColumn col : viewer.getTable().getColumns()) {
+			col.pack();
+		}
+	}
+	
+	/**
+	 * Gets the pointed column.
+	 *
+	 * @param mouseposition the mouseposition
+	 * @return the pointed column
+	 */
+	public int getPointedColumn(Point mouseposition) {
+		int x = mouseposition.x; // + lineTableViewer.getTable().get;
+		int sumWidthColumn = this.nColumn.getWidth();
+		if (x < sumWidthColumn)
+			return 0;
+		
+		sumWidthColumn += this.unitColumn.getWidth();
+		if (x < sumWidthColumn)
+			return 1;
+		
+		sumWidthColumn += this.freqColumn.getWidth();
+		if (x < sumWidthColumn)
+			return 2;
+		
+		return 2;
+	}
+	
+	/**
+	 * Gets the referencer.
+	 *
+	 * @return the referencer
+	 */
+	public Referencer getReferencer() {
+		return this.referencer;
+	}
+	
+	/**
+	 * Gets the corpus.
+	 *
+	 * @return the corpus
+	 */
+	public CQPCorpus getCorpus() {
+		return this.corpus;
+	}
+	
+	/**
+	 * 
+	 */
+	protected void initializeFields() {
+		// word properties
+		try {
+			ArrayList<Property> selectedProps = new ArrayList<>();
+			ArrayList<Property> availables = new ArrayList<>();
+			availables.addAll(corpus.getOrderedProperties());
+			availables.addAll(corpus.getVirtualProperties());
+			
+			if (referencer.getProperty() != null) {
+				selectedProps.add(referencer.getProperty());
+				availables.remove(referencer.getProperty());
+				this.propertiesSelector.setProperties(availables, selectedProps);
+			}
+			else {
+				this.propertiesSelector.setCorpus(corpus);
+			}
+			
+		}
+		catch (CqiClientException e1) {
+			org.txm.utils.logger.Log.printStackTrace(e1);
+		}
+		
+		// references
+		
+		try {
+			ArrayList<StructuralUnitProperty> availables2 = new ArrayList<>();
+			availables2.addAll(corpus.getStructuralUnitProperties());
+			Collections.sort(availables2);
+			
+			ArrayList<StructuralUnitProperty> selectedProps = new ArrayList<>();
+			if (referencer.getPattern() != null) {
+				for (StructuralUnitProperty p : referencer.getPattern()) {
+					selectedProps.add(p);
+					availables2.remove(p);
+				}
+			}
+			
+			this.patternArea.setProperties(availables2, selectedProps);
+		}
+		catch (CqiClientException e1) {
+			org.txm.utils.logger.Log.printStackTrace(e1);
+			return;
+		}
+	}
+	
+	@Override
+	public void updateResultFromEditor() {
+		// nothing to do
+	}
+
+	public TableViewer getTableViewer() {
+		
+		return viewer;
+	}
+}

Property changes on: TXM/trunk/bundles/org.txm.referencer.rcp/src/org/txm/referencer/rcp/editors/ReferencerEditor.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.referencer.rcp/src/org/txm/referencer/rcp/handlers/___ReferencerToConc.java
===================================================================
--- TXM/trunk/bundles/org.txm.referencer.rcp/src/org/txm/referencer/rcp/handlers/___ReferencerToConc.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.referencer.rcp/src/org/txm/referencer/rcp/handlers/___ReferencerToConc.java	(revision 3659)
@@ -0,0 +1,139 @@
+// Copyright © 2010-2020 ENS de Lyon., University of Franche-Comté
+// 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.referencer.rcp.handlers;
+
+import java.util.List;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.handlers.HandlerUtil;
+import org.txm.concordance.core.functions.Concordance;
+import org.txm.concordance.rcp.editors.ConcordanceEditor;
+import org.txm.rcp.editors.TXMResultEditorInput;
+import org.txm.referencer.core.functions.Referencer;
+import org.txm.referencer.core.functions.Referencer.Line;
+import org.txm.referencer.rcp.editors.ReferencerEditor;
+import org.txm.searchengine.cqp.ReferencePattern;
+import org.txm.searchengine.cqp.corpus.CQPCorpus;
+import org.txm.searchengine.cqp.corpus.Property;
+import org.txm.searchengine.cqp.corpus.query.CQLQuery;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class ReferencerToConc.
+ */
+@Deprecated
+public class ___ReferencerToConc extends AbstractHandler {
+	
+	/*
+	 * (non-Javadoc)
+	 * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
+	 */
+	@Override
+	public Object execute(ExecutionEvent event) throws ExecutionException {
+		IStructuredSelection selection = (IStructuredSelection) HandlerUtil
+				.getActiveWorkbenchWindow(event).getActivePage().getSelection();
+		
+		ReferencerEditor refeditor = (ReferencerEditor) HandlerUtil
+				.getActiveWorkbenchWindow(event).getActivePage()
+				.getActivePart();
+		
+		return link(refeditor, selection);
+	}
+	
+	/**
+	 * Link.
+	 *
+	 * @param refeditor the refeditor
+	 * @param iSelection the selection
+	 * @return the object
+	 */
+	public static Object link(ReferencerEditor refeditor, ISelection iSelection) {
+		IStructuredSelection selection = (IStructuredSelection) iSelection;
+		String query = getQuery(refeditor.getReferencer(), selection);
+		if (query.length() == 0) {
+			return null;
+		}
+		CQPCorpus corpus = refeditor.getCorpus();
+		Concordance concordance = new Concordance(corpus);
+		
+		ReferencePattern rp = new ReferencePattern();
+		for (Property p : refeditor.getReferencer().getPattern()) {
+			rp.addProperty(p);
+		}
+		
+		concordance.setParameters(new CQLQuery(query), null, null, null, null, null, null, rp, rp, null, null);
+		TXMResultEditorInput editorInput = new TXMResultEditorInput(concordance);
+		
+		IWorkbenchPage page = refeditor.getEditorSite().getWorkbenchWindow().getActivePage();
+		try {
+			ConcordanceEditor conceditor = (ConcordanceEditor) page.openEditor(editorInput,
+					ConcordanceEditor.class.getName());
+		}
+		catch (PartInitException e) {
+			System.err.println("Error: " + e.getLocalizedMessage());
+		}
+		
+		return null;
+	}
+	
+	/**
+	 * Gets the query.
+	 *
+	 * @param selection the selection
+	 * @return the query
+	 */
+	private static String getQuery(Referencer referencer, IStructuredSelection selection) {
+		String query = ""; //$NON-NLS-1$
+		
+		Line fline = (Line) selection.getFirstElement();
+		int nbToken = 1;
+		
+		List<Line> lines = selection.toList();
+		
+		Property prop = referencer.getProperty();
+		for (int t = 0; t < nbToken; t++) {
+			query += "[" + prop + "=\""; //$NON-NLS-1$ //$NON-NLS-2$
+			
+			for (Line line : lines) {
+				String s = line.getPropValue();
+				s = CQLQuery.addBackSlash(s);
+				query += s + "|"; //$NON-NLS-1$
+			}
+			query = query.substring(0, query.length() - 1);
+			query += "\"] "; //$NON-NLS-1$
+		}
+		query = query.substring(0, query.length() - 1);
+		return query;
+	}
+}

Property changes on: TXM/trunk/bundles/org.txm.referencer.rcp/src/org/txm/referencer/rcp/handlers/___ReferencerToConc.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.referencer.rcp/src/org/txm/referencer/rcp/handlers/CopyLines.java
===================================================================
--- TXM/trunk/bundles/org.txm.referencer.rcp/src/org/txm/referencer/rcp/handlers/CopyLines.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.referencer.rcp/src/org/txm/referencer/rcp/handlers/CopyLines.java	(revision 3659)
@@ -0,0 +1,68 @@
+// Copyright © 2010-2020 ENS de Lyon., University of Franche-Comté
+// 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.referencer.rcp.handlers;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.handlers.HandlerUtil;
+import org.txm.referencer.rcp.editors.ReferencerEditor;
+import org.txm.rcp.editors.TableKeyListener;
+
+/**
+ * Allow the user to copy lines in a ReferencerEditor table.
+ * @author mdecorde
+ */
+public class CopyLines extends AbstractHandler {
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
+	 */
+	@Override
+	public Object execute(ExecutionEvent event) throws ExecutionException {
+		// Shell shell = HandlerUtil.getActiveWorkbenchWindowChecked(event).getShell();
+		// ISelection selection = HandlerUtil.getActiveWorkbenchWindow(event).getActivePage().getSelection();
+
+		IWorkbenchPart editor = HandlerUtil.getActiveWorkbenchWindow(event).getActivePage().getActivePart();
+		
+		if (editor instanceof ReferencerEditor) {
+			ReferencerEditor ceditor = (ReferencerEditor) editor;
+			copyLines(ceditor);
+		}
+
+		return null;
+	}
+
+	public static void copyLines(ReferencerEditor editor) {
+		TableViewer viewer = editor.getTableViewer();
+				
+		TableKeyListener.copyLinesToClipboard(new TableViewer[] {viewer});
+	}
+}

Property changes on: TXM/trunk/bundles/org.txm.referencer.rcp/src/org/txm/referencer/rcp/handlers/CopyLines.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.referencer.rcp/src/org/txm/referencer/rcp/handlers/ComputeReferencer.java
===================================================================
--- TXM/trunk/bundles/org.txm.referencer.rcp/src/org/txm/referencer/rcp/handlers/ComputeReferencer.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.referencer.rcp/src/org/txm/referencer/rcp/handlers/ComputeReferencer.java	(revision 3659)
@@ -0,0 +1,74 @@
+// Copyright © 2010-2020 ENS de Lyon., University of Franche-Comté
+// 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.referencer.rcp.handlers;
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.txm.rcp.editors.TXMEditor;
+import org.txm.rcp.handlers.BaseAbstractHandler;
+import org.txm.referencer.core.functions.Referencer;
+import org.txm.referencer.rcp.editors.ReferencerEditor;
+import org.txm.searchengine.cqp.corpus.CQPCorpus;
+
+/**
+ * Opens the Referencer editor with a corpus or a Referencer result .
+ * 
+ * @author mdecorde
+ * @author sjacquot
+ */
+public class ComputeReferencer extends BaseAbstractHandler {
+	
+
+	@Override
+	public Object execute(ExecutionEvent event) throws ExecutionException {
+		if (!this.checkCorpusEngine()) {
+			return false;
+		}
+		
+		Object selection = this.getCorporaViewSelectedObject(event);
+		Referencer referencer = null;
+		
+		// Creating from Corpus
+		if (selection instanceof CQPCorpus) {
+			referencer = new Referencer((CQPCorpus)selection);
+		}
+		// Reopening from existing result
+		else if (selection instanceof Referencer) {
+			referencer = (Referencer)selection;
+		}
+		// Error
+		else	{
+			return super.logCanNotExecuteCommand(selection);
+		}
+		
+		TXMEditor.openEditor(referencer, ReferencerEditor.class.getName());
+		
+		return null;
+	}
+	
+}

Property changes on: TXM/trunk/bundles/org.txm.referencer.rcp/src/org/txm/referencer/rcp/handlers/ComputeReferencer.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.referencer.rcp/src/org/txm/referencer/rcp/handlers/SendReferencerTo.java
===================================================================
--- TXM/trunk/bundles/org.txm.referencer.rcp/src/org/txm/referencer/rcp/handlers/SendReferencerTo.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.referencer.rcp/src/org/txm/referencer/rcp/handlers/SendReferencerTo.java	(revision 3659)
@@ -0,0 +1,57 @@
+// Copyright © 2010-2020 ENS de Lyon., University of Franche-Comté
+// 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.referencer.rcp.handlers;
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.txm.links.rcp.handlers.SendSelectionToQueryable;
+import org.txm.referencer.core.functions.Referencer;
+
+/**
+ * Sends the selected lines of a referencer to compute another command.
+ * 
+ * @author sjacquot
+ * 
+ */
+public class SendReferencerTo extends SendSelectionToQueryable {
+
+
+	@Override
+	public String createQuery(ExecutionEvent event, ISelection selection) {
+		if (selection instanceof StructuredSelection) {
+			StructuredSelection sselection = (StructuredSelection)selection;
+			return ((Referencer) this.getActiveEditorResult(event)).createQuery(sselection.toList());
+		}
+		return null;
+	}
+
+
+
+}

Property changes on: TXM/trunk/bundles/org.txm.referencer.rcp/src/org/txm/referencer/rcp/handlers/SendReferencerTo.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.referencer.rcp/src/org/txm/referencer/rcp/preferences/ReferencerPreferencePage.java
===================================================================
--- TXM/trunk/bundles/org.txm.referencer.rcp/src/org/txm/referencer/rcp/preferences/ReferencerPreferencePage.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.referencer.rcp/src/org/txm/referencer/rcp/preferences/ReferencerPreferencePage.java	(revision 3659)
@@ -0,0 +1,62 @@
+// Copyright © 2010-2020 ENS de Lyon., University of Franche-Comté
+// 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.referencer.rcp.preferences;
+
+import org.eclipse.jface.preference.BooleanFieldEditor;
+import org.eclipse.ui.IWorkbench;
+import org.txm.rcp.preferences.TXMPreferencePage;
+import org.txm.rcp.preferences.TXMPreferenceStore;
+import org.txm.referencer.core.preferences.ReferencerPreferences;
+import org.txm.referencer.rcp.messages.ReferencerUIMessages;
+
+
+/**
+ * Referencer preference page.
+ * 
+ * @author mdecorde
+ * @author sjacquot
+ *
+ */
+public class ReferencerPreferencePage extends TXMPreferencePage {
+
+
+	
+	@Override
+	public void createFieldEditors() {
+		this.addField(new BooleanFieldEditor(ReferencerPreferences.SORT_BY_FREQUENCIES, ReferencerUIMessages.orderReferencesByFrequency, this.getFieldEditorParent()));
+	}
+
+	@Override
+	public void init(IWorkbench workbench) {
+		this.setPreferenceStore(new TXMPreferenceStore(ReferencerPreferences.getInstance().getPreferencesNodeQualifier()));
+		this.setTitle(ReferencerUIMessages.referencer);
+	}
+	
+	
+	
+}
\ No newline at end of file

Property changes on: TXM/trunk/bundles/org.txm.referencer.rcp/src/org/txm/referencer/rcp/preferences/ReferencerPreferencePage.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.referencer.rcp/src/org/txm/referencer/rcp/adapters/ReferencerAdapterFactory.java
===================================================================
--- TXM/trunk/bundles/org.txm.referencer.rcp/src/org/txm/referencer/rcp/adapters/ReferencerAdapterFactory.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.referencer.rcp/src/org/txm/referencer/rcp/adapters/ReferencerAdapterFactory.java	(revision 3659)
@@ -0,0 +1,39 @@
+// Copyright © 2010-2020 ENS de Lyon., University of Franche-Comté
+package org.txm.referencer.rcp.adapters;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.model.IWorkbenchAdapter;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.FrameworkUtil;
+import org.txm.rcp.adapters.TXMResultAdapter;
+import org.txm.rcp.adapters.TXMResultAdapterFactory;
+import org.txm.referencer.core.functions.Referencer;
+
+/**
+ * A factory for creating Adapter objects.
+ * 
+ * @author mdecorde
+ * @author sjacquot
+ */
+public class ReferencerAdapterFactory extends TXMResultAdapterFactory {
+
+	
+	public static final ImageDescriptor ICON =
+			AbstractUIPlugin.imageDescriptorFromPlugin(FrameworkUtil.getBundle(ReferencerAdapterFactory.class).getSymbolicName(),
+					"platform:/plugin/"+ FrameworkUtil.getBundle(ReferencerAdapterFactory.class).getSymbolicName() + "/icons/functions/referencer.png"); //$NON-NLS-1$ //$NON-NLS-2$
+
+	@Override
+	public Object getAdapter(Object adaptableObject, Class adapterType) {
+		if(this.canAdapt(adapterType) && adaptableObject instanceof Referencer)	{
+			return new TXMResultAdapter() {
+				@Override
+				public ImageDescriptor getImageDescriptor(Object object) {
+					return ICON;
+				}
+			};
+		}
+		return null;
+	}
+
+
+}

Property changes on: TXM/trunk/bundles/org.txm.referencer.rcp/src/org/txm/referencer/rcp/adapters/ReferencerAdapterFactory.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.referencer.rcp/build.properties
===================================================================
--- TXM/trunk/bundles/org.txm.referencer.rcp/build.properties	(revision 0)
+++ TXM/trunk/bundles/org.txm.referencer.rcp/build.properties	(revision 3659)
@@ -0,0 +1,10 @@
+#Fri Jul 06 10:25:16 CEST 2018
+bin.includes = META-INF/,\
+               .,\
+               plugin.xml,\
+               icons/,\
+               OSGI-INF/,\
+               OSGI-INF/l10n/bundle.properties
+output..=bin/
+source..=src/
+#qualifier=svn

Property changes on: TXM/trunk/bundles/org.txm.referencer.rcp/build.properties
___________________________________________________________________
Added: svn:mime-type
   + text/plain


Property changes on: TXM/trunk/bundles/org.txm.referencer.rcp
___________________________________________________________________
Added: svn:ignore
   + bin

target


Index: TXM/trunk/bundles/org.txm.ruby.rcp/.project
===================================================================
--- TXM/trunk/bundles/org.txm.ruby.rcp/.project	(revision 0)
+++ TXM/trunk/bundles/org.txm.ruby.rcp/.project	(revision 3659)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>org.txm.ruby.rcp</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.pde.ManifestBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.pde.SchemaBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.pde.PluginNature</nature>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+	</natures>
+</projectDescription>

Property changes on: TXM/trunk/bundles/org.txm.ruby.rcp/.project
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.ruby.rcp/src/org/txm/ruby/rcp/RubyPreferencesPage.java
===================================================================
--- TXM/trunk/bundles/org.txm.ruby.rcp/src/org/txm/ruby/rcp/RubyPreferencesPage.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.ruby.rcp/src/org/txm/ruby/rcp/RubyPreferencesPage.java	(revision 3659)
@@ -0,0 +1,32 @@
+package org.txm.ruby.rcp;
+
+import org.eclipse.jface.preference.StringFieldEditor;
+import org.eclipse.ui.IWorkbench;
+import org.txm.ruby.core.RubyPreferences;
+import org.txm.rcp.IImageKeys;
+import org.txm.rcp.preferences.TXMPreferencePage;
+import org.txm.rcp.preferences.TXMPreferenceStore;
+
+/**
+ * Index preferences page.
+ * 
+ * @author mdecorde
+ *
+ */
+public class RubyPreferencesPage extends TXMPreferencePage {
+	
+	@Override
+	public void init(IWorkbench workbench) {
+		
+		this.setPreferenceStore(new TXMPreferenceStore(RubyPreferences.getInstance().getPreferencesNodeQualifier()));
+		this.setTitle("Ruby");
+		this.setImageDescriptor(IImageKeys.getImageDescriptor("org.txm.ruby.rcp", "icon/ruby.png"));
+	}
+	
+	@Override
+	protected void createFieldEditors() {
+		this.addField(new StringFieldEditor(RubyPreferences.HOME, "Ruby Home", this.getFieldEditorParent()));
+		
+		this.addField(new StringFieldEditor(RubyPreferences.EXECUTABLE_FILENAME, "Ruby executable name", this.getFieldEditorParent()));
+	}
+}

Property changes on: TXM/trunk/bundles/org.txm.ruby.rcp/src/org/txm/ruby/rcp/RubyPreferencesPage.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.ruby.rcp/icon/ruby.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: TXM/trunk/bundles/org.txm.ruby.rcp/icon/ruby.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: TXM/trunk/bundles/org.txm.ruby.rcp/build.properties
===================================================================
--- TXM/trunk/bundles/org.txm.ruby.rcp/build.properties	(revision 0)
+++ TXM/trunk/bundles/org.txm.ruby.rcp/build.properties	(revision 3659)
@@ -0,0 +1,5 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+               .,\
+               plugin.xml

Property changes on: TXM/trunk/bundles/org.txm.ruby.rcp/build.properties
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.ruby.rcp/plugin.xml
===================================================================
--- TXM/trunk/bundles/org.txm.ruby.rcp/plugin.xml	(revision 0)
+++ TXM/trunk/bundles/org.txm.ruby.rcp/plugin.xml	(revision 3659)
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+   <extension
+         point="org.eclipse.ui.preferencePages">
+      <page
+            category="org.txm.rcp.preferences.ScriptPreferencePage"
+            class="org.txm.ruby.rcp.RubyPreferencesPage"
+            id="org.txm.ruby.rcp.RubyPreferencesPage"
+            name="Ruby">
+      </page>
+   </extension>
+
+</plugin>

Property changes on: TXM/trunk/bundles/org.txm.ruby.rcp/plugin.xml
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.ruby.rcp/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- TXM/trunk/bundles/org.txm.ruby.rcp/.settings/org.eclipse.jdt.core.prefs	(revision 0)
+++ TXM/trunk/bundles/org.txm.ruby.rcp/.settings/org.eclipse.jdt.core.prefs	(revision 3659)
@@ -0,0 +1,7 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
+org.eclipse.jdt.core.compiler.compliance=1.8
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.8

Property changes on: TXM/trunk/bundles/org.txm.ruby.rcp/.settings/org.eclipse.jdt.core.prefs
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.ruby.rcp/.classpath
===================================================================
--- TXM/trunk/bundles/org.txm.ruby.rcp/.classpath	(revision 0)
+++ TXM/trunk/bundles/org.txm.ruby.rcp/.classpath	(revision 3659)
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
+	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins">
+		<accessrules>
+			<accessrule kind="accessible" pattern="**"/>
+		</accessrules>
+	</classpathentry>
+	<classpathentry kind="src" path="src"/>
+	<classpathentry kind="output" path="bin"/>
+</classpath>

Property changes on: TXM/trunk/bundles/org.txm.ruby.rcp/.classpath
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.ruby.rcp/META-INF/MANIFEST.MF
===================================================================
--- TXM/trunk/bundles/org.txm.ruby.rcp/META-INF/MANIFEST.MF	(revision 0)
+++ TXM/trunk/bundles/org.txm.ruby.rcp/META-INF/MANIFEST.MF	(revision 3659)
@@ -0,0 +1,11 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: org.txm.ruby.rcp
+Bundle-SymbolicName: org.txm.ruby.rcp;singleton:=true
+Bundle-Version: 1.0.0.qualifier
+Bundle-Vendor: textometrie.org
+Automatic-Module-Name: org.txm.ruby.rcp
+Bundle-RequiredExecutionEnvironment: JavaSE-16
+Require-Bundle: org.txm.rcp;bundle-version="0.8.3",
+ org.txm.ruby.core;bundle-version="1.0.0";visibility:=reexport
+Export-Package: org.txm.ruby.rcp

Property changes on: TXM/trunk/bundles/org.txm.ruby.rcp/META-INF/MANIFEST.MF
___________________________________________________________________
Added: svn:mime-type
   + text/plain


Property changes on: TXM/trunk/bundles/org.txm.ruby.rcp
___________________________________________________________________
Added: svn:ignore
   + target


Index: TXM/trunk/bundles/org.txm.searchengine.cqp.core/plugin.xml
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.core/plugin.xml	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.core/plugin.xml	(revision 3659)
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>  
+   <extension
+         point="org.txm.searchengine.core.SearchEngine">
+      <SearchEngine
+            class="org.txm.searchengine.cqp.CQPSearchEngine">
+      </SearchEngine>
+   </extension>
+   <extension
+         point="org.eclipse.core.runtime.preferences">
+      <initializer
+            class="org.txm.searchengine.cqp.CQPPreferences">
+      </initializer>
+      <initializer
+            class="org.txm.searchengine.cqp.core.preferences.SubcorpusPreferences">
+      </initializer>
+      <initializer
+            class="org.txm.searchengine.cqp.core.preferences.PartitionPreferences">
+      </initializer>
+   </extension>
+
+
+</plugin>

Property changes on: TXM/trunk/bundles/org.txm.searchengine.cqp.core/plugin.xml
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.core/.settings/org.eclipse.core.resources.prefs
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.core/.settings/org.eclipse.core.resources.prefs	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.core/.settings/org.eclipse.core.resources.prefs	(revision 3659)
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+encoding//src/org/txm/searchengine/cqp/core/messages/messages_fr.properties=UTF-8

Property changes on: TXM/trunk/bundles/org.txm.searchengine.cqp.core/.settings/org.eclipse.core.resources.prefs
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.core/.classpath
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.core/.classpath	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.core/.classpath	(revision 3659)
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="con"
+		path="org.eclipse.jdt.launching.JRE_CONTAINER" />
+	<classpathentry kind="con"
+		path="org.eclipse.pde.core.requiredPlugins">
+		<accessrules>
+			<accessrule kind="accessible" pattern="**" />
+		</accessrules>
+	</classpathentry>
+	<classpathentry kind="src" path="src" />
+	<classpathentry kind="output" path="bin" />
+</classpath>
\ No newline at end of file

Property changes on: TXM/trunk/bundles/org.txm.searchengine.cqp.core/.classpath
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.core/META-INF/MANIFEST.MF
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.core/META-INF/MANIFEST.MF	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.core/META-INF/MANIFEST.MF	(revision 3659)
@@ -0,0 +1,25 @@
+Manifest-Version: 1.0
+Export-Package: org.txm.importer.cwb,
+ org.txm.searchengine.cqp,
+ org.txm.searchengine.cqp.clientExceptions,
+ org.txm.searchengine.cqp.core.functions.preview,
+ org.txm.searchengine.cqp.core.functions.selection,
+ org.txm.searchengine.cqp.core.functions.summary,
+ org.txm.searchengine.cqp.core.messages,
+ org.txm.searchengine.cqp.core.preferences,
+ org.txm.searchengine.cqp.core.tests,
+ org.txm.searchengine.cqp.corpus,
+ org.txm.searchengine.cqp.corpus.query,
+ org.txm.searchengine.cqp.serverException
+Bundle-SymbolicName: org.txm.searchengine.cqp.core;singleton:=true
+Bundle-Version: 1.1.0.qualifier
+Bundle-Name: %Bundle-Name
+Bundle-ClassPath: .
+Require-Bundle: org.txm.searchengine.core;bundle-version="1.0.0";visib
+ ility:=reexport,org.txm.libs.cqp;bundle-version="1.0.0";visibility:=r
+ eexport
+Bundle-ManifestVersion: 2
+Bundle-RequiredExecutionEnvironment: JavaSE-16
+Bundle-Vendor: %Bundle-Vendor
+Automatic-Module-Name: org.txm.searchengine.cqp.core
+

Property changes on: TXM/trunk/bundles/org.txm.searchengine.cqp.core/META-INF/MANIFEST.MF
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.core/.project
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.core/.project	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.core/.project	(revision 3659)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>org.txm.searchengine.cqp.core</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.pde.ManifestBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.pde.SchemaBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.pde.PluginNature</nature>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+	</natures>
+</projectDescription>

Property changes on: TXM/trunk/bundles/org.txm.searchengine.cqp.core/.project
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/CQPPreferences.java
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/CQPPreferences.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/CQPPreferences.java	(revision 3659)
@@ -0,0 +1,36 @@
+package org.txm.searchengine.cqp;
+
+import org.txm.core.preferences.TXMPreferences;
+
+/**
+ * CQP preferences initializer.
+ * 
+ * @author mdecorde
+ * @author sjacquot
+ *
+ */
+public class CQPPreferences extends TXMPreferences {
+	
+
+	/**
+	 * List of part names.
+	 */
+	public static final String PART_NAMES = "part_names"; //$NON-NLS-1$
+	
+	/**
+	 * Gets the instance.
+	 * @return the instance
+	 */
+	public static TXMPreferences getInstance()	{
+		if (!TXMPreferences.instances.containsKey(CQPPreferences.class)) {
+			new CQPPreferences();
+		}
+		return TXMPreferences.instances.get(CQPPreferences.class);
+	}
+
+
+	@Override
+	public void initializeDefaultPreferences() {
+		super.initializeDefaultPreferences();
+	}
+}

Property changes on: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/CQPPreferences.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/serverException/CqiClErrorWrongAttributeType.java
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/serverException/CqiClErrorWrongAttributeType.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/serverException/CqiClErrorWrongAttributeType.java	(revision 3659)
@@ -0,0 +1,40 @@
+// Copyright © 2010-2020 ENS de Lyon., University of Franche-Comté
+// 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: 2013-05-06 17:38:43 +0200 (lun., 06 mai 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.searchengine.cqp.serverException;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class CqiClErrorWrongAttributeType.
+ */
+public class CqiClErrorWrongAttributeType extends CqiClError {
+
+	/** The Constant serialVersionUID. */
+	private static final long serialVersionUID = 1L;
+	public CqiClErrorWrongAttributeType(){super();}
+	public CqiClErrorWrongAttributeType(String msg){super(msg);}
+}

Property changes on: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/serverException/CqiClErrorWrongAttributeType.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/serverException/CqiClErrorNoSuchAttribute.java
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/serverException/CqiClErrorNoSuchAttribute.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/serverException/CqiClErrorNoSuchAttribute.java	(revision 3659)
@@ -0,0 +1,40 @@
+// Copyright © 2010-2020 ENS de Lyon., University of Franche-Comté
+// 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: 2013-05-06 17:38:43 +0200 (lun., 06 mai 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.searchengine.cqp.serverException;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class CqiClErrorNoSuchAttribute.
+ */
+public class CqiClErrorNoSuchAttribute extends CqiClError {
+
+	/** The Constant serialVersionUID. */
+	private static final long serialVersionUID = 1L;
+	public CqiClErrorNoSuchAttribute() {super();}
+	public CqiClErrorNoSuchAttribute(String msg) {super(msg);}
+}

Property changes on: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/serverException/CqiClErrorNoSuchAttribute.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/serverException/CqiClErrorOutOfMemory.java
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/serverException/CqiClErrorOutOfMemory.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/serverException/CqiClErrorOutOfMemory.java	(revision 3659)
@@ -0,0 +1,40 @@
+// Copyright © 2010-2020 ENS de Lyon., University of Franche-Comté
+// 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: 2013-05-06 17:38:43 +0200 (lun., 06 mai 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.searchengine.cqp.serverException;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class CqiClErrorOutOfMemory.
+ */
+public class CqiClErrorOutOfMemory extends CqiClError {
+
+	/** The Constant serialVersionUID. */
+	private static final long serialVersionUID = 1L;
+	public CqiClErrorOutOfMemory(){super();}
+	public CqiClErrorOutOfMemory(String msg){super(msg);}
+}

Property changes on: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/serverException/CqiClErrorOutOfMemory.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/serverException/CqiErrorUserAbort.java
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/serverException/CqiErrorUserAbort.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/serverException/CqiErrorUserAbort.java	(revision 3659)
@@ -0,0 +1,40 @@
+// Copyright © 2010-2020 ENS de Lyon., University of Franche-Comté
+// 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: 2013-05-06 17:38:43 +0200 (lun., 06 mai 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.searchengine.cqp.serverException;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class CqiErrorUserAbort.
+ */
+public class CqiErrorUserAbort extends CqiServerError {
+
+	/** The Constant serialVersionUID. */
+	private static final long serialVersionUID = 1L;
+	public CqiErrorUserAbort(){super();}
+	public CqiErrorUserAbort(String msg){super(msg);}
+}

Property changes on: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/serverException/CqiErrorUserAbort.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/serverException/CqiServerError.java
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/serverException/CqiServerError.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/serverException/CqiServerError.java	(revision 3659)
@@ -0,0 +1,42 @@
+// Copyright © 2010-2020 ENS de Lyon., University of Franche-Comté
+// 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: 2013-05-06 17:38:43 +0200 (lun., 06 mai 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.searchengine.cqp.serverException;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The base class for all exceptions wrapping an error sent by teh CQi server.
+ *
+ * @author Jean-Philippe Magué
+ */
+public class CqiServerError extends Exception {
+
+	/** The Constant serialVersionUID. */
+	private static final long serialVersionUID = 1L;
+	public CqiServerError(){super();}
+	public CqiServerError(String msg){super(msg);}
+}

Property changes on: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/serverException/CqiServerError.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/serverException/CqiErrorConnectRefused.java
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/serverException/CqiErrorConnectRefused.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/serverException/CqiErrorConnectRefused.java	(revision 3659)
@@ -0,0 +1,40 @@
+// Copyright © 2010-2020 ENS de Lyon., University of Franche-Comté
+// 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: 2013-05-06 17:38:43 +0200 (lun., 06 mai 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.searchengine.cqp.serverException;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class CqiErrorConnectRefused.
+ */
+public class CqiErrorConnectRefused extends CqiServerError {
+
+	/** The Constant serialVersionUID. */
+	private static final long serialVersionUID = 1L;
+	public CqiErrorConnectRefused(){super();}
+	public CqiErrorConnectRefused(String msg){super(msg);}
+}

Property changes on: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/serverException/CqiErrorConnectRefused.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/serverException/package.html
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/serverException/package.html	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/serverException/package.html	(revision 3659)
@@ -0,0 +1,5 @@
+<html>
+<body>
+	<p>Exceptions due to pure internal cqp server unexpected behaviour.</p>
+</body>
+</html>
\ No newline at end of file

Property changes on: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/serverException/package.html
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/serverException/CqiClErrorCorpusAccess.java
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/serverException/CqiClErrorCorpusAccess.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/serverException/CqiClErrorCorpusAccess.java	(revision 3659)
@@ -0,0 +1,40 @@
+// Copyright © 2010-2020 ENS de Lyon., University of Franche-Comté
+// 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: 2013-05-06 17:38:43 +0200 (lun., 06 mai 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.searchengine.cqp.serverException;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class CqiClErrorCorpusAccess.
+ */
+public class CqiClErrorCorpusAccess extends CqiClError {
+
+	/** The Constant serialVersionUID. */
+	private static final long serialVersionUID = 1L;
+	public CqiClErrorCorpusAccess(){super();}
+	public CqiClErrorCorpusAccess(String msg){super(msg);}
+}

Property changes on: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/serverException/CqiClErrorCorpusAccess.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/serverException/CqiCqpErrorOutOfRange.java
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/serverException/CqiCqpErrorOutOfRange.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/serverException/CqiCqpErrorOutOfRange.java	(revision 3659)
@@ -0,0 +1,40 @@
+// Copyright © 2010-2020 ENS de Lyon., University of Franche-Comté
+// 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: 2013-05-06 17:38:43 +0200 (lun., 06 mai 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.searchengine.cqp.serverException;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class CqiCqpErrorOutOfRange.
+ */
+public class CqiCqpErrorOutOfRange extends CqiCqpError {
+
+	/** The Constant serialVersionUID. */
+	private static final long serialVersionUID = 1L;
+	public CqiCqpErrorOutOfRange(){super();}
+	public CqiCqpErrorOutOfRange(String msg){super(msg);}
+}

Property changes on: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/serverException/CqiCqpErrorOutOfRange.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/serverException/CqiCqpError.java
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/serverException/CqiCqpError.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/serverException/CqiCqpError.java	(revision 3659)
@@ -0,0 +1,40 @@
+// Copyright © 2010-2020 ENS de Lyon., University of Franche-Comté
+// 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: 2013-05-06 17:38:43 +0200 (lun., 06 mai 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.searchengine.cqp.serverException;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class CqiCqpError.
+ */
+public class CqiCqpError extends CqiServerError {
+
+	/** The Constant serialVersionUID. */
+	private static final long serialVersionUID = 1L;
+	public CqiCqpError(){super();}
+	public CqiCqpError(String msg){super(msg);}
+}

Property changes on: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/serverException/CqiCqpError.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/serverException/CqiErrorGeneralError.java
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/serverException/CqiErrorGeneralError.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/serverException/CqiErrorGeneralError.java	(revision 3659)
@@ -0,0 +1,40 @@
+// Copyright © 2010-2020 ENS de Lyon., University of Franche-Comté
+// 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: 2013-05-06 17:38:43 +0200 (lun., 06 mai 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.searchengine.cqp.serverException;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class CqiErrorGeneralError.
+ */
+public class CqiErrorGeneralError extends CqiServerError {
+
+	/** The Constant serialVersionUID. */
+	private static final long serialVersionUID = 1L;
+	public CqiErrorGeneralError(){super();}
+	public CqiErrorGeneralError(String msg){super(msg);}
+}

Property changes on: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/serverException/CqiErrorGeneralError.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/serverException/CqiClErrorOutOfRange.java
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/serverException/CqiClErrorOutOfRange.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/serverException/CqiClErrorOutOfRange.java	(revision 3659)
@@ -0,0 +1,40 @@
+// Copyright © 2010-2020 ENS de Lyon., University of Franche-Comté
+// 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: 2013-05-06 17:38:43 +0200 (lun., 06 mai 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.searchengine.cqp.serverException;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class CqiClErrorOutOfRange.
+ */
+public class CqiClErrorOutOfRange extends CqiClError {
+
+	/** The Constant serialVersionUID. */
+	private static final long serialVersionUID = 1L;
+	public CqiClErrorOutOfRange(){super();}
+	public CqiClErrorOutOfRange(String msg){super(msg);}
+}

Property changes on: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/serverException/CqiClErrorOutOfRange.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/serverException/CqiClErrorRegex.java
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/serverException/CqiClErrorRegex.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/serverException/CqiClErrorRegex.java	(revision 3659)
@@ -0,0 +1,40 @@
+// Copyright © 2010-2020 ENS de Lyon., University of Franche-Comté
+// 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: 2013-05-06 17:38:43 +0200 (lun., 06 mai 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.searchengine.cqp.serverException;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class CqiClErrorRegex.
+ */
+public class CqiClErrorRegex extends CqiClError {
+
+	/** The Constant serialVersionUID. */
+	private static final long serialVersionUID = 1L;
+	public CqiClErrorRegex(){super();}
+	public CqiClErrorRegex(String msg){super(msg);}
+}

Property changes on: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/serverException/CqiClErrorRegex.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/serverException/CqiCqpErrorSyntax.java
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/serverException/CqiCqpErrorSyntax.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/serverException/CqiCqpErrorSyntax.java	(revision 3659)
@@ -0,0 +1,40 @@
+// Copyright © 2010-2020 ENS de Lyon., University of Franche-Comté
+// 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: 2011-05-09 14:58:28 +0200 (lun., 09 mai 2011) $
+// $LastChangedRevision: 1839 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.searchengine.cqp.serverException;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class CqiCqpErrorErrorGeneral.
+ */
+public class CqiCqpErrorSyntax extends CqiCqpError {
+
+	/** The Constant serialVersionUID. */
+	private static final long serialVersionUID = 1L;
+	public CqiCqpErrorSyntax(){super();}
+	public CqiCqpErrorSyntax(String msg){super(msg);}
+}

Property changes on: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/serverException/CqiCqpErrorSyntax.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/serverException/CqiClErrorInternal.java
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/serverException/CqiClErrorInternal.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/serverException/CqiClErrorInternal.java	(revision 3659)
@@ -0,0 +1,40 @@
+// Copyright © 2010-2020 ENS de Lyon., University of Franche-Comté
+// 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: 2013-05-06 17:38:43 +0200 (lun., 06 mai 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.searchengine.cqp.serverException;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class CqiClErrorInternal.
+ */
+public class CqiClErrorInternal extends CqiClError {
+
+	/** The Constant serialVersionUID. */
+	private static final long serialVersionUID = 1L;
+	public CqiClErrorInternal(){super();}
+	public CqiClErrorInternal(String msg){super(msg);}
+}

Property changes on: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/serverException/CqiClErrorInternal.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/serverException/CqiCqpErrorErrorGeneral.java
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/serverException/CqiCqpErrorErrorGeneral.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/serverException/CqiCqpErrorErrorGeneral.java	(revision 3659)
@@ -0,0 +1,40 @@
+// Copyright © 2010-2020 ENS de Lyon., University of Franche-Comté
+// 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: 2013-05-06 17:38:43 +0200 (lun., 06 mai 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.searchengine.cqp.serverException;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class CqiCqpErrorErrorGeneral.
+ */
+public class CqiCqpErrorErrorGeneral extends CqiCqpError {
+
+	/** The Constant serialVersionUID. */
+	private static final long serialVersionUID = 1L;
+	public CqiCqpErrorErrorGeneral(){super();}
+	public CqiCqpErrorErrorGeneral(String msg){super(msg);}
+}

Property changes on: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/serverException/CqiCqpErrorErrorGeneral.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/serverException/CqiClError.java
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/serverException/CqiClError.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/serverException/CqiClError.java	(revision 3659)
@@ -0,0 +1,43 @@
+// Copyright © 2010-2020 ENS de Lyon., University of Franche-Comté
+// 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: 2013-05-06 17:38:43 +0200 (lun., 06 mai 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.searchengine.cqp.serverException;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The base class for all exceptions wrapping a CL based error sent by the CQi
+ * server.
+ *
+ * @author Jean-Philippe Magué
+ */
+public class CqiClError extends CqiServerError {
+
+	/** The Constant serialVersionUID. */
+	private static final long serialVersionUID = 1L;
+	public CqiClError(){super();}
+	public CqiClError(String msg){super(msg);}
+}

Property changes on: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/serverException/CqiClError.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/serverException/CqiCqpErrorInvalidField.java
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/serverException/CqiCqpErrorInvalidField.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/serverException/CqiCqpErrorInvalidField.java	(revision 3659)
@@ -0,0 +1,40 @@
+// Copyright © 2010-2020 ENS de Lyon., University of Franche-Comté
+// 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: 2013-05-06 17:38:43 +0200 (lun., 06 mai 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.searchengine.cqp.serverException;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class CqiCqpErrorInvalidField.
+ */
+public class CqiCqpErrorInvalidField extends CqiCqpError {
+
+	/** The Constant serialVersionUID. */
+	private static final long serialVersionUID = 1L;
+	public CqiCqpErrorInvalidField(){super();}
+	public CqiCqpErrorInvalidField(String msg){super(msg);}
+}

Property changes on: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/serverException/CqiCqpErrorInvalidField.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/serverException/CqiCqpErrorNoSuchCorpus.java
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/serverException/CqiCqpErrorNoSuchCorpus.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/serverException/CqiCqpErrorNoSuchCorpus.java	(revision 3659)
@@ -0,0 +1,40 @@
+// Copyright © 2010-2020 ENS de Lyon., University of Franche-Comté
+// 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: 2013-05-06 17:38:43 +0200 (lun., 06 mai 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.searchengine.cqp.serverException;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class CqiCqpErrorNoSuchCorpus.
+ */
+public class CqiCqpErrorNoSuchCorpus extends CqiCqpError {
+
+	/** The Constant serialVersionUID. */
+	private static final long serialVersionUID = 1L;
+	public CqiCqpErrorNoSuchCorpus(){super();}
+	public CqiCqpErrorNoSuchCorpus(String msg){super(msg);}
+}

Property changes on: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/serverException/CqiCqpErrorNoSuchCorpus.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/serverException/CqiErrorSyntaxError.java
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/serverException/CqiErrorSyntaxError.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/serverException/CqiErrorSyntaxError.java	(revision 3659)
@@ -0,0 +1,40 @@
+// Copyright © 2010-2020 ENS de Lyon., University of Franche-Comté
+// 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: 2013-05-06 17:38:43 +0200 (lun., 06 mai 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.searchengine.cqp.serverException;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class CqiErrorSyntaxError.
+ */
+public class CqiErrorSyntaxError extends CqiServerError {
+
+	/** The Constant serialVersionUID. */
+	private static final long serialVersionUID = 1L;
+	public CqiErrorSyntaxError(){super();}
+	public CqiErrorSyntaxError(String msg){super(msg);}
+}

Property changes on: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/serverException/CqiErrorSyntaxError.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/core/messages/CQPSearchEngineCoreMessages.java
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/core/messages/CQPSearchEngineCoreMessages.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/core/messages/CQPSearchEngineCoreMessages.java	(revision 3659)
@@ -0,0 +1,94 @@
+package org.txm.searchengine.cqp.core.messages;
+
+import org.eclipse.osgi.util.NLS;
+import org.txm.utils.messages.Utf8NLS;
+
+
+/**
+ * CQP Search engine core messages.
+ * 
+ * @author mdecorde
+ * @author sjacquot
+ *
+ */
+public class CQPSearchEngineCoreMessages extends NLS {
+
+	private static final String BUNDLE_NAME = "org.txm.searchengine.cqp.core.messages.messages"; //$NON-NLS-1$
+
+	public static String errorColonTextP0IsNull; 
+	public static String errorColonEditionDefaultIsNull; 
+	public static String errorColonTextidsP0AndWordidsP1; 
+	public static String p0IsNotAValidCQPIDForASubcorpusItMustBeAnUppercaseCharacterFollowedByLowercaseCharacters; 
+
+	public static String connectingToTheSearchEngineWithTheFollowingParametersColonP0ColonP1AtP2P3; 
+	public static String connectedToTheSearchEngine; 
+	public static String gettingLastCQPError; 
+	public static String searchEngineLaunched; 
+	public static String failedToConnectToSearchEngine; 
+	public static String theDirectoryDoesNotExistsColon; 
+	public static String theBinaryDirectoryDoesNotExistsColon; 
+	public static String theRegistryDirectoryDoesNotExistsColon; 
+	public static String theCorporaDirectoryDoesNotExistsColon; 
+	public static String processingCorpus; 
+	public static String theDataDirectoryDoesNotExistsColon; 
+	public static String fixingRegistryFileP0WithP1; 
+	public static String startingProcessWithCommandColon; 
+	public static String stoppingProcessColon; 
+	public static String processStopedColon; 
+	public static String cantFindCQPLocationColon; 
+
+	public static String internalCQIErrorColon; 
+	public static String unknownCQPCodesColonB1; 
+	public static String queryError; 
+	public static String cLErrorColon; 
+	public static String cQPErrorColonP0; 
+	public static String unknownCQPErrorColonB1; 
+	public static String unknownCQPCQIErrorColonB1; 
+	public static String unknownCQPCodeColonB1; 
+	public static String b2; 
+	public static String lastCQiErrorColon; 
+	public static String lastCQPErrorColon; 
+	public static String couldNotReconnectToServerColon; 
+	public static String clientdumpSubCorpussubcorpusNetCqiClientCQICONSTFIELDMATCH12Colon; 
+	public static String cqpserverStdoutColon; 
+	public static String cqpserverStderrColon; 
+	public static String noError; 
+	public static String theFileP0CannotBeFound; 
+	
+	public static String sourceRegistryDoesNotExistsColon; 
+	public static String cantFindRegistryFile; 
+	public static String dataDirectory; 
+	public static String couldNotPatchTheRegistryFile; 
+	public static String couldNotBeFoundInRegistryFile; 
+	public static String updating; 
+	public static String updatingP0CorpusLanguageToP1; 
+
+	public static String theTargetCorpusDoesntExist; 
+	public static String addingAlignmentAttributeToCorpusP0RegistryColonP1; 
+	
+	public static String readString2DIntegerFromTheCQiServerColonP0; 
+	public static String readBooleanFromTheCQiServerColonP0; 
+	public static String readByteFromTheCQiServerColonP0; 
+	public static String readIntegerArrayFromTheCQiServerColonP0; 
+	public static String readIntegerFromTheCQiServerColonP0; 
+	public static String readStringArrayFromTheCQiServerColonP0; 
+	public static String readStringFromTheCQiServerColonP0; 
+	public static String readingAnIntegerTableFromTheCQiServer; 
+	public static String readingBooleanFromTheCQiServer; 
+	public static String readingHeaderFromTheCQiServer; 
+	public static String readingIntegerArrayFromTheCQiServer; 
+	public static String readingIntegerFromTheCQiServer; 
+	public static String readingStringArrayFromTheCQiServer; 
+	public static String readingStringFromTheCQiServer; 
+
+	
+	
+	static {
+		// initialize resource bundle
+		Utf8NLS.initializeMessages(BUNDLE_NAME, CQPSearchEngineCoreMessages.class);
+	}
+
+	private CQPSearchEngineCoreMessages() {
+	}
+	
+}

Property changes on: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/core/messages/CQPSearchEngineCoreMessages.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/core/messages/messages.properties
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/core/messages/messages.properties	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/core/messages/messages.properties	(revision 3659)
@@ -0,0 +1,62 @@
+#TXM messages generated by the PluginMessagesManager class
+#Fri Jun 10 16:36:03 CEST 2022
+addingAlignmentAttributeToCorpusP0RegistryColonP1=Adding to the register of corpus {0} the alignment attribute {1}...
+b2=b2 
+cantFindCQPLocationColon=** Can not find CQP location at {0}.
+cantFindRegistryFile=** Can not find 'registry' file.
+cLErrorColon=** CQP CL error\: {0}
+clientdumpSubCorpussubcorpusNetCqiClientCQICONSTFIELDMATCH12Colon=client.dumpSubCorpus(subcorpus, NetCqiClient.CQI_CONST_FIELD_MATCH, 1, 2) \: 
+connectedToTheSearchEngine=Connected to the search engine.
+connectingToTheSearchEngineWithTheFollowingParametersColonP0ColonP1AtP2P3=Connecting to the search engine with the following parameters\: {0}\:{1}@{2}{3}…
+couldNotBeFoundInRegistryFile={0} not found in registry file {1}.
+couldNotPatchTheRegistryFile=** Can not update the 'registry' file.
+couldNotReconnectToServerColon=** Can not reconnect to CQP server\: 
+cQPErrorColonP0=** CQP error\: {0}
+cqpserverStderrColon=** cqpserver stderr\: 
+cqpserverStdoutColon=** cqpserver stdout\: 
+dataDirectory=The 'data' folder {0} does not exist.
+errorColonEditionDefaultIsNull=** Error \: default edition is null
+errorColonTextidsP0AndWordidsP1=** Error\: text identifiers {0} and word identifiers {1}.
+errorColonTextP0IsNull=** Error\: text {0} has null value.
+failedToConnectToSearchEngine=** Failed to connect to the search engine.
+fixingRegistryFileP0WithP1=Fixing registry file {0} with {1}.
+gettingLastCQPError=Last CQP error retrieval.
+internalCQIErrorColon=Internal CQI error\: 
+lastCQiErrorColon=Last CQi error\: {0}.
+lastCQPErrorColon=Last CQP error\: {0}.
+noError=No error to notify.
+p0IsNotAValidCQPIDForASubcorpusItMustBeAnUppercaseCharacterFollowedByLowercaseCharacters={0} is not a valid CQP identifier for a sub-corpus. It must be in uppercase followed by lowercase characters.
+processingCorpus=Processing corpus "{0}"…
+processStopedColon=Process {0} stopped.
+queryError=Query error
+readBooleanFromTheCQiServerColonP0=Boolean read from the CQi server\: {0}.
+readByteFromTheCQiServerColonP0=Byte read from the CQi server\: {0}.
+readingAnIntegerTableFromTheCQiServer=Reading an integer table from the CQi server…
+readingBooleanFromTheCQiServer=Reading a boolean from the CQi server…
+readingHeaderFromTheCQiServer=Reading a header from the CQi server…
+readingIntegerArrayFromTheCQiServer=Reading an integer vector from the CQi server…
+readingIntegerFromTheCQiServer=Reading an integer from the CQi server…
+readingStringArrayFromTheCQiServer=Reading a string vector from the CQi server…
+readingStringFromTheCQiServer=Reading a string from the CQi server…
+readIntegerArrayFromTheCQiServerColonP0=Integer vector read from the CQi server\: {0}.
+readIntegerFromTheCQiServerColonP0=Integer read from the CQi server\: {0}.
+readString2DIntegerFromTheCQiServerColonP0=2D integer array read from the CQi server\: {0}.
+readStringArrayFromTheCQiServerColonP0=String vector read from the CQi server\: {0}.
+readStringFromTheCQiServerColonP0=String read from the CQi server\: {0}.
+searchEngineLaunched=Search engine launched…
+sourceRegistryDoesNotExistsColon=No registry file in {0}.
+startingProcessWithCommandColon=Starting the process with command line\: {0}
+stoppingProcessColon=Stopping the process\: {0}
+theBinaryDirectoryDoesNotExistsColon=No "bin" folder in {0}.
+theCorporaDirectoryDoesNotExistsColon=No "corpora" folder in {0}.
+theDataDirectoryDoesNotExistsColon=No "data" folder in {0}.
+theDirectoryDoesNotExistsColon=The {0} folder does not exist.
+theFileP0CannotBeFound=The {0} file can not be found.
+theRegistryDirectoryDoesNotExistsColon=No "registry" folder in {0}.  
+theTargetCorpusDoesntExist=** The target corpus {0} does not exist.
+unknownCQPCodeColonB1=Unknown CQP code\: b1 
+unknownCQPCodesColonB1=Unknown CQP codes\: b1 
+unknownCQPCQIErrorColonB1=** Unknown CQP/CQI error\: b1 
+unknownCQPErrorColonB1=** Unknown CQP error\: b1 
+updating=Updating {0} corpus encoding to {1}…
+updatingP0CorpusLanguageToP1=Updating {0} corpus language to {1}…

Property changes on: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/core/messages/messages.properties
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/core/messages/messages_fr.properties
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/core/messages/messages_fr.properties	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/core/messages/messages_fr.properties	(revision 3659)
@@ -0,0 +1,62 @@
+#TXM messages generated by the PluginMessagesManager class
+#Fri Jun 10 16:36:03 CEST 2022
+addingAlignmentAttributeToCorpusP0RegistryColonP1=Ajout au registre du corpus {0} l''attribut d'alignement {1}…
+b2=b2 
+cantFindCQPLocationColon=** Échec de localisation de CQP à {0}.
+cantFindRegistryFile=** Le fichier 'registry' est introuvable.
+cLErrorColon=** Erreur CL CQP \: {0}
+clientdumpSubCorpussubcorpusNetCqiClientCQICONSTFIELDMATCH12Colon=client.dumpSubCorpus(subcorpus, NetCqiClient.CQI_CONST_FIELD_MATCH, 1, 2) \: 
+connectedToTheSearchEngine=Connecté au moteur de recherche.
+connectingToTheSearchEngineWithTheFollowingParametersColonP0ColonP1AtP2P3=Connexion au moteur de recherche avec les paramètres suivants \: {0}\:{1}@{2}{3}…
+couldNotBeFoundInRegistryFile={0} n'a pas été trouvé dans le fichier de registre {1}.
+couldNotPatchTheRegistryFile=** Impossible de mettre à jour le fichier 'registry'.
+couldNotReconnectToServerColon=** Échec de la reconnexion au serveur \: 
+cQPErrorColonP0=** Erreur CQP\: {0}
+cqpserverStderrColon=** cqpserver stderr\: 
+cqpserverStdoutColon=** cqpserver stdout\: 
+dataDirectory=Le dossier 'data'' {0} n''existe pas.
+errorColonEditionDefaultIsNull=** Erreur \: l'édition par défaut est nulle
+errorColonTextidsP0AndWordidsP1=** Erreur \: identifiants de textes {0} et identifiants de mots {1}.
+errorColonTextP0IsNull=** Erreur \: text {0} est de valeur nulle.
+failedToConnectToSearchEngine=** Échec de connexion au moteur de recherche.
+fixingRegistryFileP0WithP1=Mise à jour du fichier registry {0} avec {1}.
+gettingLastCQPError=Récupération de la dernière erreur CQP.
+internalCQIErrorColon=Erreur interne CQI \: 
+lastCQiErrorColon=Dernière erreur CQi \: {0}.
+lastCQPErrorColon=Dernière erreur CQP \: {0}.
+noError=Pas d'erreur à notifier.
+p0IsNotAValidCQPIDForASubcorpusItMustBeAnUppercaseCharacterFollowedByLowercaseCharacters={0} n'est pas un identifiant de sous-corpus CQP valide. Il doit être en majuscules suivies de caractères minuscules.
+processingCorpus=Traitement du corpus "{0}"…
+processStopedColon=Processus {0} arrêté.
+queryError=Erreur de requête
+readBooleanFromTheCQiServerColonP0=Booléen reçu du serveur CQi \: {0}.
+readByteFromTheCQiServerColonP0=Octet reçu du serveur CQi \: {0}.
+readingAnIntegerTableFromTheCQiServer=Lecture d'un tableau d'entiers du serveur CQi…
+readingBooleanFromTheCQiServer=Lecture d'un booléen du serveur CQi…
+readingHeaderFromTheCQiServer=Lecture d'une entête du serveur CQi…
+readingIntegerArrayFromTheCQiServer=Lecture d'un vecteur d'entiers du serveur CQi…
+readingIntegerFromTheCQiServer=Lecture d'un entier du serveur CQi…
+readingStringArrayFromTheCQiServer=Lecture d'un vecteur de chaînes du serveur CQi…
+readingStringFromTheCQiServer=Lecture d'une chaîne du serveur CQi…
+readIntegerArrayFromTheCQiServerColonP0=Vecteur d''entiers reçu du serveur CQi \: {0}.
+readIntegerFromTheCQiServerColonP0=Entier reçu du serveur CQi \: {0}.
+readString2DIntegerFromTheCQiServerColonP0=Tableau d''entiers 2D reçu du serveur CQi \: {0}.
+readStringArrayFromTheCQiServerColonP0=Vector de chaînes reçu du serveur CQi \: {0}.
+readStringFromTheCQiServerColonP0=Chaîne reçue du serveur CQi \: {0}.
+searchEngineLaunched=Moteur de recherche lancé…
+sourceRegistryDoesNotExistsColon=Pas de fichier registry dans {0}.
+startingProcessWithCommandColon=Démarrage du processus avec la ligne de commande \: {0}
+stoppingProcessColon=Arrêt du processus en cours \: {0}
+theBinaryDirectoryDoesNotExistsColon=Pas de dossier "bin" dans {0}.
+theCorporaDirectoryDoesNotExistsColon=Pas de dossier "corpora" dans {0}.
+theDataDirectoryDoesNotExistsColon=Pas de dossier "data" dans {0}.
+theDirectoryDoesNotExistsColon=Le dossier {0} n'existe pas.
+theFileP0CannotBeFound=Le fichier {0} est introuvable.
+theRegistryDirectoryDoesNotExistsColon=Pas de dossier "registry" dans {0}.
+theTargetCorpusDoesntExist=** Le corpus cible {0} n''existe pas.
+unknownCQPCodeColonB1=Code CQP inconnu \: b1 
+unknownCQPCodesColonB1=Codes CQP inconnus \: b1 
+unknownCQPCQIErrorColonB1=** Erreur CQP/CQI inconnue \: b1 
+unknownCQPErrorColonB1=** Erreur CQP inconnue \: b1 
+updating=Mise à jour de l'encodage du corpus {0} vers {1}…
+updatingP0CorpusLanguageToP1=Mise à jour de la langue du corpus {0} vers {1}…

Property changes on: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/core/messages/messages_fr.properties
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/core/functions/selection/package.html
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/core/functions/selection/package.html	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/core/functions/selection/package.html	(revision 3659)
@@ -0,0 +1,5 @@
+<html>
+<body>
+	<p>Selection: select text using metadata values</p>
+</body>
+</html>
\ No newline at end of file

Property changes on: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/core/functions/selection/package.html
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/core/functions/selection/SelectionResult.java
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/core/functions/selection/SelectionResult.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/core/functions/selection/SelectionResult.java	(revision 3659)
@@ -0,0 +1,13 @@
+package org.txm.searchengine.cqp.core.functions.selection;
+
+import java.util.*;
+
+public class SelectionResult extends ArrayList<String>{
+	public HashMap<String,ArrayList<String>> critera = new HashMap<String, ArrayList<String>>();
+	
+	@Override
+	public String toString()
+	{
+		return super.toString() + critera.toString();
+	}
+}

Property changes on: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/core/functions/selection/SelectionResult.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/core/functions/selection/Selection.java
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/core/functions/selection/Selection.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/core/functions/selection/Selection.java	(revision 3659)
@@ -0,0 +1,535 @@
+// Copyright © 2010-2020 ENS de Lyon., University of Franche-Comté
+// 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.core.functions.selection;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+
+import org.txm.core.messages.TXMCoreMessages;
+import org.txm.core.results.TXMParameters;
+import org.txm.core.results.TXMResult;
+import org.txm.metadatas.Metadata;
+import org.txm.metadatas.MetadataGroup;
+import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
+import org.txm.searchengine.cqp.clientExceptions.UnexpectedAnswerException;
+import org.txm.searchengine.cqp.corpus.CQPCorpus;
+import org.txm.searchengine.cqp.corpus.CorpusManager;
+import org.txm.searchengine.cqp.corpus.MainCorpus;
+import org.txm.searchengine.cqp.corpus.Property;
+import org.txm.searchengine.cqp.corpus.QueryResult;
+import org.txm.searchengine.cqp.corpus.StructuralUnit;
+import org.txm.searchengine.cqp.corpus.StructuralUnitProperty;
+import org.txm.searchengine.cqp.corpus.query.Match;
+import org.txm.searchengine.cqp.corpus.query.CQLQuery;
+import org.txm.searchengine.cqp.serverException.CqiServerError;
+import org.txm.utils.TXMProgressMonitor;
+import org.txm.utils.logger.Log;
+
+/**
+ * Used to build sub-corpus of texts.
+ * It links texts to their properties and compute some stats
+ * 
+ * @author mdecorde
+ *
+ */
+public class Selection extends TXMResult {
+	
+	/** Full selection. */
+	CQPCorpus corpus;
+	
+	/** The query to get texts metadatas and number. */
+	CQLQuery query;
+	
+	/** The cqp positions of the texts start element. */
+	int[] positions;
+	
+	/** The all properties. */
+	List<StructuralUnitProperty> allProperties;
+	
+	/** The textids. */
+	List<String> textids;
+	
+	/** The numberofwords. */
+	HashMap<String, Integer> numberOfWordsPerText;
+	
+	/** The text metadatas values. */
+	HashMap<String, HashMap<String, String>> metadatasValuesPerText;
+	
+	HashMap<String, List<String>> valuesPerMetadata;
+	
+	/** The metadatas and groups. */
+	ArrayList<Metadata> metadatas;
+	
+	ArrayList<MetadataGroup> metadatagroups;
+	
+	/** The property and group names per usage. */
+	private ArrayList<String> selectionPropertyNames;
+	
+	private ArrayList<String> displayPropertyNames;
+	
+	private ArrayList<String> selectionGroupNames;
+	
+	private ArrayList<String> displayGroupNames;
+	
+	/** the list of property used per group **/
+	private HashMap<String, List<String>> propertyNamesPerGroup;
+	
+	/**
+	 * Instantiates a new selection.
+	 *
+	 * @param corpus the corpus
+	 */
+	public Selection(MainCorpus corpus) {
+		super(corpus);
+		// this query returns N results, where N is the number of text
+		this.query = new CQLQuery("<text>[]"); //$NON-NLS-1$
+		this.corpus = corpus;
+		init();
+	}
+	
+	/**
+	 * get positions, properties
+	 * and compute texts stats (but not words)
+	 * and get texts metadatas.
+	 */
+	private boolean init() {
+		try {
+			if (corpus.getProject() == null) {
+				System.out.println(TXMCoreMessages.selectionErrorColonTheCorpus + corpus + TXMCoreMessages.hasNoBase);
+				return false;
+			}
+			metadatas = corpus.getImportMetadata();
+			metadatagroups = corpus.getMetadataGroups();
+			
+			// get texts positions
+			QueryResult result = corpus.query(query, "selection", false); //$NON-NLS-1$
+			List<Match> matches = result.getMatches();
+			result.drop();
+			// System.out.println("Nb of texts: "+matches.size());
+			positions = new int[matches.size()]; // starting positions of texts in the corpus
+			for (int i = 0; i < matches.size(); i++)
+				positions[i] = matches.get(i).getStart();
+			
+			// select used structuralUnitsProperties in corpus structuralUnitsProperties
+			StructuralUnit text_su = corpus.getStructuralUnit("text"); //$NON-NLS-1$
+			allProperties = new ArrayList<>();
+			if (metadatas.size() > 0) {
+				for (Metadata m : metadatas) {
+					try {
+						StructuralUnitProperty sup = text_su.getProperty(m.id);
+						if (sup == null) {
+							Log.warning(TXMCoreMessages.cantFindStructuralUnitForMetadataWithIdColon + m.id);
+							continue;
+						}
+						allProperties.add(sup);
+					}
+					catch (Exception e) {
+						Log.severe(TXMCoreMessages.errorWhileGettingMetadatasFromBaseimportMetadatasColon + e);
+					}
+				}
+			}
+			
+			// in case no metadatas are declared in import.xml
+			if (allProperties.size() == 0)
+				for (StructuralUnitProperty sup : text_su.getOrderedProperties())
+				allProperties.add(sup);
+			
+			// get text ids (using starting position of texts) + text size using the positions
+			StructuralUnitProperty sup = text_su.getProperty("id"); //$NON-NLS-1$
+			int[] idx = CorpusManager.getCorpusManager().getCqiClient().cpos2Struc(sup.getQualifiedName(), positions);
+			// System.out.println("cpos2Struc: "+Arrays.toString(idx));
+			String[] textsIdArray = CorpusManager.getCorpusManager().getCqiClient().struc2Str(sup.getQualifiedName(), idx);
+			// System.out.println("struc2Str: "+Arrays.toString(textsIdArray));
+			textids = Arrays.asList(textsIdArray);
+			
+			metadatasValuesPerText = new HashMap<>();
+			numberOfWordsPerText = new HashMap<>();
+			for (int i = 0; i < textids.size(); i++) {
+				this.metadatasValuesPerText.put(textids.get(i), new HashMap<String, String>());
+				
+				// QueryResult result2 = corpus.query(new Query("[_.text_id=\""+textids.get(i)+"\"] expand to text"), "temp", false); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+				QueryResult result2 = corpus.query(new CQLQuery("/region[text,a]:: a.text_id=\"" + textids.get(i) + "\""), "temp", false); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+				int tot = 0;
+				for (Match m : result2.getMatches(0, 0))
+					tot += m.getEnd() - m.getStart();
+				numberOfWordsPerText.put(textids.get(i), tot);
+				result2.drop();
+			}
+			
+			// System.out.println(textMetadatas);
+			// INITIALIZATIONS
+			for (StructuralUnitProperty property : allProperties) {
+				readTextMetadatas(property);
+			}
+			
+			getTextMetadatas();
+			getStructuralUnitPropertyValues();
+			getDisplayPropertyNames();
+			getSelectionPropertyNames();
+			getDisplayGroupNames();
+			getSelectionGroupNames();
+			getMetadataGroupNames();
+		}
+		catch (Exception e) {
+			org.txm.utils.logger.Log.printStackTrace(e);
+			return false;
+		}
+		return true;
+	}
+	
+	public CQPCorpus getCorpus() {
+		return this.corpus;
+	}
+	
+	public HashMap<String, List<String>> getMetadataGroupNames() {
+		if (propertyNamesPerGroup != null)
+			return propertyNamesPerGroup;
+		propertyNamesPerGroup = new HashMap<>();
+		for (MetadataGroup gp : metadatagroups) {
+			ArrayList<String> list = new ArrayList<>();
+			System.out.println("gp: " + gp.id); //$NON-NLS-1$
+			propertyNamesPerGroup.put(gp.id, list);
+			for (Metadata m : gp.metadatas)
+				list.add(m.id);
+		}
+		return propertyNamesPerGroup;
+	}
+	
+	/**
+	 * print the full texts stats.
+	 *
+	 * @throws CqiClientException the cqi client exception
+	 */
+	public void fullDump() throws CqiClientException {
+		System.out.println(TXMCoreMessages.textMetadataColon);
+		System.out.println(TXMCoreMessages.corpusColon + corpus);
+		System.out.println("Text query: " + query); //$NON-NLS-1$
+		System.out.println("Texts ids: " + textids); //$NON-NLS-1$
+		System.out.println("Text positions: " + Arrays.toString(positions)); //$NON-NLS-1$
+		System.out.println("Text nbwords: " + numberOfWordsPerText); //$NON-NLS-1$
+		System.out.println();
+		System.out.println("StructuralUnitsProperties: " + allProperties); //$NON-NLS-1$
+		System.out.println("Meta values per texts: " + metadatasValuesPerText); //$NON-NLS-1$
+		System.out.println("Meta values per name: " + valuesPerMetadata); //$NON-NLS-1$
+		System.out.println();
+		System.out.println("Declared metadatas: " + metadatas); //$NON-NLS-1$
+		System.out.println("Declared metadata groups: " + metadatagroups); //$NON-NLS-1$
+		System.out.println(""); //$NON-NLS-1$
+		System.out.println("Selection props: " + selectionPropertyNames); //$NON-NLS-1$
+		System.out.println("Displayed props: " + displayPropertyNames); //$NON-NLS-1$
+		System.out.println("Selection groups: " + selectionGroupNames); //$NON-NLS-1$
+		System.out.println("Displayed groups: " + displayGroupNames); //$NON-NLS-1$
+		System.out.println("Properties used per group: " + propertyNamesPerGroup); //$NON-NLS-1$
+	}
+	
+	/**
+	 * Gets the number of word.
+	 *
+	 * @param property the property
+	 * @param value the value
+	 * @return the number of words which 'property' value matches param 'value'
+	 */
+	public int getNumberOfWord(StructuralUnitProperty property, String value) {
+		int nb = 0;
+		for (String text : metadatasValuesPerText.keySet())
+			if (metadatasValuesPerText.get(text).get(property.getName()).equals(value))
+				nb += numberOfWordsPerText.get(text);
+		return nb;
+	}
+	
+	/**
+	 * Gets the text number.
+	 *
+	 * @param property the property
+	 * @param value the value
+	 * @return the number of text which 'property' value matches param 'value'
+	 */
+	public int getNumberOfText(StructuralUnitProperty property, String value) {
+		int nb = 0;
+		for (String text : metadatasValuesPerText.keySet())
+			if (metadatasValuesPerText.get(text).get(property.getName()).equals(value))
+				nb++;
+		return nb;
+	}
+	
+	/**
+	 * Loads the metadatas values and store them per text id.
+	 *
+	 * @param property the property
+	 * @return
+	 * @return the text metadatas
+	 * @throws UnexpectedAnswerException the unexpected answer exception
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiServerError the cqi server error
+	 */
+	private HashMap<String, HashMap<String, String>> readTextMetadatas(StructuralUnitProperty property) throws UnexpectedAnswerException, IOException, CqiServerError {
+		int[] idx = CorpusManager.getCorpusManager().getCqiClient().cpos2Struc(property.getQualifiedName(), positions);
+		String[] values = CorpusManager.getCorpusManager().getCqiClient().struc2Str(property.getQualifiedName(), idx);
+		
+		for (int i = 0; i < values.length; i++) {
+			this.metadatasValuesPerText.get(textids.get(i)).put(property.getName(), values[i]);
+		}
+		
+		return metadatasValuesPerText;
+	}
+	
+	/**
+	 * Gets the text metadatas values per text.
+	 *
+	 * @return the text metadatas
+	 */
+	public HashMap<String, HashMap<String, String>> getTextMetadatas() {
+		return this.metadatasValuesPerText;
+	}
+	
+	/**
+	 * Gets the number of words.
+	 *
+	 * @return the number of words
+	 */
+	public HashMap<String, Integer> getNumberOfWordsPerText() {
+		return this.numberOfWordsPerText;
+	}
+	
+	/**
+	 * Gets the text ids.
+	 *
+	 * @return the text ids, corpus ordered
+	 */
+	public List<String> getTextIds() {
+		return this.textids;
+	}
+	
+	/**
+	 * Gets and loads the selection properties name.
+	 *
+	 * @return the selection text metadata
+	 */
+	public ArrayList<String> getSelectionPropertyNames() {
+		if (selectionPropertyNames != null)
+			return selectionPropertyNames;
+		StructuralUnit text_su;
+		selectionPropertyNames = new ArrayList<>();
+		/*
+		 * try {
+		 * text_su = corpus.getStructuralUnit("text");
+		 * // if corpus has metadatas declared
+		 * if (metadatas.size() > 0)
+		 * {
+		 * for(Metadata m : metadatas)
+		 * {
+		 * selectionPropertyNames.add(m.id);
+		 * }
+		 * }
+		 * //if no props added via metadata then get all text properties
+		 * if (selectionPropertyNames.size() == 0)
+		 * {
+		 * for(Property p : text_su.getProperties())
+		 * selectionPropertyNames.add(p.getName());
+		 * }
+		 * } catch (Exception e) {
+		 * // TODO Auto-generated catch block
+		 * org.txm.utils.logger.Log.printStackTrace(e);
+		 * } //$NON-NLS-1$
+		 */
+		for (StructuralUnitProperty prop : allProperties)
+			selectionPropertyNames.add(prop.getName());
+		return selectionPropertyNames;
+	}
+	
+	/**
+	 * Gets and loads the selection group names.
+	 *
+	 * @return the selection text metadata
+	 */
+	public ArrayList<String> getSelectionGroupNames() {
+		if (selectionGroupNames != null)
+			return selectionGroupNames;
+		selectionGroupNames = new ArrayList<>();
+		for (Metadata m : metadatagroups) {
+			if (m.selection) {
+				selectionGroupNames.add(m.id);
+			}
+		}
+		
+		return selectionGroupNames;
+	}
+	
+	/**
+	 * Gets the display properties name.
+	 *
+	 * @return the display text metadata
+	 */
+	public ArrayList<String> getDisplayPropertyNames() {
+		if (displayPropertyNames != null)
+			return displayPropertyNames;
+		StructuralUnit text_su;
+		displayPropertyNames = new ArrayList<>();
+		try {
+			text_su = corpus.getStructuralUnit("text"); //$NON-NLS-1$
+			
+			// if corpus has metadatas declared
+			if (metadatas.size() > 0) {
+				for (Metadata m : metadatas) {
+					if (m.display) // only keep metadata for selection
+						displayPropertyNames.add(m.id);
+				}
+			}
+			
+			if (displayPropertyNames.size() == 0) {
+				for (Property p : text_su.getOrderedProperties())
+					displayPropertyNames.add(p.getName());
+			}
+			
+		}
+		catch (Exception e) {
+			org.txm.utils.logger.Log.printStackTrace(e);
+		}
+		return displayPropertyNames;
+	}
+	
+	/**
+	 * Gets and loads the display group names.
+	 *
+	 * @return the display text metadata
+	 */
+	public ArrayList<String> getDisplayGroupNames() {
+		if (displayGroupNames != null)
+			return displayGroupNames;
+		displayGroupNames = new ArrayList<>();
+		for (Metadata m : metadatagroups) {
+			if (m.display) // only keep metadata for selection
+				displayGroupNames.add(m.id);
+		}
+		return displayGroupNames;
+	}
+	
+	/**
+	 * Gets the structural unit property values per structuralUnitProperty.
+	 *
+	 * @return
+	 */
+	public HashMap<String, List<String>> getStructuralUnitPropertyValues() {
+		if (valuesPerMetadata != null)
+			return valuesPerMetadata;
+		valuesPerMetadata = new HashMap<>();
+		
+		try {
+			for (StructuralUnitProperty sup : allProperties) {
+				try {
+					valuesPerMetadata.put(sup.getName(), sup.getValues());
+				}
+				catch (CqiClientException e) {
+					System.out.println(TXMCoreMessages.failedToGetSupValuesOf + sup.getFullName());
+					org.txm.utils.logger.Log.printStackTrace(e);
+					return valuesPerMetadata;
+				}
+			}
+		}
+		catch (Exception e) {
+			org.txm.utils.logger.Log.printStackTrace(e);
+		}
+		return valuesPerMetadata;
+	}
+	
+	public ArrayList<Metadata> getMetadatas() {
+		return metadatas;
+	}
+	
+	public ArrayList<MetadataGroup> getMetadatagroups() {
+		return metadatagroups;
+	}
+	
+	@Override
+	public String getName() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+	
+	@Override
+	public String getSimpleName() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+	
+	@Override
+	public String getDetails() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+	
+	@Override
+	public void clean() {
+		// TODO Auto-generated method stub
+	}
+	
+	@Override
+	public boolean canCompute() {
+		return this.corpus != null;
+	}
+	
+	@Override
+	public boolean setParameters(TXMParameters parameters) {
+		// TODO Auto-generated method stub
+		System.err.println("Selection.setParameters(): not yet implemented.");
+		return true;
+	}
+	
+	@Override
+	public boolean loadParameters() {
+		// TODO Auto-generated method stub
+		System.err.println("Selection.loadParameters(): not yet implemented.");
+		return true;
+	}
+	
+	@Override
+	public boolean saveParameters() {
+		// TODO Auto-generated method stub
+		System.err.println("Selection.saveParameters(): not yet implemented.");
+		return true;
+	}
+	
+	@Override
+	protected boolean _compute(TXMProgressMonitor monitor) throws Exception {
+		System.err.println("Selection.compute() not implemented");
+		return false;
+	}
+	
+	@Override
+	public boolean _toTxt(File outfile, String encoding, String colseparator, String txtseparator) throws Exception {
+		// TODO Auto-generated method stub
+		return false;
+	}
+	
+	@Override
+	public String getResultType() {
+		return "Selection";
+	}
+}

Property changes on: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/core/functions/selection/Selection.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/core/functions/summary/Summary.java
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/core/functions/summary/Summary.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/core/functions/summary/Summary.java	(revision 3659)
@@ -0,0 +1,327 @@
+package org.txm.searchengine.cqp.core.functions.summary;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Arrays;
+
+import org.apache.commons.lang.StringUtils;
+import org.txm.core.messages.TXMCoreMessages;
+import org.txm.core.results.Parameter;
+import org.txm.core.results.TXMParameters;
+import org.txm.core.results.TXMResult;
+import org.txm.objects.Edition;
+import org.txm.objects.Page;
+import org.txm.objects.Text;
+import org.txm.searchengine.cqp.CQPSearchEngine;
+import org.txm.searchengine.cqp.core.messages.CQPSearchEngineCoreMessages;
+import org.txm.searchengine.cqp.corpus.MainCorpus;
+import org.txm.searchengine.cqp.corpus.Property;
+import org.txm.searchengine.cqp.corpus.QueryResult;
+import org.txm.searchengine.cqp.corpus.StructuralUnitProperty;
+import org.txm.searchengine.cqp.corpus.query.CQLQuery;
+import org.txm.utils.TXMProgressMonitor;
+import org.txm.utils.logger.Log;
+
+public class Summary extends TXMResult {
+	
+	MainCorpus corpus;
+	
+	TreeNode treenodes = new TreeNode("root"); //$NON-NLS-1$
+	
+	@Parameter(key = "props")
+	protected ArrayList<StructuralUnitProperty> properties;
+	
+	public Summary(MainCorpus corpus) {
+		super(corpus);
+		this.corpus = corpus;
+	}
+	
+	@Override
+	public boolean canCompute() {
+		return corpus != null && properties != null && properties.size() > 0;
+	}
+	
+	@Override
+	public boolean setParameters(TXMParameters parameters) {
+		System.err.println("Summary.setParameters(): not yet implemented.");
+		return true;
+	}
+	
+	@Override
+	public boolean loadParameters() {
+		System.err.println("Summary.loadParameters(): not yet implemented.");
+		return true;
+	}
+	
+	
+	@Override
+	public boolean saveParameters() {
+		System.err.println("Summary.saveParameters(): not yet implemented.");
+		return true;
+	}
+	
+	
+	@Override
+	protected boolean _compute(TXMProgressMonitor monitor) throws Exception {
+		treenodes.end = corpus.getSize();
+		treenodes.id = corpus.getID();
+		treenodes.start = 0;
+		treenodes.parent = null;
+		treenodes.clear();
+		// get all type of structures
+		for (int j = 0; j < properties.size(); j++) {
+			String suname = properties.get(j).getStructuralUnit().getName();
+			// System.out.println("getting : "+properties.get(j).getFullName());
+			
+			QueryResult result = corpus.query(new CQLQuery("<" + properties.get(j).getFullName() + ">[]"), "summary", false); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+			int[] starts = result.getStarts();
+			//result.drop();
+			result = corpus.query(new CQLQuery("[]</" + properties.get(j).getFullName() + ">"), "summary", false); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+			int[] ends = result.getStarts();
+			//result.drop();
+			// System.out.println("starts: "+Arrays.toString(starts));
+			// System.out.println("ends: "+Arrays.toString(ends));
+			int[] strcutpos = CQPSearchEngine.getCqiClient().cpos2Struc(properties.get(j).getQualifiedName(), starts);
+			String[] infos = CQPSearchEngine.getCqiClient().struc2Str(properties.get(j).getQualifiedName(), strcutpos);
+			// allMatches.put(suname, list);
+			if (starts.length != ends.length) {
+				System.out.println(suname + ": starts.length " + starts.length + " != ends.length " + ends.length); //$NON-NLS-1$ //$NON-NLS-2$
+				return false;
+			}
+			
+			// create the nodes list
+			for (int i = 0; i < starts.length; i++) {
+				// System.out.println("suname: "+suname+" start: "+m.getStart());
+				TreeNode node = new TreeNode();
+				node.start = starts[i];
+				node.end = ends[i];
+				node.struct = suname;
+				node.id = infos[i];
+				treenodes.add(node);
+			}
+		}
+		// this.print();
+		
+		// System.out.println("sorting... "+treenodes.size()+" nodes");
+		// sorting and create hierarchy nodes
+		processNodeList(treenodes);
+		
+		// System.out.println("checking result..."+treenodes.size()+" nodes");
+		if (treenodes.check()) {
+			return true;
+		}
+		else {
+			return false;
+		}
+	}
+	
+	public TreeNode getRoot() {
+		return treenodes;
+	}
+	
+	private void processNodeList(TreeNode nodes) {
+		// System.out.println("+processing node list: "+nodes.size());
+		if (nodes.size() == 0) {
+			return;
+		}
+		
+		// 1st loop
+		// System.out.println("1st loop: "+nodes.size());
+		for (int i = 0; i < nodes.size(); i++) {
+			TreeNode node = nodes.get(i);
+			if (node.end == -1)
+				System.out.println("ERROR: node.end = -1"); //$NON-NLS-1$
+			for (int j = 0; j < nodes.size(); j++) {
+				if (j != i) {
+					TreeNode n2 = nodes.get(j);
+					if (n2.start >= node.start && n2.end <= node.end) {
+						n2.parent = node;
+						node.add(n2);
+						nodes.remove(j);
+						j--;
+						if (j < i) {
+							i--;
+						}
+					}
+				}
+			}
+		}
+		
+		// process sublists
+		// System.out.println("processing sublists: "+nodes.size());
+		for (int i = 0; i < nodes.size(); i++) {
+			TreeNode node = nodes.get(i);
+			processNodeList(node);
+		}
+	}
+	
+	public ArrayList<StructuralUnitProperty> getProperties() {
+		return properties;
+	}
+	
+	public void print() {
+		for (TreeNode node : treenodes) {
+			System.out.println("\n" + node); //$NON-NLS-1$
+		}
+	}
+	
+	
+	public Page getDefaultEditionPage(TreeNode node) throws Exception {
+		StructuralUnitProperty text_id = corpus.getStructuralUnit("text").getProperty("id"); //$NON-NLS-1$ //$NON-NLS-2$
+		Property w_id = corpus.getProperty("id"); //$NON-NLS-1$
+		int[] positions = { node.getStart() };
+		final String[] wordids = CQPSearchEngine.getCqiClient().cpos2Str(w_id.getQualifiedName(), positions);
+		int[] textidstruct = CQPSearchEngine.getCqiClient().cpos2Struc(text_id.getQualifiedName(), positions);
+		String[] textids = CQPSearchEngine.getCqiClient().struc2Str(text_id.getQualifiedName(), textidstruct);
+		
+		if (wordids.length == 1 && textids.length == 1) {
+			Text text = corpus.getProject().getText(textids[0]);
+			if (text == null) {
+				Log.severe(TXMCoreMessages.bind(CQPSearchEngineCoreMessages.errorColonTextP0IsNull, textids[0]));
+				return null;
+			}
+			
+			Edition edition = text.getEdition("default"); //$NON-NLS-1$
+			if (edition == null) {
+				if (text.getEditions().size() == 0) {
+					System.out.println("No edition for text: " + text);
+				}
+				else {
+					for (Edition ed : text.getEditions()) {
+						edition = ed;
+						break;
+					}
+				}
+			}
+			if (edition == null) {
+				System.out.println(CQPSearchEngineCoreMessages.errorColonEditionDefaultIsNull);
+				return null;
+			}
+			
+			node.wordid = wordids[0];
+			return edition.getPageForWordId(wordids[0]);
+		}
+		else {
+			Log.severe(TXMCoreMessages.bind(CQPSearchEngineCoreMessages.errorColonTextidsP0AndWordidsP1, Arrays.toString(textids), Arrays.toString(wordids)));
+			return null;
+		}
+	}
+	
+	public class TreeNode extends ArrayList<TreeNode> {
+		
+		/**
+		 * 
+		 */
+		private static final long serialVersionUID = 1L;
+		
+		public TreeNode parent;
+		
+		boolean leaf = false;
+		
+		String struct;
+		
+		String id;
+		
+		int start = -1;
+		
+		int end = -1;
+		
+		public String wordid;
+		
+		public TreeNode() {
+			
+		}
+		
+		public boolean check() {
+			for (TreeNode node : this) {
+				if (node.start >= this.start && node.end <= this.end && (node.end - node.start) < (this.end - this.start))
+					return node.check();
+				else
+					return false;
+			}
+			return true;
+		}
+		
+		public TreeNode(String struct) {
+			this();
+			this.struct = struct;
+		}
+		
+		@Override
+		public String toString() {
+			String str = struct + "(" + start + ", " + end + ")"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+			if (size() > 0) {
+				str += "\n\t" + super.toString(); //$NON-NLS-1$
+			}
+			return str;
+		}
+		
+		public TreeNode getParent() {
+			return parent;
+		}
+		
+		public String getInfo() {
+			return id;
+		}
+		
+		public int getStart() {
+			return start;
+		}
+		
+		public String getWordId() {
+			return wordid;
+		}
+	}
+	
+	@Override
+	public String getName() {
+		if (properties != null && properties.size() > 0) {
+			return corpus.getName();
+		}
+		else {
+			return StringUtils.join(properties, ", ");
+		}
+	}
+	
+	@Override
+	public String getSimpleName() {
+		if (properties != null && properties.size() > 0) {
+			return corpus.getName();
+		}
+		else {
+			return StringUtils.join(properties, ", ");
+		}
+	}
+	
+	@Override
+	public String getDetails() {
+		// TODO Auto-generated method stub
+		return "" + corpus + " " + properties;
+	}
+	
+	@Override
+	public void clean() {
+		// TODO Auto-generated method stub
+	}
+	
+	
+	@Override
+	public boolean _toTxt(File outfile, String encoding, String colseparator, String txtseparator) throws Exception {
+		
+		return false;
+	}
+	
+	public void setProperties(ArrayList<StructuralUnitProperty> properties) {
+		this.properties = properties;
+	}
+	
+	
+	@Override
+	public String getResultType() {
+		return "Summary";
+	}
+	
+	public MainCorpus getCorpus() {
+		return corpus;
+	}
+}

Property changes on: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/core/functions/summary/Summary.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/core/functions/preview/package.html
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/core/functions/preview/package.html	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/core/functions/preview/package.html	(revision 3659)
@@ -0,0 +1,6 @@
+<html>
+<body>
+	<p>Prototype of Preview functionnaly: shows the begining of a
+		corpus or a partition.</p>
+</body>
+</html>
\ No newline at end of file

Property changes on: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/core/functions/preview/package.html
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/core/functions/preview/Preview.java
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/core/functions/preview/Preview.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/core/functions/preview/Preview.java	(revision 3659)
@@ -0,0 +1,136 @@
+package org.txm.searchengine.cqp.core.functions.preview;
+
+import java.io.File;
+import java.util.Collection;
+import java.util.List;
+
+import org.txm.core.results.TXMParameters;
+import org.txm.core.results.TXMResult;
+import org.txm.searchengine.cqp.corpus.CQPCorpus;
+import org.txm.searchengine.cqp.corpus.Partition;
+import org.txm.searchengine.cqp.corpus.query.Match;
+import org.txm.utils.TXMProgressMonitor;
+
+public class Preview extends TXMResult {
+	
+	private CQPCorpus corpus;
+	
+	private Partition partition;
+	
+	private int n;
+	
+	public Preview(CQPCorpus corpus, int n) {
+		super(corpus);
+		this.corpus = corpus;
+		this.n = n;
+	}
+	
+	public Preview(Partition partition, int n) {
+		super(partition);
+		this.partition = partition;
+		this.n = n;
+	}
+	
+	protected boolean computeCorpus() {
+		boolean ok = false;
+		
+		return ok;
+	}
+	
+	protected boolean computePartition() {
+		boolean ok = false;
+		List<? extends org.txm.objects.Match> matches = corpus.getMatches();
+		for (org.txm.objects.Match m : matches) {
+			if (m.size() >= n) {
+				ok = true;
+			}
+		}
+		return ok;
+	}
+	
+	private String getLine(CQPCorpus corpus) {
+		List<? extends org.txm.objects.Match> matches = corpus.getMatches();
+		if (matches.size() == 0) return ""; //$NON-NLS-1$
+		
+		org.txm.objects.Match firstOkMatch = matches.get(0);
+		for (org.txm.objects.Match m : matches) {
+			if (m.size() >= n) {
+				Collection<? extends Integer> positions = m.getRange();
+				
+			}
+		}
+		return "";// getString(firstOkMatch); //$NON-NLS-1$
+	}
+	
+	@Override
+	public String getName() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+	
+	@Override
+	public String getSimpleName() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+	
+	@Override
+	public String getDetails() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+	
+	@Override
+	public void clean() {
+		// TODO Auto-generated method stub
+		
+	}
+	
+	@Override
+	public boolean canCompute() {
+		return corpus != null;
+	}
+	
+	@Override
+	public boolean setParameters(TXMParameters parameters) {
+		// TODO Auto-generated method stub
+		System.err.println("Preview.setParameters(): not yet implemented.");
+		return true;
+	}
+	
+	@Override
+	public boolean loadParameters() {
+		// TODO Auto-generated method stub
+		System.err.println("Preview.loadParameters(): not yet implemented.");
+		return true;
+	}
+	
+	@Override
+	public boolean saveParameters() {
+		// TODO Auto-generated method stub
+		System.err.println("Preview.saveParameters(): not yet implemented.");
+		return true;
+	}
+	
+	
+	@Override
+	protected boolean _compute(TXMProgressMonitor monitor) throws Exception {
+		if (partition != null) {
+			return computePartition();
+		}
+		else {
+			return computeCorpus();
+		}
+	}
+	
+	@Override
+	public boolean _toTxt(File outfile, String encoding, String colseparator, String txtseparator) throws Exception {
+		// TODO Auto-generated method stub
+		return false;
+	}
+	
+	@Override
+	public String getResultType() {
+		return "Preview";
+	}
+}

Property changes on: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/core/functions/preview/Preview.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/core/preferences/SubcorpusPreferences.java
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/core/preferences/SubcorpusPreferences.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/core/preferences/SubcorpusPreferences.java	(revision 3659)
@@ -0,0 +1,39 @@
+package org.txm.searchengine.cqp.core.preferences;
+
+import org.osgi.service.prefs.Preferences;
+import org.txm.core.preferences.TXMPreferences;
+
+public class SubcorpusPreferences extends TXMPreferences {
+	
+	public static String EDITORMODE = "editor_mode";
+	
+	public static String OPTIMIZED_MODE = "optimized_mode";
+	
+	public static final String TARGET_STRATEGY = "target_strategy";
+	
+	public SubcorpusPreferences() {
+		// TODO Auto-generated constructor stub
+	}
+	
+	/**
+	 * Gets the instance.
+	 * 
+	 * @return the instance
+	 */
+	public static TXMPreferences getInstance() {
+		if (!TXMPreferences.instances.containsKey(SubcorpusPreferences.class)) {
+			new SubcorpusPreferences();
+		}
+		return TXMPreferences.instances.get(SubcorpusPreferences.class);
+	}
+	
+	@Override
+	public void initializeDefaultPreferences() {
+		super.initializeDefaultPreferences();
+		
+		Preferences preferences = this.getDefaultPreferencesNode();
+		
+		preferences.putBoolean(EDITORMODE, false);
+		preferences.putBoolean(OPTIMIZED_MODE, true);
+	}
+}

Property changes on: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/core/preferences/SubcorpusPreferences.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/core/preferences/PartitionPreferences.java
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/core/preferences/PartitionPreferences.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/core/preferences/PartitionPreferences.java	(revision 3659)
@@ -0,0 +1,33 @@
+package org.txm.searchengine.cqp.core.preferences;
+
+import org.osgi.service.prefs.Preferences;
+import org.txm.core.preferences.TXMPreferences;
+
+public class PartitionPreferences extends TXMPreferences {
+
+	public static String EDITOR_MODE = "editor_mode";
+	
+	public PartitionPreferences() {
+		// TODO Auto-generated constructor stub
+	}
+
+	/**
+	 * Gets the instance.
+	 * @return the instance
+	 */
+	public static TXMPreferences getInstance()	{
+		if (!TXMPreferences.instances.containsKey(PartitionPreferences.class)) {
+			new PartitionPreferences();
+		}
+		return TXMPreferences.instances.get(PartitionPreferences.class);
+	}
+	
+	@Override
+	public void initializeDefaultPreferences() {
+		super.initializeDefaultPreferences();
+		
+		Preferences preferences = this.getDefaultPreferencesNode();
+		
+		preferences.putBoolean(EDITOR_MODE, false);
+	}
+}

Property changes on: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/core/preferences/PartitionPreferences.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/core/tests/TestSubcorpus.java
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/core/tests/TestSubcorpus.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/core/tests/TestSubcorpus.java	(revision 3659)
@@ -0,0 +1,71 @@
+package org.txm.searchengine.cqp.core.tests;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.Arrays;
+
+import org.txm.searchengine.cqp.NetCqiClient;
+import org.txm.searchengine.cqp.clientExceptions.UnexpectedAnswerException;
+import org.txm.searchengine.cqp.corpus.CQPCorpus;
+import org.txm.searchengine.cqp.corpus.CorpusManager;
+import org.txm.searchengine.cqp.corpus.Subcorpus;
+import org.txm.searchengine.cqp.corpus.query.CQLQuery;
+import org.txm.searchengine.cqp.serverException.CqiServerError;
+
+public class TestSubcorpus {
+
+	public static String CORPUS = "DISCOURS"; //$NON-NLS-1$
+
+	public static boolean allTests(File outdir) {
+		TestSubcorpus tester = new TestSubcorpus();
+		return tester.test1(outdir) && tester.test2(outdir) && tester.test3(outdir);
+	}
+
+	public boolean test1(File outdir) {
+		try {
+			CQPCorpus corpus = CorpusManager.getCorpusManager().getCorpus(CORPUS);
+			Subcorpus sub = corpus.createSubcorpus(new CQLQuery("\"je\" expand to p"), "JEP"); //$NON-NLS-1$ //$NON-NLS-2$
+
+			writePositions(sub, new File(outdir, TestSubcorpus.class.getName()+"_test1.csv")); //$NON-NLS-1$
+		} catch (Exception e) {
+			org.txm.utils.logger.Log.printStackTrace(e);
+			return false;
+		}
+		return true;
+	}
+
+	public boolean test2(File outdir) {
+		try {
+			CQPCorpus corpus = CorpusManager.getCorpusManager().getCorpus(CORPUS);
+			Subcorpus sub = corpus.createSubcorpus(corpus.getStructuralUnit("text"), corpus.getStructuralUnit("text").getProperty("loc"), "De_Gaulle", "DG"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
+
+			writePositions(sub, new File(outdir, TestSubcorpus.class.getName()+"_test2.csv")); //$NON-NLS-1$
+		} catch (Exception e) {
+			org.txm.utils.logger.Log.printStackTrace(e);
+			return false;
+		}
+		return true;
+	}
+
+	public boolean test3(File outdir) {
+		try {
+			CQPCorpus corpus = CorpusManager.getCorpusManager().getCorpus(CORPUS);
+			Subcorpus sub = corpus.createSubcorpus(corpus.getStructuralUnit("text"), corpus.getStructuralUnit("text").getProperty("type"), Arrays.asList("Allocution radiotélévisée", "Conférence de presse"), "alloc+presse"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
+
+			writePositions(sub, new File(outdir, TestSubcorpus.class.getName()+"_test3.csv")); //$NON-NLS-1$
+		} catch (Exception e) {
+			org.txm.utils.logger.Log.printStackTrace(e);
+			return false;
+		}
+		return true;
+	}
+
+	private void writePositions(Subcorpus sub, File outfile) throws UnexpectedAnswerException, IOException, CqiServerError {
+		int[] positions = CorpusManager.getCorpusManager().getCqiClient().dumpSubCorpus(sub.getQualifiedCqpId(), NetCqiClient.CQI_CONST_FIELD_MATCH, 0, sub.getNMatch());
+		PrintWriter writer = new PrintWriter(new FileWriter(outfile));
+		for(int i : positions) writer.println(i);
+		writer.close();
+	}
+}

Property changes on: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/core/tests/TestSubcorpus.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/core/tests/package.html
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/core/tests/package.html	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/core/tests/package.html	(revision 3659)
@@ -0,0 +1,5 @@
+<html>
+<body>
+	<p>First draft of tests for TXM</p>
+</body>
+</html>
\ No newline at end of file

Property changes on: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/core/tests/package.html
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/MemCqiClient.java
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/MemCqiClient.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/MemCqiClient.java	(revision 3659)
@@ -0,0 +1,753 @@
+package org.txm.searchengine.cqp;
+
+import java.io.IOException;
+
+import org.eclipse.osgi.util.NLS;
+import org.txm.core.messages.TXMCoreMessages;
+import org.txm.searchengine.cqp.clientExceptions.UnexpectedAnswerException;
+import org.txm.searchengine.cqp.core.messages.CQPSearchEngineCoreMessages;
+import org.txm.searchengine.cqp.serverException.CqiClErrorCorpusAccess;
+import org.txm.searchengine.cqp.serverException.CqiClErrorInternal;
+import org.txm.searchengine.cqp.serverException.CqiClErrorNoSuchAttribute;
+import org.txm.searchengine.cqp.serverException.CqiClErrorOutOfMemory;
+import org.txm.searchengine.cqp.serverException.CqiClErrorOutOfRange;
+import org.txm.searchengine.cqp.serverException.CqiClErrorRegex;
+import org.txm.searchengine.cqp.serverException.CqiClErrorWrongAttributeType;
+import org.txm.searchengine.cqp.serverException.CqiCqpErrorErrorGeneral;
+import org.txm.searchengine.cqp.serverException.CqiCqpErrorInvalidField;
+import org.txm.searchengine.cqp.serverException.CqiCqpErrorNoSuchCorpus;
+import org.txm.searchengine.cqp.serverException.CqiCqpErrorOutOfRange;
+import org.txm.searchengine.cqp.serverException.CqiCqpErrorSyntax;
+import org.txm.searchengine.cqp.serverException.CqiErrorConnectRefused;
+import org.txm.searchengine.cqp.serverException.CqiErrorGeneralError;
+import org.txm.searchengine.cqp.serverException.CqiErrorSyntaxError;
+import org.txm.searchengine.cqp.serverException.CqiErrorUserAbort;
+import org.txm.searchengine.cqp.serverException.CqiServerError;
+import org.txm.utils.logger.Log;
+
+/**
+ * @author mdecorde
+ *         Declares all the natives methods
+ */
+public class MemCqiClient extends AbstractCqiClient {
+	
+	/**
+	 * The server to deal with.
+	 */
+	protected MemCqiServer server;
+	
+	/**
+	 * 
+	 * @param server
+	 * @throws Exception
+	 */
+	public MemCqiClient(MemCqiServer server) throws Exception {
+		super();
+		this.server = server;
+	}
+	
+	public boolean start(String[] args) {
+		return true;
+	}
+	
+	public synchronized void stop() {
+		server.stop();
+	}
+	
+	public static final byte[] intToByteArray(int value) {
+		return new byte[] {
+				(byte) (value >>> 24),
+				(byte) (value >>> 16),
+				(byte) (value >>> 8),
+				(byte) value };
+	}
+	
+	public byte[] throwExceptionFromCqi(int error) throws CqiServerError, UnexpectedAnswerException, IOException {
+		return throwExceptionFromCqi("", error);
+	}
+	
+	public byte[] throwExceptionFromCqi(String message, int error) throws CqiServerError, UnexpectedAnswerException, IOException {
+		byte[] ret = intToByteArray(error);
+		
+		byte b = ret[2];
+		byte b2 = ret[3];
+		// System.out.println("bytes: "+ret[0]+" "+ret[1]+" "+ret[2]+" "+ret[3]);
+		// System.out.println("b1 "+b+ " b2 "+b2);
+		Log.finest(TXMCoreMessages.bind(CQPSearchEngineCoreMessages.readByteFromTheCQiServerColonP0, b));
+		switch (b) {
+			case 0x00:// cf cqi.h:29
+				return CQI_PADDING;
+			case 0x01:// cf cqi.h:37
+				Log.finest(TXMCoreMessages.bind(CQPSearchEngineCoreMessages.readByteFromTheCQiServerColonP0, b));
+				switch (b2) {
+					case 0x01:// cf cqi.h:39
+						return CQI_STATUS_OK;
+					case 0x02:// cf cqi.h:40
+						return CQI_STATUS_CONNECT_OK;
+					case 0x03:// cf cqi.h:41
+						return CQI_STATUS_BYE_OK;
+					case 0x04:// cf cqi.h:42
+						return CQI_STATUS_PING_OK;
+					default:
+						throw new CqiErrorGeneralError(CQPSearchEngineCoreMessages.unknownCQPErrorColonB1 + b + CQPSearchEngineCoreMessages.b2 + b2);
+				}
+			case 0x02:// cf cqi.h:45
+				Log.finest(TXMCoreMessages.bind(CQPSearchEngineCoreMessages.readByteFromTheCQiServerColonP0, b));
+				
+				lastError = CQPSearchEngineCoreMessages.internalCQIErrorColon + " CQI_ERROR (" + b + ")";
+				
+				switch (b2) {
+					case 0x01:// cf cqi.h:39
+						throw new CqiErrorGeneralError();
+					case 0x02:// cf cqi.h:40
+						throw new CqiErrorConnectRefused();
+					case 0x03:// cf cqi.h:41
+						throw new CqiErrorUserAbort();
+					case 0x04:// cf cqi.h:42
+						throw new CqiErrorSyntaxError();
+					default:
+						throw new CqiErrorGeneralError(CQPSearchEngineCoreMessages.unknownCQPCQIErrorColonB1 + b + CQPSearchEngineCoreMessages.b2 + b2);
+				}
+			case 0x03:// cf cqi.h:53
+				Log.finest(TXMCoreMessages.bind(CQPSearchEngineCoreMessages.readByteFromTheCQiServerColonP0, b));
+				switch (b2) {
+					case 0x01:// cf cqi.h:39
+						return CQI_DATA_BYTE;
+					case 0x02:// cf cqi.h:40
+						return CQI_DATA_BOOL;
+					case 0x03:// cf cqi.h:41
+						return CQI_DATA_INT;
+					case 0x04:// cf cqi.h:42
+						return CQI_DATA_STRING;
+					case 0x05:// cf cqi.h:42
+						return CQI_DATA_BYTE_LIST;
+					case 0x06:// cf cqi.h:42
+						return CQI_DATA_BOOL_LIST;
+					case 0x07:// cf cqi.h:42
+						return CQI_DATA_INT_LIST;
+					case 0x08:// cf cqi.h:42
+						return CQI_DATA_STRING_LIST;
+					case 0x09:// cf cqi.h:42
+						return CQI_DATA_INT_INT;
+					case 0x0A:// cf cqi.h:42
+						return CQI_DATA_INT_INT_INT_INT;
+					case 0x0B:// cf cqi.h:42
+						return CQI_DATA_INT_TABLE;
+					default:
+						throw new CqiErrorGeneralError(CQPSearchEngineCoreMessages.unknownCQPCodeColonB1 + b + CQPSearchEngineCoreMessages.b2 + b2);
+				}
+			case 0x04:// cf cqi.h:67
+				
+				lastError = CQPSearchEngineCoreMessages.cLErrorColon + "CL_ERROR (" + b + ")";
+				Log.finest(TXMCoreMessages.bind(CQPSearchEngineCoreMessages.readByteFromTheCQiServerColonP0, b));
+				switch (b2) {
+					case 0x01:// cf cqi.h:39
+						lastError += ": NoSuchAttribute error";
+						throw new CqiClErrorNoSuchAttribute(message);
+					case 0x02:// cf cqi.h:40
+						lastError += ": WrongAttributeType error";
+						throw new CqiClErrorWrongAttributeType(message);
+					case 0x03:// cf cqi.h:41
+						lastError += ": OutOfRange error";
+						throw new CqiClErrorOutOfRange(message);
+					case 0x04:// cf cqi.h:42
+						lastError = this.getLastCqiError();
+						throw new CqiClErrorRegex(message);
+					case 0x05:// cf cqi.h:42
+						lastError += ": CorpusAccess error";
+						throw new CqiClErrorCorpusAccess(message);
+					case 0x06:// cf cqi.h:42
+						lastError += ": OutOfMemory error";
+						throw new CqiClErrorOutOfMemory(message);
+					case 0x07:// cf cqi.h:42
+						lastError += ": Internal error";
+						throw new CqiClErrorInternal(message);
+					default:
+						lastError += ": Unknown error";
+						throw new CqiErrorGeneralError(CQPSearchEngineCoreMessages.unknownCQPErrorColonB1 + b + CQPSearchEngineCoreMessages.b2 + b2);
+				}
+				
+			case 0x05:// cf cqi.h:94
+				
+				lastError = NLS.bind(CQPSearchEngineCoreMessages.cQPErrorColonP0, "CQI_CQP_ERROR (" + b + ")");
+				Log.finest(TXMCoreMessages.bind(CQPSearchEngineCoreMessages.readByteFromTheCQiServerColonP0, b));
+				switch (b2) {
+					case 0x01:// cf cqi.h:39
+						lastError += ": General error";
+						throw new CqiCqpErrorErrorGeneral(message);
+					case 0x02:// cf cqi.h:40
+						lastError += ": NoSuchCorpus error";
+						throw new CqiCqpErrorNoSuchCorpus(message);
+					case 0x03:// cf cqi.h:41
+						lastError += ": InvalidField error";
+						throw new CqiCqpErrorInvalidField(message);
+					case 0x04:// cf cqi.h:42
+						lastError += ": OutOfRange error";
+						throw new CqiCqpErrorOutOfRange(message);
+					case 0x05:// cf cqi.h:44
+						lastError = getLastCQPError();
+						throw new CqiCqpErrorSyntax(message);
+					default:
+						throw new CqiErrorGeneralError(CQPSearchEngineCoreMessages.unknownCQPErrorColonB1 + b + CQPSearchEngineCoreMessages.b2 + b2);
+				}
+			default:
+				throw new CqiErrorGeneralError(CQPSearchEngineCoreMessages.unknownCQPCodesColonB1 + b + CQPSearchEngineCoreMessages.b2 + b2);
+		}
+		// return null;
+	}
+	
+	@Override
+	public synchronized int[] alg2Cpos(String arg0, int arg1) throws UnexpectedAnswerException, IOException, CqiServerError {
+		if (arg0 == null) {
+			throw new CqiServerError("alg2Cpos called with NULL parameter.");
+		}
+		int[] rez = server.alg2Cpos(arg0, arg1);
+		if (rez == null) {
+			throwExceptionFromCqi(server.getErrorCode());
+		}
+		return rez;
+	}
+	
+	@Override
+	public synchronized int attributeSize(String arg0) throws IOException, UnexpectedAnswerException, CqiServerError {
+		if (arg0 == null) {
+			throw new CqiServerError("attributeSize called with NULL parameter.");
+		}
+		Integer ret = server.attributeSize(arg0);
+		if (ret == null || ret == -1) {
+			throwExceptionFromCqi(server.getErrorCode());
+			// throw exception
+		}
+		return ret;
+	}
+	
+	@Override
+	public synchronized boolean connect(String arg0, String arg1) {
+		return server.isLoaded;
+	};
+	
+	@Override
+	public synchronized String[] corpusAlignementAttributes(String arg0) throws UnexpectedAnswerException, IOException, CqiServerError {
+		if (arg0 == null) {
+			throw new CqiServerError("corpusAlignementAttributes called with NULL parameter.");
+		}
+		String[] rez = server.corpusAlignementAttributes(arg0);
+		if (rez == null) {
+			throwExceptionFromCqi(server.getErrorCode());
+		}
+		return rez;
+	}
+	
+	@Override
+	public synchronized String corpusCharset(String arg0) throws UnexpectedAnswerException, IOException, CqiServerError {
+		if (arg0 == null) {
+			throw new CqiServerError("corpusCharset called with NULL parameter.");
+		}
+		String rez = server.corpusCharset(arg0);
+		if (rez == null) {
+			throwExceptionFromCqi(server.getErrorCode());
+		}
+		return rez;
+	}
+	
+	//public native String getOption(String name) throws UnexpectedAnswerException, IOException, CqiServerError;
+	@Override
+	public synchronized String getOption(String name) throws UnexpectedAnswerException, IOException, CqiServerError {
+		if (name == null) {
+			throw new CqiServerError("getOption called with NULL parameter.");
+		}
+		String rez = server.getOption(name);
+		if (rez == null) {
+			throwExceptionFromCqi(server.getErrorCode());
+		}
+		return rez;
+	}
+	
+	//public native String setOption(String name, String value) throws UnexpectedAnswerException, IOException, CqiServerError;
+	@Override
+	public synchronized String setOption(String name, String value) throws UnexpectedAnswerException, IOException, CqiServerError {
+		if (name == null) {
+			throw new CqiServerError("setOption called with NULL name parameter.");
+		}
+		if (value == null) {
+			throw new CqiServerError("setOption called with NULL value parameter.");
+		}
+		String rez = server.setOption(name, value);
+		if (rez == null) {
+			throwExceptionFromCqi(server.getErrorCode());
+		}
+		return rez;
+	}
+	
+	@Override
+	public synchronized String corpusFullName(String arg0) throws UnexpectedAnswerException, IOException, CqiServerError {
+		if (arg0 == null) {
+			throw new CqiServerError("corpusFullName called with NULL parameter.");
+		}
+		String rez = server.corpusFullName(arg0);
+		if (rez == null) {
+			throwExceptionFromCqi(server.getErrorCode());
+		}
+		return rez;
+	}
+	
+	@Override
+	public String[] corpusInfo(String arg0) throws UnexpectedAnswerException, IOException, CqiServerError {
+		throw new UnsupportedOperationException();
+		/*
+		 * String[] rez = server.corpusInfo(arg0);
+		 * if (rez == null) {
+		 * throwExceptionFromCqi(server.getErrorCode());
+		 * }
+		 * return rez;
+		 */
+	}
+	
+	@Override
+	public synchronized String[] corpusPositionalAttributes(String arg0) throws UnexpectedAnswerException, IOException, CqiServerError {
+		if (arg0 == null) {
+			throw new CqiServerError("corpusPositionalAttributes called with NULL parameter.");
+		}
+		String[] rez = server.corpusPositionalAttributes(arg0);
+		if (rez == null) {
+			throwExceptionFromCqi(server.getErrorCode());
+		}
+		return rez;
+	}
+	
+	@Override
+	public synchronized String[] corpusProperties(String arg0) throws UnexpectedAnswerException, IOException, CqiServerError {
+		if (arg0 == null) {
+			throw new CqiServerError("corpusProperties called with NULL parameter.");
+		}
+		String[] rez = server.corpusProperties(arg0);
+		if (rez == null) {
+			throwExceptionFromCqi(server.getErrorCode());
+		}
+		return rez;
+	}
+	
+	@Override
+	public synchronized boolean corpusStructuralAttributeHasValues(String arg0) throws UnexpectedAnswerException, IOException, CqiServerError {
+		if (arg0 == null) {
+			throw new CqiServerError("corpusStructuralAttributeHasValues called with NULL parameter.");
+		}
+		Boolean rez = server.corpusStructuralAttributeHasValues(arg0);
+		if (rez == null || !rez) {
+			throwExceptionFromCqi(server.getErrorCode());
+		}
+		return rez;
+	}
+	
+	@Override
+	public synchronized String[] corpusStructuralAttributes(String arg0) throws UnexpectedAnswerException, IOException, CqiServerError {
+		if (arg0 == null) {
+			throw new CqiServerError("corpusStructuralAttributes called with NULL parameter.");
+		}
+		String[] rez = server.corpusStructuralAttributes(arg0);
+		if (rez == null) {
+			throwExceptionFromCqi(server.getErrorCode());
+		}
+		return rez;
+	}
+	
+	@Override
+	public synchronized int[] cpos2Alg(String arg0, int[] arg1) throws UnexpectedAnswerException, IOException, CqiServerError {
+		if (arg0 == null || arg1 == null) {
+			throw new CqiServerError("cpos2Alg called with NULL parameter.");
+		}
+		int[] rez = server.cpos2Alg(arg0, arg1);
+		if (rez == null) {
+			throwExceptionFromCqi(server.getErrorCode());
+		}
+		return rez;
+	}
+	
+	@Override
+	public synchronized int[] cpos2Id(String arg0, int[] arg1) throws UnexpectedAnswerException, IOException, CqiServerError {
+		if (arg0 == null || arg1 == null) {
+			throw new CqiServerError("cpos2Id called with NULL parameter.");
+		}
+		int[] rez = server.cpos2Id(arg0, arg1);
+		if (rez == null) {
+			throwExceptionFromCqi(server.getErrorCode());
+		}
+		return rez;
+	}
+	
+	@Override
+	public synchronized int[] cpos2LBound(String arg0, int[] arg1) throws UnexpectedAnswerException, IOException, CqiServerError {
+		if (arg0 == null || arg1 == null) {
+			throw new CqiServerError("cpos2LBound called with NULL parameter.");
+		}
+		int[] rez = server.cpos2LBound(arg0, arg1);
+		if (rez == null) {
+			throwExceptionFromCqi(server.getErrorCode());
+		}
+		return rez;
+	}
+	
+	@Override
+	public synchronized int[] cpos2RBound(String arg0, int[] arg1) throws UnexpectedAnswerException, IOException, CqiServerError {
+		if (arg0 == null || arg1 == null) {
+			throw new CqiServerError("cpos2RBound called with NULL parameter.");
+		}
+		int[] rez = server.cpos2RBound(arg0, arg1);
+		if (rez == null) {
+			throwExceptionFromCqi(server.getErrorCode());
+		}
+		return rez;
+	}
+	
+	@Override
+	public synchronized String[] cpos2Str(String arg0, int[] arg1) throws UnexpectedAnswerException, IOException, CqiServerError {
+		if (arg0 == null || arg1 == null) {
+			throw new CqiServerError("cpos2Str called with NULL parameter.");
+		}
+		String[] rez = server.cpos2Str(arg0, arg1);
+		if (rez == null) {
+			throwExceptionFromCqi(server.getErrorCode());
+		}
+		return rez;
+	}
+	
+	@Override
+	public synchronized int[] cpos2Struc(String arg0, int[] arg1) throws UnexpectedAnswerException, IOException, CqiServerError {
+		if (arg0 == null || arg1 == null) {
+			throw new CqiServerError("cpos2Struc called with NULL parameter.");
+		}
+		int[] rez = server.cpos2Struc(arg0, arg1);
+		if (rez == null) {
+			throwExceptionFromCqi(server.getErrorCode());
+		}
+		return rez;
+	}
+	
+	@Override
+	public synchronized void cqpQuery(String arg0, String arg1, String arg2)
+			throws IOException, UnexpectedAnswerException, CqiServerError {
+		if (arg0 == null || arg1 == null || arg2 == null) {
+			throw new CqiServerError("cqpQuery called with NULL parameter.");
+		}
+		Boolean ret = server.cqpQuery(arg0, arg1, arg2);
+		// System.out.println("CQPSERVER return: "+ret);
+		if (ret == null || !ret) {
+			int e = server.getErrorCode();
+			// System.out.println("throw exception with cqp error code: "+e);
+			throwExceptionFromCqi(e);
+		}
+	}
+	
+	@Override
+	public synchronized void query(String arg0)
+			throws IOException, UnexpectedAnswerException, CqiServerError {
+		if (arg0 == null) {
+			throw new CqiServerError("query called with NULL parameter.");
+		}
+		Boolean ret = server.query(arg0);
+		if (ret == null || !ret) {
+			System.out.println(CQPSearchEngineCoreMessages.queryError);
+			throwExceptionFromCqi(server.getErrorCode());
+		}
+	}
+	
+	@Override
+	public boolean disconnect() {
+		return true;
+	};
+	
+	@Override
+	public void dropAttribute(String arg0) throws IOException, UnexpectedAnswerException, CqiServerError {
+		throw new UnsupportedOperationException();
+		// Boolean ret = server.dropAttribute(arg0);
+		// if(ret == null || !ret) {
+		// throwExceptionFromCqi(server.getErrorCode());
+		// }
+	}
+	
+	@Override
+	public synchronized void dropCorpus(String arg0) throws Exception {
+		Log.finest(NLS.bind("Droping corpus {0}...", arg0)); //$NON-NLS-1$
+		if (arg0 == null) {
+			throw new Exception("dropCorpus called with NULL parameter.");
+		}
+		Boolean ret = server.dropCorpus(arg0);
+		if (ret == null || !ret) {
+			throwExceptionFromCqi(server.getErrorCode());
+		}
+	}
+	
+	@Override
+	public synchronized void dropSubCorpus(String arg0) throws IOException, UnexpectedAnswerException, CqiServerError {
+		Log.finest(NLS.bind("Droping subcorpus {0}...", arg0)); //$NON-NLS-1$
+		if (arg0 == null) {
+			throw new CqiServerError("dropSubCorpus called with NULL parameter.");
+		}
+		Boolean ret = server.dropSubCorpus(arg0);
+		if (ret == null || !ret) {
+			throwExceptionFromCqi("Fail to drop subcorpus " + arg0 + ": ", server.getErrorCode());
+		}
+	}
+	
+	@Override
+	public synchronized int[] dumpSubCorpus(String arg0, byte arg1, int arg2, int arg3)
+			throws IOException, UnexpectedAnswerException, CqiServerError {
+		if (arg0 == null) {
+			throw new CqiServerError("dumpSubCorpus called with NULL parameter.");
+		}
+		int[] rez = server.dumpSubCorpus(arg0, arg1, arg2, arg3);
+		if (rez == null) {
+			throwExceptionFromCqi(server.getErrorCode());
+		}
+		return rez;
+	}
+	
+	@Override
+	public int[][] fdist1(String arg0, int arg1, byte arg2, String arg3)
+			throws IOException, UnexpectedAnswerException, CqiServerError {
+		if (arg0 == null || arg3 == null) {
+			throw new CqiServerError("fdist1 called with NULL parameter.");
+		}
+		int[] all = nfdist1(arg0, arg1, arg2, arg3);
+		
+		int[][] freqs = new int[all.length / 2][2];
+		int c = 0;
+		for (int i = 0; i < freqs.length; i++) {
+			freqs[i][0] = all[c++];
+			freqs[i][1] = all[c++];
+		}
+		return freqs;
+		
+	}
+	
+	public synchronized int[] nfdist1(String arg0, int arg1, byte arg2, String arg3)
+			throws IOException, UnexpectedAnswerException, CqiServerError {
+		if (arg0 == null || arg3 == null) {
+			throw new CqiServerError("nfdist1 called with NULL parameter.");
+		}
+		int[] rez = server.nfdist1(arg0, arg1, arg2, arg3);
+		if (rez == null) {
+			throwExceptionFromCqi(server.getErrorCode());
+		}
+		return rez;
+	}
+	
+	@Override
+	public int[][] fdist2(String arg0, int arg1, byte arg2, String arg3,
+			byte arg4, String arg5) throws IOException,
+			UnexpectedAnswerException, CqiServerError {
+		if (arg0 == null || arg3 == null || arg5 == null) {
+			throw new CqiServerError("fdist2 called with NULL parameter.");
+		}
+		int[] all = nfdist2(arg0, arg1, arg2, arg3, arg4, arg5);
+		if (all == null) {
+			return new int[0][0];
+		}
+		int[][] freqs = new int[all.length / 2][3];
+		int c = 0;
+		for (int i = 0; i < freqs.length; i++) {
+			freqs[i][0] = all[c++];
+			freqs[i][1] = all[c++];
+			freqs[i][2] = all[c++];
+		}
+		return freqs;
+	}
+	
+	public synchronized int[] nfdist2(String arg0, int arg1, byte arg2, String arg3,
+			byte arg4, String arg5) throws IOException, UnexpectedAnswerException, CqiServerError {
+		if (arg0 == null || arg3 == null || arg5 == null) {
+			throw new CqiServerError("nfdist2 called with NULL parameter.");
+		}
+		int[] rez = server.nfdist2(arg0, arg1, arg2, arg3, arg4, arg5);
+		if (rez == null) {
+			throwExceptionFromCqi(server.getErrorCode());
+		}
+		return rez;
+	}
+	
+	@Override
+	public synchronized String getLastCQPError() throws UnexpectedAnswerException, IOException, CqiServerError {
+		String rez = server.getLastCQPError();
+		if (rez == null) {
+			throwExceptionFromCqi(server.getErrorCode());
+		}
+		return rez;
+	}
+	
+	@Override
+	public String getLastCqiError() throws UnexpectedAnswerException, IOException, CqiServerError {
+		String rez = server.getLastCqiError();
+		if (rez == null) {
+			throwExceptionFromCqi(server.getErrorCode());
+		}
+		return rez;
+	}
+	
+	@Override
+	public synchronized int[] id2Cpos(String arg0, int arg1) throws UnexpectedAnswerException, IOException, CqiServerError {
+		if (arg0 == null) {
+			throw new CqiServerError("id2Cpos called with NULL parameter.");
+		}
+		int[] rez = server.id2Cpos(arg0, arg1);
+		if (rez == null) {
+			throwExceptionFromCqi(server.getErrorCode());
+		}
+		return rez;
+	}
+	
+	@Override
+	public synchronized int[] id2Freq(String arg0, int[] arg1) throws UnexpectedAnswerException, IOException, CqiServerError {
+		if (arg0 == null || arg1 == null) {
+			throw new CqiServerError("id2Freq called with NULL parameter.");
+		}
+		int[] rez = server.id2Freq(arg0, arg1);
+		if (rez == null) {
+			throwExceptionFromCqi(server.getErrorCode());
+		}
+		return rez;
+	}
+	
+	@Override
+	public synchronized String[] id2Str(String arg0, int[] arg1) throws UnexpectedAnswerException, IOException, CqiServerError {
+		if (arg0 == null || arg1 == null) {
+			throw new CqiServerError("id2Str called with NULL parameter.");
+		}
+		String[] rez = server.id2Str(arg0, arg1);
+		if (rez == null) {
+			throwExceptionFromCqi(server.getErrorCode());
+		}
+		return rez;
+	}
+	
+	@Override
+	public synchronized int[] idList2Cpos(String arg0, int[] arg1) throws UnexpectedAnswerException, IOException, CqiServerError {
+		if (arg0 == null || arg1 == null) {
+			throw new CqiServerError("idList2Cpos called with NULL parameter.");
+		}
+		int[] rez = server.idList2Cpos(arg0, arg1);
+		if (rez == null) {
+			throwExceptionFromCqi(server.getErrorCode());
+		}
+		return rez;
+	}
+	
+	@Override
+	public synchronized int lexiconSize(String arg0) throws IOException, UnexpectedAnswerException, CqiServerError {
+		if (arg0 == null) {
+			throw new CqiServerError("lexiconSize called with NULL parameter.");
+		}
+		Integer rez = server.lexiconSize(arg0);
+		if (rez == null) {
+			throwExceptionFromCqi(server.getErrorCode());
+		}
+		return rez;
+	}
+	
+	@Override
+	public synchronized String[] listCorpora() throws UnexpectedAnswerException, IOException, CqiServerError {
+		String[] rez = server.listCorpora();
+		if (rez == null) {
+			throwExceptionFromCqi(server.getErrorCode());
+		}
+		return rez;
+	}
+	
+	@Override
+	public synchronized String[] listSubcorpora(String arg0) throws UnexpectedAnswerException, IOException, CqiServerError {
+		if (arg0 == null) {
+			throw new CqiServerError("listSubcorpora called with NULL parameter.");
+		}
+		String[] rez = server.listSubcorpora(arg0);
+		if (rez == null) {
+			throwExceptionFromCqi(server.getErrorCode());
+		}
+		return rez;
+	}
+	
+	@Override
+	public boolean reconnect() {
+		return true;
+	};
+	
+	@Override
+	public synchronized int[] regex2Id(String arg0, String arg1) throws UnexpectedAnswerException, IOException, CqiServerError {
+		if (arg0 == null || arg1 == null) {
+			throw new CqiServerError("regex2Id called with NULL parameter.");
+		}
+		int[] rez = server.regex2Id(arg0, arg1);
+		if (rez == null) {
+			throwExceptionFromCqi(server.getErrorCode());
+		}
+		return rez;
+	}
+	
+	@Override
+	public synchronized int[] str2Id(String arg0, String[] arg1) throws IOException, UnexpectedAnswerException, CqiServerError {
+		if (arg0 == null || arg1 == null) {
+			throw new CqiServerError("str2Id called with NULL parameter.");
+		}
+		int[] rez = server.str2Id(arg0, arg1);
+		if (rez == null) {
+			// System.out.println("error: "+server.getErrorCode());
+			throwExceptionFromCqi(server.getErrorCode());
+		}
+		return rez;
+	}
+	
+	@Override
+	public synchronized int[] struc2Cpos(String arg0, int arg1) throws UnexpectedAnswerException, IOException, CqiServerError {
+		if (arg0 == null) {
+			throw new CqiServerError("struc2Cpos called with NULL parameter.");
+		}
+		int[] rez = server.struc2Cpos(arg0, arg1);
+		if (rez == null) {
+			throwExceptionFromCqi(server.getErrorCode());
+		}
+		return rez;
+	}
+	
+	@Override
+	public synchronized String[] struc2Str(String arg0, int[] arg1) throws UnexpectedAnswerException, IOException, CqiServerError {
+		if (arg0 == null || arg1 == null) {
+			throw new CqiServerError("struc2Str called with NULL parameter.");
+		}
+		String[] rez = server.struc2Str(arg0, arg1);
+		if (rez == null) {
+			throwExceptionFromCqi(server.getErrorCode());
+		}
+		return rez;
+	}
+	
+	@Override
+	public synchronized boolean subCorpusHasField(String arg0, byte arg1) throws IOException, UnexpectedAnswerException, CqiServerError {
+		Boolean rez = server.subCorpusHasField(arg0, arg1);
+		if (rez == null || !rez) {
+			throwExceptionFromCqi(server.getErrorCode());
+		}
+		return rez;
+	}
+	
+	@Override
+	public synchronized int subCorpusSize(String arg0) throws IOException, UnexpectedAnswerException, CqiServerError {
+		if (arg0 == null) {
+			throw new CqiServerError("subCorpusSize called with NULL parameter.");
+		}
+		Integer rez = server.subCorpusSize(arg0);
+		if (rez == null) {
+			throwExceptionFromCqi(server.getErrorCode());
+		}
+		return rez;
+	}
+	
+	@Override
+	public synchronized boolean load_a_system_corpus(String regfilepath, String entry) throws IOException, UnexpectedAnswerException, CqiServerError {
+		if (regfilepath == null) {
+			throw new CqiServerError("load_a_system_corpus called with NULL regfilepath parameter.");
+		}
+		if (entry == null) {
+			throw new CqiServerError("load_a_system_corpus called with NULL entry parameter.");
+		}
+		return server.load_a_system_corpus(regfilepath, entry);
+	}
+
+}

Property changes on: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/MemCqiClient.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/NetCqiServer.java
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/NetCqiServer.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/NetCqiServer.java	(revision 3659)
@@ -0,0 +1,363 @@
+// Copyright © 2010-2020 ENS de Lyon., University of Franche-Comté
+// 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: 2013-09-05 09:27:13 +0200 (jeu., 05 sept. 2013) $
+// $LastChangedRevision: 2529 $
+// $LastChangedBy: mdecorde $
+//
+package org.txm.searchengine.cqp;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
+import java.util.ArrayList;
+import java.util.Arrays;
+
+import org.apache.commons.lang.StringUtils;
+import org.txm.core.messages.TXMCoreMessages;
+import org.txm.searchengine.core.messages.SearchEngineCoreMessages;
+import org.txm.searchengine.cqp.clientExceptions.ServerNotFoundException;
+import org.txm.searchengine.cqp.clientExceptions.UnexpectedAnswerException;
+import org.txm.searchengine.cqp.core.messages.CQPSearchEngineCoreMessages;
+import org.txm.searchengine.cqp.serverException.CqiServerError;
+import org.txm.utils.logger.Log;
+
+// TODO: Auto-generated Javadoc
+/**
+ * This class aims at handling a CQi server process. It is not a CQi server per
+ * se.
+ * 
+ * @author Jean-Philippe Magué
+ */
+public class NetCqiServer extends AbstractCqiServer {
+
+	/** The cmd line. */
+	String[] cmdLine;
+
+	/**
+	 * Gets the last cmd line.
+	 *
+	 * @return the last cmd line
+	 */
+	@Override
+	public String getLastCmdLine() {
+		return StringUtils.join(cmdLine, " "); //$NON-NLS-1$
+	}
+
+	/** The additional options. */
+	String additionalOptions;
+
+	public boolean debug = false;
+
+	/** The monitor output. */
+	boolean monitorOutput;
+
+	/** The path to executable. */
+	String pathToExecutable;
+
+	/** The path to init file. */
+	String pathToInitFile;
+
+	/** The path to registry. */
+	String pathToRegistry;
+
+	/** The process. */
+	private Process process;
+
+	/**
+	 * Instantiates a new CQi server.
+	 * 
+	 * @param pathToExecutable
+	 *            the path to the executable
+	 * @param pathToRegistry
+	 *            the path to the registry
+	 * @param pathToInitFile
+	 *            the path to the init file
+	 * 
+	 * @throws ServerNotFoundException
+	 *             the server not found exception
+	 */
+	public NetCqiServer(String pathToExecutable, String pathToRegistry, String pathToInitFile) throws ServerNotFoundException {
+		this(pathToExecutable, pathToRegistry, pathToInitFile, ""); //$NON-NLS-1$
+	}
+
+	/**
+	 ** Instantiates a new CQi server.
+	 * 
+	 * @param pathToExecutable
+	 *            the path to the executable
+	 * @param pathToRegistry
+	 *            the path to the registry
+	 * @param pathToInitFile
+	 *            the path to the init file
+	 * @param additionalOptions
+	 *            the additional command line options
+	 * 
+	 * @throws ServerNotFoundException
+	 *             the server not found exception
+	 */
+	public NetCqiServer(String pathToExecutable, String pathToRegistry, String pathToInitFile, String additionalOptions) throws ServerNotFoundException {
+		this(pathToExecutable, pathToRegistry, pathToInitFile, additionalOptions, false);
+	}
+
+	/**
+	 * Instantiates a new cqi server.
+	 *
+	 * @param pathToExecutable
+	 *            the path to executable
+	 * @param pathToRegistry
+	 *            the path to registry
+	 * @param pathToInitFile
+	 *            the path to init file
+	 * @param additionalOptions
+	 *            the additional options
+	 * @param monitorOutput
+	 *            the monitor output
+	 */
+	public NetCqiServer(String pathToExecutable, String pathToRegistry, String pathToInitFile, String additionalOptions, boolean monitorOutput) {
+
+		this.pathToExecutable = pathToExecutable;
+		this.pathToRegistry = pathToRegistry;
+		this.pathToInitFile = pathToInitFile;
+		this.additionalOptions = additionalOptions;
+		this.monitorOutput = monitorOutput;
+	}
+
+	/**
+	 * Convert stream to string.
+	 *
+	 * @param is
+	 *            the is
+	 * @return the string
+	 */
+	@Override
+	public String convertStreamToString(InputStream is) {
+		BufferedReader reader = new BufferedReader(new InputStreamReader(is));
+		StringBuilder sb = new StringBuilder();
+
+		String line = null;
+		try {
+			while ((line = reader.readLine()) != null) {
+				sb.append(line);
+			}
+		} catch (IOException e) {
+			org.txm.utils.logger.Log.printStackTrace(e);
+		} finally {
+			try {
+				is.close();
+			} catch (IOException e) {
+				org.txm.utils.logger.Log.printStackTrace(e);
+			}
+		}
+
+		return sb.toString();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see java.lang.Object#finalize()
+	 */
+	@Override
+	protected void finalize() throws Throwable {
+		try {
+			this.stop();
+		} finally {
+			super.finalize();
+		}
+	}
+
+	/**
+	 * Gets the error stream.
+	 *
+	 * @return the error stream
+	 */
+	@Override
+	public InputStream getErrorStream() {
+		return process.getErrorStream();
+	}
+
+	/**
+	 * Gets the input stream.
+	 *
+	 * @return the input stream
+	 */
+	@Override
+	public InputStream getInputStream() {
+		return process.getInputStream();
+	}
+
+	/**
+	 * Gets the output stream.
+	 *
+	 * @return the output stream
+	 */
+	@Override
+	public OutputStream getOutputStream() {
+		return process.getOutputStream();
+	}
+
+	/**
+	 * Checks if the server is running.
+	 * 
+	 * @return true, if is running
+	 */
+	@Override
+	public Boolean isRunning() {
+		try {
+			this.process.exitValue();// this throws an
+										// IllegalThreadStateException if te
+										// process is running
+			// The IllegalThreadStateException has not been thrown, the process
+			// is not running.
+			return false;
+		} catch (IllegalThreadStateException e) {
+			// The IllegalThreadStateException has been thrown, all good.
+			return true;
+		}
+	}
+
+	@Override
+	public void setDebug(boolean val) {
+		debug = val;
+	}
+
+	/**
+	 * Start.
+	 *
+	 * @return true, if successful
+	 */
+	@Override
+	public Boolean start() {
+		ArrayList<String> cmd = new ArrayList<String>();
+		cmd.add(""); //$NON-NLS-1$ executable path will be foudn in preferences
+		if (pathToInitFile != null && pathToInitFile.length() > 0) {
+			cmd.add("-I");//$NON-NLS-1$
+			cmd.add(pathToInitFile);
+		}
+		cmd.add("-r"); //$NON-NLS-1$
+		cmd.add(pathToRegistry);
+		cmd.addAll(Arrays.asList(additionalOptions.trim().split(" ")));
+		cmdLine = cmd.toArray(new String[cmd.size()]);
+		Log.fine("Starting NullSearchEngineServer: " + cmd + " ... ");
+
+		try {
+			// System.out.println(Messages.bind(Messages.STARTING_SERVER,
+			// StringUtils.join(cmdLine, " "))); //$NON-NLS-1$
+			ProcessBuilder processBuilder = new ProcessBuilder(cmdLine);
+			processBuilder.redirectErrorStream(true);
+			this.process = processBuilder.start();
+
+			final InputStream stdout = this.process.getInputStream();
+			final InputStream stderr = this.process.getErrorStream();
+
+			Thread t1 = new Thread() {
+				@Override
+				public void run() {
+					InputStreamReader isr = new InputStreamReader(stdout);
+					BufferedReader br = new BufferedReader(isr);
+					String line = null;
+					try {
+						while ((line = br.readLine()) != null) {
+							if (debug)
+								System.out.println(CQPSearchEngineCoreMessages.cqpserverStdoutColon + line);
+						}
+					} catch (IOException e) {
+						Log.severe(Log.toString(e));
+					}
+				}
+			};
+			t1.start();
+
+			Thread t2 = new Thread() {
+				@Override
+				public void run() {
+					InputStreamReader isr = new InputStreamReader(stderr);
+					BufferedReader br = new BufferedReader(isr);
+					String line = null;
+					try {
+						while ((line = br.readLine()) != null) {
+							if (debug)
+								System.out.println(CQPSearchEngineCoreMessages.cqpserverStderrColon + line);
+						}
+					} catch (IOException e) {
+						// TODO Auto-generated catch block
+						org.txm.utils.logger.Log.printStackTrace(e);
+					}
+				}
+			};
+			t2.start();
+
+			return isRunning();
+		} catch (IOException e) {
+			// System.err.println("CQP server failed to start with the following command
+			// line: "
+			// + StringUtils.join(cmd, " "));
+		}
+		return false;
+	}
+
+	/**
+	 * Stop the server.
+	 */
+	@Override
+	public Boolean stop() {
+		Log.fine(SearchEngineCoreMessages.info_stoppingSearchEngine);
+
+		try {
+			process.destroy();
+			process.waitFor();
+		} catch (Exception e) {
+			Log.finest(Log.toString(e));
+			return false;
+		}
+		Log.fine(SearchEngineCoreMessages.info_searchEngineStopped);
+		return true;
+	}
+
+	public static void main(String args[]) {
+		try {
+			NetCqiServer server = new NetCqiServer("C:\\Program files\\TXM\\cwb\\bin\\cqpserver", "C:\\Documents and Settings\\mdecorde\\TXM\\registry", "C:\\Program files\\TXM\\cwb\\cqpserver.init", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+					"-b 1000000 -d OFF -P 4877"); //$NON-NLS-1$
+			System.out.println(server.start());
+
+			NetCqiClient client = new NetCqiClient("localhost", 4877); //$NON-NLS-1$
+			System.out.println(client.connect("", "")); //$NON-NLS-1$ //$NON-NLS-2$
+			server.stop();
+		} catch (ServerNotFoundException e) {
+			// TODO Auto-generated catch block
+			org.txm.utils.logger.Log.printStackTrace(e);
+		} catch (UnexpectedAnswerException e) {
+			// TODO Auto-generated catch block
+			org.txm.utils.logger.Log.printStackTrace(e);
+		} catch (IOException e) {
+			// TODO Auto-generated catch block
+			org.txm.utils.logger.Log.printStackTrace(e);
+		} catch (CqiServerError e) {
+			// TODO Auto-generated catch block
+			org.txm.utils.logger.Log.printStackTrace(e);
+		}
+	}
+}
\ No newline at end of file

Property changes on: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/NetCqiServer.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/ICqiServer.java
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/ICqiServer.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/ICqiServer.java	(revision 3659)
@@ -0,0 +1,90 @@
+// Copyright © 2010-2020 ENS de Lyon., University of Franche-Comté
+// 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: 2011-12-14 10:52:18 +0100 (mer., 14 déc. 2011) $
+// $LastChangedRevision: 2080 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.searchengine.cqp;
+
+import java.io.InputStream;
+import java.io.OutputStream;
+
+/**
+ * This class aims at handling a CQi server process. It is not a CQi server per
+ * se.
+ * 
+ * @author Jean-Philippe Magué
+ */
+public interface ICqiServer {
+
+	public void setDebug(boolean val);
+
+	/**
+	 * Start.
+	 *
+	 * @return true, if successful
+	 * @throws Exception 
+	 */
+	public Boolean start() throws Exception;
+
+	/**
+	 * Convert stream to string.
+	 *
+	 * @param is the is
+	 * @return the string
+	 */
+	public String convertStreamToString(InputStream is);
+
+	/**
+	 * Stop the server.
+	 */
+	public Boolean stop();
+
+	/**
+	 * Checks if the server is running.
+	 * 
+	 * @return true, if is running
+	 */
+	public Boolean isRunning();
+
+	/**
+	 * Gets the error stream.
+	 *
+	 * @return the error stream
+	 */
+	public InputStream getErrorStream();
+
+	/**
+	 * Gets the input stream.
+	 *
+	 * @return the input stream
+	 */
+	public InputStream getInputStream();
+	/**
+	 * Gets the output stream.
+	 *
+	 * @return the output stream
+	 */
+	public OutputStream getOutputStream();
+}

Property changes on: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/ICqiServer.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/package.html
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/package.html	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/package.html	(revision 3659)
@@ -0,0 +1,6 @@
+<html>
+<body>
+	<p>Implementation of full text indexing and querying using the CQP
+		engine.</p>
+</body>
+</html>
\ No newline at end of file

Property changes on: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/package.html
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/CqpDataProxy.java
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/CqpDataProxy.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/CqpDataProxy.java	(revision 3659)
@@ -0,0 +1,203 @@
+// Copyright © 2010-2020 ENS de Lyon., University of Franche-Comté
+// 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: 2013-05-06 17:38:43 +0200 (lun., 06 mai 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.searchengine.cqp;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.apache.commons.lang.ArrayUtils;
+import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
+import org.txm.searchengine.cqp.corpus.Property;
+import org.txm.searchengine.cqp.corpus.StructuralUnitProperty;
+import org.txm.utils.SparseList;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class CqpDataProxy.
+ */
+public class CqpDataProxy {
+	/**
+	 * Data is cached in a sparse list which give for each position the
+	 * corresponding string (given the property it is dedicated to).
+	 */
+	private SparseList<String> data;
+
+	/** The property getQualifiedName. */
+	private String property;
+	private boolean isWordProperty = true;
+	private NetCqiClient netCqiClient;
+	/**
+	 * Instantiates a new cqp data proxy.
+	 *
+	 * @param property the property getQualifiedName
+	 */
+	public CqpDataProxy(NetCqiClient netCqiClient, String property) {
+		this(netCqiClient,  property, true);
+	}
+	
+	public CqpDataProxy(NetCqiClient netCqiClient, Property property) {
+		this(netCqiClient,  property.getQualifiedName(), !(property instanceof StructuralUnitProperty));
+	}
+	
+	/**
+	 * Instantiates a new cqp data proxy.
+	 *
+	 * @param property the property getQualifiedName
+	 * @param isWordProperty true is the default value
+	 */
+	public CqpDataProxy(NetCqiClient netCqiClient, String property, boolean isWordProperty) {
+		this.data = new SparseList<String>();
+		this.property = property;
+		this.isWordProperty = isWordProperty;
+		this.netCqiClient = netCqiClient;
+	}
+
+	/**
+	 * Return lists of strings. The positions parameter gives a list of starting
+	 * points, and the nWords parameter gives a list of sizes: The i^th string
+	 * starts at the position positions.get(i) and is nWords.get(i)
+	 *
+	 * @param positions the positions
+	 * @param nWords the n words
+	 * @return the data
+	 * @throws CqiClientException the cqi client exception
+	 */
+	public List<List<String>> getData(List<Integer> positions,
+			List<Integer> nWords) throws CqiClientException {
+		List<List<String>> lines = new ArrayList<List<String>>();
+		for (int i = 0; i < positions.size(); i++)
+			lines.add(data.getRange(positions.get(i), positions.get(i)
+					+ nWords.get(i)));
+		List<Integer> allPositionsNeeded = new ArrayList<Integer>();
+		// the position in the corpus of the missing values
+		
+		for (int i = 0; i < lines.size(); i++) {
+			List<String> line = lines.get(i);
+			for (int j = 0; j < line.size(); j++) {
+				if (line.get(j) == null)
+					allPositionsNeeded.add(positions.get(i) + j);
+			}
+		}
+		if (allPositionsNeeded.size() > 0) {
+			String[] missingValues;
+			try {
+				if (!isWordProperty) {
+					//System.out.println("DataProxy: "+allPositionsNeeded);
+					int[] strucs = netCqiClient.cpos2Struc(
+									property,
+									ArrayUtils
+											.toPrimitive(allPositionsNeeded
+													.toArray(new Integer[0])));
+					//System.out.println("structs: "+Arrays.toString(strucs));
+					missingValues = netCqiClient._struc2Str(
+									property, strucs);
+					//System.out.println("missingValues: "+missingValues);
+				} else {
+					missingValues = netCqiClient._cpos2Str(
+									property,
+									ArrayUtils
+											.toPrimitive(allPositionsNeeded
+													.toArray(new Integer[0])));
+				}
+			} catch (Exception e) {
+				throw new CqiClientException(e);
+			}
+			for (int i = 0; i < missingValues.length; i++)
+				data.add(allPositionsNeeded.get(i), missingValues[i]);
+			// There is no more missing values in data, we can query it again
+			// This is is pretty ugly since all the non missing values have
+			// already been retrieved...
+			lines = new ArrayList<List<String>>();
+			for (int i = 0; i < positions.size(); i++)
+				lines.add(data.getRange(positions.get(i), positions.get(i)
+						+ nWords.get(i)));
+		}
+		return lines;
+	}
+
+	public List<String> getData(List<Integer> positions) throws CqiClientException {
+		int [] ipositions = new int[positions.size()];
+		for(int i = 0 ; i < positions.size() ; i++)
+			ipositions[i] = positions.get(i);
+		return getData(ipositions);
+	}
+	
+	/**
+	 * Gets the data.
+	 *
+	 * @param positions the positions
+	 * @return the data
+	 * @throws CqiClientException the cqi client exception
+	 */
+	public List<String> getData(int[] positions) throws CqiClientException {
+		//System.out.println("CqpDataProxy: start "+property);
+		//System.out.println("positions: "+Arrays.toString(positions));
+		List<String> lines = new ArrayList<String>();
+		for (int i = 0; i < positions.length; i++)
+			lines.add(data.getRange(positions[i], positions[i] + 1).get(0));
+		//System.out.println("lines: "+lines);
+		List<Integer> missingValuePositions = new ArrayList<Integer>();// the position in the corpus of the missing values
+		for (int i = 0; i < lines.size(); i++) {
+			String line = lines.get(i);
+			if (line == null)
+				missingValuePositions.add(positions[i]);
+		}
+		//System.out.println("missingValuePositions: "+missingValuePositions);
+		if (missingValuePositions.size() > 0) {
+			String[] missingValues;
+			try {
+				if (!isWordProperty) {
+					int[] strucs = netCqiClient.cpos2Struc(
+									property,
+									ArrayUtils.toPrimitive(missingValuePositions
+													.toArray(new Integer[0])));
+					//System.out.println("structs: "+Arrays.toString(strucs));
+					missingValues = netCqiClient._struc2Str(property, strucs);
+				} else {
+					missingValues = netCqiClient._cpos2Str(
+									property,
+									ArrayUtils.toPrimitive(missingValuePositions
+													.toArray(new Integer[0])));
+					//System.out.println("missingValues: "+missingValues);
+				}
+			} catch (Exception e) {
+				throw new CqiClientException(e);
+			}
+			for (int i = 0; i < missingValues.length; i++)
+				data.add(missingValuePositions.get(i), missingValues[i]);
+			// There is no more missing values in data, we can query it again
+			// This is is pretty ugly since all the non missing values have
+			// already been retrieved...
+			lines = new ArrayList<String>();
+			for (int i = 0; i < positions.length; i++)
+				lines.add(data.getRange(positions[i], positions[i] + 1).get(0));
+		}
+		return lines;
+	}
+}

Property changes on: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/CqpDataProxy.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/NetCqiClient.java
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/NetCqiClient.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/NetCqiClient.java	(revision 3659)
@@ -0,0 +1,1956 @@
+// Copyright © 2010-2020 ENS de Lyon., University of Franche-Comté
+// 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: 2015-05-13 09:46:56 +0200 (Wed, 13 May 2015) $
+// $LastChangedRevision: 2967 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.searchengine.cqp;
+
+import java.io.ByteArrayOutputStream;
+import java.io.DataInput;
+import java.io.DataInputStream;
+import java.io.DataOutput;
+import java.io.DataOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.InetSocketAddress;
+import java.net.Socket;
+import java.net.SocketAddress;
+import java.util.Arrays;
+import java.util.HashMap;
+
+import org.txm.core.messages.TXMCoreMessages;
+import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
+import org.txm.searchengine.cqp.clientExceptions.ServerNotFoundException;
+import org.txm.searchengine.cqp.clientExceptions.UnexpectedAnswerException;
+import org.txm.searchengine.cqp.core.messages.CQPSearchEngineCoreMessages;
+import org.txm.searchengine.cqp.serverException.CqiClErrorCorpusAccess;
+import org.txm.searchengine.cqp.serverException.CqiClErrorInternal;
+import org.txm.searchengine.cqp.serverException.CqiClErrorNoSuchAttribute;
+import org.txm.searchengine.cqp.serverException.CqiClErrorOutOfMemory;
+import org.txm.searchengine.cqp.serverException.CqiClErrorOutOfRange;
+import org.txm.searchengine.cqp.serverException.CqiClErrorRegex;
+import org.txm.searchengine.cqp.serverException.CqiClErrorWrongAttributeType;
+import org.txm.searchengine.cqp.serverException.CqiCqpErrorErrorGeneral;
+import org.txm.searchengine.cqp.serverException.CqiCqpErrorInvalidField;
+import org.txm.searchengine.cqp.serverException.CqiCqpErrorNoSuchCorpus;
+import org.txm.searchengine.cqp.serverException.CqiCqpErrorOutOfRange;
+import org.txm.searchengine.cqp.serverException.CqiCqpErrorSyntax;
+import org.txm.searchengine.cqp.serverException.CqiErrorConnectRefused;
+import org.txm.searchengine.cqp.serverException.CqiErrorGeneralError;
+import org.txm.searchengine.cqp.serverException.CqiErrorSyntaxError;
+import org.txm.searchengine.cqp.serverException.CqiErrorUserAbort;
+import org.txm.searchengine.cqp.serverException.CqiServerError;
+import org.txm.utils.ExecTimer;
+import org.txm.utils.logger.Log;
+
+// TODO: Auto-generated Javadoc
+/**
+ * This class implements a Java CQi client.
+ *
+ * @author Jean-Philippe Magué
+ */
+public class NetCqiClient extends AbstractCqiClient {
+
+	/** The socket. */
+	private Socket socket;
+
+	/** The server address. */
+	private SocketAddress serverAddress;
+
+	/** The stream to write data on the socket. */
+	private DataOutput streamToServer;
+
+	/** The stream to read data from the socket. */
+	private DataInput streamFromServer;
+
+	/** The host. */
+	private String host;
+
+	/** The port. */
+	private int port;
+
+	private String username;
+
+	private String password;
+	
+	//key 1 : property name
+	private HashMap<String,CqpDataProxy> corporacache = new HashMap<String, CqpDataProxy>();
+
+	/**
+	 * Write a string on the socket.
+	 * 
+	 * @param string
+	 *            the string
+	 * 
+	 * @throws IOException
+	 *             Signals that an I/O exception has occurred.
+	 */
+	private synchronized void writeString(String string) throws IOException {
+		byte[] bytes = string.getBytes("UTF-8"); //$NON-NLS-1$
+		this.streamToServer.writeShort(bytes.length);
+		this.streamToServer.write(bytes);
+
+		// short length = (short) string.length();
+
+		// long start = System.currentTimeMillis();
+		// this.streamToServer.writeShort(length);
+		// this.streamToServer.write(string.getBytes("UTF-8"));
+		// long end = System.currentTimeMillis();
+		// System.out.println("String \"" + string + "\" writen at " +
+		// (string.getBytes("ISO-8859-1").length/(1+end-start)) +"kb/s");
+
+	}
+
+	/**
+	 * Write a string array on the socket.
+	 * 
+	 * @param strings
+	 *            the string array
+	 * 
+	 * @throws IOException
+	 *             Signals that an I/O exception has occurred.
+	 */
+	private synchronized void writeStringArray(String[] strings)
+			throws IOException {
+		int length = strings.length;
+		this.streamToServer.writeInt(length);
+		for (int i = 0; i < length; i++)
+			writeString(strings[i]);
+	}
+
+	/**
+	 * Write int array on the socket.
+	 * 
+	 * @param ints
+	 *            the int array
+	 * 
+	 * @throws IOException
+	 *             Signals that an I/O exception has occurred.
+	 */
+	private synchronized void writeIntArray(int[] ints) throws IOException {
+		int length = ints.length;
+		this.streamToServer.writeInt(length);
+		for (int i = 0; i < length; i++) {
+			// System.out.println(i+"/"+length);
+			this.streamToServer.writeInt(ints[i]);
+		}
+	}
+
+	/**
+	 * Read a string from the socket.
+	 * 
+	 * @return the string
+	 * 
+	 * @throws UnexpectedAnswerException
+	 *             Signals that the data read on the socket is unexpected
+	 * @throws CqiServerError
+	 *             Signals that the cqi server raised an error
+	 * @throws IOException
+	 *             Signals that an I/O exception has occurred.
+	 */
+	private synchronized String readString() throws UnexpectedAnswerException, CqiServerError, IOException {
+		
+		Log.finest(CQPSearchEngineCoreMessages.readingStringFromTheCQiServer);
+		
+		if (readHeaderFromServer() != CQI_DATA_STRING) {
+			throw new UnexpectedAnswerException();
+		}
+		short length = this.streamFromServer.readShort();
+		byte[] bytes = new byte[length];
+		this.streamFromServer.readFully(bytes);
+		String res = new String(bytes, "UTF-8"); //$NON-NLS-1$
+		
+		Log.finest(TXMCoreMessages.bind(CQPSearchEngineCoreMessages.readStringFromTheCQiServerColonP0, res));
+		
+		return res;
+	}
+
+	/**
+	 * Read a boolean from the socket.
+	 * 
+	 * @return the boolean
+	 * 
+	 * @throws UnexpectedAnswerException
+	 *             Signals that the data read on the socket is unexpected
+	 * @throws CqiServerError
+	 *             Signals that the cqi server raised an error
+	 * @throws IOException
+	 *             Signals that an I/O exception has occurred.
+	 */
+	private synchronized boolean readBoolean() throws UnexpectedAnswerException, CqiServerError, IOException {
+		byte b = 0;
+		
+		Log.finest(CQPSearchEngineCoreMessages.readingBooleanFromTheCQiServer);
+		
+		if (readHeaderFromServer() != CQI_DATA_BOOL) {
+			throw new UnexpectedAnswerException();
+		}
+		b = this.streamFromServer.readByte();
+		boolean res = (b == 1);
+		
+		Log.finest(TXMCoreMessages.bind(CQPSearchEngineCoreMessages.readBooleanFromTheCQiServerColonP0, res));
+		
+		return res;
+	}
+
+	/**
+	 * Read an int from the socket.
+	 * 
+	 * @return the int
+	 * 
+	 * @throws UnexpectedAnswerException
+	 *             Signals that the data read on the socket is unexpected
+	 * @throws CqiServerError
+	 *             Signals that the cqi server raised an error
+	 * @throws IOException
+	 *             Signals that an I/O exception has occurred.
+	 */
+	private synchronized int readInt() throws UnexpectedAnswerException, CqiServerError, IOException {
+		
+		Log.finest(CQPSearchEngineCoreMessages.readingIntegerFromTheCQiServer);
+		
+		if (readHeaderFromServer() != CQI_DATA_INT) {
+			throw new UnexpectedAnswerException();
+		}
+		int res = this.streamFromServer.readInt();
+		
+		Log.finest(TXMCoreMessages.bind(CQPSearchEngineCoreMessages.readIntegerFromTheCQiServerColonP0, res));
+		
+		return res;
+	}
+
+	/**
+	 * Read a string array from the socket.
+	 * 
+	 * @return the string array
+	 * 
+	 * @throws UnexpectedAnswerException
+	 *             Signals that the data read on the socket is unexpected
+	 * @throws CqiServerError
+	 *             Signals that the cqi server raised an error
+	 * @throws IOException
+	 *             Signals that an I/O exception has occurred.
+	 */
+	private synchronized String[] readStringArray() throws UnexpectedAnswerException, CqiServerError, IOException {
+		
+		Log.finest(CQPSearchEngineCoreMessages.readingStringArrayFromTheCQiServer);
+		
+		byte[] header = readHeaderFromServer();
+		if (header != CQI_DATA_STRING_LIST) {
+			throw new UnexpectedAnswerException();
+		}
+		// long start = System.currentTimeMillis();
+		int arrayLength = this.streamFromServer.readInt();
+		int nByteRead = 4;
+		String[] strings = new String[arrayLength];
+		/*
+		 * System.out.println("Available: "+this.socket.getInputStream().available
+		 * ()); byte[] allb = readInByte(this.socket.getInputStream());
+		 * 
+		 * System.out.println("count = "+allb.length);
+		 * System.out.println("array length = "+arrayLength);
+		 * 
+		 * int readindex = 0; for(int i=0; i<arrayLength; i++){ short
+		 * stringLength = bytesToShort(allb[readindex],allb[readindex+1]);
+		 * readindex += 2;
+		 * 
+		 * byte[] strbytes = new byte[stringLength]; System.arraycopy(allb,
+		 * readindex, strbytes, 0, stringLength); strings[i] = new
+		 * String(strbytes,"UTF-8");
+		 * //System.out.println(""+i+" Str len "+stringLength
+		 * +" >> "+strings[i]); readindex += stringLength; }
+		 */
+		for (int i = 0; i < arrayLength; i++) {
+			short stringLength = this.streamFromServer.readShort();
+			nByteRead += 2;
+			byte[] bytes = new byte[stringLength];
+			// long start2 = System.currentTimeMillis();
+			this.streamFromServer.readFully(bytes);
+			// long end2 = System.currentTimeMillis();
+			// System.out.println("Reading at " +
+			// (stringLength/(1+end2-start2))+ "kb/s");
+			nByteRead += stringLength;
+			strings[i] = new String(bytes, "UTF-8");//, "ISO-8859-1"); //$NON-NLS-1$
+		}
+		// System.out.println("read : "+nByteRead);
+		// long end = System.currentTimeMillis();
+		// System.out.println(nByteRead + " bytes read in " +(end-start)+ "ms ("
+		// + (nByteRead/(1+end-start)) + "kb/s)");
+		
+		Log.finest(TXMCoreMessages.bind(CQPSearchEngineCoreMessages.readStringArrayFromTheCQiServerColonP0, Arrays.asList(strings)));
+		
+		return strings;
+	}
+
+	/**
+	 * Read in byte.
+	 *
+	 * @param in the in
+	 * @return the byte[]
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 */
+	private synchronized byte[] readInByte(InputStream in) throws IOException {
+		int count;
+		byte[] buffer = new byte[8192];
+		ByteArrayOutputStream out = new ByteArrayOutputStream();
+		while ((count = in.read(buffer)) > 0) {
+			out.write(buffer, 0, count);
+		}
+		out.close();
+		return out.toByteArray();
+	}
+
+	/**
+	 * Byte array to string.
+	 *
+	 * @param b the b
+	 * @return the string
+	 */
+	private synchronized String byteArrayToString(byte[] b) {
+		StringBuffer res = new StringBuffer("["); //$NON-NLS-1$
+		if (b.length > 0) {
+			res.append(b[0]);
+			for (int i = 1; i < b.length; i++)
+				res.append("; " + b[i]); //$NON-NLS-1$
+		}
+		res.append("]"); //$NON-NLS-1$
+		return res.toString();
+	}
+
+	/**
+	 * Read an int array from the socket.
+	 * 
+	 * @return the int array
+	 * 
+	 * @throws UnexpectedAnswerException
+	 *             Signals that the data read on the socket is unexpected
+	 * @throws CqiServerError
+	 *             Signals that the cqi server raised an error
+	 * @throws IOException
+	 *             Signals that an I/O exception has occurred.
+	 */
+	private synchronized int[] readIntList() throws UnexpectedAnswerException,
+	CqiServerError, IOException {
+		
+		Log.finest(CQPSearchEngineCoreMessages.readingIntegerArrayFromTheCQiServer);
+		
+		if ((readHeaderFromServer()) != CQI_DATA_INT_LIST) {
+			throw new UnexpectedAnswerException();
+		}
+		int arrayLength = this.streamFromServer.readInt();
+		int bsize = arrayLength * 4;
+
+		int[] ints = new int[arrayLength];
+		byte[] b = new byte[bsize];// int size
+
+		// System.out.println("bsize : "+bsize);
+		streamFromServer.readFully(b);
+		// System.out.println("read "+ ((DataInputStream)
+		// streamFromServer).readFully(b));
+		int nbline = 0;
+		for (int i = 0; i + 3 < bsize; i += 4) {
+			ints[nbline++] = bytesToInt(b[i], b[i + 1], b[i + 2], b[i + 3]);
+		}
+		/*
+		 * for(int i=0; i<arrayLength; i++){ ints[i] =
+		 * this.streamFromServer.readInt(); }
+		 */
+		
+		Log.finest(TXMCoreMessages.bind(CQPSearchEngineCoreMessages.readIntegerArrayFromTheCQiServerColonP0, Arrays.asList(ints)));
+		
+		return ints;
+	}
+
+	/**
+	 * Bytes to int.
+	 *
+	 * @param bytes the bytes
+	 * @return the int
+	 */
+	protected synchronized static int bytesToInt(byte[] bytes) {
+		int value = 0;
+
+		for (int i = 0; i < bytes.length; i++) {
+			value = value << 8;
+			value += bytes[i] & 0xff;
+		}
+
+		return value;
+	}
+
+	/**
+	 * Bytes to int.
+	 *
+	 * @param a the a
+	 * @param b the b
+	 * @param c the c
+	 * @param d the d
+	 * @return the int
+	 */
+	protected synchronized static int bytesToInt(byte a, byte b, byte c, byte d) {
+		return (((a & 0xff) << 24) | ((b & 0xff) << 16) | ((c & 0xff) << 8) | (d & 0xff));
+	}
+
+	/**
+	 * Bytes to short.
+	 *
+	 * @param hi the hi
+	 * @param lo the lo
+	 * @return the short
+	 */
+	protected synchronized static short bytesToShort(byte hi, byte lo) {
+		return (short) (((hi & 0xFF) << 8) | (lo & 0xFF));
+	}
+
+	/**
+	 * Read an int array from the socket.
+	 * 
+	 * @return the int array
+	 * 
+	 * @throws UnexpectedAnswerException
+	 *             Signals that the data read on the socket is unexpected
+	 * @throws CqiServerError
+	 *             Signals that the cqi server raised an error
+	 * @throws IOException
+	 *             Signals that an I/O exception has occurred.
+	 */
+	private synchronized int[][] readIntTable() throws UnexpectedAnswerException, CqiServerError, IOException {
+		
+		Log.finest(CQPSearchEngineCoreMessages.readingAnIntegerTableFromTheCQiServer);
+		
+		if ((readHeaderFromServer()) != CQI_DATA_INT_TABLE) {
+			throw new UnexpectedAnswerException();
+		}
+		int nRow = this.streamFromServer.readInt();
+		int nCol = this.streamFromServer.readInt();
+		int[][] ints = new int[nRow][nCol];
+		for (int i = 0; i < nRow; i++)
+			for (int j = 0; j < nCol; j++)
+				ints[i][j] = this.streamFromServer.readInt();
+		
+		Log.finest(TXMCoreMessages.bind(CQPSearchEngineCoreMessages.readString2DIntegerFromTheCQiServerColonP0, Arrays.asList(ints)));
+		
+		return ints;
+	}
+
+	/**
+	 * Read two successive ints from the socket.
+	 *
+	 * @return an array of size 2 containing the int
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws CqiServerError Signals that the cqi server raised an error
+	 */
+	private synchronized int[] readIntInt() throws IOException,	UnexpectedAnswerException, CqiServerError {
+		
+		Log.finest(CQPSearchEngineCoreMessages.readingIntegerArrayFromTheCQiServer);
+		
+		if (readHeaderFromServer() != CQI_DATA_INT_INT) {
+			throw new UnexpectedAnswerException();
+		}
+		int[] res = new int[2];
+		res[0] = this.streamFromServer.readInt();
+		res[1] = this.streamFromServer.readInt();
+		
+		Log.finest(TXMCoreMessages.bind(CQPSearchEngineCoreMessages.readIntegerArrayFromTheCQiServerColonP0, Arrays.asList(res)));
+		
+		return res;
+	}
+
+	/**
+	 * Read four successive ints from the socket.
+	 *
+	 * @return an array of size 4 containing the int
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws CqiServerError Signals that the cqi server raised an error
+	 */
+	private synchronized int[] readIntIntIntInt() throws IOException, UnexpectedAnswerException, CqiServerError {
+		
+		Log.finest(CQPSearchEngineCoreMessages.readingIntegerArrayFromTheCQiServer);
+		
+		if (readHeaderFromServer() != CQI_DATA_INT_INT_INT_INT) {
+			throw new UnexpectedAnswerException();
+		}
+		int[] res = new int[4];
+		res[0] = this.streamFromServer.readInt();
+		res[1] = this.streamFromServer.readInt();
+		res[2] = this.streamFromServer.readInt();
+		res[3] = this.streamFromServer.readInt();
+		
+		Log.finest(TXMCoreMessages.bind(CQPSearchEngineCoreMessages.readIntegerArrayFromTheCQiServerColonP0, Arrays.asList(res)));
+		return res;
+	}
+
+	/**
+	 * Read the header of the data send by the server.
+	 * 
+	 * @return the header
+	 * 
+	 * @throws UnexpectedAnswerException
+	 *             Signals that the data read on the socket is unexpected
+	 * @throws CqiServerError
+	 *             Signals that the cqi server raised an error
+	 * @throws IOException
+	 *             Signals that an I/O exception has occurred.
+	 */
+	private synchronized byte[] readHeaderFromServer() throws UnexpectedAnswerException, CqiServerError, IOException {
+		
+		Log.finest(CQPSearchEngineCoreMessages.readingHeaderFromTheCQiServer);
+		
+		byte b = this.streamFromServer.readByte();
+		
+		Log.finest(CQPSearchEngineCoreMessages.bind(CQPSearchEngineCoreMessages.readByteFromTheCQiServerColonP0, b));
+		
+		switch (b) {
+		case 0x00:// cf cqi.h:29
+			return CQI_PADDING;
+		case 0x01:// cf cqi.h:37
+			b = this.streamFromServer.readByte();
+			
+			Log.finest(CQPSearchEngineCoreMessages.bind(CQPSearchEngineCoreMessages.readByteFromTheCQiServerColonP0, b));
+			
+			switch (b) {
+			case 0x01:// cf cqi.h:39
+				return CQI_STATUS_OK;
+			case 0x02:// cf cqi.h:40
+				return CQI_STATUS_CONNECT_OK;
+			case 0x03:// cf cqi.h:41
+				return CQI_STATUS_BYE_OK;
+			case 0x04:// cf cqi.h:42
+				return CQI_STATUS_PING_OK;
+			}
+		case 0x02:// cf cqi.h:45
+			b = this.streamFromServer.readByte();
+			
+			Log.finest(CQPSearchEngineCoreMessages.bind(CQPSearchEngineCoreMessages.readByteFromTheCQiServerColonP0, b));
+			
+			lastError = CQPSearchEngineCoreMessages.internalCQIErrorColon+b;
+			switch (b) {
+			case 0x01:// cf cqi.h:39
+				throw new CqiErrorGeneralError();
+			case 0x02:// cf cqi.h:40
+				throw new CqiErrorConnectRefused();
+			case 0x03:// cf cqi.h:41
+				throw new CqiErrorUserAbort();
+			case 0x04:// cf cqi.h:42
+				throw new CqiErrorSyntaxError();
+			}
+		case 0x03:// cf cqi.h:53
+			b = this.streamFromServer.readByte();
+			
+			Log.finest(CQPSearchEngineCoreMessages.bind(CQPSearchEngineCoreMessages.readByteFromTheCQiServerColonP0, b));
+			
+			switch (b) {
+			case 0x01:// cf cqi.h:39
+				return CQI_DATA_BYTE;
+			case 0x02:// cf cqi.h:40
+				return CQI_DATA_BOOL;
+			case 0x03:// cf cqi.h:41
+				return CQI_DATA_INT;
+			case 0x04:// cf cqi.h:42
+				return CQI_DATA_STRING;
+			case 0x05:// cf cqi.h:42
+				return CQI_DATA_BYTE_LIST;
+			case 0x06:// cf cqi.h:42
+				return CQI_DATA_BOOL_LIST;
+			case 0x07:// cf cqi.h:42
+				return CQI_DATA_INT_LIST;
+			case 0x08:// cf cqi.h:42
+				return CQI_DATA_STRING_LIST;
+			case 0x09:// cf cqi.h:42
+				return CQI_DATA_INT_INT;
+			case 0x0A:// cf cqi.h:42
+				return CQI_DATA_INT_INT_INT_INT;
+			case 0x0B:// cf cqi.h:42
+				return CQI_DATA_INT_TABLE;
+			}
+		case 0x04:// cf cqi.h:67
+
+			b = this.streamFromServer.readByte();
+			lastError = CQPSearchEngineCoreMessages.cLErrorColon+b;
+			
+			Log.finest(CQPSearchEngineCoreMessages.bind(CQPSearchEngineCoreMessages.readByteFromTheCQiServerColonP0, b));
+			
+			switch (b) {
+			case 0x01:// cf cqi.h:39
+				throw new CqiClErrorNoSuchAttribute();
+			case 0x02:// cf cqi.h:40
+				throw new CqiClErrorWrongAttributeType();
+			case 0x03:// cf cqi.h:41
+				throw new CqiClErrorOutOfRange();
+			case 0x04:// cf cqi.h:42
+				lastError = getLastCqiError();
+				throw new CqiClErrorRegex();
+			case 0x05:// cf cqi.h:42
+				throw new CqiClErrorCorpusAccess();
+			case 0x06:// cf cqi.h:42
+				throw new CqiClErrorOutOfMemory();
+			case 0x07:// cf cqi.h:42
+				throw new CqiClErrorInternal();
+			}
+		case 0x05:// cf cqi.h:94
+
+			b = this.streamFromServer.readByte();
+			lastError = CQPSearchEngineCoreMessages.bind(CQPSearchEngineCoreMessages.cQPErrorColonP0, b);
+			
+			Log.finest(CQPSearchEngineCoreMessages.bind(CQPSearchEngineCoreMessages.readByteFromTheCQiServerColonP0, b));
+			
+			switch (b) {
+			case 0x01:// cf cqi.h:39
+				throw new CqiCqpErrorErrorGeneral();
+			case 0x02:// cf cqi.h:40
+				throw new CqiCqpErrorNoSuchCorpus();
+			case 0x03:// cf cqi.h:41
+				throw new CqiCqpErrorInvalidField();
+			case 0x04:// cf cqi.h:42
+				throw new CqiCqpErrorOutOfRange();
+			case 0x05:// cf cqi.h:44
+				lastError = getLastCQPError();
+				throw new CqiCqpErrorSyntax();
+			}
+		}
+		return null;
+	}
+
+	/**
+	 * Ask the server to execute a function with a String->String signature.
+	 *
+	 * @param string the argument
+	 * @param function the function to be executed
+	 * @return the result
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiServerError Signals that the cqi server raised an error
+	 */
+	private synchronized String genericStringToString(String string, byte[] function) throws UnexpectedAnswerException, IOException,
+			CqiServerError {
+		this.streamToServer.write(function);
+		this.writeString(string);
+		return readString();
+	}
+
+	/**
+	 * Ask the server to execute a function with a String->StringArray signature.
+	 *
+	 * @param string the argument
+	 * @param function the function to be executed
+	 * @return the result
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiServerError Signals that the cqi server raised an error
+	 */
+	private synchronized String[] genericStringToStringArray(String string, byte[] function) throws UnexpectedAnswerException, IOException, CqiServerError {
+		this.streamToServer.write(function);
+		this.writeString(string);
+		return readStringArray();
+	}
+
+	/**
+	 * Ask the server to execute a function with a String x int[]->String[]
+	 * signature.
+	 *
+	 * @param string the string argument
+	 * @param ints the int[] argument
+	 * @param function the function to be executed
+	 * @return the result
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws CqiServerError Signals that the cqi server raised an error
+	 */
+	private synchronized String[] genericStringXIntArraytoStringArray( String string, int[] ints, byte[] function) throws IOException, UnexpectedAnswerException, CqiServerError {
+		// long start = System.currentTimeMillis();
+		this.streamToServer.write(function);
+		// System.out.println(System.currentTimeMillis()-start);
+		this.writeString(string);
+		// System.out.println(System.currentTimeMillis()-start);
+		this.writeIntArray(ints);
+		// System.out.println(System.currentTimeMillis()-start);
+		String[] res = readStringArray();
+		// System.out.println(System.currentTimeMillis()-start);
+		return res;
+	}
+
+	/**
+	 * Ask the server to execute a function with a String x int[]->int[]
+	 * signature.
+	 *
+	 * @param string the string argument
+	 * @param ints the int[] argument
+	 * @param function the function to be executed
+	 * @return the result
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws CqiServerError Signals that the cqi server raised an error
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 */
+	private synchronized int[] genericStringXIntArraytoIntArray(String string, int[] ints, byte[] function) throws UnexpectedAnswerException, CqiServerError, IOException {
+		this.streamToServer.write(function);
+		this.writeString(string);
+		this.writeIntArray(ints);
+		return readIntList();
+	}
+
+	/**
+	 * Instantiates a new cqi client.
+	 * 
+	 * @param host
+	 *            the host of the CQI server
+	 * @param port
+	 *            the port of the CQI server
+	 * 
+	 * @throws ServerNotFoundException
+	 *             the server not found exception
+	 */
+	public NetCqiClient(String host, int port) throws ServerNotFoundException {
+		try {
+			Thread.sleep(500);
+		} catch (InterruptedException ix) {
+		}
+
+		int attempts = 10;
+		while (attempts > 0) {
+			try {
+				this.host = host;
+				this.port = port;
+				this.socket = new Socket();
+				this.serverAddress = new InetSocketAddress(host, port);
+				this.socket.connect(serverAddress);
+				this.streamToServer = new DataOutputStream(this.socket.getOutputStream());
+				this.streamFromServer = new DataInputStream(this.socket.getInputStream());
+				Log.fine(CQPSearchEngineCoreMessages.searchEngineLaunched);
+				return;
+			} catch (IOException e) {
+				System.err.print("."); //$NON-NLS-1$
+				try {
+					Thread.sleep(2000);
+				} catch (InterruptedException ix) {
+				}
+			}
+
+			attempts--;
+		}
+		throw new ServerNotFoundException(CQPSearchEngineCoreMessages.failedToConnectToSearchEngine);
+	}
+
+	// CQI_ERROR_CONNECT_REFUSED
+	/**
+	 * Connect the client to a server.
+	 *
+	 * @param username the username
+	 * @param password the password
+	 * @return true, if successful
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiServerError Signals that the cqi server raised an error
+	 */
+	@Override
+	public synchronized boolean connect(String username, String password) throws UnexpectedAnswerException, IOException, CqiServerError {
+		this.username = username;
+		this.password = password;
+		
+		Log.finest(TXMCoreMessages.bind(CQPSearchEngineCoreMessages.connectingToTheSearchEngineWithTheFollowingParametersColonP0ColonP1AtP2P3, username, password, host, port));
+		
+		this.streamToServer.write(CQI_CTRL_CONNECT);
+		this.writeString(username);
+		this.writeString(password);
+		try {
+			readHeaderFromServer();
+			Log.finest(CQPSearchEngineCoreMessages.connectedToTheSearchEngine);
+			return true;
+		} catch (CqiErrorConnectRefused e) {
+			return false;
+		} catch (CqiServerError e) {
+			return false;
+		}
+	}
+
+	// None
+	/**
+	 * Disconnect.
+	 * 
+	 * @return true, if successful
+	 * 
+	 * @throws UnexpectedAnswerException
+	 *             Signals that the data read on the socket is unexpected
+	 * @throws CqiServerError
+	 *             Signals that the cqi server raised an error
+	 * @throws IOException
+	 *             Signals that an I/O exception has occurred.
+	 */
+	@Override
+	public synchronized boolean disconnect() throws UnexpectedAnswerException, CqiServerError, IOException {
+		this.streamToServer.write(CQI_CTRL_BYE);
+		return (readHeaderFromServer() == CQI_STATUS_BYE_OK);
+	}
+
+	String lastError;
+	@Override
+	public synchronized String getLastError() {
+		if(lastError != null && lastError.length() > 0) {
+			return lastError;
+		}
+		return CQPSearchEngineCoreMessages.noError;
+	}
+
+	// CQI_CTRL_LAST_GENERAL_ERROR
+	/**
+	 * return the last CQP error.
+	 *
+	 * @return the last error
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiServerError Signals that the cqi server raised an error
+	 */
+	@Override
+	public synchronized String getLastCqiError() throws UnexpectedAnswerException, IOException, CqiServerError {
+		
+		Log.severe(CQPSearchEngineCoreMessages.gettingLastCQPError);
+		
+		this.streamToServer.write(CQI_CTRL_LAST_GENERAL_ERROR);
+
+		try {
+			String ret = readString();
+			return getLastCQPError()+"\t"+ret; //$NON-NLS-1$
+		} catch (CqiServerError e) {
+			Log.severe(CQPSearchEngineCoreMessages.lastCQiErrorColon + e);
+			return "error"; //$NON-NLS-1$
+		}
+	}
+
+	// CQI_CTRL_LAST_CQP_ERROR
+	/**
+	 * return the last CQP error.
+	 *
+	 * @return the last error
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiServerError Signals that the cqi server raised an error
+	 */
+	@Override
+	public synchronized String getLastCQPError() {
+		try {
+			this.streamToServer.write(CQI_CTRL_LAST_CQP_ERROR);
+			String ret = readString();
+			return ret;
+		} catch (Exception e) {
+			Log.severe(CQPSearchEngineCoreMessages.lastCQPErrorColon + e);
+			return "error"; //$NON-NLS-1$
+		}
+	}
+
+	// None
+	/**
+	 * Lists the corpora available on the server.
+	 *
+	 * @return the name of the corpora
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiServerError Signals that the cqi server raised an error
+	 */
+	@Override
+	public synchronized String[] listCorpora() throws UnexpectedAnswerException, IOException, CqiServerError {
+		this.streamToServer.write(CQI_CORPUS_LIST_CORPORA);
+		return readStringArray();
+	}
+
+	// None
+	/**
+	 * Gives the corpus charset.
+	 *
+	 * @param corpus the corpus
+	 * @return the name of the charset
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiServerError Signals that the cqi server raised an error
+	 */
+	@Override
+	public synchronized String corpusCharset(String corpus) throws UnexpectedAnswerException, IOException, CqiServerError {
+		return genericStringToString(corpus, CQI_CORPUS_CHARSET);
+	}
+
+	// None (not really implemented anyway)
+	/**
+	 * Gives the corpus properties.
+	 *
+	 * @param corpus the corpus
+	 * @return the properties
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiServerError Signals that the cqi server raised an error
+	 */
+	@Override
+	public synchronized String[] corpusProperties(String corpus) throws UnexpectedAnswerException, IOException, CqiServerError {
+		return genericStringToStringArray(corpus, CQI_CORPUS_PROPERTIES);
+	}
+
+	// CQI_CQP_ERROR_NO_SUCH_CORPUS
+	/**
+	 * Gives the corpus positional attributes.
+	 *
+	 * @param corpusID the corpus id
+	 * @return the name of the attributes
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiServerError Signals that the cqi server raised an error
+	 */
+	@Override
+	public synchronized String[] corpusPositionalAttributes(String corpusID) throws UnexpectedAnswerException, IOException, CqiServerError {
+		return genericStringToStringArray(corpusID, CQI_CORPUS_POSITIONAL_ATTRIBUTES);
+	}
+
+	// CQI_CQP_ERROR_NO_SUCH_CORPUS
+	/**
+	 * Gives the corpus structural attributes.
+	 *
+	 * @param corpus the corpus
+	 * @return the name of the attributes
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiServerError Signals that the cqi server raised an error
+	 */
+	@Override
+	public synchronized String[] corpusStructuralAttributes(String corpus) throws UnexpectedAnswerException, IOException, CqiServerError {
+		return genericStringToStringArray(corpus, CQI_CORPUS_STRUCTURAL_ATTRIBUTES);
+	}
+
+	// CQI_CQP_ERROR_NO_SUCH_CORPUS, CQI_CL_ERROR_NO_SUCH_ATTRIBUTE,
+	// CQI_CL_ERROR_WRONG_ATTRIBUTE_TYPE
+	/**
+	 * Check wether a structural attribute has values.
+	 *
+	 * @param attribute the attribute
+	 * @return true, if it has values
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiServerError Signals that the cqi server raised an error
+	 */
+	@Override
+	public synchronized boolean corpusStructuralAttributeHasValues(String attribute) throws UnexpectedAnswerException, IOException, CqiServerError {
+		this.streamToServer.write(CQI_CORPUS_STRUCTURAL_ATTRIBUTE_HAS_VALUES);
+		this.writeString(attribute);
+		return readBoolean();
+	}
+
+	// CQI_CQP_ERROR_NO_SUCH_CORPUS
+	/**
+	 * Gives the corpus alignement attributes.
+	 *
+	 * @param corpus the corpus
+	 * @return the name of attributes
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiServerError Signals that the cqi server raised an error
+	 */
+	@Override
+	public synchronized String[] corpusAlignementAttributes(String corpus) throws UnexpectedAnswerException, IOException, CqiServerError {
+		return genericStringToStringArray(corpus, CQI_CORPUS_ALIGNMENT_ATTRIBUTES);
+	}
+
+	// CQI_CQP_ERROR_NO_SUCH_CORPUS
+	/**
+	 * Gives the corpus full name.
+	 *
+	 * @param corpus the corpus
+	 * @return the full name
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiServerError Signals that the cqi server raised an error
+	 */
+	@Override
+	public synchronized String corpusFullName(String corpus) throws UnexpectedAnswerException, IOException, CqiServerError {
+		return genericStringToString(corpus, CQI_CORPUS_FULL_NAME);
+	}
+
+	/**
+	 * Gives the corpus info listed in the .INFO file.
+	 *
+	 * @param corpus the corpus
+	 * @return the info
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiServerError Signals that the cqi server raised an error
+	 */
+	@Override
+	public synchronized String[] corpusInfo(String corpus) throws UnexpectedAnswerException, IOException, CqiServerError {
+		throw new UnsupportedOperationException();
+	}
+
+	/**
+	 * Drop a corpus.
+	 * 
+	 * @param corpus
+	 *            the corpus
+	 * @throws IOException 
+	 */
+	@Override
+	public synchronized void dropCorpus(String corpus) throws IOException {
+		this.streamToServer.write(CQI_CORPUS_DROP_CORPUS);
+		this.writeString(corpus);
+		return;
+	}
+
+	// CQI_CQP_ERROR_NO_SUCH_CORPUS, CQI_CL_ERROR_NO_SUCH_ATTRIBUTE,
+	// CQI_CL_ERROR_WRONG_ATTRIBUTE_TYPE, CQI_CL_ERROR_CORPUS_ACCESS
+	/**
+	 * Gives an attribute size (the number of token).
+	 *
+	 * @param attribute the attribute
+	 * @return the size
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws CqiServerError Signals that the cqi server raised an error
+	 */
+	@Override
+	public synchronized int attributeSize(String attribute) throws IOException, UnexpectedAnswerException, CqiServerError {
+		this.streamToServer.write(CQI_CL_ATTRIBUTE_SIZE);
+		this.writeString(attribute);
+		return readInt();
+	}
+
+	// CQI_CQP_ERROR_NO_SUCH_CORPUS, CQI_CL_ERROR_NO_SUCH_ATTRIBUTE,
+	// CQI_CL_ERROR_WRONG_ATTRIBUTE_TYPE, CQI_CL_ERROR_CORPUS_ACCESS
+	/**
+	 * Gives the lexicon size of an attribute.
+	 *
+	 * @param attribute the attribute
+	 * @return the int
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws CqiServerError Signals that the cqi server raised an error
+	 * @returns the number of entries in the lexicon of a positional attribute
+	 */
+	@Override
+	public synchronized int lexiconSize(String attribute) throws IOException, UnexpectedAnswerException, CqiServerError {
+		this.streamToServer.write(CQI_CL_LEXICON_SIZE);
+		this.writeString(attribute);
+		return readInt();
+	}
+
+	/**
+	 * Drop attribute.
+	 *
+	 * @param attribute the attribute
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws CqiServerError Signals that the cqi server raised an error
+	 */
+	@Override
+	public synchronized void dropAttribute(String attribute) throws IOException, UnexpectedAnswerException, CqiServerError {
+		throw new UnsupportedOperationException();
+	}
+
+	/**
+	 * Converts an array of attribute values to their ID.
+	 *
+	 * @param attribute the attribute
+	 * @param strings the values
+	 * @return the IDs
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws CqiServerError Signals that the cqi server raised an error
+	 */
+	@Override
+	public synchronized int[] str2Id(String attribute, String[] strings) throws IOException, UnexpectedAnswerException, CqiServerError {
+		this.streamToServer.write(CQI_CL_STR2ID);
+		this.writeString(attribute);
+		this.writeStringArray(strings);
+		return readIntList();
+	}
+
+	/**
+	 * Converts an array of attribute ID to their values.
+	 *
+	 * @param attribute the positional attribute
+	 * @param ids the ids
+	 * @return the values
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiServerError Signals that the cqi server raised an error
+	 */
+	@Override
+	public synchronized String[] id2Str(String attribute, int[] ids) throws UnexpectedAnswerException, IOException, CqiServerError {
+		return genericStringXIntArraytoStringArray(attribute, ids, CQI_CL_ID2STR);
+	}
+
+	/**
+	 * Converts an array of attribute IDs to their frequency.
+	 *
+	 * @param attribute the attribute
+	 * @param ids the ids
+	 * @return the frequencies
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiServerError Signals that the cqi server raised an error
+	 */
+	@Override
+	public synchronized int[] id2Freq(String attribute, int[] ids) throws UnexpectedAnswerException, IOException, CqiServerError {
+		return genericStringXIntArraytoIntArray(attribute, ids, CQI_CL_ID2FREQ);
+	}
+
+	/**
+	 * Converts an array of position to their ID given an attribute.
+	 *
+	 * @param attribute the attribute
+	 * @param cpos the positions
+	 * @return the IDs
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiServerError Signals that the cqi server raised an error
+	 */
+	@Override
+	public synchronized int[] cpos2Id(String attribute, int[] cpos) throws UnexpectedAnswerException, IOException, CqiServerError {
+		return genericStringXIntArraytoIntArray(attribute, cpos, CQI_CL_CPOS2ID);
+	}
+
+	/**
+	 * Converts an array of position to their value given an attribute.
+	 *
+	 * @param attribute the attribute
+	 * @param cpos the cpos
+	 * @return the values
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiServerError the cqi server error
+	 */
+	@Override
+	public synchronized String[] cpos2Str(String attribute, int[] cpos) throws UnexpectedAnswerException, IOException, CqiServerError {
+		
+		if (corporacache.get(attribute) == null) {
+			corporacache.put(attribute, new CqpDataProxy(this, attribute, true));
+		}
+		
+		try {
+			return corporacache.get(attribute).getData(cpos).toArray(new String[cpos.length]);
+		} catch (CqiClientException e) {
+			throw new CqiServerError(e.getMessage());
+		}
+//		return genericStringXIntArraytoStringArray(attribute, cpos,
+//				CQI_CL_CPOS2STR);
+	}
+	
+	public synchronized String[] _cpos2Str(String attribute, int[] cpos) throws UnexpectedAnswerException, IOException, CqiServerError {
+		return genericStringXIntArraytoStringArray(attribute, cpos, CQI_CL_CPOS2STR);
+	}
+
+	/**
+	 * Computes for each position of an array the Id of the enclosing structural
+	 * attribute.
+	 *
+	 * @param attribute the attribute
+	 * @param cpos the positions
+	 * @return the IDs
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiServerError the cqi server error
+	 */
+	@Override
+	public synchronized int[] cpos2Struc(String attribute, int[] cpos) throws UnexpectedAnswerException, IOException, CqiServerError {
+		return genericStringXIntArraytoIntArray(attribute, cpos, CQI_CL_CPOS2STRUC);
+	}
+
+	/**
+	 * Computes for each position of an array the position of the left boundary
+	 * of the enclosing structural attribute.
+	 *
+	 * @param attribute the attribute
+	 * @param cpos the cpos
+	 * @return the positions of the left boundaries
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiServerError the cqi server error
+	 */
+	@Override
+	public synchronized int[] cpos2LBound(String attribute, int[] cpos) throws UnexpectedAnswerException, IOException, CqiServerError {
+		return genericStringXIntArraytoIntArray(attribute, cpos, CQI_CL_CPOS2LBOUND);
+	}
+
+	/**
+	 * Computes for each position of an array the position of the right boundary
+	 * of the enclosing structural attribute.
+	 *
+	 * @param attribute the attribute
+	 * @param cpos the cpos
+	 * @return the positions of the right boundaries
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiServerError the cqi server error
+	 */
+	@Override
+	public synchronized int[] cpos2RBound(String attribute, int[] cpos) throws UnexpectedAnswerException, IOException, CqiServerError {
+		return genericStringXIntArraytoIntArray(attribute, cpos, CQI_CL_CPOS2RBOUND);
+	}
+
+	/**
+	 * Computes for each position of an array the Id of the enclosing alignment
+	 * attribute.
+	 *
+	 * @param attribute the attribute
+	 * @param cpos the cpos
+	 * @return the int[]
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiServerError the cqi server error
+	 */
+	@Override
+	public synchronized int[] cpos2Alg(String attribute, int[] cpos) throws UnexpectedAnswerException, IOException, CqiServerError {
+		return genericStringXIntArraytoIntArray(attribute, cpos, CQI_CL_CPOS2ALG);
+	}
+
+	/**
+	 * Retrieves annotated string values of structure regions in <strucs>; "" if
+	 * out of range.
+	 *
+	 * @param attribute the attribute
+	 * @param strucs the strucs
+	 * @return the string[]
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiServerError the cqi server error
+	 */
+	@Override
+	public synchronized String[] struc2Str(String attribute, int[] strucs) throws UnexpectedAnswerException, IOException, CqiServerError {
+		return _struc2Str(attribute, strucs);
+	}
+	
+	/**
+	 * Retrieves annotated string values of structure regions in <strucs>; "" if
+	 * out of range.
+	 *
+	 * @param attribute the attribute
+	 * @param strucs the strucs
+	 * @return the string[]
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiServerError the cqi server error
+	 */
+	public synchronized String[] _struc2Str(String attribute, int[] strucs) throws UnexpectedAnswerException, IOException, CqiServerError {
+		return genericStringXIntArraytoStringArray(attribute, strucs, CQI_CL_STRUC2STR);
+	}
+
+	/**
+	 * Retrieves all corpus positions where the given token occurs.
+	 *
+	 * @param attribute the attribute
+	 * @param id the id
+	 * @return the position
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiServerError the cqi server error
+	 */
+	@Override
+	public synchronized int[] id2Cpos(String attribute, int id) throws UnexpectedAnswerException, IOException, CqiServerError {
+		this.streamToServer.write(CQI_CL_ID2CPOS);
+		this.writeString(attribute);
+		this.streamToServer.writeInt(id);
+		return readIntList();
+	}
+
+	/**
+	 * Retrieves all corpus positions where one of the tokens in <id_list>
+	 * occurs; the returned list is sorted as a whole, not per token id.
+	 *
+	 * @param attribute the attribute
+	 * @param ids the ids
+	 * @return the positions
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiServerError the cqi server error
+	 */
+	@Override
+	public synchronized int[] idList2Cpos(String attribute, int[] ids) throws UnexpectedAnswerException, IOException, CqiServerError {
+		return genericStringXIntArraytoIntArray(attribute, ids,
+				CQI_CL_IDLIST2CPOS);
+	}
+
+	/**
+	 * Retrieves the lexicon IDs of all tokens that match <regex>; the returned
+	 * list may be empty (size 0);.
+	 *
+	 * @param attribute the attribute
+	 * @param regex the regex
+	 * @return the IDs
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiServerError the cqi server error
+	 */
+	@Override
+	public synchronized int[] regex2Id(String attribute, String regex) throws UnexpectedAnswerException, IOException, CqiServerError {
+		this.streamToServer.write(CQI_CL_REGEX2ID);
+		this.writeString(attribute);
+		this.writeString(regex);
+		return readIntList();
+	}
+
+	/**
+	 * Retrieves the start and end corpus positions of structure region <struc>.
+	 *
+	 * @param attribute the attribute
+	 * @param struc the struc
+	 * @return an array of size 2 containing the start and end positions
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiServerError the cqi server error
+	 */
+	@Override
+	public synchronized int[] struc2Cpos(String attribute, int struc) throws UnexpectedAnswerException, IOException, CqiServerError {
+		this.streamToServer.write(CQI_CL_STRUC2CPOS);
+		this.writeString(attribute);
+		this.streamToServer.writeInt(struc);
+		return this.readIntInt();
+	}
+
+	/**
+	 * Retrieves start and end corpus positions of an alignement region in the
+	 * source and target corpora<struc>.
+	 *
+	 * @param attribute the attribute
+	 * @param struc the struc
+	 * @return an array of size 4 containing (src_start, src_end, target_start,
+	 * target_end)
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiServerError the cqi server error
+	 */
+	@Override
+	public synchronized int[] alg2Cpos(String attribute, int struc) throws UnexpectedAnswerException, IOException, CqiServerError {
+		this.streamToServer.write(CQI_CL_ALG2CPOS);
+		this.writeString(attribute);
+		this.streamToServer.writeInt(struc);
+		return readIntIntIntInt();
+	}
+
+	/**
+	 * Runs a CQP query.
+	 *
+	 * @param motherCorpus the mother corpus
+	 * @param subcorpus the subcorpus
+	 * @param query the query
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws CqiServerError the cqi server error
+	 */
+	@Override
+	public synchronized void cqpQuery(String motherCorpus, String subcorpus, String query) throws IOException, UnexpectedAnswerException, CqiServerError {
+		//System.out.println("CQPQUERY: Mother: "+motherCorpus+", sub:"+subcorpus+", "+query);
+		this.streamToServer.write(CQI_CQP_QUERY);
+		this.writeString(motherCorpus);
+		this.writeString(subcorpus);
+		this.writeString(query);
+		this.readHeaderFromServer(); // may receive a CQI_CQP_ERROR_GENERAL
+
+	}
+	
+	/**
+	 * Evaluate and run a raw CQP query.
+	 *
+	 * @param motherCorpus the mother corpus
+	 * @param subcorpus the subcorpus
+	 * @param query the query
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws CqiServerError the cqi server error
+	 */
+	public synchronized void query(String query) throws IOException, UnexpectedAnswerException, CqiServerError {
+		//System.out.println("CQPQUERY: Mother: "+motherCorpus+", sub:"+subcorpus+", "+query);
+		this.streamToServer.write(CQI_CQP_QUERY_EVAL);
+		this.writeString(query);
+		this.readHeaderFromServer(); // may receive a CQI_CQP_ERROR_GENERAL
+
+	}
+
+	/**
+	 * Lists all the subcorpora of a corpus.
+	 *
+	 * @param corpus the corpus
+	 * @return the name of the subcorpora
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiCqpErrorNoSuchCorpus the cqi cqp error no such corpus
+	 */
+	@Override
+	public synchronized String[] listSubcorpora(String corpus) throws UnexpectedAnswerException, IOException, CqiCqpErrorNoSuchCorpus {
+		try {
+			return genericStringToStringArray(corpus, CQI_CQP_LIST_SUBCORPORA);
+		} catch (CqiCqpErrorNoSuchCorpus e) {
+			throw e;
+		} catch (CqiServerError e) {
+			throw new UnexpectedAnswerException(e);
+		}
+	}
+
+	/**
+	 * Gives the size of a subcorpus .
+	 * 
+	 * @param subcorpus
+	 *            the subcorpus
+	 * 
+	 * @return the size
+	 * 
+	 * @throws IOException
+	 *             Signals that an I/O exception has occurred.
+	 * @throws UnexpectedAnswerException
+	 *             Signals that the data read on the socket is unexpected
+	 * @throws CqiServerError
+	 *             the cqi server error
+	 */
+	@Override
+	public synchronized int subCorpusSize(String subcorpus) throws IOException, UnexpectedAnswerException, CqiServerError {
+		this.streamToServer.write(CQI_CQP_SUBCORPUS_SIZE);
+		this.writeString(subcorpus);
+		return this.readInt();
+	}
+
+	/**
+	 * Checks wether a subcorpus has a field.
+	 * 
+	 * @param subcorpus
+	 *            the subcorpus
+	 * @param field
+	 *            the field
+	 * 
+	 * @return true, if the subcorpus has the field
+	 * 
+	 * @throws IOException
+	 *             Signals that an I/O exception has occurred.
+	 * @throws UnexpectedAnswerException
+	 *             Signals that the data read on the socket is unexpected
+	 * @throws CqiServerError
+	 *             the cqi server error
+	 */
+	@Override
+	public synchronized boolean subCorpusHasField(String subcorpus, byte field) throws IOException, UnexpectedAnswerException, CqiServerError {
+		this.streamToServer.write(CQI_CQP_SUBCORPUS_HAS_FIELD);
+		this.writeString(subcorpus);
+		this.streamToServer.writeByte(field);
+		return this.readBoolean();
+	}
+
+	/**
+	 * Dumps the values of <field> for match ranges <first> .. <last> in
+	 * <subcorpus>. <field> is one of the CQI_CONST_FIELD_* constants.
+	 * 
+	 * @param subcorpus
+	 *            the subcorpus
+	 * @param field
+	 *            the field
+	 * @param first
+	 *            the first
+	 * @param last
+	 *            the last
+	 * 
+	 * @return the values
+	 * 
+	 * @throws IOException
+	 *             Signals that an I/O exception has occurred.
+	 * @throws UnexpectedAnswerException
+	 *             Signals that the data read on the socket is unexpected
+	 * @throws CqiServerError
+	 *             the cqi server error
+	 */
+	@Override
+	public synchronized int[] dumpSubCorpus(String subcorpus, byte field, int first, int last) throws IOException, UnexpectedAnswerException, CqiServerError {
+		this.streamToServer.write(CQI_CQP_DUMP_SUBCORPUS);
+		this.writeString(subcorpus);
+		this.streamToServer.writeByte(field);
+		this.streamToServer.writeInt(first);
+		this.streamToServer.writeInt(last);
+		return this.readIntList();
+	}
+
+	/**
+	 * Drops a subcorpus.
+	 * 
+	 * @param subcorpus
+	 *            the subcorpus
+	 * 
+	 * @throws IOException
+	 *             Signals that an I/O exception has occurred.
+	 * @throws UnexpectedAnswerException
+	 *             Signals that the data read on the socket is unexpected
+	 * @throws CqiServerError
+	 *             the cqi server error
+	 */
+	@Override
+	public synchronized void dropSubCorpus(String subcorpus) throws IOException, UnexpectedAnswerException, CqiServerError {
+		this.streamToServer.write(CQI_CQP_DROP_SUBCORPUS);
+		this.writeString(subcorpus);
+		this.readHeaderFromServer();
+	}
+
+	/**
+	 * Returns <n> (id, frequency) pairs flattened into a list of size 2*<n> NB:
+	 * pairs are sorted by frequency desc.
+	 * 
+	 * @param subcorpus
+	 *            the subcorpus
+	 * @param cutoff
+	 *            the cutoff
+	 * @param field
+	 *            the field : one of CQI_CONST_FIELD_MATCH,
+	 *            CQI_CONST_FIELD_TARGET, CQI_CONST_FIELD_KEYWORD
+	 * @param attribute
+	 *            the attribute
+	 * 
+	 * @return the int[][]
+	 * 
+	 * @throws IOException
+	 *             Signals that an I/O exception has occurred.
+	 * @throws UnexpectedAnswerException
+	 *             Signals that the data read on the socket is unexpected
+	 * @throws CqiServerError
+	 *             the cqi server error
+	 */
+	@Override
+	public synchronized int[][] fdist1(String subcorpus, int cutoff, byte field, String attribute) throws IOException, UnexpectedAnswerException, CqiServerError {
+		this.streamToServer.write(CQI_CQP_FDIST_1);
+		this.writeString(subcorpus);
+		this.streamToServer.writeInt(cutoff);
+		this.streamToServer.writeByte(field);
+		this.writeString(attribute);
+		return this.readIntTable();
+	}
+
+	/**
+	 * Returns <n> (id1, id2, frequency) pairs flattened into a list of size
+	 * 3*<n> NB: triples are sorted by frequency desc. .
+	 * 
+	 * @param subcorpus
+	 *            the subcorpus
+	 * @param cutoff
+	 *            the cutoff
+	 * @param field1
+	 *            the field1
+	 * @param attribute1
+	 *            the attribute1
+	 * @param field2
+	 *            the field2
+	 * @param attribute2
+	 *            the attribute2
+	 * 
+	 * @return the int[]
+	 * 
+	 * @throws IOException
+	 *             Signals that an I/O exception has occurred.
+	 * @throws UnexpectedAnswerException
+	 *             Signals that the data read on the socket is unexpected
+	 * @throws CqiServerError
+	 *             the cqi server error
+	 */
+	@Override
+	public synchronized int[][] fdist2(String subcorpus, int cutoff, byte field1, String attribute1, byte field2, String attribute2) throws IOException, UnexpectedAnswerException, CqiServerError {
+		this.streamToServer.write(CQI_CQP_FDIST_1);
+		this.writeString(subcorpus);
+		this.streamToServer.writeInt(cutoff);
+		this.streamToServer.writeByte(field1);
+		this.writeString(attribute1);
+		this.streamToServer.writeByte(field2);
+		this.writeString(attribute2);
+		return this.readIntTable();
+	}
+
+	@Override
+	public boolean reconnect() {
+		try {
+			return connect(username, password);
+		} catch (Exception e) {
+			System.out.println(CQPSearchEngineCoreMessages.couldNotReconnectToServerColon+e);
+			return false;
+		}
+	}
+
+	/**
+	 * @param args
+	 * @throws Exception 
+	 */
+	public static void main(String[] args) throws Exception {
+		String pathToExecutable = "/usr/lib/TXM/cwb/bin/cqpserver"; //$NON-NLS-1$
+		String pathToRegistry = "/home/mdecorde/TXM/registry"; //$NON-NLS-1$
+		String pathToInitFile = "/usr/lib/TXM/cwb/cqpserver.init"; //$NON-NLS-1$
+
+		String corpus = "DISCOURS"; //$NON-NLS-1$
+		String subcorpusname = "SUB"; //$NON-NLS-1$
+		String subcorpusid = corpus+":"+subcorpusname; //$NON-NLS-1$
+		String query = "[word=\"j.*\"]"; //$NON-NLS-1$
+		String regex = "j.*"; //$NON-NLS-1$
+		String pattribute1 = corpus+".word"; //$NON-NLS-1$
+		String pattribute2 = corpus+".frpos"; //$NON-NLS-1$
+		String pattribute3 = corpus+".frlemma"; //$NON-NLS-1$
+		String sattribute1 = corpus+".text_id"; //$NON-NLS-1$
+		String sattribute2 = corpus+".p_id"; //$NON-NLS-1$
+		String sattribute3 = corpus+".s_id"; //$NON-NLS-1$
+		
+		String align_attr = "p_id"; //$NON-NLS-1$
+
+		int[] cpos = {0,1,2,3,4,5,6,7,8,9,10};
+//		int id = 1;
+		int[] ids = {0,1,2,3,4,5,6,7,8,9,10};
+		String[] strings = {"je", "jamais"}; //$NON-NLS-1$ //$NON-NLS-2$
+		int[] strucpos = {0, 1, 2, 3 , 4};
+
+		NetCqiServer server = new NetCqiServer(pathToExecutable, pathToRegistry, pathToInitFile, "", false); //$NON-NLS-1$
+		if (server.start()) System.out.println("Server ok"); //$NON-NLS-1$
+		NetCqiClient client = new NetCqiClient("127.0.0.1", 4877); //$NON-NLS-1$
+		if (client.connect("anonymous", "")) System.out.println("Client ok"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+
+		ExecTimer.start();
+		try {
+			System.out.println("client.alg2Cpos(sattribute, struct_id) : "+Arrays.toString(client.alg2Cpos(sattribute1, 0))); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+
+		try {
+			System.out.println("client.attributeSize(sattribute1) : "+client.attributeSize(sattribute1)); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+
+		try {
+			System.out.println("client.attributeSize(sattribute2) : "+client.attributeSize(sattribute2)); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+		
+		try {
+			System.out.println("client.attributeSize(sattribute3) : "+client.attributeSize(sattribute3)); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+		
+		try {
+			System.out.println("client.corpusAlignementAttributes(corpus) : "+Arrays.toString(client.corpusAlignementAttributes(corpus))); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+
+		try {
+			System.out.println("client.corpusCharset(corpus) : "+client.corpusCharset(corpus)); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+
+		try {
+			System.out.println("client.corpusFullName(corpus) : "+client.corpusFullName(corpus)); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+
+		try {
+			System.out.println("client.corpusInfo(corpus) : "+client.corpusInfo(corpus)); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+
+		try {
+			System.out.println("client.corpusPositionalAttributes(corpus) : "+Arrays.toString(client.corpusPositionalAttributes(corpus))); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+
+		try {
+			System.out.println("client.corpusProperties(corpus) : "+Arrays.toString(client.corpusProperties(corpus))); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+
+		try {
+			System.out.println("client.corpusStructuralAttributeHasValues(sattribute1) : "+client.corpusStructuralAttributeHasValues(sattribute1)); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+		try {
+			System.out.println("client.corpusStructuralAttributeHasValues(sattribute2) : "+client.corpusStructuralAttributeHasValues(sattribute2)); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+		try {
+			System.out.println("client.corpusStructuralAttributeHasValues(sattribute3) : "+client.corpusStructuralAttributeHasValues(sattribute3)); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+		
+		try {
+			System.out.println("client.corpusStructuralAttributes(corpus) : "+Arrays.toString(client.corpusStructuralAttributes(corpus))); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+
+		try {
+			System.out.println("client.cpos2Alg(align_attr, cpos) : "+Arrays.toString(client.cpos2Alg(align_attr, cpos))); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+
+		try {
+			System.out.println("client.cpos2Id(pattribute1, cpos) : "+Arrays.toString(client.cpos2Id(pattribute1, cpos))); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+		try {
+			System.out.println("client.cpos2Id(pattribute2, cpos) : "+Arrays.toString(client.cpos2Id(pattribute2, cpos))); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+		try {
+			System.out.println("client.cpos2Id(pattribute3, cpos) : "+Arrays.toString(client.cpos2Id(pattribute3, cpos))); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+
+		try {
+			System.out.println("client.cpos2LBound(sattribute1, cpos) : "+Arrays.toString(client.cpos2LBound(sattribute1, cpos))); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+		try {
+			System.out.println("client.cpos2LBound(sattribute2, cpos) : "+Arrays.toString(client.cpos2LBound(sattribute2, cpos))); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+		try {
+			System.out.println("client.cpos2LBound(sattribute3, cpos) : "+Arrays.toString(client.cpos2LBound(sattribute3, cpos))); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+
+		try {
+			System.out.println("client.cpos2RBound(sattribute1, cpos) : "+Arrays.toString(client.cpos2RBound(sattribute1, cpos))); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+		try {
+			System.out.println("client.cpos2RBound(sattribute2, cpos) : "+Arrays.toString(client.cpos2RBound(sattribute2, cpos))); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+		try {
+			System.out.println("client.cpos2RBound(sattribute3, cpos) : "+Arrays.toString(client.cpos2RBound(sattribute3, cpos))); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+
+		try {
+			System.out.println("client.cpos2Str(pattribute1, cpos) : "+Arrays.toString(client.cpos2Str(pattribute1, cpos))); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+		try {
+			System.out.println("client.cpos2Str(pattribute2, cpos) : "+Arrays.toString(client.cpos2Str(pattribute2, cpos))); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+		try {
+			System.out.println("client.cpos2Str(pattribute3, cpos) : "+Arrays.toString(client.cpos2Str(pattribute3, cpos))); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+
+		try {
+			System.out.println("client.cpos2Struc(sattribute1, cpos) : "+Arrays.toString(client.cpos2Struc(sattribute1, cpos))); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+		try {
+			System.out.println("client.cpos2Struc(sattribute2, cpos) : "+Arrays.toString(client.cpos2Struc(sattribute2, cpos))); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+		try {
+			System.out.println("client.cpos2Struc(sattribute3, cpos) : "+Arrays.toString(client.cpos2Struc(sattribute3, cpos))); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+
+		try {
+			System.out.println("client.cqpQuery(corpus, subcorpus, query)");client.cqpQuery(corpus, subcorpusname, query); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+
+		try {
+			System.out.println("client.dropAttribute(pattribute1)");client.dropAttribute(pattribute1); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+		try {
+			System.out.println("client.dropAttribute(pattribute2)");client.dropAttribute(pattribute2); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+		try {
+			System.out.println("client.dropAttribute(pattribute3)");client.dropAttribute(pattribute3); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+
+		try {
+			System.out.println("client.dropCorpus(corpus)");client.dropCorpus(corpus); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+
+		try {
+			System.out.println(CQPSearchEngineCoreMessages.clientdumpSubCorpussubcorpusNetCqiClientCQICONSTFIELDMATCH12Colon+Arrays.toString(client.dumpSubCorpus(subcorpusid, NetCqiClient.CQI_CONST_FIELD_MATCH, 1, 10)));
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+
+		try {
+			System.out.println("client.dumpSubCorpus(subcorpus, NetCqiClient.CQI_CONST_FIELD_MATCHEND, 1, 2) : "+Arrays.toString(client.dumpSubCorpus(subcorpusid, NetCqiClient.CQI_CONST_FIELD_MATCHEND, 1, 10))); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+
+		try {
+			//System.out.println("//client.fdist1(arg0, arg1, arg2, arg3) : "+client.fdist1(arg0, arg1, arg2, arg3));
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+
+		try {
+			//System.out.println("//client.fdist2(arg0, arg1, arg2, arg3, arg4, arg5) : "+client.fdist2(arg0, arg1, arg2, arg3, arg4, arg5));
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+
+		try {
+			System.out.println("client.getLastCqiError() : "+client.getLastCqiError()); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+
+		try {
+			System.out.println("client.getLastCQPError() : "+client.getLastCQPError()); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+
+		try {
+			System.out.println("client.id2Cpos(pattribute1, 0) : "+Arrays.toString(client.id2Cpos(pattribute1, 0))); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+		try {
+			System.out.println("client.id2Cpos(pattribute2, 0) : "+Arrays.toString(client.id2Cpos(pattribute2, 0))); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+		try {
+			System.out.println("client.id2Cpos(pattribute3, 0) : "+Arrays.toString(client.id2Cpos(pattribute3, 0))); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+		
+		try {
+			System.out.println("client.id2Cpos(pattribute1, 1) : "+Arrays.toString(client.id2Cpos(pattribute1, 1))); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+		try {
+			System.out.println("client.id2Cpos(pattribute2, 1) : "+Arrays.toString(client.id2Cpos(pattribute2, 1))); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+		try {
+			System.out.println("client.id2Cpos(pattribute3, 1) : "+Arrays.toString(client.id2Cpos(pattribute3, 1))); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+		
+		try {
+			System.out.println("client.id2Cpos(pattribute1, 2) : "+Arrays.toString(client.id2Cpos(pattribute1, 2))); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+		try {
+			System.out.println("client.id2Cpos(pattribute2, 2) : "+Arrays.toString(client.id2Cpos(pattribute2, 2))); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+		try {
+			System.out.println("client.id2Cpos(pattribute3, 2) : "+Arrays.toString(client.id2Cpos(pattribute3, 2))); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+
+		try {
+			System.out.println("client.id2Freq(pattribute1, ids) : "+Arrays.toString(client.id2Freq(pattribute1, ids))); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+		try {
+			System.out.println("client.id2Freq(pattribute2, ids) : "+Arrays.toString(client.id2Freq(pattribute2, ids))); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+		try {
+			System.out.println("client.id2Freq(pattribute3, ids) : "+Arrays.toString(client.id2Freq(pattribute3, ids))); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+
+		try {
+			System.out.println("client.id2Str(pattribute1, ids) : "+Arrays.toString(client.id2Str(pattribute1, ids))); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+		try {
+			System.out.println("client.id2Str(pattribute2, ids) : "+Arrays.toString(client.id2Str(pattribute2, ids))); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+		try {
+			System.out.println("client.id2Str(pattribute3, ids) : "+Arrays.toString(client.id2Str(pattribute3, ids))); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+
+		try {
+			System.out.println("client.idList2Cpos(pattribute1, ids) : "+Arrays.toString(client.idList2Cpos(pattribute1, ids))); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+		try {
+			System.out.println("client.idList2Cpos(pattribute2, ids) : "+Arrays.toString(client.idList2Cpos(pattribute2, ids))); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+		try {
+			System.out.println("client.idList2Cpos(pattribute3, ids) : "+Arrays.toString(client.idList2Cpos(pattribute3, ids))); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+
+		try {
+			System.out.println("client.lexiconSize(pattribute1) : "+client.lexiconSize(pattribute1)); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+		try {
+			System.out.println("client.lexiconSize(pattribute2) : "+client.lexiconSize(pattribute2)); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+		try {
+			System.out.println("client.lexiconSize(pattribute3) : "+client.lexiconSize(pattribute3)); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+
+		try {
+			System.out.println("client.listCorpora() : "+Arrays.toString(client.listCorpora())); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+
+		try {
+			System.out.println("client.listSubcorpora(corpus) : "+Arrays.toString(client.listSubcorpora(corpus))); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+
+		try {
+			System.out.println("client.regex2Id(pattribute1, regex) : "+Arrays.toString(client.regex2Id(pattribute1, regex))); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+		try {
+			System.out.println("client.regex2Id(pattribute2, regex) : "+Arrays.toString(client.regex2Id(pattribute2, regex))); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+		try {
+			System.out.println("client.regex2Id(pattribute3, regex) : "+Arrays.toString(client.regex2Id(pattribute3, regex))); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+
+		try {
+			System.out.println("client.str2Id(pattribute1, strings) : "+Arrays.toString(client.str2Id(pattribute1, strings))); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+		try {
+			System.out.println("client.str2Id(pattribute2, strings) : "+Arrays.toString(client.str2Id(pattribute2, strings))); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+		try {
+			System.out.println("client.str2Id(pattribute3, strings) : "+Arrays.toString(client.str2Id(pattribute3, strings))); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+
+		try {
+			System.out.println("client.struc2Cpos(sattribute1, 0) : "+Arrays.toString(client.struc2Cpos(sattribute1, 0))); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+		try {
+			System.out.println("client.struc2Cpos(sattribute2, 0) : "+Arrays.toString(client.struc2Cpos(sattribute2, 0))); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+		try {
+			System.out.println("client.struc2Cpos(sattribute3, 0) : "+Arrays.toString(client.struc2Cpos(sattribute3, 0))); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+		
+		try {
+			System.out.println("client.struc2Cpos(sattribute1, 1) : "+Arrays.toString(client.struc2Cpos(sattribute1, 1))); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+		try {
+			System.out.println("client.struc2Cpos(sattribute2, 1) : "+Arrays.toString(client.struc2Cpos(sattribute2, 1))); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+		try {
+			System.out.println("client.struc2Cpos(sattribute3, 1) : "+Arrays.toString(client.struc2Cpos(sattribute3, 1))); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+		
+		try {
+			System.out.println("client.struc2Cpos(sattribute1, 2) : "+Arrays.toString(client.struc2Cpos(sattribute1, 2))); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+		try {
+			System.out.println("client.struc2Cpos(sattribute2, 2) : "+Arrays.toString(client.struc2Cpos(sattribute2, 2))); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+		try {
+			System.out.println("client.struc2Cpos(sattribute3, 2) : "+Arrays.toString(client.struc2Cpos(sattribute3, 2))); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+		
+		try {
+			System.out.println("client.struc2Cpos(sattribute1, 3) : "+Arrays.toString(client.struc2Cpos(sattribute1, 3))); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+		try {
+			System.out.println("client.struc2Cpos(sattribute2, 3) : "+Arrays.toString(client.struc2Cpos(sattribute2, 3))); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+		try {
+			System.out.println("client.struc2Cpos(sattribute3, 3) : "+Arrays.toString(client.struc2Cpos(sattribute3, 3))); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+		
+		try {
+			System.out.println("client.struc2Str(sattribute1, strucpos) : "+Arrays.toString(client.struc2Str(sattribute1, strucpos))); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+		try {
+			System.out.println("client.struc2Str(sattribute2, strucpos) : "+Arrays.toString(client.struc2Str(sattribute2, strucpos))); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+		try {
+			System.out.println("client.struc2Str(sattribute3, strucpos) : "+Arrays.toString(client.struc2Str(sattribute3, strucpos))); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+
+		try {
+			System.out.println("client.subCorpusHasField(subcorpus, (byte)0) : "+client.subCorpusHasField(subcorpusid, (byte)0)); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+
+		try {
+			System.out.println("client.subCorpusSize(subcorpus) : "+client.subCorpusSize(subcorpusid)); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+
+		try {
+			System.out.println("client.dropSubCorpus(subcorpus)"); client.dropSubCorpus(subcorpusid); //$NON-NLS-1$
+		} catch(Exception e) { System.out.println("Exception : "+e);} //$NON-NLS-1$
+
+		System.out.println("TIME: "+ExecTimer.stop()); //$NON-NLS-1$
+
+		server.stop();
+		
+	}
+
+	@Override
+	public boolean load_a_system_corpus(String regfilepath, String entry) throws IOException, UnexpectedAnswerException, CqiServerError {
+		this.streamToServer.write(CQI_CQP_LOAD_SYSTEM_CORPUS);
+		this.writeString(regfilepath);
+		this.writeString(entry);
+		return readBoolean();
+	}
+
+	@Override
+	public String setOption(String name, String value) throws UnexpectedAnswerException, IOException, CqiServerError {
+		
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public String getOption(String name) throws UnexpectedAnswerException, IOException, CqiServerError {
+		
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+}
\ No newline at end of file

Property changes on: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/NetCqiClient.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/CqpPropertyDataProxy.java
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/CqpPropertyDataProxy.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/CqpPropertyDataProxy.java	(revision 3659)
@@ -0,0 +1,64 @@
+// Copyright © 2010-2020 ENS de Lyon., University of Franche-Comté
+// 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: 2013-05-06 17:38:43 +0200 (lun., 06 mai 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.searchengine.cqp;
+
+import java.util.List;
+
+import org.txm.searchengine.cqp.corpus.CQPCorpus;
+import org.txm.searchengine.cqp.corpus.StructuralUnitProperty;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class CqpPropertyDataProxy.
+ */
+public class CqpPropertyDataProxy {
+	/**
+	 * Data is cached in a sparse list which give for each position the
+	 * corresponding string (given the property it is dedicated to).
+	 */
+	private List<String> data = null;
+
+	/** The property. */
+	private StructuralUnitProperty property;
+
+	/** the corpus. */
+	private CQPCorpus corpus;
+
+	/**
+	 * The Constructor.
+	 *
+	 * @param corpus the corpus
+	 * @param property The property the dataProxy is dedicated to
+	 */
+	public CqpPropertyDataProxy(CQPCorpus corpus, StructuralUnitProperty property) {
+		this.property = property;
+		this.corpus = corpus;
+	}
+
+
+}

Property changes on: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/CqpPropertyDataProxy.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/ICqiClient.java
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/ICqiClient.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/ICqiClient.java	(revision 3659)
@@ -0,0 +1,863 @@
+// Copyright © 2010-2020 ENS de Lyon., University of Franche-Comté
+// 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: 2012-03-01 08:14:11 +0100 (jeu., 01 mars 2012) $
+// $LastChangedRevision: 2134 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.searchengine.cqp;
+
+import java.io.IOException;
+
+import org.txm.searchengine.cqp.clientExceptions.UnexpectedAnswerException;
+import org.txm.searchengine.cqp.serverException.CqiCqpErrorNoSuchCorpus;
+import org.txm.searchengine.cqp.serverException.CqiServerError;
+
+/**
+ * This class implements a Java Interface CQi client.
+ *
+ * @author mdecorde
+ */
+public interface ICqiClient {
+
+	/** The Constant CQI_PADDING. */
+	final static public byte[] CQI_PADDING = { (byte) 0x00 };
+
+	/** The Constant CQI_STATUS_OK. */
+	final static public byte[] CQI_STATUS_OK = { (byte) 0x01, (byte) 0x01 };
+
+	/** The Constant CQI_STATUS_CONNECT_OK. */
+	final static public byte[] CQI_STATUS_CONNECT_OK = { (byte) 0x01, (byte) 0x02 };
+
+	/** The Constant CQI_STATUS_BYE_OK. */
+	final static public byte[] CQI_STATUS_BYE_OK = { (byte) 0x01, (byte) 0x03 };
+
+	/** The Constant CQI_STATUS_PING_OK. */
+	final static public byte[] CQI_STATUS_PING_OK = { (byte) 0x01, (byte) 0x04 };
+
+	/** The Constant CQI_ERROR_GENERAL_ERROR. */
+	final static public byte[] CQI_ERROR_GENERAL_ERROR = { (byte) 0x02, (byte) 0x01 };
+
+	/** The Constant CQI_ERROR_CONNECT_REFUSED. */
+	final static public byte[] CQI_ERROR_CONNECT_REFUSED = { (byte) 0x02, (byte) 0x02 };
+
+	/** The Constant CQI_ERROR_USER_ABORT. */
+	final static public byte[] CQI_ERROR_USER_ABORT = { (byte) 0x02, (byte) 0x03 };
+
+	/** The Constant CQI_ERROR_SYNTAX_ERROR. */
+	final static public byte[] CQI_ERROR_SYNTAX_ERROR = { (byte) 0x02, (byte) 0x04 };
+
+	/** The Constant CQI_DATA_BYTE. */
+	final static public byte[] CQI_DATA_BYTE = { (byte) 0x03, (byte) 0x01 };
+
+	/** The Constant CQI_DATA_BOOL. */
+	final static public byte[] CQI_DATA_BOOL = { (byte) 0x03, (byte) 0x02 };
+
+	/** The Constant CQI_DATA_INT. */
+	final static public byte[] CQI_DATA_INT = { (byte) 0x03, (byte) 0x03 };
+
+	/** The Constant CQI_DATA_STRING. */
+	final static public byte[] CQI_DATA_STRING = { (byte) 0x03, (byte) 0x04 };
+
+	/** The Constant CQI_DATA_BYTE_LIST. */
+	final static public byte[] CQI_DATA_BYTE_LIST = { (byte) 0x03, (byte) 0x05 };
+
+	/** The Constant CQI_DATA_BOOL_LIST. */
+	final static public byte[] CQI_DATA_BOOL_LIST = { (byte) 0x03, (byte) 0x06 };
+
+	/** The Constant CQI_DATA_INT_LIST. */
+	final static public byte[] CQI_DATA_INT_LIST = { (byte) 0x03, (byte) 0x07 };
+
+	/** The Constant CQI_DATA_STRING_LIST. */
+	final static public byte[] CQI_DATA_STRING_LIST = { (byte) 0x03, (byte) 0x08 };
+
+	/** The Constant CQI_DATA_INT_INT. */
+	final static public byte[] CQI_DATA_INT_INT = { (byte) 0x03, (byte) 0x09 };
+
+	/** The Constant CQI_DATA_INT_INT_INT_INT. */
+	final static public byte[] CQI_DATA_INT_INT_INT_INT = { (byte) 0x03, (byte) 0x0A };
+
+	/** The Constant CQI_DATA_INT_TABLE. */
+	final static public byte[] CQI_DATA_INT_TABLE = { (byte) 0x03, (byte) 0x0B };
+
+	/** The Constant CQI_CL_ERROR_NO_SUCH_ATTRIBUTE. */
+	final static public byte[] CQI_CL_ERROR_NO_SUCH_ATTRIBUTE = { (byte) 0x04,
+		(byte) 0x01 };
+
+	/** The Constant CQI_CL_ERROR_WRONG_ATTRIBUTE_TYPE. */
+	final static public byte[] CQI_CL_ERROR_WRONG_ATTRIBUTE_TYPE = { (byte) 0x04,
+		(byte) 0x02 };
+
+	/** The Constant CQI_CL_ERROR_OUT_OF_RANGE. */
+	final static public byte[] CQI_CL_ERROR_OUT_OF_RANGE = { (byte) 0x04, (byte) 0x03 };
+
+	/** The Constant CQI_CL_ERROR_REGEX. */
+	final static public byte[] CQI_CL_ERROR_REGEX = { (byte) 0x04, (byte) 0x04 };
+
+	/** The Constant CQI_CL_ERROR_CORPUS_ACCESS. */
+	final static public byte[] CQI_CL_ERROR_CORPUS_ACCESS = { (byte) 0x04, (byte) 0x05 };
+
+	/** The Constant CQI_CL_ERROR_OUT_OF_MEMORY. */
+	final static public byte[] CQI_CL_ERROR_OUT_OF_MEMORY = { (byte) 0x04, (byte) 0x06 };
+
+	/** The Constant CQI_CL_ERROR_INTERNAL. */
+	final static public byte[] CQI_CL_ERROR_INTERNAL = { (byte) 0x04, (byte) 0x07 };
+
+	/** The Constant CQI_CQP_ERROR_GENERAL. */
+	final static public byte[] CQI_CQP_ERROR_GENERAL = { (byte) 0x05, (byte) 0x01 };
+
+	/** The Constant CQI_CQP_ERROR_NO_SUCH_CORPUS. */
+	final static public byte[] CQI_CQP_ERROR_NO_SUCH_CORPUS = { (byte) 0x05,
+		(byte) 0x02 };
+
+	/** The Constant CQI_CQP_ERROR_INVALID_FIELD. */
+	final static public byte[] CQI_CQP_ERROR_INVALID_FIELD = { (byte) 0x05,
+		(byte) 0x03 };
+
+	/** The Constant CQI_CQP_ERROR_OUT_OF_RANGE. */
+	final static public byte[] CQI_CQP_ERROR_OUT_OF_RANGE = { (byte) 0x05, (byte) 0x04 };
+
+	/** The Constant CQI_CQP_ERROR_OUT_OF_RANGE. */
+	final static public byte[] CQI_CQP_ERROR_SYNTAX = { (byte) 0x05, (byte) 0x05 };
+
+	/** The Constant CQI_CTRL_CONNECT. */
+	final static public byte[] CQI_CTRL_CONNECT = { (byte) 0x11, (byte) 0x01 };
+
+	/** The Constant CQI_CTRL_BYE. */
+	final static public byte[] CQI_CTRL_BYE = { (byte) 0x11, (byte) 0x02 };
+
+	/** The Constant CQI_CTRL_USER_ABORT. */
+	final static public byte[] CQI_CTRL_USER_ABORT = { (byte) 0x11, (byte) 0x03 };
+
+	/** The Constant CQI_CTRL_PING. */
+	final static public byte[] CQI_CTRL_PING = { (byte) 0x11, (byte) 0x04 };
+
+	/** The Constant CQI_CTRL_LAST_GENERAL_ERROR. */
+	final static public byte[] CQI_CTRL_LAST_GENERAL_ERROR = { (byte) 0x11,
+		(byte) 0x05 };
+
+	/** The Constant CQI_CTRL_LAST_CQP_ERROR. */
+	final static public byte[] CQI_CTRL_LAST_CQP_ERROR = { (byte) 0x11,
+		(byte) 0x06 };
+
+	/** The Constant CQI_CORPUS_LIST_CORPORA. */
+	final static public byte[] CQI_CORPUS_LIST_CORPORA = { (byte) 0x13, (byte) 0x01 };
+
+	/** The Constant CQI_CORPUS_CHARSET. */
+	final static public byte[] CQI_CORPUS_CHARSET = { (byte) 0x13, (byte) 0x03 };
+
+	/** The Constant CQI_CORPUS_PROPERTIES. */
+	final static public byte[] CQI_CORPUS_PROPERTIES = { (byte) 0x13, (byte) 0x04 };
+
+	/** The Constant CQI_CORPUS_POSITIONAL_ATTRIBUTES. */
+	final static public byte[] CQI_CORPUS_POSITIONAL_ATTRIBUTES = { (byte) 0x13,
+		(byte) 0x05 };
+
+	/** The Constant CQI_CORPUS_STRUCTURAL_ATTRIBUTES. */
+	final static public byte[] CQI_CORPUS_STRUCTURAL_ATTRIBUTES = { (byte) 0x13,
+		(byte) 0x06 };
+
+	/** The Constant CQI_CORPUS_STRUCTURAL_ATTRIBUTE_HAS_VALUES. */
+	final static public byte[] CQI_CORPUS_STRUCTURAL_ATTRIBUTE_HAS_VALUES = {
+		(byte) 0x13, (byte) 0x07 };
+
+	/** The Constant CQI_CORPUS_ALIGNMENT_ATTRIBUTES. */
+	final static public byte[] CQI_CORPUS_ALIGNMENT_ATTRIBUTES = { (byte) 0x13,
+		(byte) 0x08 };
+
+	/** The Constant CQI_CORPUS_FULL_NAME. */
+	final static public byte[] CQI_CORPUS_FULL_NAME = { (byte) 0x13, (byte) 0x09 };
+
+	/** The Constant CQI_CORPUS_INFO. */
+	final static public byte[] CQI_CORPUS_INFO = { (byte) 0x13, (byte) 0x0A };
+
+	/** The Constant CQI_CORPUS_DROP_CORPUS. */
+	final static public byte[] CQI_CORPUS_DROP_CORPUS = { (byte) 0x13, (byte) 0x0B };
+
+	/** The Constant CQI_CL_ATTRIBUTE_SIZE. */
+	final static public byte[] CQI_CL_ATTRIBUTE_SIZE = { (byte) 0x14, (byte) 0x01 };
+
+	/** The Constant CQI_CL_LEXICON_SIZE. */
+	final static public byte[] CQI_CL_LEXICON_SIZE = { (byte) 0x14, (byte) 0x02 };
+
+	/** The Constant CQI_CL_DROP_ATTRIBUTE. */
+	final static public byte[] CQI_CL_DROP_ATTRIBUTE = { (byte) 0x14, (byte) 0x03 };
+
+	/** The Constant CQI_CL_STR2ID. */
+	final static public byte[] CQI_CL_STR2ID = { (byte) 0x14, (byte) 0x04 };
+
+	/** The Constant CQI_CL_ID2STR. */
+	final static public byte[] CQI_CL_ID2STR = { (byte) 0x14, (byte) 0x05 };
+
+	/** The Constant CQI_CL_ID2FREQ. */
+	final static public byte[] CQI_CL_ID2FREQ = { (byte) 0x14, (byte) 0x06 };
+
+	/** The Constant CQI_CL_CPOS2ID. */
+	final static public byte[] CQI_CL_CPOS2ID = { (byte) 0x14, (byte) 0x07 };
+
+	/** The Constant CQI_CL_CPOS2STR. */
+	final static public byte[] CQI_CL_CPOS2STR = { (byte) 0x14, (byte) 0x08 };
+
+	/** The Constant CQI_CL_CPOS2STRUC. */
+	final static public byte[] CQI_CL_CPOS2STRUC = { (byte) 0x14, (byte) 0x09 };
+
+	/** The Constant CQI_CL_CPOS2LBOUND. */
+	final static public byte[] CQI_CL_CPOS2LBOUND = { (byte) 0x14, (byte) 0x20 };
+
+	/** The Constant CQI_CL_CPOS2RBOUND. */
+	final static public byte[] CQI_CL_CPOS2RBOUND = { (byte) 0x14, (byte) 0x21 };
+
+	/** The Constant CQI_CL_CPOS2ALG. */
+	final static public byte[] CQI_CL_CPOS2ALG = { (byte) 0x14, (byte) 0x0A };
+
+	/** The Constant CQI_CL_STRUC2STR. */
+	final static public byte[] CQI_CL_STRUC2STR = { (byte) 0x14, (byte) 0x0B };
+
+	/** The Constant CQI_CL_ID2CPOS. */
+	final static public byte[] CQI_CL_ID2CPOS = { (byte) 0x14, (byte) 0x0C };
+
+	/** The Constant CQI_CL_IDLIST2CPOS. */
+	final static public byte[] CQI_CL_IDLIST2CPOS = { (byte) 0x14, (byte) 0x0D };
+
+	/** The Constant CQI_CL_REGEX2ID. */
+	final static public byte[] CQI_CL_REGEX2ID = { (byte) 0x14, (byte) 0x0E };
+
+	/** The Constant CQI_CL_STRUC2CPOS. */
+	final static public byte[] CQI_CL_STRUC2CPOS = { (byte) 0x14, (byte) 0x0F };
+
+	/** The Constant CQI_CL_ALG2CPOS. */
+	final static public byte[] CQI_CL_ALG2CPOS = { (byte) 0x14, (byte) 0x10 };
+
+	/** The Constant CQI_CQP_QUERY. */
+	final static public byte[] CQI_CQP_QUERY = { (byte) 0x15, (byte) 0x01 };
+
+	/** The Constant CQI_CQP_LIST_SUBCORPORA. */
+	final static public byte[] CQI_CQP_LIST_SUBCORPORA = { (byte) 0x15, (byte) 0x02 };
+
+	/** The Constant CQI_CQP_SUBCORPUS_SIZE. */
+	final static public byte[] CQI_CQP_SUBCORPUS_SIZE = { (byte) 0x15, (byte) 0x03 };
+
+	/** The Constant CQI_CQP_SUBCORPUS_HAS_FIELD. */
+	final static public byte[] CQI_CQP_SUBCORPUS_HAS_FIELD = { (byte) 0x15,
+		(byte) 0x04 };
+
+	/** The Constant CQI_CQP_DUMP_SUBCORPUS. */
+	final static public byte[] CQI_CQP_DUMP_SUBCORPUS = { (byte) 0x15, (byte) 0x05 };
+
+	/** The Constant CQI_CQP_DROP_SUBCORPUS. */
+	final static public byte[] CQI_CQP_DROP_SUBCORPUS = { (byte) 0x15, (byte) 0x09 };
+
+	/** The Constant CQI_CQP_FDIST_1. */
+	final static public byte[] CQI_CQP_FDIST_1 = { (byte) 0x15, (byte) 0x10 };
+
+	/** The Constant CQI_CQP_FDIST_2. */
+	final static public byte[] CQI_CQP_FDIST_2 = { (byte) 0x15, (byte) 0x11 };
+	
+	/** The Constant CQI_CQP_QUERY. */
+	final static public byte[] CQI_CQP_QUERY_EVAL = { (byte) 0x15, (byte) 0x012 };
+	
+	/** The Constant CQI_CQP_LOAD_SYSTEM_CORPUS. */
+	final static public byte[] CQI_CQP_LOAD_SYSTEM_CORPUS = { (byte) 0x15, (byte) 0x13 };
+	
+	/** The Constant CQI_CONST_FIELD_MATCH. */
+	final public static byte CQI_CONST_FIELD_MATCH = (byte) 0x10;
+
+	/** The Constant CQI_CONST_FIELD_MATCHEND. */
+	final public static byte CQI_CONST_FIELD_MATCHEND = (byte) 0x11;
+	
+	/** The Constant CQI_CONST_FIELD_TARGET. */
+	final public static byte CQI_CONST_FIELD_TARGET = (byte) 0x00;
+	/** The Constant CQI_CONST_FIELD_KEYWORD. */
+	final public static byte CQI_CONST_FIELD_KEYWORD = (byte) 0x09;
+	
+	final public static byte CQI_CONST_FIELD_TARGET_0 = (byte) 0x00;
+	final public static byte CQI_CONST_FIELD_TARGET_1 = (byte) 0x01;
+	final public static byte CQI_CONST_FIELD_TARGET_2 = (byte) 0x02;
+	final public static byte CQI_CONST_FIELD_TARGET_3 = (byte) 0x03;
+	final public static byte CQI_CONST_FIELD_TARGET_4 = (byte) 0x04;
+	final public static byte CQI_CONST_FIELD_TARGET_5 = (byte) 0x05;
+	final public static byte CQI_CONST_FIELD_TARGET_6 = (byte) 0x06;
+	final public static byte CQI_CONST_FIELD_TARGET_7 = (byte) 0x07;
+	final public static byte CQI_CONST_FIELD_TARGET_8 = (byte) 0x08;
+	final public static byte CQI_CONST_FIELD_TARGET_9 = (byte) 0x09;
+	
+	// CQI_ERROR_CONNECT_REFUSED
+	/**
+	 * Connect the client to a server.
+	 *
+	 * @param username the username
+	 * @param password the password
+	 * @return true, if successful
+	 */
+	public boolean connect(String username, String password) throws UnexpectedAnswerException, IOException, CqiServerError ;
+
+	// None
+	/**
+	 * Disconnect.
+	 * 
+	 * @return true, if successful
+	 */
+	public boolean disconnect() throws UnexpectedAnswerException, CqiServerError, IOException;
+
+	// CQI_CTRL_LAST_GENERAL_ERROR
+	/**
+	 * return the last CQP error.
+	 *
+	 * @return the last error
+	 */
+	public String getLastCqiError() throws UnexpectedAnswerException, IOException,	CqiServerError;
+
+	// CQI_CTRL_LAST_CQP_ERROR
+	/**
+	 * return the last CQP error.
+	 *
+	 * @return the last error
+	 */
+	public String getLastCQPError() throws UnexpectedAnswerException, IOException,	CqiServerError;
+
+	// None
+	/**
+	 * Lists the corpora available on the server.
+	 *
+	 * @return the name of the corpora
+	 */
+	public String[] listCorpora() throws UnexpectedAnswerException, IOException, CqiServerError;
+
+	// None
+	/**
+	 * Gives the corpus charset.
+	 *
+	 * @param corpus the corpus
+	 * @return the name of the charset
+	 */
+	public String corpusCharset(String corpus) throws UnexpectedAnswerException, IOException, CqiServerError;
+	
+	/**
+	 * Get the String value of a CQP environment option 
+	 *
+	 * @param name the option full name
+	 * @return the value
+	 */
+	public String getOption(String name) throws UnexpectedAnswerException, IOException, CqiServerError;
+	
+	// None
+	/**
+	 * set the String value of a CQP environment option 
+	 *
+	 * @param name the option full name
+	 * @param value the option value to set
+	 * @return the value
+	 */
+	public String setOption(String name, String value) throws UnexpectedAnswerException, IOException, CqiServerError;
+
+	// None (not really implemented anyway)
+	/**
+	 * Gives the corpus properties.
+	 *
+	 * @param corpus the corpus
+	 * @return the properties
+	 */
+	public String[] corpusProperties(String corpus) throws UnexpectedAnswerException, IOException, CqiServerError;
+
+	// CQI_CQP_ERROR_NO_SUCH_CORPUS
+	/**
+	 * Gives the corpus positional attributes.
+	 *
+	 * @param corpusID the corpus id
+	 * @return the name of the attributes
+	 */
+	public String[] corpusPositionalAttributes(String corpusID) throws UnexpectedAnswerException, IOException, CqiServerError;
+
+	// CQI_CQP_ERROR_NO_SUCH_CORPUS
+	/**
+	 * Gives the corpus structural attributes.
+	 *
+	 * @param corpus the corpus
+	 * @return the name of the attributes
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiServerError Signals that the cqi server raised an error
+	 */
+	public String[] corpusStructuralAttributes(String corpus) throws UnexpectedAnswerException, IOException, CqiServerError;
+
+	// CQI_CQP_ERROR_NO_SUCH_CORPUS, CQI_CL_ERROR_NO_SUCH_ATTRIBUTE,
+	// CQI_CL_ERROR_WRONG_ATTRIBUTE_TYPE
+	/**
+	 * Check wether a structural attribute has values.
+	 *
+	 * @param attribute the attribute
+	 * @return true, if it has values
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiServerError Signals that the cqi server raised an error
+	 */
+	public boolean corpusStructuralAttributeHasValues(String attribute) throws UnexpectedAnswerException, IOException,
+	CqiServerError;
+
+	// CQI_CQP_ERROR_NO_SUCH_CORPUS
+	/**
+	 * Gives the corpus alignement attributes.
+	 *
+	 * @param corpus the corpus
+	 * @return the name of attributes
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiServerError Signals that the cqi server raised an error
+	 */
+	public String[] corpusAlignementAttributes(String corpus) throws UnexpectedAnswerException, IOException, CqiServerError;
+
+	// CQI_CQP_ERROR_NO_SUCH_CORPUS
+	/**
+	 * Gives the corpus full name.
+	 *
+	 * @param corpus the corpus
+	 * @return the full name
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiServerError Signals that the cqi server raised an error
+	 */
+	public String corpusFullName(String corpus) throws UnexpectedAnswerException, IOException, CqiServerError;
+
+	/**
+	 * Gives the corpus info listed in the .INFO file.
+	 *
+	 * @param corpus the corpus
+	 * @return the info
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiServerError Signals that the cqi server raised an error
+	 */
+	public  String[] corpusInfo(String corpus) throws UnexpectedAnswerException, IOException, CqiServerError;
+
+	/**
+	 * Drop a corpus.
+	 * 
+	 * @param corpus
+	 *            the corpus
+	 */
+	public void dropCorpus(String corpus) throws Exception;
+
+	// CQI_CQP_ERROR_NO_SUCH_CORPUS, CQI_CL_ERROR_NO_SUCH_ATTRIBUTE,
+	// CQI_CL_ERROR_WRONG_ATTRIBUTE_TYPE, CQI_CL_ERROR_CORPUS_ACCESS
+	/**
+	 * Gives an attribute size (the number of token).
+	 *
+	 * @param attribute the attribute
+	 * @return the size
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws CqiServerError Signals that the cqi server raised an error
+	 */
+	public int attributeSize(String attribute) throws IOException, UnexpectedAnswerException, CqiServerError;
+
+	// CQI_CQP_ERROR_NO_SUCH_CORPUS, CQI_CL_ERROR_NO_SUCH_ATTRIBUTE,
+	// CQI_CL_ERROR_WRONG_ATTRIBUTE_TYPE, CQI_CL_ERROR_CORPUS_ACCESS
+	/**
+	 * Gives the lexicon size of an attribute.
+	 *
+	 * @param attribute the attribute
+	 * @return the int
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws CqiServerError Signals that the cqi server raised an error
+	 * @returns the number of entries in the lexicon of a positional attribute
+	 */
+	public int lexiconSize(String attribute) throws IOException, UnexpectedAnswerException, CqiServerError;
+
+	/**
+	 * Drop attribute.
+	 *
+	 * @param attribute the attribute
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws CqiServerError Signals that the cqi server raised an error
+	 */
+	public void dropAttribute(String attribute) throws IOException, UnexpectedAnswerException, CqiServerError;
+
+	/**
+	 * Converts an array of attribute values to their ID.
+	 *
+	 * @param attribute the attribute
+	 * @param strings the values
+	 * @return the IDs
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws CqiServerError Signals that the cqi server raised an error
+	 */
+	public int[] str2Id(String attribute, String[] strings) throws IOException, UnexpectedAnswerException, CqiServerError;
+
+	/**
+	 * Converts an array of attribute ID to their values.
+	 *
+	 * @param attribute the attribute
+	 * @param ids the ids
+	 * @return the values
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiServerError Signals that the cqi server raised an error
+	 */
+	public String[] id2Str(String attribute, int[] ids) throws UnexpectedAnswerException, IOException, CqiServerError;
+
+	/**
+	 * Converts an array of attribute IDs to their frequency.
+	 *
+	 * @param attribute the attribute
+	 * @param ids the ids
+	 * @return the frequencies
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiServerError Signals that the cqi server raised an error
+	 */
+	public int[] id2Freq(String attribute, int[] ids) throws UnexpectedAnswerException, IOException, CqiServerError;
+
+	/**
+	 * Converts an array of position to their ID given an attribute.
+	 *
+	 * @param attribute the attribute
+	 * @param cpos the positions
+	 * @return the IDs
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiServerError Signals that the cqi server raised an error
+	 */
+	public int[] cpos2Id(String attribute, int[] cpos) throws UnexpectedAnswerException, IOException, CqiServerError;
+
+	/**
+	 * Converts an array of position to their value given an attribute.
+	 *
+	 * @param attribute the attribute
+	 * @param cpos the cpos
+	 * @return the values
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiServerError the cqi server error
+	 */
+	public String[] cpos2Str(String attribute, int[] cpos) throws UnexpectedAnswerException, IOException, CqiServerError;
+
+	/**
+	 * Computes for each position of an array the Id of the enclosing structural
+	 * attribute.
+	 *
+	 * @param attribute the attribute
+	 * @param cpos the positions
+	 * @return the IDs
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiServerError the cqi server error
+	 */
+	public int[] cpos2Struc(String attribute, int[] cpos) throws UnexpectedAnswerException, IOException, CqiServerError;
+
+	/**
+	 * Computes for each position of an array the position of the left boundary
+	 * of the enclosing structural attribute.
+	 *
+	 * @param attribute the attribute
+	 * @param cpos the cpos
+	 * @return the positions of the left boundaries
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiServerError the cqi server error
+	 */
+	public int[] cpos2LBound(String attribute, int[] cpos) throws UnexpectedAnswerException, IOException, CqiServerError;
+
+	/**
+	 * Computes for each position of an array the position of the right boundary
+	 * of the enclosing structural attribute.
+	 *
+	 * @param attribute the attribute
+	 * @param cpos the cpos
+	 * @return the positions of the right boundaries
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiServerError the cqi server error
+	 */
+	public int[] cpos2RBound(String attribute, int[] cpos) throws UnexpectedAnswerException, IOException, CqiServerError;
+
+	/**
+	 * Computes for each position of an array the Id of the enclosing alignment
+	 * attribute.
+	 *
+	 * @param attribute the attribute
+	 * @param cpos the cpos
+	 * @return the int[]
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiServerError the cqi server error
+	 */
+	public int[] cpos2Alg(String attribute, int[] cpos) throws UnexpectedAnswerException, IOException, CqiServerError;
+
+	/**
+	 * Retrieves annotated string values of structure regions in <strucs>; "" if
+	 * out of range.
+	 *
+	 * @param attribute the attribute
+	 * @param strucs the strucs
+	 * @return the string[]
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiServerError the cqi server error
+	 */
+	public String[] struc2Str(String attribute, int[] strucs) throws UnexpectedAnswerException, IOException, CqiServerError;
+
+	/**
+	 * Retrieves all corpus positions where the given token occurs.
+	 *
+	 * @param attribute the attribute
+	 * @param id the id
+	 * @return the position
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiServerError the cqi server error
+	 */
+	public int[] id2Cpos(String attribute, int id) throws UnexpectedAnswerException, IOException, CqiServerError;
+
+	/**
+	 * Retrieves all corpus positions where one of the tokens in <id_list>
+	 * occurs; the returned list is sorted as a whole, not per token id.
+	 *
+	 * @param attribute the attribute
+	 * @param ids the ids
+	 * @return the positions
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiServerError the cqi server error
+	 */
+	public int[] idList2Cpos(String attribute, int[] ids) throws UnexpectedAnswerException, IOException, CqiServerError;
+
+	/**
+	 * Retrieves the lexicon IDs of all tokens that match <regex>; the returned
+	 * list may be empty (size 0).
+	 *
+	 * @param attribute the attribute
+	 * @param regex the regex
+	 * @return the IDs
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiServerError the cqi server error
+	 */
+	public int[] regex2Id(String attribute, String regex) throws UnexpectedAnswerException, IOException, CqiServerError;
+
+	/**
+	 * Retrieves the start and end corpus positions of structure region <struc>.
+	 *
+	 * @param attribute the attribute
+	 * @param struc the struc
+	 * @return an array of size 2 containing the start and end positions
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiServerError the cqi server error
+	 */
+	public int[] struc2Cpos(String attribute, int struc) throws UnexpectedAnswerException, IOException, CqiServerError;
+
+	/**
+	 * Retrieves start and end corpus positions of an alignement region in the
+	 * source and target corpora<struc>.
+	 *
+	 * @param attribute the attribute
+	 * @param struc the struc
+	 * @return an array of size 4 containing (src_start, src_end, target_start,
+	 * target_end)
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiServerError the cqi server error
+	 */
+	public int[] alg2Cpos(String attribute, int struc) throws UnexpectedAnswerException, IOException, CqiServerError;
+
+	/**
+	 * Runs a CQP query.
+	 *
+	 * @param motherCorpus the mother corpus
+	 * @param subcorpus the subcorpus
+	 * @param query the query
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws CqiServerError the cqi server error
+	 */
+	public void cqpQuery(String motherCorpus, String subcorpus, String query) throws IOException, UnexpectedAnswerException, CqiServerError;
+
+	/**
+	 * Lists all the subcorpora of a corpus.
+	 *
+	 * @param corpus the corpus
+	 * @return the name of the subcorpora
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiCqpErrorNoSuchCorpus the cqi cqp error no such corpus
+	 */
+	public String[] listSubcorpora(String corpus) throws UnexpectedAnswerException, IOException, CqiServerError;
+
+	/**
+	 * Gives the size of a subcorpus .
+	 * 
+	 * @param subcorpus
+	 *            the subcorpus
+	 * 
+	 * @return the size
+	 * 
+	 * @throws IOException
+	 *             Signals that an I/O exception has occurred.
+	 * @throws UnexpectedAnswerException
+	 *             Signals that the data read on the socket is unexpected
+	 * @throws CqiServerError
+	 *             the cqi server error
+	 */
+	public int subCorpusSize(String subcorpus) throws IOException,
+	UnexpectedAnswerException, CqiServerError;
+
+	/**
+	 * Checks wether a subcorpus has a field.
+	 * 
+	 * @param subcorpus
+	 *            the subcorpus
+	 * @param field CQI_CONST_FIELD_MATCH, CQI_CONST_FIELD_MATCHEND or CQI_CONST_FIELD_TARGET
+	 * 
+	 * @return true, if the subcorpus has the field
+	 * 
+	 * @throws IOException
+	 *             Signals that an I/O exception has occurred.
+	 * @throws UnexpectedAnswerException
+	 *             Signals that the data read on the socket is unexpected
+	 * @throws CqiServerError
+	 *             the cqi server error
+	 */
+	public boolean subCorpusHasField(String subcorpus, byte field) throws IOException, UnexpectedAnswerException, CqiServerError;
+
+	/**
+	 * Dumps the values of <field> for match ranges <first> .. <last> in
+	 * <subcorpus>. <field> is one of the CQI_CONST_FIELD_* constants.
+	 * 
+	 * @param subcorpus
+	 *            the subcorpus
+	 * @param field CQI_CONST_FIELD_MATCH, CQI_CONST_FIELD_MATCHEND or CQI_CONST_FIELD_TARGET
+	 * @param first
+	 *            the first
+	 * @param last
+	 *            the last
+	 * 
+	 * @return the values
+	 * 
+	 * @throws IOException
+	 *             Signals that an I/O exception has occurred.
+	 * @throws UnexpectedAnswerException
+	 *             Signals that the data read on the socket is unexpected
+	 * @throws CqiServerError
+	 *             the cqi server error
+	 */
+	public int[] dumpSubCorpus(String subcorpus, byte field, int first, int last) throws IOException, UnexpectedAnswerException,
+	CqiServerError;
+
+	/**
+	 * Drops a subcorpus.
+	 * 
+	 * @param subcorpus
+	 *            the subcorpus
+	 * 
+	 * @throws IOException
+	 *             Signals that an I/O exception has occurred.
+	 * @throws UnexpectedAnswerException
+	 *             Signals that the data read on the socket is unexpected
+	 * @throws CqiServerError
+	 *             the cqi server error
+	 */
+	public void dropSubCorpus(String subcorpus) throws IOException,
+	UnexpectedAnswerException, CqiServerError;
+
+	/**
+	 * Returns <n> (id, frequency) pairs flattened into a list of size 2*<n> NB:
+	 * pairs are sorted by frequency desc.
+	 * 
+	 * @param subcorpus
+	 *            the subcorpus
+	 * @param cutoff
+	 *            the cutoff
+	 * @param field
+	 *            the field : one of CQI_CONST_FIELD_MATCH, CQI_CONST_FIELD_MATCHEND or CQI_CONST_FIELD_TARGET
+	 * @param attribute
+	 *            the attribute
+	 * 
+	 * @return the int[][]
+	 * 
+	 * @throws IOException
+	 *             Signals that an I/O exception has occurred.
+	 * @throws UnexpectedAnswerException
+	 *             Signals that the data read on the socket is unexpected
+	 * @throws CqiServerError
+	 *             the cqi server error
+	 */
+	public int[][] fdist1(String subcorpus, int cutoff,
+			byte field, String attribute) throws IOException,
+			UnexpectedAnswerException, CqiServerError;
+
+	/**
+	 * Returns <n> (id1, id2, frequency) pairs flattened into a list of size
+	 * 3*<n> NB: triples are sorted by frequency desc. .
+	 * 
+	 * @param subcorpus
+	 *            the subcorpus
+	 * @param cutoff
+	 *            the cutoff
+	 * @param field1
+	 *            the field1
+	 * @param attribute1
+	 *            the attribute1
+	 * @param field2
+	 *            the field2
+	 * @param attribute2
+	 *            the attribute2
+	 * 
+	 * @return the int[]
+	 * 
+	 * @throws IOException
+	 *             Signals that an I/O exception has occurred.
+	 * @throws UnexpectedAnswerException
+	 *             Signals that the data read on the socket is unexpected
+	 * @throws CqiServerError
+	 *             the cqi server error
+	 */
+	public int[][] fdist2(String subcorpus, int cutoff,
+			byte field1, String attribute1, byte field2, String attribute2) throws IOException, UnexpectedAnswerException, CqiServerError;
+
+	public boolean reconnect() ;
+	
+	/**
+	 * Runs a CQP query line (ends with ";").
+	 *
+	 * @param query the query
+	 * @throws CqiServerError 
+	 * @throws UnexpectedAnswerException 
+	 * @throws IOException 
+	 */
+	public void query(String query) throws IOException, UnexpectedAnswerException, CqiServerError;
+
+	/**
+	 * Load a system corpus
+	 *
+	 * @param regfilepath the subcorpus
+	 * @param entry the corpus ID (uppercase)
+	 * @return 
+	 * @throws CqiServerError 
+	 * @throws UnexpectedAnswerException 
+	 * @throws IOException 
+	 */
+	public boolean load_a_system_corpus(String regfilepath, String entry) throws IOException, UnexpectedAnswerException, CqiServerError;
+}

Property changes on: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/ICqiClient.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/AbstractCqiServer.java
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/AbstractCqiServer.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/AbstractCqiServer.java	(revision 3659)
@@ -0,0 +1,108 @@
+// Copyright © 2010-2020 ENS de Lyon., University of Franche-Comté
+// 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: 2011-12-14 10:52:18 +0100 (mer., 14 déc. 2011) $
+// $LastChangedRevision: 2080 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.searchengine.cqp;
+
+import java.io.InputStream;
+import java.io.OutputStream;
+
+// TODO: Auto-generated Javadoc
+/**
+ * This class aims at handling a CQi server process. It is not a CQi server per
+ * se.
+ * 
+ * @author Jean-Philippe Magué
+ */
+public abstract class AbstractCqiServer implements ICqiServer {
+	
+	@Override
+	public abstract void setDebug(boolean val);
+
+	/**
+	 * Gets the last cmd line.
+	 *
+	 * @return the last cmd line
+	 */
+	public String getLastCmdLine() {
+		return ""; //$NON-NLS-1$
+	}
+
+	/**
+	 * Start.
+	 *
+	 * @return true, if successful
+	 * @throws Exception 
+	 */
+	@Override
+	public abstract Boolean start() throws Exception;
+	
+	/**
+	 * Convert stream to string.
+	 *
+	 * @param is the is
+	 * @return the string
+	 */
+	@Override
+	public abstract String convertStreamToString(InputStream is);
+	
+	/**
+	 * Stop the server.
+	 */
+	@Override
+	public abstract Boolean stop();
+
+	/**
+	 * Checks if the server is running.
+	 * 
+	 * @return true, if is running
+	 */
+	@Override
+	public abstract Boolean isRunning();
+
+	/**
+	 * Gets the error stream.
+	 *
+	 * @return the error stream
+	 */
+	@Override
+	public abstract InputStream getErrorStream();
+
+	/**
+	 * Gets the input stream.
+	 *
+	 * @return the input stream
+	 */
+	@Override
+	public abstract InputStream getInputStream();
+	/**
+	 * Gets the output stream.
+	 *
+	 * @return the output stream
+	 */
+	@Override
+	public abstract OutputStream getOutputStream();
+}
\ No newline at end of file

Property changes on: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/AbstractCqiServer.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/CQPEdition.java
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/CQPEdition.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/CQPEdition.java	(revision 3659)
@@ -0,0 +1,101 @@
+package org.txm.searchengine.cqp.corpus;
+
+import java.util.ArrayList;
+
+import org.txm.objects.Edition;
+import org.txm.objects.Page;
+import org.txm.objects.Project;
+import org.txm.objects.Text;
+import org.txm.searchengine.cqp.corpus.query.CQLQuery;
+import org.txm.utils.TXMProgressMonitor;
+import org.txm.utils.io.IOUtils;
+
+/**
+ * Build onthefly HTML pages from the CQP indexes (words + structures)
+ * 
+ * @author mdecorde
+ *
+ */
+public class CQPEdition extends Edition {
+	
+	ArrayList<Page> cache = new ArrayList<>();
+	int MAX = 20;
+	
+	public CQPEdition(Text text) {
+		
+		super(text);
+	}
+	
+	public CQPEdition(String id) {
+		
+		super(id);
+	}
+	
+	@Override
+	protected boolean _compute(TXMProgressMonitor monitor) throws Exception {
+		pPageNames.clear();
+		pPageFirstWordIds.clear();
+		cache.clear();
+		
+		Project p = getProject();
+		MainCorpus corpus = p.getChildren(MainCorpus.class).get(0);
+		String paginantionElementName = p.getEditionDefinition("cqp").getPageElement();
+		StructuralUnit structure = corpus.getStructuralUnit(paginantionElementName);
+		if (structure == null) {
+			paginantionElementName = "p";
+			structure = corpus.getStructuralUnit(paginantionElementName);
+			if (structure == null) {
+				paginantionElementName = "div";
+				structure = corpus.getStructuralUnit(paginantionElementName);
+				if (structure == null) {
+					paginantionElementName = "text";
+				}
+			}
+		}
+		QueryResult qr = corpus.query(new CQLQuery("<"+paginantionElementName+">[]"), "TMP", false);
+		
+		String[] ids = corpus.getProperty("id").cpos2Str(qr.getStarts());
+		int nPages = qr.size;
+		
+		for (int i = 0 ; i <= nPages ; i++) {
+			pPageNames.add(""+i);
+			pPageFirstWordIds.add(ids[i]);
+		}
+		qr.drop(); // no more usefull
+		return nPages > 0;
+	}
+	
+	/**
+	 * Gets the page.
+	 *
+	 * @param no the no
+	 * @return the page
+	 */
+	public Page getPage(int n) {
+		
+		if (n >= 0 && pPageNames.size() > n) {
+			
+			String wId = "w_0"; // default word id
+			if (pPageFirstWordIds.size() > n) {
+				wId = pPageFirstWordIds.get(n);
+			}
+			Page p = new Page(this, pPageNames.get(n), wId, n);
+			if (cache.contains(p)) {
+				
+				return p; // html file is alredy built
+			}
+			p.getFile().getParentFile().mkdirs();
+			IOUtils.write(p.getFile(), "<html><body>TODO n="+n+ "w="+wId+"</body></html>");
+			
+			cache.add(p);
+			if (cache.size() > MAX) {
+				Page toClean = cache.remove(0);
+				toClean.getFile().delete();
+			}
+			return p;
+		}
+		else {
+			return null;
+		}
+	}
+}

Property changes on: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/CQPEdition.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/QueryResult.java
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/QueryResult.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/QueryResult.java	(revision 3659)
@@ -0,0 +1,520 @@
+// Copyright © 2010-2020 ENS de Lyon., University of Franche-Comté
+// 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: 2016-03-01 10:10:58 +0100 (Tue, 01 Mar 2016) $
+// $LastChangedRevision: 3133 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.searchengine.cqp.corpus;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.txm.core.messages.TXMCoreMessages;
+import org.txm.searchengine.core.Selection;
+import org.txm.searchengine.cqp.AbstractCqiClient;
+import org.txm.searchengine.cqp.CQPSearchEngine;
+import org.txm.searchengine.cqp.ICqiClient;
+import org.txm.searchengine.cqp.MemCqiClient;
+import org.txm.searchengine.cqp.NetCqiClient;
+import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
+import org.txm.searchengine.cqp.clientExceptions.InvalidCqpIdException;
+import org.txm.searchengine.cqp.clientExceptions.UnexpectedAnswerException;
+import org.txm.searchengine.cqp.corpus.query.Match;
+import org.txm.searchengine.cqp.corpus.query.CQLQuery;
+import org.txm.searchengine.cqp.serverException.CqiServerError;
+
+/**
+ * The result of a CQP query on a corpus.
+ * 
+ * @author jmague
+ */
+public class QueryResult extends Selection implements CqpObject {
+	
+	/** The cqp id. */
+	protected String cqpId;
+	
+	/** The mother main corpus. */
+	protected MainCorpus motherMainCorpus;
+	
+	/** The name. */
+	protected String name;
+	
+	/** The n match. */
+	protected int nMatch = -1;
+	
+	/** The queried corpus. */
+	protected CQPCorpus queriedCorpus;
+	
+	/** The query. */
+	protected CQLQuery query;
+	
+	/** The size. */
+	protected int size = -1;
+	
+	/**
+	 * Instantiates a new query result.
+	 * 
+	 * Not intended to be used directly. See {@link CQPCorpus#query(CQLQuery, String)}
+	 * 
+	 * @param cqpId
+	 *            the cqp id
+	 * @param name
+	 *            the name
+	 * @param queriedCorpus
+	 *            the queried corpus
+	 * @param query
+	 *            the query
+	 * 
+	 * @throws InvalidCqpIdException
+	 *             the invalid cqp id exception
+	 */
+	public QueryResult(String cqpId, String name, CQPCorpus queriedCorpus,
+			CQLQuery query) throws InvalidCqpIdException {
+		
+		// super(cqpId);
+		checkCqpId(cqpId);
+		this.cqpId = cqpId;
+		this.name = name;
+		this.queriedCorpus = queriedCorpus;
+		if (queriedCorpus instanceof Subcorpus) {
+			this.motherMainCorpus = ((Subcorpus) queriedCorpus)
+					.getMainCorpus();
+		}
+		else {
+			this.motherMainCorpus = ((MainCorpus) queriedCorpus);
+		}
+		this.query = query;
+	}
+	
+	/*
+	 * (non-Javadoc)
+	 * @see
+	 * org.txm.searchengine.cqp.corpus.CqpObject#checkCqpId(java.lang
+	 * .String)
+	 */
+	@Override
+	public boolean checkCqpId(String cqpId) throws InvalidCqpIdException {
+		
+		if (!AbstractCqiClient.checkSubcorpusId(cqpId)) {
+			throw new InvalidCqpIdException(cqpId + TXMCoreMessages.isNotAValidCQPIdForASubcorpusItMustBeAnUppercaseCharactersFollowedByLowercaseCharacters);
+		}
+		return true;
+	}
+	
+	/**
+	 * Drops the query results. More specifically, it drops its CQP counterpart.
+	 * 
+	 * This method has to be called when a query result is no longer usefull.
+	 * 
+	 * @throws CqiClientException
+	 *             the cqi client exception
+	 */
+	@Override
+	public void drop() throws CqiClientException {
+		
+		try {
+			CorpusManager.getCorpusManager().getCqiClient().dropSubCorpus(this.getQualifiedCqpId());
+		}
+		catch (Exception e) {
+			throw new CqiClientException(e);
+		}
+	}
+	
+	@Override
+	public void finalize() {
+		// try { drop(); }
+		// catch(Exception e) { }
+	}
+	
+	/*
+	 * (non-Javadoc)
+	 * @see org.txm.searchengine.cqp.corpus.CqpObject#getCqpId()
+	 */
+	@Override
+	public String getCqpId() {
+		
+		return cqpId;
+	}
+	
+	public int[] getEnds() throws CqiClientException, IOException, CqiServerError {
+		
+		int n = this.getNMatch();
+		if (n > 0) {
+			return getEnds(0, n - 1);
+		}
+		else {
+			return new int[0];
+		}
+	}
+	
+	public int[] getEnds(int from, int to) throws UnexpectedAnswerException, IOException, CqiServerError {
+		
+		return CorpusManager.getCorpusManager().getCqiClient()
+				.dumpSubCorpus(getQualifiedCqpId(),
+						NetCqiClient.CQI_CONST_FIELD_MATCHEND, from, to);
+	}
+	
+	/*
+	 * (non-Javadoc)
+	 * @see org.txm.searchengine.cqp.corpus.CqpObject#getMotherMainCorpus()
+	 */
+	@Override
+	public MainCorpus getMainCorpus() {
+		
+		return motherMainCorpus;
+	}
+	
+	/**
+	 * get the Nth match
+	 * 
+	 * @param i
+	 * @return
+	 * @throws UnexpectedAnswerException
+	 * @throws IOException
+	 * @throws CqiServerError
+	 */
+	public Match getMatch(int i) throws UnexpectedAnswerException, IOException, CqiServerError {
+		
+		AbstractCqiClient cqi = CorpusManager.getCorpusManager().getCqiClient();
+		
+		int[] starts = cqi.dumpSubCorpus(getQualifiedCqpId(), NetCqiClient.CQI_CONST_FIELD_MATCH, i, i);
+		
+		int[] ends = cqi.dumpSubCorpus(getQualifiedCqpId(), NetCqiClient.CQI_CONST_FIELD_MATCHEND, i, i);
+		
+		return new Match(starts[0], ends[0]); // the starts&ends arrays should be of size 1
+	}
+	
+	/**
+	 * Gets all the matches.
+	 * 
+	 * WARNING: on win32 OS, this function may takes a long time if called with sockets
+	 * 
+	 * @return the matches
+	 * 
+	 * @throws CqiClientException
+	 *             the cqi client exception
+	 */
+	@Override
+	public List<Match> getMatches() throws CqiClientException {
+		
+		int n = this.getNMatch();
+		if (n > 0) {
+			return getMatches(0, n - 1);
+		}
+		else {
+			return new ArrayList<>();
+		}
+	}
+	
+	
+	
+	/**
+	 * Retrieves some of the matches of a query
+	 * 
+	 * Not all the matches are returned, but only those between from and to. For
+	 * example, getMatches(0,9) returns the first 10 matches while
+	 * getMatches(0,getNMatches()) return them all.
+	 * 
+	 * @param from
+	 *            the from
+	 * @param to
+	 *            the to
+	 * 
+	 * @return the matches
+	 * 
+	 * @throws CqiClientException
+	 *             the cqi client exception
+	 */
+	/**
+	 * @return
+	 * @throws CqiClientException
+	 */
+	@Override
+	public List<Match> getMatches(int from, int to) throws CqiClientException {
+		
+		int[] starts, ends, targets;
+		List<Match> res = new ArrayList<>();
+		try {
+			starts = getStarts(from, to);
+			ends = getEnds(from, to);
+			targets = getTargets(from, to);
+		}
+		catch (Exception e) {
+			throw new CqiClientException(e);
+		}
+		for (int i = 0; i <= to - from; i++) {
+			res.add(new Match(starts[i], ends[i], targets[i]));
+		}
+		return res;
+	}
+	
+	private int[] getTargets(int from, int to) throws UnexpectedAnswerException, IOException, CqiServerError {
+		
+		return CorpusManager.getCorpusManager().getCqiClient()
+				.dumpSubCorpus(getQualifiedCqpId(),
+						NetCqiClient.CQI_CONST_FIELD_TARGET, from, to);
+	}
+	
+	/*
+	 * (non-Javadoc)
+	 * @see org.txm.searchengine.cqp.corpus.CqpObject#getName()
+	 */
+	@Override
+	public String getName() {
+		
+		return name;
+	}
+	
+	/**
+	 * Gets the number of matches.
+	 * 
+	 * @return the number of matches
+	 * 
+	 * @throws CqiClientException
+	 *             the cqi client exception
+	 */
+	@Override
+	public int getNMatch() throws CqiClientException {
+		
+		// if (nMatch == -1) //
+		try {
+			nMatch = CorpusManager.getCorpusManager().getCqiClient().subCorpusSize(getQualifiedCqpId());
+		}
+		catch (Exception e) {
+			return 0;
+		}
+		return nMatch;
+	}
+	
+	/*
+	 * (non-Javadoc)
+	 * @see
+	 * org.txm.searchengine.cqp.corpus.CqpObject#getQualifiedCqpId()
+	 */
+	@Override
+	public String getQualifiedCqpId() {
+		
+		return motherMainCorpus.getCqpId() + ":" + this.cqpId; //$NON-NLS-1$
+	}
+	
+	/**
+	 * Gets the queried corpus.
+	 * 
+	 * @return the queried corpus
+	 */
+	public CQPCorpus getQueriedCorpus() {
+		
+		return queriedCorpus;
+	}
+	
+	// /**
+	// * Gets all the matches.
+	// * WARNING: on win32 OS, this function may takesQUETE a long time
+	// *
+	// * @return the matches
+	// *
+	// * @throws CqiClientException
+	// * the cqi client exception
+	// */
+	// public List<Match> getRandomMatches(float perc) throws CqiClientException {
+	//
+	// ArrayList<Match> allmatches = new ArrayList<Match>(getMatches(0, getNMatch() - 1));
+	// ArrayList<Match> sub = new ArrayList<Match>();
+	// int count = 0;
+	// for(Match m : allmatches)
+	// {
+	// if(count >= size)
+	// return sub;
+	// count++;
+	// if(Math.random() > perc)
+	// sub.add(m);
+	// }
+	// return sub;
+	// }
+	
+	/**
+	 * Gets the query.
+	 * 
+	 * @return the query
+	 */
+	@Override
+	public CQLQuery getQuery() {
+		
+		return query;
+	}
+	
+	/**
+	 * Retrieves some of the matches of a query
+	 * 
+	 * Not all the matches are returned, but only those between from and to. For
+	 * example, getMatches(0,9) returns the first 10 matches while
+	 * getMatches(0,getNMatches()) return them all.
+	 * 
+	 * @param from
+	 *            the from
+	 * @param to
+	 *            the to
+	 * 
+	 * @return the matches
+	 * 
+	 * @throws CqiClientException
+	 *             the cqi client exception
+	 */
+	/**
+	 * @return
+	 * @throws CqiClientException
+	 */
+	public int[] getStartMatches(int from, int to) throws CqiClientException {
+		
+		int n = this.getNMatch();
+		if (to > n) to = n;
+		try {
+			return CorpusManager.getCorpusManager().getCqiClient()
+					.dumpSubCorpus(getQualifiedCqpId(),
+							NetCqiClient.CQI_CONST_FIELD_MATCH, from, to);
+		}
+		catch (Exception e) {
+			throw new CqiClientException(e);
+		}
+	}
+	
+	public int[] getStarts() throws CqiClientException, IOException, CqiServerError {
+		
+		int n = this.getNMatch();
+		if (n > 0) {
+			return getStarts(0, n - 1);
+		}
+		else {
+			return new int[0];
+		}
+	}
+	
+	public int[] getStarts(int from, int to) throws UnexpectedAnswerException, IOException, CqiServerError {
+		
+		return CorpusManager.getCorpusManager().getCqiClient().dumpSubCorpus(getQualifiedCqpId(), NetCqiClient.CQI_CONST_FIELD_MATCH, from, to);
+	}
+	
+	@Override
+	public String toString() {
+		
+		return this.getQualifiedCqpId();
+	}
+	
+	@Override
+	public boolean isTargetUsed() throws UnexpectedAnswerException, IOException, CqiServerError {
+
+		return CQPSearchEngine.getCqiClient().subCorpusHasField(this.getQualifiedCqpId(), ICqiClient.CQI_CONST_FIELD_TARGET);
+	}
+	
+	@Override
+	public boolean delete(int iMatch) {
+		
+		AbstractCqiClient CQI = CorpusManager.getCorpusManager().getCqiClient();
+		if (CQI instanceof MemCqiClient) {
+			MemCqiClient MCQI = (MemCqiClient) CQI;
+			
+			String query = "delete " + this.getQualifiedCqpId() + " " + iMatch + ";";
+			try {
+				MCQI.query(query);
+				size = -1;
+				nMatch = -1;
+				return true;
+			}
+			catch (UnexpectedAnswerException | IOException | CqiServerError e) {
+				// TODO Auto-generated catch block
+				e.printStackTrace();
+			}
+		}
+		return false;
+	}
+	
+	@Override
+	public boolean delete(org.txm.objects.Match match) {
+		
+		AbstractCqiClient CQI = CorpusManager.getCorpusManager().getCqiClient();
+		if (CQI instanceof MemCqiClient) {
+			try {
+				MemCqiClient MCQI = (MemCqiClient) CQI;
+				
+				Match m2;
+				List<? extends Match> allMatches = getMatches();
+				int to = allMatches.size();
+				for (int i = 0; i < to; i++) {
+					m2 = allMatches.get(i);
+					if (m2.getStart() == match.getStart() && m2.getEnd() == match.getEnd()) {
+						String query = "delete " + this.getQualifiedCqpId() + " " + i + ";";
+						
+						MCQI.query(query);
+						
+						size = -1;
+						nMatch = -1;
+						return true;
+					}
+				}
+			}
+			catch (Exception e) {
+				// TODO Auto-generated catch block
+				e.printStackTrace();
+			}
+		}
+		
+		return false;
+	}
+	
+	@Override
+	public boolean delete(ArrayList<org.txm.objects.Match> matchesToRemove) {
+		
+		AbstractCqiClient CQI = CorpusManager.getCorpusManager().getCqiClient();
+		List<? extends Match> allMatches;
+		try {
+			allMatches = getMatches();
+			
+			int to = allMatches.size();
+			int c = 0;
+			if (CQI instanceof MemCqiClient) {
+				MemCqiClient MCQI = (MemCqiClient) CQI;
+				for (org.txm.objects.Match m : matchesToRemove) {
+					Match m2;
+					
+					for (int i = 0; i < to; i++) {// TODO may be a bit faster since allMatches&matchesToRemove are ordered
+						m2 = allMatches.get(i);
+						if (m2.getStart() == m.getStart() && m2.getEnd() == m.getEnd()) {
+							String query = "delete " + this.getQualifiedCqpId() + " " + (i) + ";";
+							MCQI.query(query);
+							c++;
+							break; // one match per line
+						}
+					}
+				}
+				return c > 0;
+			}
+		}
+		catch (Exception e1) {
+			// TODO Auto-generated catch block
+			e1.printStackTrace();
+		}
+		return false;
+	}
+}

Property changes on: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/QueryResult.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/CQPLexicon.java
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/CQPLexicon.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/CQPLexicon.java	(revision 3659)
@@ -0,0 +1,749 @@
+// Copyright © 2010-2020 ENS de Lyon., University of Franche-Comté
+// 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: 2016-09-19 10:31:00 +0200 (Mon, 19 Sep 2016) $
+// $LastChangedRevision: 3298 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.searchengine.cqp.corpus;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStreamWriter;
+import java.io.UnsupportedEncodingException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Map;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.osgi.util.NLS;
+import org.txm.core.messages.TXMCoreMessages;
+import org.txm.core.results.TXMParameters;
+import org.txm.core.results.TXMResult;
+import org.txm.searchengine.cqp.AbstractCqiClient;
+import org.txm.searchengine.cqp.ICqiClient;
+import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
+import org.txm.searchengine.cqp.corpus.query.CQLQuery;
+import org.txm.searchengine.cqp.corpus.query.MatchUtils;
+import org.txm.searchengine.cqp.serverException.CqiServerError;
+import org.txm.utils.TXMProgressMonitor;
+//import org.txm.statsengine.core.StatException;
+//import org.txm.statsengine.core.data.Vector;
+//import org.txm.statsengine.r.core.data.VectorImpl;
+import org.txm.utils.logger.Log;
+
+//  TODO should be put into stat.data package ?
+/**
+ * Represent a frequency list according to a {@link CQPCorpus} (or a.
+ *
+ * {@link Subcorpus}) and a {@link Property}.
+ * 
+ * @author sloiseau
+ */
+public class CQPLexicon {
+
+
+	/** The forms. */
+	private String[] forms;
+
+	/** The freqs. */
+	private int[] freqs;
+
+	/** The ids. */
+	private int[] ids;
+
+	/** The number of tokens. */
+	int numberOfTokens = -1;
+
+	/** The symbol. */
+	private String symbol;
+
+	/** The writer. */
+	private OutputStreamWriter writer;
+
+	/**
+	 * The property.
+	 */
+	protected WordProperty pProperty;
+
+	private CQPCorpus corpus;
+
+	/**
+	 * @param corpus
+	 */
+	public CQPLexicon(CQPCorpus corpus) {
+		this.corpus = corpus;
+	}
+
+	public boolean _compute() throws Exception {
+
+		if (pProperty instanceof VirtualProperty) {
+			return computeWithVirtualProperty(this.getParent(), (VirtualProperty)pProperty);
+		} else {
+			if (this.getParent() instanceof MainCorpus) {
+				return computeWithMainCorpus((MainCorpus) this.getParent(), pProperty, null); // uses CQi fdist method
+			}
+			else if (this.getParent() instanceof Subcorpus) {
+				return computewithSubCorpus((Subcorpus) this.getParent(), pProperty, null); // uses CQi fdist method
+			}
+			else {
+				Log.severe("Error: Lexicon parent is neither a Maincorpus nor a Subcorpus."); //$NON-NLS-1$
+				return false;
+			}
+		}
+	}
+
+	private boolean computeWithVirtualProperty(CQPCorpus corpus, VirtualProperty property) {
+
+		int[] positions = MatchUtils.toPositions(corpus.getMatches());
+		int[] ids2 = property.cpos2Id(positions);
+		Arrays.sort(ids2);
+		HashSet<Integer> test = new HashSet<Integer>();
+		int[] freqs2 = new int[ids2.length]; // max freqs length
+		int[] idsHash = new int[ids2.length]; // max idsHash length
+		idsHash[0] = ids2[0];
+		int n = 0; // max size
+		for (int i = 0 ; i < ids2.length ; i++) {
+			test.add(ids2[i]);
+			if (idsHash[n] != ids2[i]) { // new entry
+				n++;
+				idsHash[n] = ids2[i];
+			}
+			freqs2[n] = freqs2[n] + 1;
+		}
+			
+		ids = new int[n];
+		System.arraycopy(idsHash, 0, ids, 0, n);
+		freqs = new int[n];
+		System.arraycopy(freqs2, 0, freqs, 0, n);
+			
+		init(corpus, property, freqs, ids);
+		return true;
+
+	}
+
+	/**
+	 * Gets the lexicon relative to a given property.
+	 * 
+	 * @param property
+	 *            the property
+	 * 
+	 * @return the lexicon
+	 * 
+	 * @throws CqiClientException
+	 *             the cqi client exception
+	 */
+	protected boolean computeWithMainCorpus(MainCorpus corpus, WordProperty property, IProgressMonitor monitor) throws CqiClientException {
+		// System.out.println("in "+this.getCqpId()+" look for cached lexicon "+property);
+		// System.out.println("not found");
+		int lexiconSize;
+		try {
+			lexiconSize = CorpusManager.getCorpusManager().getCqiClient().lexiconSize(property.getQualifiedName());
+		}
+		catch (Exception e) {
+			throw new CqiClientException(e);
+		}
+
+		int[] ids = new int[lexiconSize];
+		for (int i = 0; i < ids.length; i++) {
+			ids[i] = i;
+		}
+
+		int[] freqs;
+		try {
+			freqs = CorpusManager.getCorpusManager().getCqiClient().id2Freq(property.getQualifiedName(), ids);
+		}
+		catch (Exception e) {
+			throw new CqiClientException(e);
+		}
+
+		this.init(corpus, property, freqs, ids);
+		return true;
+	}
+
+	// /**
+	// *
+	// * @param corpus
+	// * @param property
+	// * @param monitor
+	// * @return
+	// * @throws CqiClientException
+	// */
+	// // FIXME: why this method needs to create and delete some new subcorpus???? the computing can't be done directly on the corpus argument???
+	// // eg. dist = CorpusManager.getCorpusManager().getCqiClient().fdist1(corpus.getQualifiedCqpId(), 0, ICqiClient.CQI_CONST_FIELD_MATCH, property.getName());
+	// protected boolean computewithSubCorpus(Subcorpus corpus, Property property, IProgressMonitor monitor) throws CqiClientException {
+	//
+	// //System.out.println("not found");
+	//// Log.finest(NLS.bind(IndexCoreMessages.computingTheLexiconOfSubcorpusP0, corpus.getName()));
+	// //long start = System.currentTimeMillis();
+	// int[][] fdist = null;
+	// AbstractCqiClient cqi = CorpusManager.getCorpusManager().getCqiClient();
+	// String tmp = "TMP" + CQPCorpus.getNextSubcorpusCounter();
+	// String qtmp = corpus.getMainCorpus().getQualifiedCqpId()+":"+tmp;
+	// try {
+	//// System.out.println("subcorpus: "+corpus.getQualifiedCqpId());
+	//// System.out.println("query subcorpus: "+qtmp);
+	// cqi.cqpQuery(corpus.getQualifiedCqpId(), tmp, "[]"); //$NON-NLS-1$
+	// fdist = CorpusManager.getCorpusManager().getCqiClient().fdist1(qtmp, 0, ICqiClient.CQI_CONST_FIELD_MATCH, property.getName());
+	// //System.out.println("nb lines: "+fdist.length);
+	// } catch (Exception e) {
+	// throw new CqiClientException(e);
+	// } finally {
+	// try {
+	// cqi.dropSubCorpus(qtmp);
+	// } catch (IOException e) {
+	// // TODO Auto-generated catch block
+	// e.printStackTrace();
+	// } catch (CqiServerError e) {
+	// // TODO Auto-generated catch block
+	// e.printStackTrace();
+	// }
+	// }
+	// int lexiconSize = fdist.length;
+	//
+	// int[] freqs = new int[lexiconSize];
+	// int[] ids = new int[lexiconSize];
+	// for (int i = 0; i < fdist.length; i++) {
+	// ids[i] = fdist[i][0];
+	// freqs[i] = fdist[i][1];
+	// }
+	//
+	// init(corpus, property, freqs, ids);
+	// return true;
+	// }
+
+	/**
+	 * 
+	 * @param corpus
+	 * @param property
+	 * @param monitor
+	 * @return
+	 * @throws CqiClientException
+	 */
+	// FIXME: SJ: why this method needs to create and delete some new subcorpus? the computing can't be done directly on the corpus argument?
+	// eg. dist = CorpusManager.getCorpusManager().getCqiClient().fdist1(corpus.getQualifiedCqpId(), 0, ICqiClient.CQI_CONST_FIELD_MATCH, property.getName());
+	protected boolean computewithSubCorpus(Subcorpus corpus, WordProperty property, IProgressMonitor monitor) throws CqiClientException {
+
+		// System.out.println("not found");
+		// Log.finest(NLS.bind(IndexCoreMessages.computingTheLexiconOfSubcorpusP0, corpus.getName()));
+		// long start = System.currentTimeMillis();
+		int[][] fdist = null;
+
+		boolean fast = false;
+
+		// FIXME: SJ: old version
+		if (!fast) {
+
+			AbstractCqiClient cqi = CorpusManager.getCorpusManager().getCqiClient();
+			String tmp = "TMP" + CQPCorpus.getNextSubcorpusCounter();
+			String qtmp = corpus.getMainCorpus().getQualifiedCqpId() + ":" + tmp;
+
+			try {
+				// System.out.println("subcorpus: "+corpus.getQualifiedCqpId());
+				// System.out.println("query subcorpus: "+qtmp);
+				if (tmp.length() > CQLQuery.MAX_CQL_LENGTH) {
+					Log.warning(NLS.bind("Error: CQL length limit reached ({0}) with {1} length.", CQLQuery.MAX_CQL_LENGTH, tmp.length())); 
+					return false;
+				}
+				cqi.cqpQuery(corpus.getQualifiedCqpId(), tmp, "[]"); //$NON-NLS-1$
+				fdist = CorpusManager.getCorpusManager().getCqiClient().fdist1(qtmp, 0, ICqiClient.CQI_CONST_FIELD_MATCH, property.getName());
+				// System.out.println("nb lines: "+fdist.length);
+			}
+			catch (Exception e) {
+				throw new CqiClientException(e);
+			}
+			finally {
+				try {
+					cqi.dropSubCorpus(qtmp);
+				}
+				catch (IOException e) {
+					// TODO Auto-generated catch block
+					e.printStackTrace();
+				}
+				catch (CqiServerError e) {
+					// TODO Auto-generated catch block
+					e.printStackTrace();
+				}
+			}
+		}
+		// FIXME: SJ: new version by MD that seems fastest, need to test on all types of lexicons corpora before replacing old version
+		else {
+
+			try {
+				int[] positions = MatchUtils.toPositions(corpus.getMatches());
+				int[] indexes = CorpusManager.getCorpusManager().getCqiClient().cpos2Id(property.getQualifiedName(), positions);
+				int n_indexes = CorpusManager.getCorpusManager().getCqiClient().attributeSize(property.getQualifiedName());
+				int[] counts = new int[n_indexes];
+				for (int i : indexes) {
+					counts[i]++;
+				}
+				fdist = new int[indexes.length][2];
+
+				int n = 0;
+				for (int i : indexes) {
+					fdist[n][0] = i;
+					fdist[n][1] = counts[i];
+					n++;
+				}
+			}
+			catch (Exception e) {
+				// TODO Auto-generated catch block
+				e.printStackTrace();
+			}
+		}
+		int lexiconSize = fdist.length;
+
+		int[] freqs = new int[lexiconSize];
+		int[] ids = new int[lexiconSize];
+		for (int i = 0; i < fdist.length; i++) {
+			ids[i] = fdist[i][0];
+			freqs[i] = fdist[i][1];
+		}
+
+		init(corpus, property, freqs, ids);
+		return true;
+	}
+
+
+	/**
+	 * Compute number of tokens. / this.nbr
+	 */
+	private void computeNumberOfTokens() {
+		numberOfTokens = 0;
+		for (int i = 0; i < freqs.length; i++) {
+			numberOfTokens += freqs[i];
+			// System.out.println(numberOfTokens);
+			// if (freqs[i] != 1) System.out.println(freqs[i]);
+		}
+	}
+
+	/**
+	 * Dump lexicon forms and frequencies in a String.
+	 *
+	 * @param col the col
+	 * @param txt the txt
+	 * @return the string
+	 */
+	public String dump(String col, String txt) {
+		StringBuffer buffer = new StringBuffer();
+		getForms();
+		for (int i = 0; i < forms.length; i++) {
+			buffer.append(txt + forms[i].replace(txt, txt + txt) + txt + col + freqs[i] + "\n"); //$NON-NLS-1$
+		}
+		return buffer.toString();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see java.lang.Object#equals(java.lang.Object)
+	 */
+	@Override
+	public boolean equals(Object obj) {
+		if (!(obj instanceof CQPLexicon)) {
+			return false;
+		}
+		CQPLexicon other = (CQPLexicon) obj;
+
+		if (other.nbrOfType() != this.nbrOfType()) {
+			return false;
+		}
+		return (Arrays.equals(freqs, other.getFreq()) && Arrays.equals(getForms(), other.getForms()));
+	}
+
+	/**
+	 * The corpus or subcorpus this lexicon is build on.
+	 * 
+	 * @return the corpus
+	 */
+	public CQPCorpus getCorpus() {
+		return corpus;
+	}
+
+
+	public String getDetails() {
+		return this.getParent().getName() + " " + this.pProperty.getName(); //$NON-NLS-1$
+	}
+
+	// TODO: move this into a Lexicon chart renderer
+	// /**
+	// * Draw a pareto graphic with this frequency list and record it into the
+	// * provided filename into svg format.
+	// *
+	// * @param file where to save the pareto graphic.
+	// * @return the pareto graphic
+	// * @throws StatException if anything goes wrong.
+	// */
+	// public void getParetoGraphic(File file) throws StatException {
+	// String rName = asVector().getSymbol();
+	// String expr = "pareto(" + rName + ")"; //$NON-NLS-1$ //$NON-NLS-2$
+	// try {
+	// RWorkspace.getRWorkspaceInstance().plot(file, expr, RDevice.SVG);
+	// } catch (Exception e) {
+	// throw new StatException(e);
+	// }
+	// }
+
+	/**
+	 * The different types in the lexicon, the type at the index <code>j</code>
+	 * of this array have the frequency at index <code>j</code> in the array
+	 * returned by {@link #getFreq()}.
+	 * 
+	 * @return types as an array of <code>String</code>
+	 */
+	public String[] getForms() {
+		if (forms == null) {
+			if (ids == null) {
+				return new String[0];
+			}
+			try {
+				if (pProperty instanceof WordProperty) {
+					forms = ((WordProperty)pProperty).id2Str(ids);
+				}				
+			}
+			catch (Exception e) {
+				// TODO Auto-generated catch block
+				org.txm.utils.logger.Log.printStackTrace(e);
+			}
+		}
+		return forms;
+	}
+
+	/**
+	 * The dif ferent types in the lexicon, the type at the index <code>j</code>
+	 * of this array have the frequency at index <code>j</code> in the array
+	 * returned by {@link #getFreq()}.
+	 *
+	 * @param number the number
+	 * @return types as an array of <code>String</code>
+	 */
+	public String[] getForms(int number) {
+		// System.out.println("Lexicon("+this.property+" get forms. number="+number+", ids len="+ids.length);
+		if (forms == null) {
+			try {
+				number = Math.min(number, ids.length);
+				if (number <= 0) {
+					return new String[0];
+				}
+				int[] subpositions = new int[number];
+				System.arraycopy(ids, 0, subpositions, 0, number);
+				return CorpusManager.getCorpusManager().getCqiClient().id2Str(pProperty.getQualifiedName(), subpositions);
+			}
+			catch (Exception e) {
+				// TODO Auto-generated catch block
+				org.txm.utils.logger.Log.printStackTrace(e);
+				return null;
+			}
+		}
+		else {
+			number = Math.min(number, ids.length);
+			if (number <= 0) {
+				return new String[0];
+			}
+			String[] subforms = new String[number];
+			System.arraycopy(ids, 0, subforms, 0, number);
+			return subforms;
+		}
+	}
+
+	/**
+	 * The dif ferent frequencies in the lexicon. See {@link #getForms()}.
+	 * 
+	 * @return frequencies as an array of <code>int</code>
+	 */
+	public int[] getFreq() {
+		return freqs;
+	}
+
+	/**
+	 * return the ids of the entries.
+	 *
+	 * @return types as an array of <code>String</code>
+	 */
+	public int[] getIds() {
+		return ids;
+	}
+
+	public String getName() {
+		try {
+			return this.corpus.getSimpleName() + ": " + this.getSimpleName();
+		}
+		catch (Exception e) {
+		}
+		return ""; //$NON-NLS-1$
+	}
+
+	/**
+	 * The property this lexicon is build on.
+	 * 
+	 * @return the property
+	 */
+	public Property getProperty() {
+		return pProperty;
+	}
+
+	public String getSimpleName() {
+		return this.getProperty().getName();
+	}
+
+	/**
+	 * Gets the symbol.
+	 *
+	 * @return the symbol
+	 */
+	public String getSymbol() {
+		return this.symbol;
+	}
+
+	/**
+	 * Hack frequencies using a map to set forms and frequencies
+	 *
+	 * @param corpus the corpus
+	 * @param pProperty the property
+	 * @param map the map
+	 *            {@link CQPCorpus#getLexicon(Property)} or
+	 *            {@link Subcorpus#getLexicon(Property)}.
+	 */
+	public boolean hack(Map<String, Integer> map) {
+		if (map.size() != forms.length) {
+			return false;
+		}
+
+		// super(corpus);
+		int size = map.size();
+		int[] freqs = new int[size];
+		String[] forms = map.keySet().toArray(new String[] {});
+		for (int i = 0; i < forms.length; i++) {
+			freqs[i] = map.get(forms[i]);
+		}
+
+		this.freqs = freqs;
+		return true;
+	}
+
+	/**
+	 * Protected on purpose: should be accessed through others initializer.
+	 *
+	 * @param corpus the corpus
+	 * @param property the property
+	 * @param freq the freq
+	 * @param ids the ids
+	 *            {@link CQPCorpus#getLexicon(Property)} or
+	 *            {@link Subcorpus#getLexicon(Property)}.
+	 */
+	protected void init(TXMResult corpus, WordProperty property, int[] freq, int[] ids) {
+		if (freq.length != ids.length) {
+			throw new IllegalArgumentException("wrong size freq.length != ids.length " + freq.length + " != " + ids.length);
+		}
+		this.freqs = freq;
+		this.ids = ids;
+		this.forms = getForms();
+		this.pProperty = property;
+	}
+
+
+	/**
+	 * Number of tokens (sum of all the frequencies) in the corpus.
+	 * 
+	 * @return the size of the corpus or subcorpus.
+	 */
+	public int nbrOfToken() {
+		if (numberOfTokens <= 0) {
+			computeNumberOfTokens();
+		}
+		return numberOfTokens;
+	}
+
+
+	/**
+	 * Number of different types in the frequency list.
+	 * 
+	 * @return number of types in the corpus or subcorpus.
+	 */
+	public int nbrOfType() {
+		try {
+			return freqs.length;
+		}
+		catch (Exception e) {
+			return 0;
+		}
+	}
+
+	public void setParameters(WordProperty property) {
+		this.pProperty = property;
+	}
+
+	public boolean setParameters(TXMParameters parameters) {
+		try {
+			WordProperty p = (WordProperty) parameters.get("properties");
+			this.setParameters(p);
+		}
+		catch (Exception e) {
+			Log.printStackTrace(e);
+			return false;
+		}
+		return true;
+	}
+
+	/**
+	 * Sets the symbol.
+	 *
+	 * @param symbol the new symbol
+	 */
+	public void setSymbol(String symbol) {
+		this.symbol = symbol;
+	}
+
+
+	@Override
+	public String toString() {
+		return this.getName();
+	}
+
+	/**
+	 * To txt.
+	 *
+	 * @param outfile the outfile
+	 * @param encoding the encoding
+	 * @param colseparator the colseparator
+	 * @param txtseparator the txtseparator
+	 * @return true, if successful
+	 */
+	@Deprecated
+	public boolean toTxt(File outfile, String encoding, String colseparator, String txtseparator) {
+		// NK: writer declared as class attribute to perform a clean if the operation is interrupted
+		// OutputStreamWriter writer;
+		try {
+			this.writer = new OutputStreamWriter(new FileOutputStream(outfile),
+					encoding);
+		}
+		catch (UnsupportedEncodingException e1) {
+			org.txm.utils.logger.Log.printStackTrace(e1);
+			return false;
+		}
+		catch (FileNotFoundException e1) {
+			org.txm.utils.logger.Log.printStackTrace(e1);
+			return false;
+		}
+
+		try {
+			writer.write(this.dump(colseparator, txtseparator));
+			writer.close();
+		}
+		catch (IOException e) {
+			org.txm.utils.logger.Log.printStackTrace(e);
+			return false;
+		}
+
+		return true;
+	}
+
+	/**
+	 * Sets the unit property.
+	 * 
+	 * @param property the unit property
+	 */
+	public void setProperty(WordProperty property) {
+		this.pProperty = property;
+	}
+
+
+	public static CQPLexicon getLexicon(CQPCorpus corpus, WordProperty property, TXMProgressMonitor monitor, boolean visible) throws Exception {
+		CQPLexicon lexicon = null;
+
+		property = corpus.getProperty(property.getFullName()); // ensure to use the subcorpus property
+		
+		// recycling Lexicon if exists
+		ArrayList<CQPLexicon> cachedLexicons = (ArrayList<CQPLexicon>) corpus.getObjectCacheForClass(CQPLexicon.class);
+		for (int i = 0; i < cachedLexicons.size(); i++) {
+			if (cachedLexicons.get(i).getProperty() == property) {
+				lexicon = cachedLexicons.get(i);
+				break;
+			}
+		}
+
+		// creating new Lexicon
+		if (lexicon == null || !lexicon.getProperty().getFullName().equals(property.getFullName())) {
+			lexicon = new CQPLexicon(corpus);
+			lexicon.setProperty(property);
+			lexicon._compute();
+			
+			// and store it !
+			ArrayList<CQPLexicon> cache = corpus.getObjectCacheForClass(CQPLexicon.class);
+			cache.add(lexicon);
+		}
+
+		Log.finest(TXMCoreMessages.bind("Lexicon = {0} {1}.", lexicon, lexicon.hashCode()));
+
+		return lexicon;
+	}
+
+
+	/**
+	 * Gets a Lexicon from the specified corpus.
+	 * If a Lexicon child exists in the Corpus from the specified property, returns it otherwise creates and computes a new Lexicon.
+	 * 
+	 * @param corpus
+	 * @param property
+	 * @return
+	 * @throws Exception
+	 */
+	public static CQPLexicon getLexicon(CQPCorpus corpus, WordProperty property, TXMProgressMonitor monitor) throws Exception {
+		return getLexicon(corpus, property, monitor, true);
+	}
+
+
+	// /**
+	// * Find or build a lexicon given a Corpus (MainCorpus or SubCorpus).
+	// *
+	// * @param corpus
+	// * @param property
+	// * @return a Lexicon. May return null if the lexicon forms or freqs are null.
+	// * @throws Exception
+	// */
+	// public static Lexicon getLexicon(Corpus corpus, Property property) throws Exception {
+	// HashSet<Object> results = corpus.getStoredData(Lexicon.class);
+	// for (Object result : results) {
+	// Lexicon lex = (Lexicon)result;
+	// if (lex.getProperty().equals(property)) {
+	// return lex;
+	// }
+	// }
+	//
+	// Lexicon lex = new Lexicon(corpus);
+	// lex.setParameters(property);
+	// if (lex.compute(null) && lex.getForms() != null && lex.getFreq() != null) {
+	// corpus.storeData(lex);
+	// return lex;
+	// } else {
+	// return null;
+	// }
+	// }
+
+	public CQPCorpus getParent() {
+		return corpus;
+
+	}
+}

Property changes on: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/CQPLexicon.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/CorpusManager.java
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/CorpusManager.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/CorpusManager.java	(revision 3659)
@@ -0,0 +1,248 @@
+// Copyright © 2010-2020 ENS de Lyon., University of Franche-Comté
+// 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: 2016-08-30 09:45:56 +0200 (Tue, 30 Aug 2016) $
+// $LastChangedRevision: 3283 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.searchengine.cqp.corpus;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+
+import org.txm.Toolbox;
+import org.txm.core.messages.TXMCoreMessages;
+import org.txm.objects.CorpusBuild;
+import org.txm.objects.Project;
+import org.txm.searchengine.cqp.AbstractCqiClient;
+import org.txm.searchengine.cqp.CQPSearchEngine;
+import org.txm.searchengine.cqp.NetCqiClient;
+import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
+import org.txm.searchengine.cqp.clientExceptions.InvalidCqpIdException;
+import org.txm.utils.logger.Log;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class CorpusManager provide access through a CQi client to the corpora
+ * managed by CQP.
+ * 
+ * The corpus manager is a singleton, and before the instance can be acceded via
+ * {@link #getCorpusManager()} it has to configured with
+ * {@link #setCqiClient(NetCqiClient)}.
+ * 
+ * The corpus manager must be used to create instances of {@link MainCorpus}
+ * (with {@link #getCorpus(String)}), instances of {@link Partition} (with
+ * {@link #createPartition(AbstractCorpus, Structure, Property, List)}), and
+ * instances of {@link Subcorpus} (with
+ * {@link #query(AbstractCorpus, String, String)}).
+ * 
+ * @author Jean-Philippe Magué
+ */
+public class CorpusManager {
+	
+	/** The cqi client. */
+	private static AbstractCqiClient cqiClient;
+	
+	/** The singleton. */
+	private static CorpusManager corpusManager = null;
+	
+	/** the corpora. */
+	private static HashMap<String, MainCorpus> corpora = null;
+	
+	/**
+	 * Instantiates a new corpus manager.
+	 */
+	private CorpusManager() {
+		corpora = new HashMap<>();
+	}
+	
+	/**
+	 * Sets the cqi client.
+	 * 
+	 * @param cqiClient
+	 *            the new cqi client
+	 */
+	public static void setCqiClient(AbstractCqiClient cqiClient) {
+		CorpusManager.cqiClient = cqiClient;
+	}
+	
+	/**
+	 * Gets the corpus manager.
+	 * 
+	 * @return the corpus manager
+	 */
+	public static CorpusManager getCorpusManager() {
+		// if (cqiClient == null)
+		// throw new RuntimeException(TXMCoreMessages.cQiClientNotInitialized);
+		if (corpusManager == null)
+			corpusManager = new CorpusManager();
+		return corpusManager;
+	}
+	
+	/**
+	 * Clean.
+	 */
+	public static void clean() {
+		cqiClient = null;
+		corpora = null;
+		corpusManager = null;
+	}
+	
+	/**
+	 * Clean corpora : empty the 'corpora' member.
+	 */
+	public static void cleanCorpora() {
+		corpora = new HashMap<>();
+	}
+	
+	/**
+	 * Gets a corpus.
+	 *
+	 * @param corpusName the corpus name
+	 * @return the corpus
+	 * @throws CqiClientException the cqi client exception
+	 * @throws InvalidCqpIdException the invalid cqp id exception
+	 */
+	public MainCorpus getCorpus(String corpusName) throws CqiClientException, InvalidCqpIdException {
+		
+		if (corpora == null) {
+			// System.out.println("error corpora is null ");
+			this.getCorpora();
+		}
+		
+		for (MainCorpus corpus : CorpusManager.corpora.values()) {
+			if (corpus.getID().equals(corpusName)) {
+				// System.out.println("found corpus "+corpusName);
+				return corpus;
+			}
+		}
+		// System.out.println("create corpus "+corpusName);
+		for (Project p : Toolbox.workspace.getProjects()) {
+			CorpusBuild c = p.getCorpusBuild(corpusName);
+			if (c != null && c instanceof MainCorpus) {
+				return (MainCorpus) c;
+			}
+		}
+		return null;
+	}
+	
+	/**
+	 * Checks for corpus.
+	 *
+	 * @param name the name
+	 * @return true, if successful
+	 */
+	public boolean hasCorpus(String name) {
+		if (corpora == null)
+			return false;
+		for (MainCorpus c : corpora.values())
+			if (name.equals(c.getID()))
+				return true;
+		return false;
+	}
+	
+	/**
+	 * Gets a list of the corpora managed by CQP.
+	 * 
+	 * @return the corpora
+	 * 
+	 * @throws CqiClientException
+	 *             the cqi client exception
+	 */
+	public HashMap<String, MainCorpus> getCorpora() {
+		// //System.out.println("get corpora");
+		// if (corpora != null)
+		// return corpora;
+		//
+		// String[] corporaName;
+		// try {
+		// corporaName = cqiClient.listCorpora();
+		// } catch (Exception e) {
+		// throw new CqiClientException(e);
+		// }
+		//
+		// corpora = new ArrayList<MainCorpus>(corporaName.length);
+		// for (int i = 0; i < corporaName.length; i++) {
+		// try {
+		// MainCorpus c = this.getCorpus(corporaName[i]);
+		// if (c != null) corpora.add(c);
+		// } catch (InvalidCqpIdException e) {
+		// throw new CqiClientException(TXMCoreMessages.errorColonThisExceptionShouldNotBeThrown, e);
+		// }
+		// }
+		//
+		// for (CQPCorpus corpus : corpora) {
+		// try {
+		// corpus.setCharset(cqiClient.corpusCharset(corpus.getCqpId()));
+		// // TODO : implements cqiClient.corpusLanguage
+		// // corpus.setLanguage(cqiClient.corpusLanguage(corpus.getCqpId()));
+		// } catch (Exception e) {
+		// org.txm.utils.logger.Log.printStackTrace(e);
+		// }
+		// }
+		// // System.out.println("END creating corpora");
+		return corpora;
+	}
+	
+	/**
+	 * Gets the cqi client.
+	 * 
+	 * @return the cqi client
+	 */
+	public AbstractCqiClient getCqiClient() {
+		return cqiClient;
+	}
+	
+	/**
+	 * Delete corpus.
+	 *
+	 * @param corpus the corpus
+	 */
+	public void deleteCorpus(MainCorpus corpus) {
+		if (corpora != null)
+			corpora.remove(corpus.getID());
+		if (CQPSearchEngine.isInitialized()) {
+			try {
+				CQPSearchEngine.getCqiClient().dropCorpus(corpus.getID());
+			}
+			catch (Exception e) {
+				Log.warning("Warning while removing corpus: Failed to drop corpus " + corpus);
+				Log.printStackTrace(e);
+			}
+		}
+	}
+	
+	public boolean hasCorpus(MainCorpus mainCorpus) {
+		if (corpora != null) {
+			return corpora.containsKey(mainCorpus.getID());
+		}
+		return false;
+	}
+	
+	public void add(MainCorpus mainCorpus) {
+		if (corpora != null) {
+			corpora.put(mainCorpus.getID(), mainCorpus);
+		}
+	}
+}

Property changes on: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/CorpusManager.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/Part.java
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/Part.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/Part.java	(revision 3659)
@@ -0,0 +1,173 @@
+// Copyright © 2010-2020 ENS de Lyon., University of Franche-Comté
+// 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: 2013-05-06 17:38:43 +0200 (lun., 06 mai 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.searchengine.cqp.corpus;
+
+import java.io.File;
+
+import org.eclipse.osgi.util.NLS;
+import org.txm.core.messages.TXMCoreMessages;
+import org.txm.searchengine.core.messages.SearchEngineCoreMessages;
+import org.txm.searchengine.cqp.CQPSearchEngine;
+import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
+import org.txm.searchengine.cqp.corpus.query.CQLQuery;
+import org.txm.utils.TXMProgressMonitor;
+import org.txm.utils.logger.Log;
+
+/**
+ * A Part is related to the {@link Partition} and is a CQP this.
+ *
+ * @author jmague
+ */
+public class Part extends Subcorpus {
+
+	/** The number of texts composing this part. */
+	private int nTexts = -1;
+
+	/**
+	 * 
+	 * @param partition
+	 */
+	public Part(Partition partition, String partName, String query) {
+		super(partition);
+
+		this.setUserName(partName);
+		this.pQuery = new CQLQuery(query);
+		this.pID = CqpObject.partNamePrefix + CQPCorpus.getNextSubcorpusCounter();
+		this.setVisible(false);
+		this.synchronizedWithParent = true;
+	}
+	
+	/**
+	 * 
+	 * @param parametersNodePath
+	 */
+	public Part(String parametersNodePath) {
+		super(parametersNodePath);
+		
+		this.setVisible(false);
+		this.synchronizedWithParent = true;
+	}
+	
+	@Override
+	public boolean loadParameters() throws Exception {
+		return super.loadParameters();
+	}
+	
+	@Override
+	protected boolean __compute(TXMProgressMonitor monitor) throws Exception {
+
+		try {
+			super.__compute(monitor);
+		}
+		catch (Exception e) {
+			try {
+				throw new CqiClientException(TXMCoreMessages.failedToCreatePartColon + this.getParent().getName() + "_" + this.getName() + e + " last error: " + CQPSearchEngine.getCqiClient().getLastCQPError()); //$NON-NLS-1$ //$NON-NLS-2$
+			}
+			catch (Exception e1) {
+				Log.severe(TXMCoreMessages.failedToGetLastCQPErrorColon + e1);
+				org.txm.utils.logger.Log.printStackTrace(e1);
+				return false;
+			}
+		}
+		return true;
+	}
+	
+	
+	@Override
+	public String getComputingStartMessage() {
+		return NLS.bind(SearchEngineCoreMessages.info_computingPartXWithQueryZ, this.getName(), this.pQuery);
+	}
+
+	
+	
+//	public Part createPart(String partitionName, String partName, String query) throws CqiClientException {
+//		Part part;
+//		String partCqpId = CqpObject.partNamePrefix + CQPCorpus.getNextSubcorpusCounter();
+//		Log.finest(NLS.bind(TXMCoreMessages.CREATING_PART, partName, query));
+//		long start = System.currentTimeMillis();
+//		try {
+//			CorpusManager.getCorpusManager().getCqiClient().cqpQuery(this.getParent().getQualifiedCqpId(), partCqpId, query);
+//			part = new Part(this);
+//			part.setParameters(partCqpId, partName, new CQLQuery(query));
+//			part.compute();
+//			// FIXME: persistence tests: define the UUID as the concatenation of all part CQP id
+////			this.uniqueID += partCqpId;
+//
+//		} catch (Exception e) {
+//			try {
+//				throw new CqiClientException(TXMCoreMessages.failedToCreatePartColon + partitionName + "_" + partName + e + " last error: " + CQPSearchEngine.getCqiClient().getLastCQPError()); //$NON-NLS-1$ //$NON-NLS-2$
+//			} catch (Exception e1) {
+//				Log.severe(TXMCoreMessages.failedToGetLastCQPErrorColon + e1);
+//				org.txm.utils.logger.Log.printStackTrace(e1);
+//				return null;
+//			}
+//		}
+//		long end = System.currentTimeMillis();
+//		Log.finest(NLS.bind(TXMCoreMessages.info_partCreatedInXMs, partitionName + "_" + partName, (end - start))); //$NON-NLS-1
+//
+//		return part;
+//	}
+//	
+	
+	
+	@Override
+	public String getName() {
+		return this.getSimpleName();
+	}
+	
+	
+	/**
+	 * Gets the number of texts in this part.
+	 * 
+	 * @return the n texts
+	 * 
+	 * @throws CqiClientException the cqi client exception
+	 */
+	// FIXME: SJ: became useless? + wrong method name?
+	public int getNTexts() throws CqiClientException {
+		if (nTexts < 0) {
+			try {
+				nTexts = CorpusManager.getCorpusManager().getCqiClient().subCorpusSize(this.getQualifiedCqpId());
+			} catch (Exception e) {
+				throw new CqiClientException(e);
+			}
+		}
+		return nTexts;
+	}
+
+	@Override
+	@Deprecated
+	public boolean _toTxt(File outfile, String encoding, String colseparator, String txtseparator) throws Exception {
+		return this.toTxt(outfile, encoding, colseparator, txtseparator);
+	}
+
+	@Override
+	public String getResultType() {
+		return "Part";
+	}
+}
\ No newline at end of file

Property changes on: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/Part.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/StructuralUnit.java
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/StructuralUnit.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/StructuralUnit.java	(revision 3659)
@@ -0,0 +1,229 @@
+// Copyright © 2010-2020 ENS de Lyon., University of Franche-Comté
+// 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: 2013-05-06 17:38:43 +0200 (lun., 06 mai 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.searchengine.cqp.corpus;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+
+import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
+import org.txm.utils.logger.Log;
+
+// TODO: Auto-generated Javadoc
+/**
+ * A structural units of a corpus Represents a <strong>type</strong>, not a
+ * specif ic unit.
+ * 
+ * @author jmague
+ * 
+ */
+public class StructuralUnit implements Comparable {
+
+	
+	/**
+	 * Internal properties names.
+	 */
+	private static String[] INTERNAL_PROPERTIES_NAMES = new String[] {"base", "project"}; //$NON-NLS-1$ //$NON-NLS-2$
+
+	
+	/** The name. */
+	private String name;
+
+	/** The corpus. */
+	private CQPCorpus corpus;
+
+	/** The properties. */
+	private List<StructuralUnitProperty> properties;
+
+
+	
+	/**
+	 * Instantiates a new StrucutalUnit.
+	 *
+	 * @param name the name
+	 * @param properties the properties
+	 * @param corpus the corpus
+	 * @throws CqiClientException the cqi client exception
+	 */
+	protected StructuralUnit(String name, List<String> properties, CQPCorpus corpus)
+			throws CqiClientException {
+		this.name = name;
+		this.corpus = corpus;
+		this.properties = new ArrayList<StructuralUnitProperty>();
+		for (String property : properties)
+			this.properties.add(new StructuralUnitProperty(this, property, corpus));
+	}
+
+	/**
+	 * Gets the qualified name: CORPUS.struct
+	 * 
+	 * @return the qualified name
+	 */
+	public String getQualifiedName() {
+		return corpus.getCqpId() + "." + this.getName(); //$NON-NLS-1$
+	}
+
+	/**
+	 * Gets the name without the corpus name
+	 * 
+	 * @return the name
+	 */
+	public String getName() {
+		return name;
+	}
+
+	/**
+	 * Gets the actual properties defined on this type of structural unit.
+	 * 
+	 * @return the properties
+	 */
+	public List<StructuralUnitProperty> getProperties() {
+		return properties;
+	}
+
+	/**
+	 * Gets the properties defined on this type of structural unit.
+	 * Does not return the internal properties as base, project, etc.
+	 * @return
+	 */
+	public List<StructuralUnitProperty> getUserDefinedProperties() {
+		List<StructuralUnitProperty> userDefinedProperties = new ArrayList<StructuralUnitProperty>();
+		
+		for(int i = 0; i < this.properties.size(); i++) {
+			StructuralUnitProperty p = this.properties.get(i);
+			if (Arrays.asList(INTERNAL_PROPERTIES_NAMES).contains(p.getName()))	{ 
+				continue;
+			}
+			userDefinedProperties.add(p);
+		}
+		return userDefinedProperties;
+	}
+
+	
+	/**
+	 * Gets the ordered properties.
+	 * Does not return the internal properties as base, project, etc.
+	 *
+	 * @return the ordered properties
+	 */
+	public List<StructuralUnitProperty> getOrderedProperties() {
+		List<StructuralUnitProperty> props = this.getProperties();
+		Collections.sort(props);
+		return props;
+	}
+	
+
+	/**
+	 * Gets the user defined ordered properties.
+	 * @return
+	 */
+	public List<StructuralUnitProperty> getUserDefinedOrderedProperties() {
+		List<StructuralUnitProperty> props = this.getUserDefinedProperties();
+		Collections.sort(props);
+		return props;
+	}
+
+	
+	/**
+	 * Gets a property from its name.
+	 * 
+	 * @param name
+	 *            the name
+	 * 
+	 * @return the property
+	 */
+	public StructuralUnitProperty getProperty(String name) {
+		for (StructuralUnitProperty property : properties) {
+			if (property.getName().equals(name)) {
+				return property;
+			}
+		}
+		return null;
+
+	}
+
+	/* (non-Javadoc)
+	 * @see java.lang.Object#toString()
+	 */
+	@Override
+	public String toString() {
+		return name;
+	}
+
+	/**
+	 * Equals.
+	 *
+	 * @param su the su
+	 * @return true, if successful
+	 */
+	public boolean equals(StructuralUnit su) {
+		return name.equals(su.name) && corpus.equals(su.corpus);
+	}
+
+	/* (non-Javadoc)
+	 * @see java.lang.Comparable#compareTo(java.lang.Object)
+	 */
+	@Override
+	public int compareTo(Object arg0) {
+		if (arg0 instanceof StructuralUnit)
+			return this.getQualifiedName().compareTo(
+					((StructuralUnit) arg0).getQualifiedName());
+		return 0;
+	}
+
+
+	
+ 
+	
+	
+	
+	
+
+	public static List<StructuralUnit> stringToStructuralUnits(CQPCorpus corpus, String v) {
+		ArrayList<StructuralUnit> structs = new ArrayList<StructuralUnit>();
+		if (v == null) return structs;
+		if (v.length() == 0) return structs;
+
+		String[] split = v.split("\t");
+		for (String s : split) {
+			StructuralUnit struc;
+			try {
+				struc = corpus.getStructuralUnit(s);
+			} catch (CqiClientException e) {
+				System.out.println("Error: "+v+" structure not found in "+corpus);
+				Log.printStackTrace(e);
+				return null;
+			}
+			if (struc != null) {
+				structs.add(struc);
+			}
+		}
+		return structs;
+	}
+}

Property changes on: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/StructuralUnit.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/Partition.java
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/Partition.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/Partition.java	(revision 3659)
@@ -0,0 +1,793 @@
+// Copyright © 2010-2020 ENS de Lyon., University of Franche-Comté
+// 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: 2016-11-17 17:01:31 +0100 (Thu, 17 Nov 2016) $
+// $LastChangedRevision: 3341 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.searchengine.cqp.corpus;
+
+import java.io.File;
+import java.text.Collator;
+import java.text.DateFormat;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Locale;
+
+import org.apache.commons.lang.StringUtils;
+import org.eclipse.osgi.util.NLS;
+import org.txm.core.messages.TXMCoreMessages;
+import org.txm.core.preferences.TBXPreferences;
+import org.txm.core.preferences.TXMPreferences;
+import org.txm.core.results.Parameter;
+import org.txm.core.results.TXMParameters;
+import org.txm.core.results.TXMResult;
+import org.txm.searchengine.core.messages.SearchEngineCoreMessages;
+import org.txm.searchengine.cqp.CQPPreferences;
+import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
+import org.txm.searchengine.cqp.corpus.query.CQLQuery;
+import org.txm.searchengine.cqp.corpus.query.QueryPart;
+import org.txm.utils.TXMProgressMonitor;
+import org.txm.utils.io.IOUtils;
+import org.txm.utils.logger.Log;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+
+/**
+ * A partition on a corpus. The partition is composed of {@link Part}s
+ * 
+ * The parts order depends on the Partition creation method used.
+ *
+ * @author mdecorde
+ * @author sjacquot
+ * @author Jean-Philippe Magué
+ * 
+ */
+public class Partition extends org.txm.objects.Partition {
+	
+	/** sum of parts size, stored for efficiency reasons **/
+	int totalsize = -1;
+	
+	/** The property, if not null the partition will forge its own queries */
+	@Parameter(key = TXMPreferences.STRUCTURAL_UNIT_PROPERTY)
+	protected StructuralUnitProperty pProperty;
+	
+	/**
+	 * The parts property values to use, may be null.
+	 */
+	@Parameter(key = TXMPreferences.VALUES)
+	protected List<String> pValues;
+	
+	/**
+	 * The parts queries
+	 */
+	@Parameter(key = TXMPreferences.QUERIES)
+	protected List<String> pQueries;
+	
+	/**
+	 * The parts names -> do the parts order
+	 */
+	@Parameter(key = CQPPreferences.PART_NAMES)
+	protected List<String> pPartNames;
+	
+	
+	/**
+	 * 
+	 * @param parent
+	 */
+	public Partition(CQPCorpus parent) {
+		super(parent);
+	}
+	
+	/**
+	 * 
+	 * @param parametersNodePath
+	 */
+	public Partition(String parametersNodePath) {
+		super(parametersNodePath);
+	}
+	
+	
+	
+	@Override
+	protected boolean _compute(TXMProgressMonitor monitor) throws Exception {
+		
+		// create the parts only if they not already exist
+		if (this.getPartsCount() == 0) {
+			
+			if (this.pProperty != null) {
+				_compute_with_property(monitor);
+			}
+			else {
+				_compute_with_lists(monitor);
+			}
+		}
+		this.totalsize = -1; // refresh total size at next call of getTotalSize
+		return true;
+	}
+	
+	
+	
+	/**
+	 * Computes the Partition using a list of queries.
+	 *
+	 * @param corpus the corpus
+	 * @param name the name
+	 * @param queries the queries
+	 * @param partnames the partnames
+	 * @throws Exception
+	 */
+	public boolean _compute_with_lists(TXMProgressMonitor monitor) throws Exception {
+		
+		if (this.getUserName() == null || this.getUserName().length() == 0) {
+			this.setUserName("no_name");
+		}
+		
+		Log.finest(NLS.bind(SearchEngineCoreMessages.info_creatingNewPartition, this.getUserName(), this.getParent()));
+		long start = System.currentTimeMillis();
+		
+		monitor.setTask("Building parts...");
+		
+		for (int i = 0; i < pQueries.size(); i++) {
+			String queryS = pQueries.get(i);
+			
+			String partName = String.valueOf(i);
+			if (pPartNames != null && i < pPartNames.size()) {
+				partName = pPartNames.get(i);
+			}
+			// ensure the part has a name, if empty
+			if (partName.trim().length() == 0) {
+				partName = "-"; //$NON-NLS-1$
+			}
+			new Part(this, partName, queryS);
+			
+		}
+		long end = System.currentTimeMillis();
+		Log.fine(NLS.bind(SearchEngineCoreMessages.info_partitionCreatedInXMs, this.getUserName(), (end - start)));
+		
+		return pQueries.size() > 0;
+	}
+	
+	/**
+	 * Creates a new partition on a corpus given a structure, a property of this
+	 * structure and a list of values this property can take
+	 * 
+	 * The partition has as many parts as the size of the list of value. The ith
+	 * part is composed by all the structure <code>structure</code> such as
+	 * <code>strucutre.getValue(property) == values.get(i)<code>
+	 * 
+	 * @param corpus the corpus
+	 * @param structure the structure
+	 * @param property the property
+	 * @param values the values, raw values special chars will be backslashed
+	 * @throws Exception
+	 */
+	
+	protected boolean _compute_with_property(TXMProgressMonitor monitor) throws Exception {
+		
+		CQPCorpus corpus = this.getParent();
+		if (this.getUserName() == null || this.getUserName().length() == 0) {
+			this.setUserName(corpus.getName() + "_" + pProperty.getFullName()); //$NON-NLS-1$
+		}
+		
+		Log.finest(NLS.bind(SearchEngineCoreMessages.info_creatingNewPartition, this.getUserName(), this.getParent()));
+		
+		if (pValues == null) {
+			pValues = pProperty.getValues(corpus);
+		}
+		
+		// sort parts
+		HashMap<String, String> infos = this.getParent().getSAttributesInfos().get(pProperty.getFullName());
+		
+		String type = "String"; //$NON-NLS-1$
+		if (infos != null) {
+			type = infos.get("type"); //$NON-NLS-1$
+		}
+		if (type == null || type.trim().length() == 0 || type.equals("String")) { //$NON-NLS-1$
+			Collections.sort(pValues, Collator.getInstance(Locale.getDefault())); // alpha sort
+		}
+		else if (type.equals("Integer")) { //$NON-NLS-1$
+			Collections.sort(pValues, new Comparator<String>() {
+				
+				@Override
+				public int compare(String arg0, String arg1) {
+					int i0 = Integer.parseInt(arg0);
+					int i1 = Integer.parseInt(arg1);
+					return i0 - i1;
+				}
+			});
+		}
+		else if (type.equals("Date")) { //$NON-NLS-1$
+			String format = infos.get("inputFormat"); //$NON-NLS-1$
+			final DateFormat formater = new SimpleDateFormat(format);
+			Collections.sort(pValues, new Comparator<String>() {
+				
+				@Override
+				public int compare(String arg0, String arg1) {
+					try {
+						Date i0 = formater.parse(arg0);
+						Date i1 = formater.parse(arg1);
+						return i0.compareTo(i1);
+					}
+					catch (ParseException e) {
+						return arg0.compareTo(arg1);
+					}
+				}
+			});
+		}
+		else if (type.contains("|")) { //$NON-NLS-1$
+			final List<String> sortedValues = Arrays.asList(type.split("\\|")); //$NON-NLS-1$
+			Collections.sort(pValues, new Comparator<String>() {
+				
+				@Override
+				public int compare(String arg0, String arg1) {
+					int i0 = sortedValues.indexOf(arg0);
+					int i1 = sortedValues.indexOf(arg1);
+					return i0 - i1;
+				}
+			});
+		}
+		
+		pQueries = new ArrayList<>();
+		pPartNames = new ArrayList<>();
+		for (String value : pValues) {
+			String partName = value.replace("\\", ""); //$NON-NLS-1$ //$NON-NLS-2$
+			pPartNames.add(partName);
+			CQLQuery query = new QueryPart(pProperty.getStructuralUnit(), pProperty, value); // second option is faster
+			
+			pQueries.add(query.getQueryString());
+		}
+		
+		return _compute_with_lists(monitor);
+	}
+	
+	
+	
+	
+	@Override
+	public boolean canCompute() {
+		return this.getParent() != null && (this.pProperty != null || (this.pQueries != null && this.pQueries != null));
+	}
+	
+	@Override
+	public void clean() {
+		// TODO Auto-generated method stub
+	}
+	
+	@Override
+	public int compareTo(TXMResult o) {
+		// Compare node weights
+		int output = super.compareTo(o);
+		// Compare simple names if weights are equal
+		if (output == 0) {
+			output = this.getSimpleName().compareToIgnoreCase(o.getSimpleName());
+		}
+		return output;
+	}
+	
+	// /**
+	// * TODO Part should be create lazily
+	// *
+	// * Create a part with a raw query.
+	// *
+	// * @param partitionName the partition name
+	// * @param partName the part name
+	// * @param query the query
+	// * @return the part
+	// * @throws CqiClientException the cqi client exception
+	// *
+	// * @author Sylvain Loiseau, mdecorde
+	// */
+	// public Part createPart(String partitionName, String partName, String query) throws CqiClientException {
+	// Part part;
+	// String partCqpId = CqpObject.partNamePrefix + CQPCorpus.getNextSubcorpusCounter();
+	// Log.finest(NLS.bind(TXMCoreMessages.CREATING_PART, partName, query));
+	// long start = System.currentTimeMillis();
+	// try {
+	// CorpusManager.getCorpusManager().getCqiClient().cqpQuery(this.getParent().getQualifiedCqpId(), partCqpId, query);
+	// part = new Part(this);
+	// part.setParameters(partCqpId, partName, new CQLQuery(query));
+	// part.compute();
+	// // FIXME: persistence tests: define the UUID as the concatenation of all part CQP id
+	//// this.uniqueID += partCqpId;
+	//
+	// } catch (Exception e) {
+	// try {
+	// throw new CqiClientException(TXMCoreMessages.failedToCreatePartColon + partitionName + "_" + partName + e + " last error: " + CQPSearchEngine.getCqiClient().getLastCQPError()); //$NON-NLS-1$
+	// //$NON-NLS-2$
+	// } catch (Exception e1) {
+	// Log.severe(TXMCoreMessages.failedToGetLastCQPErrorColon + e1);
+	// org.txm.utils.logger.Log.printStackTrace(e1);
+	// return null;
+	// }
+	// }
+	// long end = System.currentTimeMillis();
+	// Log.finest(NLS.bind(TXMCoreMessages.info_partCreatedInXMs, partitionName + "_" + partName, (end - start))); //$NON-NLS-1
+	//
+	// return part;
+	// }
+	
+	
+	/*
+	 * (non-Javadoc)
+	 * @see org.txm.objects.TxmObject#load()
+	 */
+	protected boolean _load(Element e) {
+		
+		// partition already computed
+		if (this.hasBeenComputedOnce()) {
+			return true;
+		}
+		
+		if (e != null && this.getParent() != null) {
+			NodeList partList = e.getChildNodes();
+			for (int i = 0; i < partList.getLength(); i++) {
+				if (partList.item(i).getNodeType() == 1) {
+					Element c = (Element) partList.item(i);
+					if (c.getNodeName().equals("part")) { //$NON-NLS-1$
+						String pname = c.getAttribute("name"); //$NON-NLS-1$
+						String pshortname = c.getAttribute("shortname"); //$NON-NLS-1$
+						String pquery = c.getAttribute("query"); //$NON-NLS-1$
+						for (Part part : getParts()) {
+							if (part.getName().equals(pname)) {
+								part.setName(pname);
+								part.setQuery(new CQLQuery(pquery));
+							}
+						}
+					}
+				}
+			}
+			// this.loadMetadata();
+			return true;
+		}
+		
+		return false;
+	}
+	
+	
+	@Override
+	public String getDetails() {
+		String name = this.getUserName();
+		int partsCount = this.getPartsCount();
+		
+		if (partsCount > 0) {
+			name += NLS.bind(" ({0})", partsCount);
+		}
+		
+		return name;
+	}
+	
+	@Override
+	public String getSimpleName() {
+		return this.getUserName();
+	}
+	
+	@Override
+	public String getName() {
+		return this.getCorpus() + TXMPreferences.PARENT_NAME_SEPARATOR + this.getSimpleName();
+	}
+	
+	@Override
+	public String getComputingStartMessage() {
+		return TXMCoreMessages.bind(SearchEngineCoreMessages.info_computingTheP0PartitionOfTheP1Corpus, this.getSimpleName(), this.getCorpus().getName());
+	}
+	
+	
+	@Override
+	public String getComputingDoneMessage() {
+		return TXMCoreMessages.bind(SearchEngineCoreMessages.info_doneP0Parts, this.getPartsCount());
+	}
+	
+	/**
+	 * Gets the number of parts.
+	 * 
+	 * @return the number of parts.
+	 */
+	public int getPartsCount() {
+		return this.getParts().size();
+	}
+	
+	
+	/**
+	 * Gets a part specified by its index.
+	 * The index also represents the raw order in the children list.
+	 * 
+	 * @param index
+	 * @return
+	 */
+	// FIXME: SJ: became useless?
+	public Part getPart(int index) {
+		return this.getParts().get(index);
+	}
+	
+	
+	/**
+	 * Gets the name of the parts.
+	 * 
+	 * @return the part names
+	 */
+	// FIXME: SJ: later, do not cache the names => the names may have been modified by the user
+	public List<String> getPartNames() {
+		if (this.hasBeenComputedOnce()) {
+			List<Part> parts = this.getParts();
+			List<String> partNames = new ArrayList<>(parts.size());
+			for (Subcorpus part : this.getParts()) {
+				partNames.add(part.getName());
+			}
+			return partNames;
+		}
+		else {
+			return this.pPartNames;
+		}
+	}
+	
+	/**
+	 * Gets the children parts.
+	 * 
+	 * @return the parts
+	 */
+	@SuppressWarnings("unchecked")
+	public List<Part> getParts() {
+		return this.getChildren(Part.class);
+	}
+	
+	/**
+	 * Gets the part sizes as int array.
+	 * 
+	 * Do N CQi requests -> avoid calling multiple times this method
+	 * 
+	 * @return
+	 * @throws CqiClientException
+	 */
+	public int[] getPartSizes() throws CqiClientException {
+		int[] partSizes = new int[this.getParts().size()];
+		for (int i = 0; i < getParts().size(); i++) {
+			Part p = this.getParts().get(i);
+			partSizes[i] = p.getSize();
+		}
+		return partSizes;
+	}
+	
+	/**
+	 * Gets the property.
+	 *
+	 * @return the property
+	 */
+	public Property getProperty() {
+		return pProperty;
+	}
+	
+	/**
+	 * Gets the structure.
+	 *
+	 * @return the structure
+	 */
+	public StructuralUnit getStructure() {
+		if (pProperty == null) return null;
+		return pProperty.getStructuralUnit();
+	}
+	
+	/**
+	 * Gets the total of all part sizes.
+	 * 
+	 * @return
+	 * @throws CqiClientException
+	 */
+	public int getTotalSize() throws CqiClientException {
+		
+		if (totalsize == -1) {
+			totalsize = 0;
+			for (Part p : getParts()) {
+				totalsize += p.getSize();
+			}
+		}
+		return totalsize;
+	}
+	
+	
+	/**
+	 * Run a query on all the parts of this partition.
+	 * 
+	 * @param query
+	 *            the query
+	 * @param name
+	 *            the name
+	 * 
+	 * @return the list< subcorpus>
+	 * 
+	 * @throws CqiClientException
+	 *             the cqi client exception
+	 */
+	public List<QueryResult> query(CQLQuery query, String name) throws CqiClientException {
+		Log.finest(TXMCoreMessages.bind(TXMCoreMessages.queryingPartitionP0, this.getUserName()));
+		List<Part> parts = getParts();
+		List<QueryResult> results = new ArrayList<>(parts.size());
+		for (Subcorpus part : parts) {
+			results.add(part.query(query, part.getName() + "_" + name, false)); //$NON-NLS-1$
+		}
+		return results;
+	}
+	
+	// /**
+	// * Register to parent.
+	// */
+	// public void registerToParent() {
+	// //registerToParent(this.name);
+	// }
+	//
+	// /**
+	// * Register to parent.
+	// *
+	// * @param partitionName the partition name
+	// */
+	// private void registerToParent(String partitionName) {
+	//// if (this.getSelfElement() == null && this.getParent() != null)
+	//// try {
+	//// Element parentElem = (Element) this.getParent().getSelfElement();
+	//// if (parentElem == null) return;
+	//// Document doc = parentElem.getOwnerDocument();
+	//// Element corporaElem;
+	//// if (this.getParent() instanceof MainCorpus) {
+	//// NodeList corporaList = parentElem.getElementsByTagName("preBuild"); //$NON-NLS-1$
+	//// corporaElem = (Element) corporaList.item(0);
+	//// } else {
+	//// corporaElem = parentElem;
+	//// }
+	//// Element partitionElem = doc.createElement("partition"); //$NON-NLS-1$
+	//// partitionElem.setAttribute("name", partitionName); //$NON-NLS-1$
+	//// corporaElem.appendChild(partitionElem);
+	//// this.setSelfElement(partitionElem);
+	//// for (Part p : getParts()) {
+	//// Element partElem = doc.createElement("part"); //$NON-NLS-1$
+	//// partElem.setAttribute("name", p.getName()); //$NON-NLS-1$
+	//// partElem.setAttribute("shortname", p.getShortName()); //$NON-NLS-1$
+	//// partElem.setAttribute("query", p.getQuery().getQueryString()); //$NON-NLS-1$
+	//// partitionElem.appendChild(partElem);
+	//// }
+	//// } catch (Exception e) {
+	//// System.out.println(TXMCoreMessages.Partition_21+e);
+	//// }
+	//// this._load();
+	// }
+	
+	// public TxmObject removeChildren(TxmObject children) {
+	// if (children instanceof Part) {
+	// if (children.getSelfElement() != null && children.getSelfElement().getParentNode() == getSelfElement())
+	// getSelfElement().removeChild(children.getSelfElement());
+	// return children;
+	// }
+	// return null;
+	// }
+	
+	@Override
+	public CQPCorpus getParent() {
+		return (CQPCorpus) super.getParent();
+	}
+	
+	/**
+	 * Remove the specified <code>Part</code> from the partition.
+	 * 
+	 * @param p
+	 * @throws CqiClientException
+	 */
+	public void removePart(Part p) throws CqiClientException {
+		p.delete();
+	}
+	
+	
+	@Override
+	public String toString() {
+		if (!this.getUserName().isEmpty()) {
+			return this.getUserName();
+		}
+		return super.toString();
+	}
+	
+	
+	@Override
+	public boolean _toTxt(File output, String encoding, String colseparator, String txtseparator) throws Exception {
+		IOUtils.write(output, this.dumpPreferences());
+		return output.exists();
+	}
+	
+	public boolean setParameters(String name, StructuralUnitProperty property, List<String> values) {
+		this.pProperty = property;
+		this.pValues = values;
+		this.setUserName(name);
+		this.pQueries = null;
+		this.pPartNames = null;
+		return true;
+	}
+	
+	public boolean setParameters(String name, List<String> queries, List<String> names) {
+		this.pProperty = null;
+		this.pValues = null;
+		this.setUserName(name);
+		this.pQueries = queries;
+		this.pPartNames = names;
+		return true;
+	}
+	
+	@Override
+	public boolean setParameters(TXMParameters parameters) {
+		this.setUserName(parameters.getString(TXMPreferences.USER_NAME));
+		String tmp = parameters.getString(CQPPreferences.PART_NAMES);
+		if (tmp != null) {
+			this.pPartNames = Arrays.asList(tmp.split("\t"));
+		}
+		else {
+			this.pPartNames = null;
+		}
+		
+		try {
+			this.pProperty = StructuralUnitProperty.stringToStructuralUnitProperty(getParent(), parameters.getString(TXMPreferences.STRUCTURAL_UNIT_PROPERTY));
+		}
+		catch (CqiClientException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+			this.pProperty = null;
+		}
+		
+		tmp = parameters.getString(CQPPreferences.QUERIES);
+		if (tmp != null) {
+			this.pQueries = Arrays.asList(tmp.split("\t"));
+		}
+		else {
+			this.pQueries = null;
+		}
+		
+		tmp = parameters.getString(CQPPreferences.VALUES);
+		if (tmp != null) {
+			this.pValues = Arrays.asList(tmp.split("\t"));
+		}
+		else {
+			this.pValues = null;
+		}
+		return true;
+	}
+	
+	@Override
+	public boolean loadParameters() {
+		String tmp = null;
+		try {
+			tmp = this.getStringParameterValue(TBXPreferences.STRUCTURAL_UNIT_PROPERTY);
+			if (!tmp.isEmpty()) {
+				this.pProperty = StructuralUnitProperty.stringToStructuralUnitProperty(this.getParent(), tmp);
+			}
+		}
+		catch (CqiClientException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+		
+		tmp = this.getStringParameterValue(CQPPreferences.PART_NAMES);
+		if (tmp != null) {
+			this.pPartNames = new ArrayList<>(Arrays.asList(tmp.split("\t")));
+		}
+		else {
+			this.pPartNames = null;
+		}
+		
+		tmp = this.getStringParameterValue(TXMPreferences.QUERIES);
+		if (tmp != null) {
+			this.pQueries = new ArrayList<>(Arrays.asList(tmp.split("\t")));
+		}
+		else {
+			this.pQueries = null;
+		}
+		
+		tmp = this.getStringParameterValue(TXMPreferences.VALUES);
+		if (tmp != null) {
+			this.pValues = new ArrayList<>(Arrays.asList(tmp.split("\t")));
+		}
+		else {
+			this.pValues = null;
+		}
+		return true;
+	}
+	
+	@Override
+	public boolean saveParameters() {
+		
+		if (this.pProperty != null) {
+			this.saveParameter(TXMPreferences.STRUCTURAL_UNIT_PROPERTY, this.pProperty.getName());
+		}
+		
+		if (this.pPartNames != null) {
+			this.saveParameter(CQPPreferences.PART_NAMES, StringUtils.join(pPartNames, "\t"));
+		}
+		
+		if (this.pQueries != null) {
+			this.saveParameter(TXMPreferences.QUERIES, StringUtils.join(pQueries, "\t"));
+		}
+		
+		if (this.pValues != null) {
+			this.saveParameter(TBXPreferences.VALUES, StringUtils.join(pValues, "\t"));
+		}
+		
+		return true;
+	}
+	
+	/**
+	 * Get the safe values (special char regexp safe).
+	 *
+	 * @param property the property
+	 * @param corpus the corpus
+	 * @return the safe values
+	 * @throws CqiClientException the cqi client exception
+	 */
+	private static List<String> getSafeValues(StructuralUnitProperty property, CQPCorpus corpus) throws CqiClientException {
+		List<String> values = property.getValues(corpus);
+		for (int i = 0; i < values.size(); i++) {
+			values.set(i, CQLQuery.addBackSlash(values.get(i)));
+		}
+		return values;
+	}
+	
+	@Override
+	public String getResultType() {
+		return "Partition";
+	}
+	
+	/**
+	 * Gets the parent Partition of the specified result if exists.
+	 * 
+	 * @param result
+	 * @return the parent Partition if exists otherwise null
+	 */
+	synchronized public static Partition getFirstParentPartition(TXMResult result) {
+		return result.getFirstParent(Partition.class);
+	}
+	
+	
+	@Override
+	public CQPCorpus getCorpus() {
+		return (CQPCorpus) parent;
+	}
+	
+	public Object getPartForName(String pName) {
+		if (pName == null) return null;
+		
+		for (Part p : getChildren(Part.class)) {
+			if (pName.equals(p.getName())) {
+				return p;
+			}
+		}
+		return null;
+	}
+	
+	public List<String> getQueriesParameter() {
+		return pQueries;
+	}
+	
+	public List<String> getPartNamesParameter() {
+		return pPartNames;
+	}
+}

Property changes on: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/Partition.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/PositionProperty.java
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/PositionProperty.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/PositionProperty.java	(revision 3659)
@@ -0,0 +1,91 @@
+package org.txm.searchengine.cqp.corpus;
+
+import java.text.NumberFormat;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
+
+/**
+ * A CQP property at token/word level
+ * 
+ * @author mdecorde
+ *
+ */
+public class PositionProperty extends VirtualProperty {
+	
+	int maxLength;
+	NumberFormat f;
+	
+	/**
+	 * Creates a new WordProperty.
+	 * 
+	 * @param name
+	 * @param corpus
+	 */
+	public PositionProperty(CQPCorpus corpus) {
+		super("position", corpus);
+		try {
+			maxLength = Integer.toString(corpus.getMainCorpus().getSize()).length();
+		} catch (CqiClientException e) {
+			e.printStackTrace();
+			maxLength = Integer.toString(Integer.MAX_VALUE).length();
+		}
+		
+		f = NumberFormat.getNumberInstance();
+		f.setMinimumIntegerDigits(maxLength);
+	}
+	
+	public String cpos2Str(int position) {
+		return f.format(position);
+	}
+	
+	public String[] cpos2Str(int[] positions) {
+		return getValues(positions).toArray(new String[positions.length]);
+	}
+	
+	public List<String> getValues(int[] positions) {
+		ArrayList<String> rez = new ArrayList<>();
+		for (int p : positions) {
+			rez.add(cpos2Str(p));
+		}
+		return rez;
+	}
+
+	@Override
+	public int[] cpos2Id(int[] allpositionsarray) {
+		return allpositionsarray; // lol
+	}
+
+	@Override
+	public int cpos2Id(int position) {
+		return position; // lol
+	}
+
+	@Override
+	public String[] id2Str(int[] indices) {
+		String[] rez = new String[indices.length];
+		for (int i = 0 ; i < rez.length ; i++) {
+			rez[i] = cpos2Str(indices[i]);
+		}
+		return rez;
+	}
+
+	@Override
+	public String id2Str(int indice) {
+		return cpos2Str(indice);
+	}
+
+	@Override
+	public String getCQLTest(String value) {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public String getCQLTest(List<String> values) {
+		// TODO Auto-generated method stub
+		return null;
+	}
+}
+

Property changes on: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/PositionProperty.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/CqpObject.java
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/CqpObject.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/CqpObject.java	(revision 3659)
@@ -0,0 +1,125 @@
+// Copyright © 2010-2020 ENS de Lyon., University of Franche-Comté
+// 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: 2013-05-06 17:38:43 +0200 (lun., 06 mai 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.searchengine.cqp.corpus;
+
+import org.txm.searchengine.cqp.clientExceptions.InvalidCqpIdException;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The top class for all object having a counterpart in CQP.
+ * 
+ * @author Jean-Philippe Magué
+ */
+public interface CqpObject {
+
+	/** The Constant subcorpusNamePrefix. */
+	public static final String subcorpusNamePrefix = "S"; //$NON-NLS-1$
+
+	/** The Constant partNamePrefix. */
+	public static final String partNamePrefix = "P"; //$NON-NLS-1$
+
+	/** The Constant queryResultNamePrefix. */
+	public static final String queryResultNamePrefix = "Q"; //$NON-NLS-1$
+
+	/**
+	 * The cqp id.
+	 *
+	 * @param cqpId the cqp id
+	 * @return true, if successful
+	 * @throws InvalidCqpIdException the invalid cqp id exception
+	 */
+	// protected String cqpId;
+
+	/** The name. */
+	// protected String name;
+
+	/** The size. */
+	// protected int size = -1;
+
+	/** The mother main corpus. */
+	// protected MainCorpus motherMainCorpus;
+
+	/**
+	 * Instantiates a new cqp object mirroring the corpus in CQP with the given
+	 * id.
+	 * 
+	 * @param cqpId
+	 *            the cqp id
+	 * 
+	 * @throws InvalidCqpIdException
+	 *             the invalid cqp id exception
+	 */
+	// public void CqpObject(String cqpId);// throws InvalidCqpIdException;/*{
+
+	/**
+	 * Check whether the ID is a valid CQP ID.
+	 * 
+	 * @param cqpId
+	 *            the cqp id
+	 * 
+	 * @return true, if cqpId is a valid CQP ID.
+	 * 
+	 * @throws InvalidCqpIdException
+	 *             the invalid cqp id exception
+	 */
+	public boolean checkCqpId(String cqpId) throws InvalidCqpIdException;
+
+	/**
+	 * Gets the cqp id.
+	 * 
+	 * @return the cqp id
+	 */
+	public String getCqpId();/*
+							 * { return cqpId; }
+							 */
+
+	/**
+	 * Gets the name.
+	 * 
+	 * @return the name
+	 */
+	public String getName();/*
+							 * { return name; }
+							 */
+
+	/**
+	 * Gets the qualified cqp id.
+	 * 
+	 * @return the qualified cqp id
+	 */
+	public String getQualifiedCqpId();
+
+	/**
+	 * Gets the mother corpus.
+	 * 
+	 * @return the mother corpus
+	 */
+	public MainCorpus getMainCorpus();/*
+											 * { return motherMainCorpus; }
+											 */
+}

Property changes on: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/CqpObject.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/StructuralUnitProperty.java
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/StructuralUnitProperty.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/StructuralUnitProperty.java	(revision 3659)
@@ -0,0 +1,354 @@
+// Copyright © 2010-2020 ENS de Lyon., University of Franche-Comté
+// 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: 2013-09-05 09:27:13 +0200 (jeu., 05 sept. 2013) $
+// $LastChangedRevision: 2529 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.searchengine.cqp.corpus;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.UUID;
+
+import org.txm.core.messages.TXMCoreMessages;
+import org.txm.core.preferences.TXMPreferences;
+import org.txm.searchengine.cqp.AbstractCqiClient;
+import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
+import org.txm.searchengine.cqp.clientExceptions.UnexpectedAnswerException;
+import org.txm.searchengine.cqp.corpus.query.CQLQuery;
+import org.txm.searchengine.cqp.corpus.query.MatchUtils;
+import org.txm.searchengine.cqp.serverException.CqiServerError;
+import org.txm.utils.logger.Log;
+
+/**
+ * A Property on the structural units the corpus. Represents a
+ * <strong>type</strong>, not a the value for a specific unit.
+ * 
+ * @author Jean-Philippe Magué
+ */
+public class StructuralUnitProperty extends Property {
+	
+	/** The values for this property corpus */
+	List<String> values;
+	
+	/** The structural unit. */
+	private StructuralUnit structuralUnit;
+	
+	
+	
+	/**
+	 * Instantiates a new structural unit property.
+	 * 
+	 * Not intended to be used directly. See
+	 *
+	 * @param structuralUnit the structural unit
+	 * @param name the name
+	 * @param corpus the corpus
+	 *            {@link StructuralUnit#getProperty(String)}
+	 */
+	public StructuralUnitProperty(StructuralUnit structuralUnit, String name, CQPCorpus corpus) {
+		super(name, corpus);
+		this.structuralUnit = structuralUnit;
+	}
+	
+	/**
+	 * Gets the structural unit on wich the property is defined.
+	 * 
+	 * @return the structural unit
+	 */
+	public StructuralUnit getStructuralUnit() {
+		return structuralUnit;
+	}
+	
+	/**
+	 * Gets the full name: "struct_propname"
+	 *
+	 * @return the full name
+	 */
+	@Override
+	public String getFullName() {
+		return structuralUnit.getName() + "_" + this.getName(); //$NON-NLS-1$
+	}
+	
+	
+	/**
+	 * Gets the full name as string: "structure@property".
+	 *
+	 * @return the full name
+	 */
+	public String asFullNameString() {
+		return this.structuralUnit.getName() + this.asString();
+	}
+	
+	
+	/**
+	 * Creates a readable formated string from the specified structural unit properties list.
+	 * 
+	 * @param properties
+	 * @return
+	 */
+	public static String asFullNameString(List<StructuralUnitProperty> properties) {
+		String str = ""; ///$NON-NLS-1$
+		for (int i = 0; i < properties.size(); i++) {
+			if (i > 0) {
+				str += ", "; //$NON-NLS-1$
+			}
+			str += properties.get(i).asFullNameString();
+		}
+		return str;
+	}
+	
+	
+	/**
+	 * Gets a list of all the values this structural property takes in the
+	 * subcorpus.
+	 *
+	 * @param subcorpus The subcorpus in which the search is restricted
+	 * @return a List of values
+	 * @throws CqiClientException the cqi client exception
+	 */
+	public List<String> getValues(CQPCorpus subcorpus) throws CqiClientException {
+		try {
+			AbstractCqiClient cqiClient = CorpusManager.getCorpusManager().getCqiClient();
+			return cqiClient.getData(this, subcorpus);
+		}
+		catch (Exception e) {
+			Log.severe(TXMCoreMessages.failedToAccessStructuralPropertyValues
+					+ this.getFullName() + " : " + e); //$NON-NLS-1$
+		}
+		return new ArrayList<>();
+		
+		/*
+		 * //if (values == null) { QueryResult tmp = subcorpus.query(new
+		 * Query("<"+this.getFullName()+">[]"), UUID.randomUUID().toString());
+		 * //$NON-NLS-1$ //$NON-NLS-2$ List<Match> matches = tmp.getMatches();
+		 * tmp.drop(); values = new ArrayList<String>(new
+		 * HashSet<String>(Match.getValuesForProperty(this,matches))); } return
+		 * new ArrayList<String>(values);
+		 */
+	}
+	
+	/**
+	 * Gets a list of all the values this structural property takes in the
+	 * subcorpus
+	 * 
+	 * return an abstract of values.
+	 *
+	 * @param subcorpus The subcorpus in which the search is restricted
+	 * @param number the number
+	 * @return a List of values
+	 * @throws CqiClientException the cqi client exception
+	 */
+	public List<String> getValues(CQPCorpus subcorpus, int number) throws CqiClientException {
+		try {
+			AbstractCqiClient cqiClient = CorpusManager.getCorpusManager().getCqiClient();
+			return cqiClient.getData(this, number);
+		}
+		catch (Exception e) {
+			Log.severe(TXMCoreMessages.failedToAccessStructuralPropertyValues
+					+ this.getFullName() + " : " + e); //$NON-NLS-1$
+		}
+		return new ArrayList<>();
+		
+		/*
+		 * //if (values == null) { QueryResult tmp = subcorpus.query(new
+		 * Query("<"+this.getFullName()+">[]"), UUID.randomUUID().toString());
+		 * //$NON-NLS-1$ //$NON-NLS-2$ List<Match> matches = tmp.getMatches();
+		 * tmp.drop(); values = new ArrayList<String>(new
+		 * HashSet<String>(Match.getValuesForProperty(this,matches))); } return
+		 * new ArrayList<String>(values);
+		 */
+	}
+	
+	/**
+	 * Gets a list of all the values this structural property takes in the main
+	 * corpus.
+	 *
+	 * @return a List of values
+	 * @throws CqiClientException the cqi client exception
+	 */
+	public List<String> getValues() throws CqiClientException {
+		return getValues(this.getCorpus());
+	}
+	
+	/**
+	 * Gets a list of all the values this structural property takes in the main
+	 * corpus.
+	 *
+	 * @return a List of values
+	 * @throws CqiClientException the cqi client exception
+	 */
+	public List<String> getOrderedValues() throws CqiClientException {
+		List<String> values = getValues(this.getCorpus());
+		Collections.sort(values);
+		return values;
+	}
+	
+	/**
+	 * Gets a list of all the values this structural property takes in the main
+	 * corpus.
+	 *
+	 * @param corpus the corpus
+	 * @return a List of values
+	 * @throws CqiClientException the cqi client exception
+	 */
+	public List<String> getOrderedValues(CQPCorpus corpus) throws CqiClientException {
+		List<String> values = getValues(corpus);
+		Collections.sort(values);
+		return values;
+	}
+	
+	/**
+	 * Gets the number of values.
+	 *
+	 * @param corpus the corpus
+	 * @return the number of values in this corpus, -1 if an error occured
+	 */
+	public Integer getNumberOfValues(CQPCorpus corpus) {
+		try {
+			QueryResult tmp = corpus.query(new CQLQuery("<" + this.getFullName() + ">[]"), UUID.randomUUID().toString(), false); //$NON-NLS-1$ //$NON-NLS-2$
+			int ret = tmp.getNMatch();
+			tmp.drop();
+			return ret;
+		}
+		catch (CqiClientException e) {
+			org.txm.utils.logger.Log.printStackTrace(e);
+		}
+		return -1;// error
+	}
+	
+	/**
+	 * Converts the specified string to a list of StructuralUnitProperty from the specified Corpus.
+	 * 
+	 * @param corpus
+	 * @param str
+	 * @return
+	 */
+	public static List<StructuralUnitProperty> stringToProperties(CQPCorpus corpus, String str) {
+		ArrayList<StructuralUnitProperty> structs = new ArrayList<>();
+		if (str == null || str.length() == 0) {
+			return structs;
+		}
+		
+		String[] split = str.split(TXMPreferences.LIST_SEPARATOR);
+		for (String s : split) {
+			String[] split2 = s.split("_", 2);
+			if (split2.length != 2) {
+				continue;
+			}
+			try {
+				StructuralUnit struc = corpus.getStructuralUnit(split2[0]);
+				StructuralUnitProperty struc_p = struc.getProperty(split2[1]);
+				if (struc_p != null) {
+					structs.add(struc_p);
+				}
+			}
+			catch (CqiClientException e) {
+				System.out.println("Error: " + str + " structure property not found in " + corpus);
+				Log.printStackTrace(e);
+				return null;
+			}
+			
+		}
+		return structs;
+	}
+	
+	
+	/**
+	 * Converts the specified string to a StructuralUnitProperty.
+	 * 
+	 * @param corpus
+	 * @param str the String to 'deserialize'. Follows the structure_property syntax
+	 * @return
+	 * @throws CqiClientException
+	 */
+	public static StructuralUnitProperty stringToStructuralUnitProperty(CQPCorpus corpus, String str) throws CqiClientException {
+		if (str == null) {
+			return null;
+		}
+		
+		String[] split = str.split("_", 2);
+		if (split.length == 2) {
+			StructuralUnit su = corpus.getStructuralUnit(split[0]);
+			if (su == null) {
+				return null;
+			}
+			
+			return su.getProperty(split[1]);
+		}
+		
+		return null;
+	}
+	
+	public String cpos2Str(int position) throws UnexpectedAnswerException, IOException, CqiServerError {
+		AbstractCqiClient cqiClient = CorpusManager.getCorpusManager().getCqiClient();
+		return cqiClient.getSingleData(this, new int[] { position }).get(0);
+	}
+	
+	public String[] cpos2Str(int[] positions) throws UnexpectedAnswerException, IOException, CqiServerError {
+		AbstractCqiClient cqiClient = CorpusManager.getCorpusManager().getCqiClient();
+		return cqiClient.getSingleData(this, positions).toArray(new String[positions.length]);
+	}
+	
+	/**
+	 * Very slow
+	 * 
+	 * @return
+	 * @throws IOException
+	 * @throws CqiServerError
+	 * @throws CqiClientException
+	 */
+	public int getNValues() throws IOException, CqiServerError, CqiClientException {
+		return getValues().size();
+	}
+	
+	/**
+	 * Very slow
+	 * 
+	 * @return
+	 * @throws IOException
+	 * @throws CqiServerError
+	 * @throws CqiClientException
+	 */
+	public String[] getValuesAsStrings() throws IOException, CqiServerError, CqiClientException {
+		List<String> values = getValues();
+		return values.toArray(new String[values.size()]);
+	}
+
+	@Override
+	public int[] cpos2Id(int[] positions) throws Exception {
+		
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public String[] id2Str(int[] positions) throws Exception {
+		
+		// TODO Auto-generated method stub
+		return null;
+	}
+}

Property changes on: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/StructuralUnitProperty.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/package.html
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/package.html	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/package.html	(revision 3659)
@@ -0,0 +1,6 @@
+<html>
+<body>
+	<p>Classes representing corpus and corpus-like data structures
+		wrapping and abstracting cqp objects and functions.</p>
+</body>
+</html>
\ No newline at end of file

Property changes on: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/package.html
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/CQPCorpus.java
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/CQPCorpus.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/CQPCorpus.java	(revision 3659)
@@ -0,0 +1,1572 @@
+// Copyright © 2010-2020 ENS de Lyon., University of Franche-Comté
+// 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: 2016-11-29 16:47:07 +0100 (Tue, 29 Nov 2016) $
+// $LastChangedRevision: 3349 $
+// $LastChangedBy: mdecorde $
+//
+package org.txm.searchengine.cqp.corpus;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Locale;
+
+import org.eclipse.osgi.util.NLS;
+import org.txm.core.messages.TXMCoreMessages;
+import org.txm.core.preferences.TXMPreferences;
+import org.txm.core.results.TXMResult;
+import org.txm.objects.CorpusCommandPreferences;
+import org.txm.objects.Project;
+import org.txm.searchengine.core.QueryBasedTXMResult;
+import org.txm.searchengine.core.messages.SearchEngineCoreMessages;
+import org.txm.searchengine.cqp.CQPSearchEngine;
+import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
+import org.txm.searchengine.cqp.clientExceptions.InvalidCqpIdException;
+import org.txm.searchengine.cqp.core.functions.selection.SelectionResult;
+import org.txm.searchengine.cqp.corpus.query.CQLQuery;
+import org.txm.searchengine.cqp.corpus.query.Match;
+import org.txm.searchengine.cqp.corpus.query.SubcorpusCQLQuery;
+import org.txm.searchengine.cqp.serverException.CqiServerError;
+import org.txm.utils.TXMProgressMonitor;
+import org.txm.utils.logger.Log;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+
+/**
+ * The Class Corpus. A corpus is either a whole corpus, as managed by CQP or a
+ * subcorpus.
+ * 
+ * @see org.txm.searchengine.cqp.corpus.MainCorpus
+ * @see org.txm.searchengine.cqp.corpus.Subcorpus
+ * 
+ * @author Jean-Philippe Magué, Sylvain Loiseau, mdecorde
+ */
+public abstract class CQPCorpus extends org.txm.objects.CorpusBuild implements CqpObject {
+	
+	/**
+	 * subresults cache. eg used to store CQP lexicons
+	 */
+	protected static HashMap<Class<?>, ArrayList<?>> cache = new HashMap<>();
+	
+	private static final int CACHE_MAXIMUM_SIZE = 5;
+	
+	/** The nocorpus. */
+	protected static int nocorpus = 1;
+	
+	/** The prefix r. */
+	protected static String prefixR = "Corpus"; //$NON-NLS-1$
+	
+	private static Integer QUERY_COUNTER = new Integer(0);
+	
+	protected static Integer SUBCORPUS_COUNTER = new Integer(0);
+	
+	protected static String WORD = TXMPreferences.DEFAULT_UNIT_PROPERTY;
+	
+	public static final Comparator<WordProperty> wordFirstComparator = new Comparator<WordProperty>() {
+		
+		@Override
+		public int compare(WordProperty o1, WordProperty o2) {
+			if (o1.getName().equals("word")) {
+				return -1;
+			}
+			if (o2.getName().equals("word")) {
+				return 1;
+			}
+			return o1.compareTo(o2);
+		}
+	};
+	
+	/**
+	 * store an object for a maximum of 5 object cached per object
+	 * 
+	 * @param forObject
+	 * @param toCache
+	 * @return
+	 */
+	public Object cache(Object toCache) {
+		if (toCache == null) {
+			return null;
+		}
+		
+		ArrayList<?> ocCache = getObjectCacheForClass(toCache.getClass());
+		if (ocCache.size() > CACHE_MAXIMUM_SIZE) {
+			ocCache.remove(0); // oldest value
+		}
+		return toCache;
+	}
+	
+	/**
+	 * Returns the first parent object that is a Subcorpus, a Corpus or a
+	 * MainCorpus. Returns the object itself if its class is one of the the three
+	 * listed below.
+	 * 
+	 * @return
+	 */
+	synchronized public static CQPCorpus getFirstParentCorpus(TXMResult result) {
+		CQPCorpus corpus = result.getFirstParent(Subcorpus.class);
+		if (corpus == null) {
+			corpus = result.getFirstParent(CQPCorpus.class);
+		}
+		if (corpus == null) {
+			corpus = (CQPCorpus) getParentMainCorpus(result);
+		}
+		return corpus;
+	}
+	
+	public static String getNextQueryCounter() {
+		QUERY_COUNTER++;
+		return QUERY_COUNTER.toString();
+	}
+	
+	/**
+	 * append the current timestamp to the subcorpus counter -> should avoid clash between subcorpus created between different TXM sessions
+	 * 
+	 * @return
+	 */
+	public static String getNextSubcorpusCounter() {
+		SUBCORPUS_COUNTER++;
+		return "" + System.currentTimeMillis() + "_" + SUBCORPUS_COUNTER.toString();
+	}
+	
+	/**
+	 * retrieve all cached objects for an object
+	 * 
+	 * @param forObject
+	 * @param c
+	 * @return
+	 */
+	public HashMap<Class<?>, ArrayList<?>> getObjectCache() {
+		return cache;
+	}
+	
+	/**
+	 * retrieve all cached objects of a certain class for an object
+	 * 
+	 * @param forObject
+	 * @param c
+	 * @return
+	 */
+	@SuppressWarnings("unchecked")
+	public <T extends Object> ArrayList<T> getObjectCacheForClass(Class<T> c) {
+		HashMap<Class<?>, ArrayList<?>> oCache = getObjectCache();
+		if (!oCache.containsKey(c)) {
+			oCache.put(c, new ArrayList<T>());
+		}
+		return (ArrayList<T>) oCache.get(c);
+	}
+	
+	/**
+	 * Gets the main corpus parent.
+	 * 
+	 * @return the first parent of class MainCorpus or the object itself if it is
+	 *         its class.
+	 */
+	synchronized public static TXMResult getParentMainCorpus(TXMResult result) {
+		return result.getFirstParent(MainCorpus.class);
+	}
+	
+	/**
+	 * remove a cached object
+	 * 
+	 * @param forObject
+	 * @param toCache
+	 * @return
+	 */
+	public static ArrayList<?> uncache(Class<?> classToUnCache) {
+		if (classToUnCache == null) {
+			return null;
+		}
+		return cache.remove(classToUnCache);
+	}
+	
+	/**
+	 * remove a cached object
+	 * 
+	 * @param forObject
+	 * @param toCache
+	 * @return
+	 */
+	public boolean uncache(Object toUnCache) {
+		if (toUnCache == null) {
+			return false;
+		}
+		ArrayList<?> ocCache = getObjectCacheForClass(toUnCache.getClass());
+		return ocCache.remove(toUnCache);
+	}
+	
+	/** All private infos of the corpus. */
+	protected String charset = "latin1"; //$NON-NLS-1$
+	
+	/**
+	 * Gets the locale of the corpus.
+	 * 
+	 * @return the locale
+	 */
+	protected String lang = null;
+	
+	/** stores The corpus lexical units properties. */
+	protected List<WordProperty> lexicalUnitsProperties;
+	
+	/** The size in token */
+	protected int size = -1;
+	
+	/** The number of starting text. */
+	protected int nbtext = -1;
+	
+	protected int[] textEndLimits;
+	
+	/** The textids. */
+	protected HashMap<String, Integer> textids = null;
+	
+	// /**
+	// * Creates a new object mapping a CQP corpus. This constructor is not
+	// * intended to be used directly. Use {@link CorpusManager#getCorpus(String)}
+	// * .
+	// *
+	// * @param pID
+	// * the id of the cqp corpus
+	// *
+	// * @throws InvalidCqpIdException
+	// * the invalid cqp id exception
+	// */
+	// protected Corpus(Corpus parentCorpus) throws InvalidCqpIdException {
+	// super(parentCorpus);
+	// if (parentCorpus ins)
+	//// checkCqpId(pID);
+	//// this.pID = pID;
+	////
+	//// // FIXME: at this moment, store the CQPID as UUIDD for persistence tests
+	//// this.uniqueID = this.pID;
+	// }
+	//
+	// /**
+	// * Creates a new object mapping a CQP corpus. This constructor is not
+	// * intended to be used directly. Use {@link CorpusManager#getCorpus(String)}
+	// * .
+	// *
+	// * @param pID
+	// * the id of the cqp corpus
+	// *
+	// * @throws InvalidCqpIdException
+	// * the invalid cqp id exception
+	// */
+	// protected Corpus(Corpus parentCorpus) throws InvalidCqpIdException {
+	// super(null, null, pID);
+	//// checkCqpId(pID);
+	//// this.pID = pID;
+	////
+	//// // FIXME: at this moment, store the CQPID as UUIDD for persistence tests
+	//// this.uniqueID = this.pID;
+	// }
+	
+	/** The corpus structural units. */
+	protected List<StructuralUnit> structuralUnits;
+	
+	/** The symbol. */
+	protected String symbol;
+	
+	protected StructuralUnitProperty textIdStructuralUnitProperty;
+	// public HashSet<Object> getStoredData(Class class1) {
+	//
+	// if (!storedData.containsKey(class1)) {
+	// storedData.put(class1, new HashSet<Object>());
+	// }
+	//
+	// return storedData.get(class1);
+	// }
+	//
+	// /**
+	// * TODO: fix this hack to store Lexicons
+	// *
+	// * @param o a lexicon
+	// */
+	// public void storeData(Object o) {
+	// if (storedData.containsKey(o.getClass())) {
+	// storedData.put(o.getClass(), new HashSet<Object>());
+	// }
+	//
+	// HashSet<Object> hash = storedData.get(o.getClass());
+	// hash.add(o);
+	// }
+	
+	protected int[] textLimits;
+	
+	protected StructuralUnit textStructuralUnit;
+	
+	protected WordProperty wordProperty = null;
+	
+	private List<VirtualProperty> virtualProperties;
+	
+	/**
+	 * 
+	 * @param corpus
+	 */
+	public CQPCorpus(CQPCorpus corpus) {
+		super(corpus);
+	}
+	
+	/**
+	 * 
+	 * @param partition
+	 */
+	public CQPCorpus(Partition partition) {
+		super(partition);
+	}
+	
+	/**
+	 * 
+	 * @param project
+	 */
+	protected CQPCorpus(Project project) {
+		super(project);
+	}
+	
+	// /**
+	// * Drop all the partitions.
+	// *
+	// * @throws CqiClientException
+	// * the cqi client exception
+	// */
+	// public void dropAllPartitions() throws CqiClientException {
+	// List<Partition> _partitions = (List<Partition>) getChildren(Partition.class);
+	// for (Partition partition : _partitions) {
+	// this.dropPartition(partition);
+	// }
+	// _partitions = null;
+	// }
+	
+	/**
+	 * 
+	 * @param parametersNodePath
+	 */
+	public CQPCorpus(String parametersNodePath) {
+		super(parametersNodePath);
+	}
+	
+	// /**
+	// * Drops a partition.
+	// *
+	// * @param partition
+	// * the partition
+	// *
+	// * @throws CqiClientException
+	// * the cqi client exception
+	// */
+	// public void dropPartition(Partition partition) throws CqiClientException {
+	// Log.finest(SearchEngineCoreMessages.info_deletingPartition +
+	// partition.getName());
+	// for (Part part : partition.getParts())
+	// try {
+	// CorpusManager.getCorpusManager().getCqiClient().dropSubCorpus(part.getQualifiedCqpId());
+	// } catch (Exception e) {
+	// throw new CqiClientException(e);
+	// }
+	// }
+	
+	public CQPCorpus(QueryBasedTXMResult result) {
+		
+		super(result);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see org.txm.objects.TxmObject#load()
+	 */
+	@Override
+	protected boolean _load(Element e) {
+		// System.out.println("*** Load corpus: "+name);
+		if (e == null) {
+			Log.warning(TXMCoreMessages.warningColonCantLoadCorpus + this);
+			return false;
+		}
+		
+		// 1- texts queries then
+		// 2- get metadatas, pattributes, sattributes, editions, biblios, uis,
+		super._load(e);
+		// System.out.println("Load corpus : "+this.name);
+		// this.loadMetadata(); // read <prop>s
+		
+		// 3- build saved subcorpus and partition
+		// System.out.println("restore subcorpora: "+selfElement);
+		NodeList preBuildElems = e.getElementsByTagName("preBuild"); //$NON-NLS-1$
+		if (preBuildElems.getLength() > 0) {
+			Element preBuildElem = (Element) preBuildElems.item(0);
+			NodeList subcorpusElems = preBuildElem.getElementsByTagName("subcorpus"); //$NON-NLS-1$
+			for (int i = 0; i < subcorpusElems.getLength(); i++) {
+				Element subcorpusElem = (Element) subcorpusElems.item(i);
+				if (!subcorpusElem.getParentNode().equals(preBuildElem)) {
+					continue; // level 1 elements
+				}
+				Subcorpus subcorp = new Subcorpus(this);
+				subcorp._load(subcorpusElem);
+			}
+			
+			NodeList partitionElems = preBuildElem.getElementsByTagName("partition"); //$NON-NLS-1$
+			for (int i = 0; i < partitionElems.getLength(); i++) {
+				Element partitionElem = (Element) partitionElems.item(i);
+				if (!partitionElem.getParentNode().equals(preBuildElem)) {
+					continue; // level 1 elements
+				}
+				String name = partitionElem.getAttribute("name"); //$NON-NLS-1$
+				List<String> names = new ArrayList<>();
+				List<String> queries = new ArrayList<>();
+				
+				NodeList partElems = partitionElem.getElementsByTagName("part"); //$NON-NLS-1$
+				for (int j = 0; j < partElems.getLength(); j++) {
+					Element part = (Element) partElems.item(j);
+					names.add(part.getAttribute("name")); //$NON-NLS-1$
+					queries.add(part.getAttribute("query")); //$NON-NLS-1$
+				}
+				try {
+					Partition partition = new Partition(this);
+					partition.setParameters(name, queries, names);
+				}
+				catch (Exception ex) {
+					Log.warning(TXMCoreMessages.bind(TXMCoreMessages.failedToRestorePartition, name, this.pID, ex));
+				}
+			}
+		}
+		
+		return true;
+	}
+	
+	/**
+	 * Empty the corpus caches
+	 */
+	@Override
+	public void clean() {
+		if (cache != null) {
+			cache.clear();
+		}
+		
+		charset = "latin1"; //$NON-NLS-1$
+		lang = null;
+		lexicalUnitsProperties = null;
+		virtualProperties = null;
+		size = -1;
+		structuralUnits = null;
+		symbol = null;
+		textIdStructuralUnitProperty = null;
+		textLimits = null;
+		textStructuralUnit = null;
+		wordProperty = null;
+	}
+	
+	/**
+	 * recursive method to clone a result
+	 * 
+	 * @param newParent
+	 *            necessary for cloning children in the right clone parent
+	 * @param all
+	 * @return
+	 */
+	@Override
+	public TXMResult clone(TXMResult newParent, boolean all) {
+		CQPCorpus c = (CQPCorpus) super.clone(newParent, all);
+		c.pID = "S" + getNextSubcorpusCounter();
+		return c;
+	}
+	
+	@Override
+	public int compareTo(TXMResult o) {
+		// Compare node weights
+		int output = super.compareTo(o);
+		// Compare simple names if weights are equal
+		if (this.pID == null) {
+			return -1;
+		}
+		if (o.getSimpleName() == null) {
+			return 1;
+		}
+		if (output == 0) {
+			output = this.getSimpleName().compareTo(o.getSimpleName());
+		}
+		return output;
+	}
+	
+	/**
+	 * Create a named subcorpus from a query on this corpus.
+	 * 
+	 * @param query
+	 *            the query
+	 * @param subcorpusName
+	 *            the resulting subcorpus name
+	 * 
+	 * @return the resulting subcorpus
+	 * 
+	 * @throws CqiClientException
+	 *             the cqi client exception
+	 */
+	public Subcorpus createSubcorpus(CQLQuery query, String subcorpusName) throws CqiClientException {
+		Subcorpus sc = createSubcorpus(query, subcorpusName, false);
+		return sc;
+	}
+	
+	/**
+	 * Creates a subcorpus and save configuration in the workspace.
+	 *
+	 * @param query
+	 *            the query
+	 * @param subcorpusName
+	 *            the subcorpus name
+	 * @param registered
+	 *            the registered
+	 * @return the subcorpus
+	 * @throws CqiClientException
+	 *             the cqi client exception
+	 */
+	public Subcorpus createSubcorpus(CQLQuery query, String subcorpusName, boolean registered) throws CqiClientException {
+		
+		Subcorpus subcorpus;
+		String subcorpusCqpId = subcorpusNamePrefix + getNextSubcorpusCounter().toString();
+		
+		long start = System.currentTimeMillis();
+		try {
+			if (query.getQueryString().length() > CQLQuery.MAX_CQL_LENGTH) {
+				Log.warning(NLS.bind("Error: CQL length limit reached ({0}) with the {1} length.", CQLQuery.MAX_CQL_LENGTH, query.getQueryString().length())); 
+				return null;
+			}
+			
+			//CorpusManager.getCorpusManager().getCqiClient().cqpQuery(this.getQualifiedCqpId(), subcorpusCqpId, CQLQuery.fixQuery(query.getQueryString()));
+			// System.out.println("SUBCORPUS: "+subcorpusCqpId+"
+			// q="+query.getQueryString());
+			subcorpus = new Subcorpus(this);
+			subcorpus.setParameters(subcorpusCqpId, subcorpusName, query);
+			subcorpus.compute();
+		}
+		catch (Exception e) {
+			throw new CqiClientException(e);
+		}
+		long end = System.currentTimeMillis();
+		
+		Log.fine(TXMCoreMessages.bind(SearchEngineCoreMessages.subcorpusP0CreatedInP1Ms, subcorpusName, (end - start)));
+		
+		// if (!registered) subcorpus.registerToParent();
+		return subcorpus;
+	}
+	
+	/**
+	 * Creates a subcorpus using workspace definition.
+	 *
+	 * @param elem
+	 *            the XML element
+	 * @return the subcorpus
+	 * @throws CqiClientException
+	 *             the cqi client exception
+	 */
+	public Subcorpus createSubcorpus(Element elem) throws CqiClientException {
+		CQLQuery query = new CQLQuery(elem.getAttribute("query")); //$NON-NLS-1$
+		String subcorpusName = elem.getAttribute("name"); //$NON-NLS-1$
+		
+		Subcorpus subcorpus;
+		String subcorpusCqpId = subcorpusNamePrefix + getNextSubcorpusCounter();
+		
+		// long start = System.currentTimeMillis();
+		try {
+			CorpusManager.getCorpusManager().getCqiClient().cqpQuery(this.getQualifiedCqpId(), subcorpusCqpId, CQLQuery.fixQuery(query.getQueryString(), this.getLang()));
+			subcorpus = new Subcorpus(this);
+			subcorpus.setParameters(subcorpusCqpId, subcorpusName, query);
+			subcorpus.compute();
+		}
+		catch (Exception e) {
+			throw new CqiClientException(e);
+		}
+		
+		return subcorpus;
+	}
+	
+	public Subcorpus createSubcorpus(String name, QueryResult queryResult) throws Exception {
+		Subcorpus sub = new Subcorpus(this);
+		sub.setParameters(queryResult.getCqpId(), name, queryResult);
+		sub.compute();
+		return sub;
+	}
+	
+	/**
+	 * Creates the subcorpus.
+	 *
+	 * @param elem the elem
+	 * @return the subcorpus
+	 * @throws CqiClientException the cqi client exception
+	 * @throws InterruptedException 
+	 */
+	public Subcorpus createSubcorpus(String name, SelectionResult selectionResult) throws CqiClientException, InterruptedException {
+		Subcorpus sub = createSubcorpus(this.getStructuralUnit("text"), this.getStructuralUnit("text").getProperty("id"), selectionResult, name); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+		sub.setSelectionResult(selectionResult);
+		sub.compute();
+		return sub;
+	}
+	
+	public Subcorpus createSubcorpus(String name, String cqpid) throws Exception {
+		Subcorpus sub = new Subcorpus(this);
+		sub.setParameters(cqpid, name, new QueryResult(cqpid, name, this, null));
+		sub.compute();
+		return sub;
+	}
+	
+	/**
+	 * Creates the subcorpus.
+	 *
+	 * @param structuralUnit the structural unit
+	 * @param structuralUnitProperty the structural unit property
+	 * @param values the values
+	 * @param subcorpusName the subcorpus name
+	 * 
+	 * @return the subcorpus
+	 * 
+	 * @throws CqiClientException the cqi client exception
+	 */
+	public Subcorpus createSubcorpus(StructuralUnit structuralUnit, StructuralUnitProperty structuralUnitProperty, List<String> values, String subcorpusName) throws CqiClientException {
+		if (values.size() == 0) {
+			Log.warning(TXMCoreMessages.noValuesGiven);
+			return null;
+		}
+		String regexp = ""; //$NON-NLS-1$
+		for (String v : values) {
+			regexp += CQLQuery.addBackSlash(v) + "|"; //$NON-NLS-1$
+		}
+		regexp = regexp.substring(0, regexp.length() - 1);
+		
+		SubcorpusCQLQuery query = new SubcorpusCQLQuery(structuralUnit, structuralUnitProperty, regexp, values);
+		return createSubcorpus(query, subcorpusName);
+	}
+	
+	/**
+	 * Create a subcorpus from a structural unit, a property on this structural unit
+	 * and a value for this property.
+	 *
+	 * @param structuralUnit the structural unit
+	 * @param structuralUnitProperty the structural unit property
+	 * @param value the value
+	 * @param subcorpusName the subcorpus name
+	 * 
+	 * @return the subcorpus
+	 * 
+	 * @throws CqiClientException the cqi client exception
+	 */
+	public Subcorpus createSubcorpus(StructuralUnit structuralUnit, StructuralUnitProperty structuralUnitProperty, String value, String subcorpusName) throws CqiClientException {
+		SubcorpusCQLQuery query = new SubcorpusCQLQuery(structuralUnit, structuralUnitProperty, CQLQuery.addBackSlash(value));
+		return createSubcorpus(query, subcorpusName);
+	}
+	
+	@Override
+	protected final boolean _compute(TXMProgressMonitor monitor) throws Exception {
+		// reset the internal variables that store cached information
+		
+		lexicalUnitsProperties = null;
+		size = -1;
+		nbtext = -1;
+		textEndLimits = null;
+		textids = null;
+		structuralUnits = null;
+		symbol = null;
+		textIdStructuralUnitProperty = null;
+		textLimits = null;
+		textStructuralUnit = null;
+		wordProperty = null;
+		
+		return __compute(monitor);
+	}
+	
+	protected abstract boolean __compute(TXMProgressMonitor monitor) throws Exception;
+	
+	/**
+	 * Create a subcorpus from a structural unit, a property on this structural unit
+	 * and a value for this property.
+	 *
+	 * @param structuralUnit the structural unit
+	 * @param structuralUnitProperty the structural unit property
+	 * @param value the value
+	 * @param subcorpusName the subcorpus name
+	 * 
+	 * @return the subcorpus
+	 * 
+	 * @throws CqiClientException the cqi client exception
+	 */
+	public Subcorpus createSubcorpusWithQueryString(StructuralUnit structuralUnit, StructuralUnitProperty structuralUnitProperty, String value, String subcorpusName) throws CqiClientException {
+		SubcorpusCQLQuery query = new SubcorpusCQLQuery(structuralUnit, structuralUnitProperty, value);
+		return createSubcorpus(query, subcorpusName);
+	}
+	
+	/**
+	 * Drop all the subcorpora.
+	 * 
+	 * @throws CqiClientException
+	 *             the cqi client exception
+	 */
+	public void dropAllSubcorpora() throws CqiClientException {
+		// System.out.println("!! drop all subcorpora: "+subcorpora.size());
+		List<Subcorpus> subcorpora = getSubcorpora();
+		while (subcorpora.size() > 0) {
+			this.dropSubcorpus(subcorpora.get(0));
+		}
+	}
+	
+	/**
+	 * Drop query result.
+	 * 
+	 * @param queryResult
+	 *            the query result
+	 * 
+	 * @throws CqiClientException
+	 *             the cqi client exception
+	 */
+	public void dropQueryResult(QueryResult queryResult) throws CqiClientException {
+		Log.fine(SearchEngineCoreMessages.bind(SearchEngineCoreMessages.deletingQueryResultP0, queryResult.getName()));
+		try {
+			CorpusManager.getCorpusManager().getCqiClient().dropSubCorpus(queryResult.getQualifiedCqpId());
+		}
+		catch (Exception e) {
+			throw new CqiClientException(e);
+		}
+	}
+	
+	/**
+	 * Drops a subcorpus in CQP also its subcorpus and partitions.
+	 * 
+	 * @param subcorpus
+	 *            the subcorpus
+	 * 
+	 * @throws CqiClientException
+	 *             the cqi client exception
+	 */
+	public boolean dropSubcorpus(CQPCorpus subcorpus) throws CqiClientException {
+		subcorpus.dropAllSubcorpora();
+		// subcorpus.dropAllPartitions();
+		try {
+			CorpusManager.getCorpusManager().getCqiClient().dropSubCorpus(subcorpus.getQualifiedCqpId());
+		}
+		catch (Exception e) {
+			throw new CqiClientException(e);
+		}
+		return true;
+	}
+	
+	/**
+	 * Test if 2 corpus have the same CQP id.
+	 *
+	 * @param c
+	 *            the c
+	 * @return true, if successful
+	 */
+	public boolean equals(CQPCorpus c) {
+		return pID.equals(c.pID);
+	}
+	
+	/**
+	 * Get the charset set in the CQP registry file.
+	 *
+	 * @return the charset
+	 */
+	public String getCharset() {
+		if (this.charset.matches("latin1")) //$NON-NLS-1$
+			return "ISO-8859-1"; //$NON-NLS-1$
+		else if (this.charset.matches("latin2")) //$NON-NLS-1$
+			return "ISO-8859-2"; //$NON-NLS-1$
+		else if (this.charset.matches("latin3")) //$NON-NLS-1$
+			return "ISO-8859-3"; //$NON-NLS-1$
+		else if (this.charset.matches("latin4")) //$NON-NLS-1$
+			return "ISO-8859-4"; //$NON-NLS-1$
+		else if (this.charset.matches("latin5")) //$NON-NLS-1$
+			return "ISO-8859-5"; //$NON-NLS-1$
+		else if (this.charset.matches("latin6")) //$NON-NLS-1$
+			return "ISO-8859-6"; //$NON-NLS-1$
+		else if (this.charset.matches("latin7")) //$NON-NLS-1$
+			return "ISO-8859-7"; //$NON-NLS-1$
+		else if (this.charset.matches("latin8")) //$NON-NLS-1$
+			return "ISO-8859-8"; //$NON-NLS-1$
+		else if (this.charset.matches("latin9")) //$NON-NLS-1$
+			return "ISO-8859-9"; //$NON-NLS-1$
+		return charset;
+	}
+	
+	/*
+	 * (non-Javadoc)
+	 * @see org.txm.searchengine.cqp.corpus.CqpObject#getMotherMainCorpus()
+	 */
+	public CQPCorpus getCorpusParent() {
+		// return (CQPCorpus) getFirstParent(CQPCorpus.class);
+		TXMResult p = getFirstParent(Subcorpus.class);
+		if (p != null)
+			return (Subcorpus) p;
+		return getFirstParent(MainCorpus.class);
+	}
+	
+	@Override
+	public String getCQLLimitQuery() {
+		CorpusCommandPreferences prefs = getProject().getCommandPreferences("concordance");
+		if (prefs == null) {
+			return "<text>[]";
+		}
+		String str = prefs.get("context_limits");
+		if (str != null) {
+			String type = prefs.get("context_limits_type");
+			if ("list".equals(type)) {
+				String[] ss = str.split(",");
+				ArrayList<String> parts = new ArrayList<>();
+				for (String s : ss) {
+					parts.add("<" + s + "> []");
+				}
+				return org.apache.commons.lang.StringUtils.join(parts, " | ");
+			}
+			else {
+				return str;
+			}
+		}
+		else {
+			return "<text>[]";
+		}
+	}
+	
+	/*
+	 * (non-Javadoc)
+	 * @see org.txm.searchengine.cqp.corpus.CqpObject#getCqpId()
+	 */
+	@Override
+	public String getCqpId() {
+		return pID;
+	}
+	
+	/**
+	 * Gets the default property (by default: "word").
+	 * 
+	 * @return
+	 * @throws CqiClientException
+	 */
+	public WordProperty getDefaultProperty() throws CqiClientException {
+		return this.getProperty(WORD);
+	}
+	
+	/**
+	 * Gets the corpus informations using CQP registry.
+	 *
+	 * @return the infos
+	 */
+	public String getInfos() {
+		return TXMCoreMessages.corpusColon + this.pID + TXMCoreMessages.encodingColon + getCharset() + TXMCoreMessages.languageColon + getLang();
+	}
+	
+	/**
+	 * Gets the language.
+	 *
+	 * @return the language
+	 */
+	@Override
+	public String getLang() {
+		//getLocale();
+		return getProject().getLang();
+	}
+	
+	/**
+	 * Get the corpus locale using txmcorpus_lang property
+	 * @deprecated use getProject.getLlang() instead, will be fixed later to mange multi lang corpus
+	 * @return
+	 */
+	public Locale getLocale() {
+		/*
+		 * Serializable lang = this.getAttribute("lang"); //$NON-NLS-1$ if (lang !=
+		 * null) { return new Locale(lang.toString()); } else return
+		 * Locale.getDefault();
+		 */
+		// System.out.println("getLang1: "+lang);
+		if (lang == null) {
+			try {
+				StructuralUnit su = this.getStructuralUnit("txmcorpus"); //$NON-NLS-1$
+				StructuralUnitProperty prop = su.getProperty("lang"); //$NON-NLS-1$
+				List<String> values = prop.getValues();
+				if (values.size() > 0)
+					lang = values.get(0);
+				// System.out.println("get lang: "+lang);
+			}
+			catch (Exception e) {
+				// TODO Auto-generated catch block
+				// org.txm.utils.logger.Log.printStackTrace(e);
+				System.out.println(TXMCoreMessages.corpusColongetLocaleColonCQPIsNotReadyToAnswerColon + e);
+			}
+		}
+		if (lang != null)
+			return new Locale(lang);
+		else
+			return Locale.getDefault();
+	}
+	
+	/*
+	 * (non-Javadoc)
+	 * @see org.txm.searchengine.cqp.corpus.CqpObject#getMotherMainCorpus()
+	 */
+	@Override
+	public MainCorpus getMainCorpus() {
+		if (this instanceof MainCorpus)
+			return (MainCorpus) this;
+		
+		return getFirstParent(MainCorpus.class);
+	}
+	
+	@Override
+	abstract public List<? extends org.txm.objects.Match> getMatches();
+	
+	@Override
+	public String getName() {
+		return this.getUserName();
+	}
+	
+	/**
+	 * Get the ordered properties (by name).
+	 *
+	 * @return the ordered properties
+	 * @throws CqiClientException
+	 *             the cqi client exception
+	 */
+	@SuppressWarnings("unchecked")
+	public List<WordProperty> getOrderedProperties() throws CqiClientException {
+		List<WordProperty> props = this.getProperties();
+		Collections.sort(props, wordFirstComparator);
+		return props;
+	}
+	
+	/**
+	 * Get the ordered Structural unit properties (by name)
+	 * 
+	 * @return all the StructuralUnitProperty ordered by name
+	 * @throws CqiClientException
+	 */
+	public Collection<StructuralUnitProperty> getOrderedStructuralUnitProperties() throws CqiClientException {
+		List<StructuralUnitProperty> properties = new ArrayList<>();
+		for (StructuralUnit su : this.getOrderedStructuralUnits())
+			if (su.getProperties() != null)
+				properties.addAll(su.getProperties());
+		
+		return properties;
+	}
+	
+	/**
+	 * Get the ordered structural units.
+	 *
+	 * @return the ordered structural units
+	 * @throws CqiClientException
+	 *             the cqi client exception
+	 */
+	@SuppressWarnings("unchecked")
+	public List<StructuralUnit> getOrderedStructuralUnits() throws CqiClientException {
+		List<StructuralUnit> units = this.getStructuralUnits();
+		Collections.sort(units);
+		return units;
+	}
+	
+	/*
+	 * public List<Property> getPreferedOrderedProperties() throws
+	 * CqiClientException { if (this.getAttribute("viewprops_order")) List<Property>
+	 * props = this.getProperties(); Collections.sort(props); return props; }
+	 */
+	
+	/**
+	 * Get all the partitions defined on a given corpus.
+	 *
+	 * @param name
+	 *            the name
+	 * @return the partitions
+	 */
+	public Partition getPartition(String name) {
+		List<Partition> partitions = getChildren(Partition.class);
+		for (Partition p : partitions)
+			if (p.getName().equals(name))
+				return p;
+		return null;
+	}
+	
+	/**
+	 * Gets all the partitions defined on a given corpus.
+	 * 
+	 * @return the partitions
+	 */
+	public List<Partition> getPartitions() {
+		return getChildren(Partition.class);
+	}
+	
+	/**
+	 * Gets the virtual properties of this corpus.
+	 * 
+	 * current implementation only returns the "position" virtual property
+	 * 
+	 * @return the properties
+	 * 
+	 * @throws CqiClientException
+	 *             the cqi client exception
+	 */
+	public List<VirtualProperty> getVirtualProperties() {
+		if (virtualProperties == null) {
+			virtualProperties = new ArrayList<>();
+			virtualProperties.add(new PositionProperty(this));
+			// virtualProperties.add(new LengthProperty(this));
+		}
+		return virtualProperties;
+	}
+	
+	/**
+	 * Gets the properties available in this corpus.
+	 * 
+	 * @return the properties
+	 * 
+	 * @throws CqiClientException
+	 *             the cqi client exception
+	 */
+	public List<WordProperty> getProperties() throws CqiClientException {
+		if (this.lexicalUnitsProperties != null) {
+			return this.lexicalUnitsProperties;
+		}
+		
+		String[] propertiesName;
+		try {
+			propertiesName = CQPSearchEngine.getCqiClient().corpusPositionalAttributes(this.getMainCorpus().pID);
+		}
+		catch (Exception e) {
+			throw new CqiClientException(e);
+		}
+		
+		List<WordProperty> properties = new ArrayList<>(propertiesName.length);
+		for (int i = 0; i < propertiesName.length; i++) {
+			properties.add(new WordProperty(propertiesName[i], this));
+		}
+		this.lexicalUnitsProperties = properties;
+		return properties;
+	}
+	
+	/*
+	 * (non-Javadoc)
+	 * @see
+	 * org.txm.searchengine.cqp.corpus.Corpus#getProperty(java.lang.
+	 * String)
+	 */
+	public WordProperty getProperty(String name) throws CqiClientException {
+		if (this.lexicalUnitsProperties == null) {
+			getProperties();
+		}
+		
+		int idx = name.indexOf(".");
+		if (idx > 0) { // the name if a qualified name
+			name = name.substring(idx + 1);
+		}
+		
+		if (VirtualProperty.isAVirtualPropertyFullName(name)) {
+			name = VirtualProperty.fullnameToName(name);
+			
+			for (WordProperty property : getVirtualProperties()) {
+				if (property.getName().equals(name)) {
+					return property;
+				}
+			}
+		}
+		else {
+			for (WordProperty property : getProperties()) {
+				if (property.getName().equals(name)) {
+					return property;
+				}
+			}
+		}
+		
+		
+		return null;
+	}
+	
+	@Override
+	public String getSimpleName() {
+		return this.getUserName();
+	}
+	
+	// /* (non-Javadoc)
+	// * @see org.txm.objects.TxmObject#removeChildren(org.txm.objects.TxmObject)
+	// */
+	// @Override
+	// public TxmObject removeChildren(TxmObject children) {
+	// Element preBuildElement =
+	// this.getProject().getProjectParameters().getPreBuildElement();
+	// if (children instanceof Subcorpus) {
+	// try {
+	// if (children.getSelfElement() != null &&
+	// children.getSelfElement().getParentNode() == getSelfElement())
+	// preBuildElement.removeChild(children.getSelfElement());
+	//
+	// if (!dropSubcorpus((Corpus) children)) {
+	// System.out.println("Corpus.removeChildren: dropSubcorpus returned false.");
+	// return null;
+	// }
+	// super.removeChildren(children);
+	// return children;
+	// } catch (CqiClientException e) {
+	// return null;
+	// }
+	// } else if (children instanceof Partition) {
+	// if (children.getSelfElement() != null &&
+	// children.getSelfElement().getParentNode() == getSelfElement()) {
+	// preBuildElement.removeChild(children.getSelfElement());
+	// }
+	// try {
+	// dropPartition((Partition) children);
+	// super.removeChildren(children);
+	// return children;
+	// } catch (CqiClientException e) {
+	// return null;
+	// }
+	//
+	// }
+	// return null;
+	// }
+	
+	// /**
+	// * Send the Corpus indexes to R.
+	// *
+	// * Only the word properties are send.
+	// * TODO: send structural unit properties too
+	// *
+	// * @return the string
+	// * @throws Exception the exception
+	// */
+	// public String SendToR() throws Exception
+	// {
+	// int initialPosition = 0;
+	// if (this.getMatches() != null && this.getMatches().size() > 0)
+	// initialPosition = this.getMatches().get(0).getStart();
+	//
+	// // cols name to export
+	// List<Property> props = this.getProperties();
+	// String[] colnames = new String[this.getProperties().size()];
+	//
+	// // compute positions list
+	// int length = 0;
+	// for (Match match : getMatches()) { // 1) get number of positions
+	// length += match.getLength();
+	// }
+	// int[] positions = new int[length];
+	// int iPosition = 0;
+	// for (Match match : getMatches()) { // 2) append positions
+	// int p_end = match.getEnd();
+	// for (int p = match.getStart() ; p < p_end ; p++)
+	// positions[iPosition] = p;
+	// }
+	//
+	// // 0- create the R object
+	// this.symbol = prefixR + (nocorpus++);
+	// RWorkspace rw = RWorkspace.getRWorkspaceInstance();
+	// rw.eval(symbol +" <- matrix(ncol="+colnames.length+",
+	// nrow="+positions.length+")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+	//
+	// for(int i = 0 ; i < props.size() ; i++) {
+	// Property prop = props.get(i);
+	// colnames[i] = prop.getName();
+	// // send positions to R
+	// int[] idx =
+	// CorpusManager.getCorpusManager().getCqiClient().cpos2Id(prop.getQualifiedName(),
+	// positions);
+	// rw.addVectorToWorkspace("tmp", idx); //$NON-NLS-1$
+	// //if (initialPosition > 0) rw.eval("tmp <- tmp - "+initialPosition);
+	// //System.out.println("lengths "+prop.getName()+" : idx="+idx.length+" mat
+	// "+positions.length);
+	// rw.eval(symbol+"[,"+(i+1)+"] <- tmp"); //$NON-NLS-1$ //$NON-NLS-2$
+	// }
+	//
+	// //set matrix col names
+	// rw.addVectorToWorkspace("tmpcol", colnames); //$NON-NLS-1$
+	// rw.eval("colnames("+symbol+") <- tmpcol"); //$NON-NLS-1$ //$NON-NLS-2$
+	//
+	// rw.eval(symbol+" <- list(data="+symbol+")"); //$NON-NLS-1$ //$NON-NLS-2$
+	//
+	// // create lexicons
+	// for (Property prop : this.getProperties()) {
+	// Lexicon lex = this.getLexicon(prop);
+	// rw.addVectorToWorkspace("tmp", lex.getForms()); //$NON-NLS-1$
+	// rw.eval(symbol+"$lex$"+prop.getName()+" <- tmp"); //$NON-NLS-1$ //$NON-NLS-2$
+	// }
+	//
+	// StructuralUnit text_su = this.getStructuralUnit("text");
+	// if (text_su != null) {
+	// StructuralUnitProperty text_id = text_su.getProperty("id");
+	// if (text_id != null) {
+	// int[] textlimits = this.getTextStartLimits();
+	// rw.addVectorToWorkspace("text_limits", textlimits);
+	// if (initialPosition > 0) rw.eval("text_limits <- text_limits -
+	// "+initialPosition);
+	// rw.eval(symbol+"$structs$text$start <- text_limits"); //$NON-NLS-1$
+	// //$NON-NLS-2$
+	//
+	// textlimits = this.getTextEndLimits();
+	// rw.addVectorToWorkspace("text_limits", textlimits);
+	// if (initialPosition > 0) rw.eval("text_limits <- text_limits -
+	// "+initialPosition);
+	// //System.out.println("lengths "+prop.getName()+" : idx="+idx.length+" mat
+	// "+positions.length);
+	// rw.eval(symbol+"$structs$text$end <- text_limits"); //$NON-NLS-1$
+	// //$NON-NLS-2$
+	// }
+	// }
+	//
+	// return symbol;
+	// }
+	
+	/**
+	 * Gets the CQP size of the corpus.
+	 *
+	 * @return the size
+	 * @throws CqiClientException
+	 *             the cqi client exception
+	 */
+	public abstract int getSize() throws CqiClientException;
+	
+	abstract public int[] getStartLimits(String structural_unit_property) throws IOException, CqiServerError, InvalidCqpIdException, CqiClientException;
+	
+	/**
+	 * Gets a structural unit from its name.
+	 *
+	 * @param name
+	 *            the name
+	 * @return the structural unit
+	 * @throws CqiClientException
+	 *             the cqi client exception
+	 */
+	public abstract StructuralUnit getStructuralUnit(String name) throws CqiClientException;
+	
+	// public List<TXMResult> clearResults() {
+	// List<TXMResult> old = this.children;
+	// this.children = new ArrayList<TXMResult>();
+	// return old;
+	// }
+	
+	// HashMap<Class, HashSet<Object>> storedData = new HashMap<Class,
+	// HashSet<Object>>();
+	
+	/**
+	 * Gets all structural units property of a corpus.
+	 *
+	 * @return the structural unit properties
+	 * @throws CqiClientException
+	 *             the cqi client exception
+	 */
+	public List<StructuralUnitProperty> getStructuralUnitProperties() throws CqiClientException {
+		if (this.structuralUnits == null)
+			getStructuralUnits();
+		
+		List<StructuralUnitProperty> properties = new ArrayList<>();
+		if (this.structuralUnits != null)
+			for (StructuralUnit su : this.structuralUnits)
+			if (su.getOrderedProperties() != null)
+				properties.addAll(su.getProperties());
+		
+		return properties;
+	}
+	
+	/**
+	 * Gets a structural units property of a structural unit by its name.
+	 *
+	 * @param name
+	 *            the name
+	 * @return the structural unit properties
+	 * @throws CqiClientException
+	 *             the cqi client exception
+	 */
+	public List<StructuralUnitProperty> getStructuralUnitProperties(String name) throws CqiClientException {
+		StructuralUnit su = this.getStructuralUnit(name);
+		
+		return su.getOrderedProperties();
+	}
+	
+	// /**
+	// *
+	// * @param o the object to remove
+	// * @return true if o has been removed
+	// */
+	// public boolean removeData(Object o) {
+	// if (storedData.containsKey(o.getClass())) {
+	// return storedData.get(o.getClass()).remove(o);
+	// }
+	// return false;
+	// }
+	
+	/**
+	 * Gets the structural units defined on this corpus.
+	 * 
+	 * @return the structural units
+	 * 
+	 * @throws CqiClientException
+	 *             the cqi client exception
+	 */
+	public abstract List<StructuralUnit> getStructuralUnits() throws CqiClientException;
+	
+	/**
+	 * Gets all the subcorpora defined on a given corpus.
+	 * 
+	 * @return the subcorpora
+	 */
+	public List<Subcorpus> getSubcorpora() {
+		return getChildren(Subcorpus.class);
+	}
+	
+	/**
+	 * Gets the subcorpus by name (e.g /CORPUS/subcorpus)
+	 *
+	 * @param name
+	 *            the name
+	 * @return the subcorpus by name
+	 */
+	public CQPCorpus getSubcorpusByName(String name) {
+		List<Subcorpus> subcorpora = getSubcorpora();
+		for (CQPCorpus corpus : subcorpora) {
+			if (corpus.getName().equals(name)) {
+				return corpus;
+			}
+		}
+		
+		return null;
+	}
+	
+	/**
+	 * Gets the subcorpus by name.
+	 *
+	 * @param name
+	 *            the name
+	 * @return the subcorpus by name
+	 */
+	public CQPCorpus getSubcorpusBySimpleName(String name) {
+		List<Subcorpus> subcorpora = getSubcorpora();
+		for (CQPCorpus corpus : subcorpora) {
+			if (corpus.getSimpleName().equals(name)) {
+				return corpus;
+			}
+		}
+		
+		return null;
+	}
+	
+	/*
+	 * (non-Javadoc)
+	 * @see org.txm.HasResults#getSubHasResults()
+	 */
+	public ArrayList<TXMResult> getSubHasResults() {
+		ArrayList<TXMResult> subresults = new ArrayList<>();
+		subresults.addAll(this.getSubcorpora());
+		subresults.addAll(this.getPartitions());
+		return subresults;
+	}
+	
+	/**
+	 * Gets the R symbol is corpus was sent in R Workspace.
+	 *
+	 * @return the symbol
+	 */
+	public String getSymbol() {
+		return symbol;
+	}
+	
+	/**
+	 * 
+	 * @return the text_id values of the CQP corpus ordered by position
+	 * @throws CqiClientException
+	 * @throws IOException
+	 * @throws CqiServerError
+	 */
+	abstract public String[] getCorpusTextIdsList() throws CqiClientException, IOException, CqiServerError;
+	
+	/**
+	 * Gets the nb texts.
+	 *
+	 * @return the nb texts
+	 * @throws CqiClientException the cqi client exception
+	 * @throws CqiServerError
+	 * @throws IOException
+	 */
+	abstract public int getNbTexts() throws CqiClientException, IOException, CqiServerError;
+	
+	public StructuralUnitProperty getTextIdStructuralUnitProperty() throws CqiClientException {
+		if (textIdStructuralUnitProperty == null) {
+			textIdStructuralUnitProperty = getTextStructuralUnit().getProperty(ID);
+		}
+		return textIdStructuralUnitProperty;
+	}
+	
+	/**
+	 * Return the CQP END positions of the main corpus texts
+	 */
+	abstract public int[] getTextEndLimits() throws CqiClientException, IOException, CqiServerError, InvalidCqpIdException;
+	
+	/**
+	 * Gets the texts ids and order number in corpus.
+	 *
+	 * @return the texts ids
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiServerError the cqi server error
+	 * @throws CqiClientException the cqi client exception
+	 */
+	abstract public HashMap<String, Integer> getTextsIds() throws IOException, CqiServerError, CqiClientException;
+	
+	/**
+	 * Return the CQP START positions of the main corpus texts
+	 */
+	abstract public int[] getTextStartLimits() throws CqiClientException, IOException, CqiServerError, InvalidCqpIdException;
+	
+	public StructuralUnit getTextStructuralUnit() throws CqiClientException {
+		if (textStructuralUnit == null) {
+			textStructuralUnit = getStructuralUnit(TEXT);
+		}
+		return textStructuralUnit;
+	}
+	
+	public WordProperty getWordProperty() throws CqiClientException {
+		if (wordProperty == null)
+			wordProperty = getProperty(WORD);
+		return wordProperty;
+	}
+	
+	/**
+	 * Runs a query on the corpus and store the result in a QueryResult.
+	 * 
+	 * !! each working query is store in the Base of the corpus !!
+	 * 
+	 * @param query
+	 *            the query
+	 * @param queryResultName
+	 *            the resulting subcorpus name
+	 * 
+	 * @return the resulting query result
+	 * 
+	 * @throws CqiClientException
+	 *             the cqi client exception
+	 */
+	public QueryResult query(CQLQuery query, String queryResultName, boolean save) throws CqiClientException {
+		
+		QueryResult queryResult = null;
+		// String queryResultId = queryResultNamePrefix + UUID.randomUUID().toString();
+		String queryResultId = queryResultNamePrefix + getNextQueryCounter();
+		
+		
+		if (query.getQueryString().length() > CQLQuery.MAX_CQL_LENGTH) {
+			try {
+				Log.warning(NLS.bind("Error: CQL length limit reached ({0}) with {1} length.", CQLQuery.MAX_CQL_LENGTH, query.getQueryString().length())); 
+				return new FakeQueryResult(queryResultName, this, query, new int[0], new int[0], new int[0]);
+			}
+			catch (InvalidCqpIdException e) {
+				// TODO Auto-generated catch block
+				e.printStackTrace();
+			}
+		}
+		
+		Log.finest(NLS.bind(TXMCoreMessages.queryOnP0ColonP1InfP2, new String[] { this.getQualifiedCqpId(), queryResultId, query.getQueryString() })); // $NON-NLS-1$
+		// long start = System.currentTimeMillis();
+		try {
+			//CorpusManager.getCorpusManager().getCqiClient().cqpQuery(this.getQualifiedCqpId(), queryResultId, fixedQuery);
+			
+			String q = query.getQueryString();
+			if (q.matches("undump \"[^ ]+\";")) { // undump query
+				String path = q.substring(8, q.length() - 2);
+				if (!new File(path).exists()) {
+					Log.severe(NLS.bind("Error: could not compute subcorpus from the dump file: {0}.", path));
+					return null;
+				}
+				CorpusManager.getCorpusManager().getCqiClient().query(";");
+				CorpusManager.getCorpusManager().getCqiClient().query("undump "+queryResultId+" < "+q.substring(7));
+			} else if (q.matches("(union|join|intersect|inter|difference|diff) [^ ]+ [^ ]+;")) {
+				CorpusManager.getCorpusManager().getCqiClient().query(";");
+				CorpusManager.getCorpusManager().getCqiClient().query(queryResultId+" = "+q);
+			} else {
+				//String fixedQuery = CQLQuery.fixQuery(query.getQueryString());
+				CorpusManager.getCorpusManager().getCqiClient().cqpQuery(this.getQualifiedCqpId(), queryResultId, CQLQuery.fixQuery(query.getQueryString(), this.getLang()));
+			}
+			
+			queryResult = new QueryResult(queryResultId, queryResultName, this, query);
+			
+			// if (save) {
+			// new SavedQuery(this).setParameters(query.toString(), new
+			// ArrayList<String>());
+			// }
+		}
+		catch (Exception e) {
+			org.txm.utils.logger.Log.printStackTrace(e);
+			String error = "???";
+			try {
+				error = CorpusManager.getCorpusManager().getCqiClient().getLastCQPError();
+			} catch (Exception e1) {
+				Log.severe(e1);
+			}
+			throw new CqiClientException(error);
+		}
+		// long end = System.currentTimeMillis();
+		// Log.finest(Messages.RETURN_FROM_QUERY+ " " + queryResult.getNMatch() + " " +
+		// (end - start)); //$NON-NLS-1$ //$NON-NLS-2$
+		
+		return queryResult;
+	}
+	
+	/**
+	 * Sets the corpus charset name, to be able to print it well.
+	 *
+	 * @param corpusCharset
+	 *            the new charset
+	 */
+	public void setCharset(String corpusCharset) {
+		this.charset = corpusCharset;
+	}
+	
+	/**
+	 * Set the corpus language name, to be able to sort it well.
+	 *
+	 * @param corpusLanguage
+	 *            the new language
+	 */
+	public void setLanguage(String corpusLanguage) {
+		this.lang = corpusLanguage;
+	}
+	
+	public Property getVirtualProperty(String s) {
+		if (s == null || s.length() == 0) {
+			return null;
+		}
+		
+		for (VirtualProperty p : this.getVirtualProperties()) {
+			if (s.equals(p.getName())) {
+				return p;
+			}
+		}
+		
+		return null;
+	}
+	
+	/**
+	 * parse a "struct_prop" property name to find the matching StructuralUnitProperty
+	 * 
+	 * @param p
+	 * @return
+	 */
+	public StructuralUnitProperty getStructuralUnitProperty(String p) {
+		
+		try {
+			return StructuralUnitProperty.stringToStructuralUnitProperty(this, p);
+		}
+		catch (CqiClientException e) {
+			e.printStackTrace();
+			return null;
+		}
+	}
+}

Property changes on: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/CQPCorpus.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/WordProperty.java
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/WordProperty.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/WordProperty.java	(revision 3659)
@@ -0,0 +1,147 @@
+package org.txm.searchengine.cqp.corpus;
+
+import java.io.IOException;
+import java.util.List;
+
+import org.txm.searchengine.cqp.clientExceptions.UnexpectedAnswerException;
+import org.txm.searchengine.cqp.corpus.query.CQLQuery;
+import org.txm.searchengine.cqp.corpus.query.MatchUtils;
+import org.txm.searchengine.cqp.serverException.CqiServerError;
+
+/**
+ * A CQP property at token/word level
+ * 
+ * @author mdecorde
+ *
+ */
+public class WordProperty extends Property {
+	
+	/**
+	 * Creates a new WordProperty.
+	 * 
+	 * @param name
+	 * @param corpus
+	 */
+	protected WordProperty(String name, CQPCorpus corpus) {
+		super(name, corpus);
+	}
+	
+	@Override
+	public String getFullName() {
+		return getName();
+	}
+	
+	
+	/**
+	 * Creates a readable formated string from the specified properties list.
+	 * 
+	 * @param properties
+	 * @return
+	 */
+	public static String asString(List<WordProperty> properties) {
+		
+		String str = "";
+		for (int i = 0; i < properties.size(); i++) {
+			if (i > 0) {
+				str += "_";
+			}
+			str += properties.get(i).getFullName();
+		}
+		return "@" + str;
+	}
+	
+	/**
+	 * 
+	 * @param positions
+	 * @return the values for the property's corpus positions
+	 * @throws UnexpectedAnswerException
+	 * @throws IOException
+	 * @throws CqiServerError
+	 */
+	public int[] cpos2Id(int[] positions) throws UnexpectedAnswerException, IOException, CqiServerError {
+		return CorpusManager.getCorpusManager().getCqiClient().cpos2Id(this.getQualifiedName(), positions);
+	}
+	
+	public String cpos2Str(int position) throws UnexpectedAnswerException, IOException, CqiServerError {
+		return CorpusManager.getCorpusManager().getCqiClient().cpos2Str(this.getQualifiedName(), new int[] { position })[0];
+	}
+	
+	public String[] cpos2Str(int[] positions) throws UnexpectedAnswerException, IOException, CqiServerError {
+		return CorpusManager.getCorpusManager().getCqiClient().cpos2Str(this.getQualifiedName(), positions);
+	}
+	
+	public String[] id2Str(int[] ids) throws UnexpectedAnswerException, IOException, CqiServerError {
+		return CorpusManager.getCorpusManager().getCqiClient().id2Str(this.getQualifiedName(), ids);
+	}
+	
+	public int[] str2Id(String[] values) throws UnexpectedAnswerException, IOException, CqiServerError {
+		return CorpusManager.getCorpusManager().getCqiClient().str2Id(this.getQualifiedName(), values);
+	}
+	
+	public int[] regex2Id(String regex) throws UnexpectedAnswerException, IOException, CqiServerError {
+		return CorpusManager.getCorpusManager().getCqiClient().regex2Id(this.getQualifiedName(), regex);
+	}
+	
+	public int str2Id(String value) throws UnexpectedAnswerException, IOException, CqiServerError {
+		return CorpusManager.getCorpusManager().getCqiClient().str2Id(this.getQualifiedName(), new String[] { value })[0];
+	}
+	
+	/**
+	 * 
+	 * @param value
+	 * @return the CQL inner word test in [] for a value
+	 */
+	public String getCQLTest(String value) {
+		
+		return this.getName() + "=\"" + CQLQuery.addBackSlash(value) + "\"";
+	}
+	
+	/**
+	 * 
+	 * @param value
+	 * @return the CQL inner word test in [] for several values
+	 */
+	public String getCQLTest(List<String> values) {
+		
+		StringBuilder sb = new StringBuilder();
+		sb.append(this.getName() + "=\""); //$NON-NLS-1$
+		for (int i = 0; i < values.size(); i++) {
+			String s = values.get(i);
+			s = CQLQuery.addBackSlash(s);
+			sb.append(s);
+			if (i < values.size() - 1) {
+				sb.append("|"); //$NON-NLS-1$
+			}
+		}
+		sb.append("\"");
+		return sb.toString();
+	}
+	
+	/**
+	 * 
+	 * @return all indexed values in the main corpus 
+	 * 
+	 * @throws UnexpectedAnswerException
+	 * @throws IOException
+	 * @throws CqiServerError
+	 */
+	public String[] getValues() throws UnexpectedAnswerException, IOException, CqiServerError {
+		
+		int n = CorpusManager.getCorpusManager().getCqiClient().lexiconSize(this.getQualifiedName());
+		int[] ids = MatchUtils.toPositions(0, n - 1);
+		return CorpusManager.getCorpusManager().getCqiClient().id2Str(this.getQualifiedName(), ids);
+	}
+	
+	/**
+	 * 
+	 * @return the number of indexed values in the main corpus 
+	 * 
+	 * @throws UnexpectedAnswerException
+	 * @throws IOException
+	 * @throws CqiServerError
+	 */
+	public int getNValues() throws UnexpectedAnswerException, IOException, CqiServerError {
+		
+		return CorpusManager.getCorpusManager().getCqiClient().lexiconSize(this.getQualifiedName());
+	};
+}

Property changes on: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/WordProperty.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/MainCorpus.java
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/MainCorpus.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/MainCorpus.java	(revision 3659)
@@ -0,0 +1,757 @@
+// Copyright © 2010-2020 ENS de Lyon., University of Franche-Comté
+// 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: 2017-01-24 18:11:42 +0100 (Tue, 24 Jan 2017) $
+// $LastChangedRevision: 3400 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.searchengine.cqp.corpus;
+
+import java.io.File;
+import java.io.IOException;
+import java.text.NumberFormat;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.UUID;
+
+import org.apache.commons.lang.StringUtils;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.osgi.util.NLS;
+import org.txm.Toolbox;
+import org.txm.core.messages.TXMCoreMessages;
+import org.txm.core.results.TXMParameters;
+import org.txm.importer.cwb.PatchCwbRegistry;
+import org.txm.importer.cwb.ReadRegistryFile;
+import org.txm.objects.CorpusBuild;
+import org.txm.objects.Project;
+import org.txm.objects.Text;
+import org.txm.searchengine.core.messages.SearchEngineCoreMessages;
+import org.txm.searchengine.cqp.AbstractCqiClient;
+import org.txm.searchengine.cqp.CQPSearchEngine;
+import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
+import org.txm.searchengine.cqp.clientExceptions.InvalidCqpIdException;
+import org.txm.searchengine.cqp.corpus.query.CQLQuery;
+import org.txm.searchengine.cqp.corpus.query.Match;
+import org.txm.searchengine.cqp.serverException.CqiServerError;
+import org.txm.utils.DeleteDir;
+import org.txm.utils.TXMProgressMonitor;
+import org.txm.utils.logger.Log;
+import org.w3c.dom.Element;
+
+/**
+ * The Class MainCorpus for mirroring CQP corpora.
+ *
+ * @author jmague, mdecorde
+ */
+public class MainCorpus extends CQPCorpus {
+	
+	protected File cqpFile;
+	
+	protected File dataDirectory;
+	
+	protected boolean modified = false;
+	
+	protected File registryFile;
+	
+	/**
+	 * CQP text ids cache
+	 */
+	protected String[] cqpTextIDS = null;
+	
+	/**
+	 * <del>Instantiates a new sub corpus</del>
+	 * 
+	 * @param partition the parent partition -> only used for subcorpus
+	 */
+	// FIXME: SJ: not used anymore? MD: this is a temporary solution to build Parts using a Partition (a Part is a CQPCorpus, etc.)
+	public MainCorpus(Partition partition) {
+		super(partition);
+		throw new IllegalArgumentException("Maincorpus parent must not be a Partition");
+	}
+	
+	/**
+	 * Instantiates a new corpus. This constructor is not intended to be used
+	 * directly. Use {@link CorpusManager#getCorpus(String)}.
+	 * 
+	 * @param pID the cqp id
+	 * 
+	 * @throws InvalidCqpIdException the invalid cqp id exception
+	 * @throws CqiClientException the cqi client exception
+	 */
+	public MainCorpus(Project project) throws InvalidCqpIdException, CqiClientException {
+		super(project);
+	}
+	
+	/**
+	 * Instantiates a new corpus. This constructor is not intended to be used
+	 * directly. Use {@link CorpusManager#getCorpus(String)}.
+	 * 
+	 * @param parametersNodePath the preference node path
+	 * 
+	 * @throws InvalidCqpIdException the invalid CQP id exception
+	 * @throws CqiClientException the cqi client exception
+	 */
+	public MainCorpus(String parametersNodePath) throws InvalidCqpIdException, CqiClientException {
+		super(parametersNodePath);
+		
+		if (getID() != null && getProjectDirectory() != null) {
+			try {
+				if (!compute(false)) {
+					Log.warning(NLS.bind("Warning: the {0} corpus won't work correctly", this.getID()));
+					throw new IllegalStateException(NLS.bind("{0} CQP MainCorpus not instanciate correctly.", this.getID()));
+				}
+			}
+			catch (InterruptedException e) {
+				throw new IllegalStateException(e);
+			}
+		}
+	}
+	
+	@Override
+	protected boolean __compute(TXMProgressMonitor monitor) throws Exception {
+		
+		if (!CQPSearchEngine.isInitialized()) {
+			Log.warning("** TXM can't load MainCorpus when CQP search engine is not ready.");
+			return false;
+		}
+		
+		if (this.pID == null || this.pID.length() == 0) {
+			Log.severe("** TXM can't load this MainCorpus: no CQP ID set.");
+			return false;
+		}
+		
+		HashMap<String, MainCorpus> corpora = CorpusManager.getCorpusManager().getCorpora();
+		if (CorpusManager.getCorpusManager().hasCorpus(this)) {
+			Log.fine(NLS.bind("** The \"{0}\" MainCorpus object in the \"{1}\" project can not be computed: another one with the same CQP identifier has already been computed.",
+					this.pID, this.getProjectDirectory()));
+			return true;
+		}
+		CorpusManager.getCorpusManager().add(this);
+		
+		cqpTextIDS = null; // reset CQP text ids
+		
+		this.dataDirectory = new File(getProjectDirectory(), "data/" + getID());
+		this.registryFile = new File(getProjectDirectory(), "registry/" + getID().toLowerCase());
+		
+		if (!dataDirectory.exists()) {
+			Log.warning("MainCorpus data files not found: " + dataDirectory);
+			return false;
+		}
+		if (!registryFile.exists()) {
+			Log.warning("MainCorpus registry file not found: " + registryFile);
+			return false;
+		}
+		try {
+			try { // fix the absolute paths in the registry file
+				PatchCwbRegistry.patch(this.registryFile, this.dataDirectory);
+			}
+			catch (IOException e) {
+				Log.severe(TXMCoreMessages.bind("Error while updating the {0} registry file.", this.registryFile));
+				Log.printStackTrace(e);
+				return false;
+			}
+			
+			// check if all corpus index files are present
+			ReadRegistryFile rrf = new ReadRegistryFile(this.registryFile);
+			ArrayList<String> errors = rrf.isCorpusBuildValid(this.dataDirectory);
+			if (errors.size() > 0) {
+				Log.warning(TXMCoreMessages.bind("Error: some {0} index files are missing : {1}.", this.getID(), StringUtils.join(errors, ", ")));
+				return false;
+			}
+			
+			Log.fine(NLS.bind("Call CQI: load_a_system_corpus with {0} and {1}", this.registryFile.getParent(), this.pID));
+			if (!CQPSearchEngine.getCqiClient().load_a_system_corpus(this.registryFile.getParent(), this.pID)) {
+				Log.warning(TXMCoreMessages.bind("Error: CQI.load_a_system_corpus failed with id={0} and registry={1}", this.getID(), this.registryFile));
+				return false;
+			}
+			
+			List<String> tmp = Arrays.asList(CQPSearchEngine.getCqiClient().listCorpora());
+			if (tmp.contains(this.pID)) {
+				Log.fine("Corpus registered: " + pID);
+				Log.fine(NLS.bind("Call CQI: corpusProperties with {0}.", this.pID));
+				try {
+					String[] props = CQPSearchEngine.getCqiClient().corpusProperties(this.pID);
+					Log.fine(NLS.bind("Corpus {0} loaded with properties: {1}.", pID, Arrays.asList(props)));
+				}
+				catch (Exception e) {
+					Log.warning(TXMCoreMessages.bind("Error while loading the {0} corpus: ", pID, e.getMessage()));
+					return false;
+				}
+			}
+			else {
+				Log.severe(TXMCoreMessages.bind("Error while loading the {0} corpus. Not found in {1}", this.pID, tmp));
+				return false;
+			}
+			
+			corpora.put(this.pID, this); // register the corpus
+		}
+		catch (Exception e) {
+			Log.severe("MainCorpus not loaded: " + e);
+			if (corpora.get(this.pID) == this) {
+				corpora.remove(this.pID); // unregister the broken corpus
+			}
+			return false;
+		}
+		
+//		// tests to enable CQP dynamic editions		
+//		if (!this.getProject().hasEditionDefinition("cqp")) {
+//			this.getProject().getEditionDefinition("cqp").setPageBreakTag("p");
+//			this.getProject().getEditionDefinition("cqp").setBuildEdition(true);
+//		}
+//		for (Text t : this.getProject().getTexts()) {
+//			List<CQPEdition> cqpedition = t.getChildren(CQPEdition.class);
+//			if (cqpedition.size() == 0) {
+//				CQPEdition e = new CQPEdition(t);
+//				e.saveParameters();
+//				e.compute();
+//			}
+//		}
+		
+		return true;
+	}
+	
+	
+	@Override
+	public String getComputingStartMessage() {
+		if (Log.isLoggingFineLevel()) {
+			return TXMCoreMessages.bind(SearchEngineCoreMessages.info_computingCorpusP0, this.getName());
+		}
+		else {
+			return ""; //$NON-NLS-1$
+		}
+	}
+	
+	
+	@Override
+	public String getComputingDoneMessage() {
+		if (Log.isLoggingFineLevel()) {
+			return super.getComputingDoneMessage();
+		}
+		else {
+			return ""; //$NON-NLS-1$
+		}
+	}
+	
+	
+	
+	@Override
+	public void onProjectClose() {
+		try {
+			if (this.hasBeenComputedOnce() && this.pID != null) {
+				CorpusManager.getCorpusManager().deleteCorpus(this);
+			}
+		}
+		catch (Exception e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+	}
+	
+	/*
+	 * (non-Javadoc)
+	 * @see org.txm.searchengine.cqp.corpus.Corpus#load()
+	 */
+	@Override
+	public boolean _load(Element e) {
+		boolean ret = super._load(e);
+		
+		return ret;
+	}
+	
+	
+	@Override
+	public boolean canCompute() throws Exception {
+		return this.pID != null && this.pID.length() > 0;
+	}
+	
+	/**
+	 * Check whether the ID is a valid CQP ID.
+	 * 
+	 * @param pID
+	 *            the cqp id
+	 * 
+	 * @return true, if pID is a valid CQP ID.
+	 * 
+	 * @throws InvalidCqpIdException
+	 *             the invalid cqp id exception
+	 */
+	@Override
+	public boolean checkCqpId(String pID) throws InvalidCqpIdException {
+		if (!pID.equals(pID.toUpperCase()))
+			throw new InvalidCqpIdException(pID + TXMCoreMessages.isNotAValidCQPIDForACorpusItMustBeInUppercaseCharacters);
+		return true;
+	}
+	
+	@Override
+	public void clean() {
+		super.clean();
+		
+		if (CorpusManager.getCorpusManager().getCorpora().get(this.pID) == this) { // unregister the MainCorpus
+			CorpusManager.getCorpusManager().getCorpora().remove(this.pID);
+		}
+		
+		try {
+			if (CQPSearchEngine.isInitialized()) {
+				CQPSearchEngine.getCqiClient().dropCorpus(getID());
+			}
+		}
+		catch (Exception e) {
+			Log.fine(e.getLocalizedMessage());
+			// Log.printStackTrace(e);
+		}
+		
+		if (dataDirectory != null) {
+			DeleteDir.deleteDirectory(dataDirectory);
+		}
+		if (registryFile != null) {
+			registryFile.delete();
+		}
+		
+		Toolbox.notifyEngines(this, "clean");
+		
+		cqpFile = null;
+		
+		dataDirectory = null;
+		nbtext = -1;
+		registryFile = null;
+		textEndLimits = null;
+		textids = null;
+	}
+	
+	public boolean equals(MainCorpus corpus) {
+		if (corpus == null) return false;
+		return this.getQualifiedCqpId().equals(corpus.getQualifiedCqpId());
+	}
+	
+	/**
+	 * Find text no.
+	 *
+	 * @param textid the textid
+	 * @return the int
+	 * @throws CqiClientException the cqi client exception
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiServerError the cqi server error
+	 */
+	public int findTextNo(String textid) throws CqiClientException, IOException, CqiServerError {
+		HashMap<String, Integer> idsmap = this.getTextsIds();
+		if (idsmap.containsKey(textid))
+			return idsmap.get(textid);
+		else
+			return -1;
+	}
+	
+	@Override
+	public String getDetails() {
+		try {
+			return this.getName() + " T=" + NumberFormat.getInstance().format(this.getSize());
+		}
+		catch (CqiClientException e) {
+			return "corpus not ready.";
+		}
+	}
+	
+	/**
+	 * Gets the first position.
+	 *
+	 * @return the first position
+	 */
+	public int getFirstPosition() {
+		return 0;
+	}
+	
+	/**
+	 * Gets the full name.
+	 * 
+	 * @return the full name
+	 * 
+	 * @throws CqiClientException
+	 *             the cqi client exception
+	 */
+	public String getFullName() throws CqiClientException {
+		try {
+			return CorpusManager.getCorpusManager().getCqiClient().corpusFullName(this.pID);
+		}
+		catch (Exception e) {
+			throw new CqiClientException(e);
+		}
+		
+	}
+	
+	@Override
+	public List<Match> getMatches() {
+		List<Match> rez = new ArrayList<>();
+		try {
+			rez.add(new Match(0, this.getSize() - 1));
+			return rez;
+		}
+		catch (CqiClientException e) {
+			org.txm.utils.logger.Log.printStackTrace(e);
+		}
+		return null;
+	}
+	
+	public int getNMatch() {
+		return 1;
+	}
+	
+	/*
+	 * (non-Javadoc)
+	 * @see
+	 * org.txm.searchengine.cqp.corpus.CqpObject#getQualifiedCqpId()
+	 */
+	@Override
+	public String getQualifiedCqpId() {
+		return pID;
+	}
+	
+	@Override
+	public String getResultType() {
+		return "Corpus";
+	}
+	
+	@Override
+	public String getSimpleName() {
+		if (modified) {
+			return getName() + "*"; //$NON-NLS-1$
+		}
+		else {
+			return getName();
+		}
+	}
+	
+	/*
+	 * (non-Javadoc)
+	 * @see org.txm.searchengine.cqp.corpus.Corpus#getSize()
+	 */
+	@Override
+	public int getSize() throws CqiClientException {
+		if (!this.hasBeenComputedOnce()) return 0;
+		
+		if (this.size == -1) {
+			try {
+				this.size = CorpusManager.getCorpusManager().getCqiClient()
+						.attributeSize(this.pID + ".word"); //$NON-NLS-1$
+			}
+			catch (Exception e) {
+				throw new CqiClientException(e);
+			}
+		}
+		return this.size;
+	}
+	
+	/**
+	 * Return the CQP START positions of the result matches of the 'cql_limit' query
+	 */
+	@Override
+	public int[] getStartLimits(String cql_limit) throws IOException, CqiServerError, InvalidCqpIdException, CqiClientException {
+		String queryResultId = queryResultNamePrefix + UUID.randomUUID().toString();
+		CorpusManager.getCorpusManager().getCqiClient().cqpQuery(
+				this.getQualifiedCqpId(), queryResultId, CQLQuery.fixQuery(cql_limit, this.getLang())); // $NON-NLS-1$
+		QueryResult queryResult = new QueryResult(queryResultId, queryResultId, this, new CQLQuery(cql_limit));
+		
+		int[] rez = queryResult.getStarts();
+		queryResult.drop();
+		return rez;
+	}
+	
+	
+	/*
+	 * (non-Javadoc)
+	 * @see
+	 * org.txm.searchengine.cqp.corpus.Corpus#getStructuralUnit(java
+	 * .lang.String)
+	 */
+	@Override
+	public StructuralUnit getStructuralUnit(String name) throws CqiClientException {
+		if (this.structuralUnits == null) {
+			getStructuralUnits();
+		}
+		for (StructuralUnit unit : this.structuralUnits) {
+			if (unit.getName().equals(name)) {
+				return unit;
+			}
+		}
+		return null;
+	}
+	
+	/**
+	 * Gets the structural attributes available in this corpus.
+	 * 
+	 * @return the properties
+	 * 
+	 * @throws CqiClientException
+	 *             the cqi client exception
+	 */
+	@Override
+	public List<StructuralUnit> getStructuralUnits() throws CqiClientException {
+		if (this.structuralUnits != null)
+			return this.structuralUnits;
+		
+		// get structures' name
+		Set<String> cqpNames;
+		try {
+			String[] names = CorpusManager.getCorpusManager().getCqiClient()
+					.corpusStructuralAttributes(this.pID);
+			cqpNames = new HashSet<>(Arrays.asList(names));
+		}
+		catch (Exception e) {
+			throw new CqiClientException(e);
+		}
+		// What we call a structural unit is called a structural attribute by
+		// cqp and what we call
+		// an attribute of a strucutural unit has no corresponding concept in
+		// cqp :
+		// if a structural unit, say 's', has 2 attributes, say 'n' and
+		// 'length', the 2 attributes
+		// are stored by cqp as embedded structural units names 's_n' and
+		// 's_length' (see the cqp documentation)
+		// Here, we go through all the structural attribute known by cqp to
+		// decide which is a structural unit and which
+		// an attribute of a structural unit
+		
+		Map<String, List<String>> attributes = new HashMap<>();
+		
+		for (String name : cqpNames) {
+			if (!attributes.containsKey(name)) {
+				int ex = name.lastIndexOf("_"); //$NON-NLS-1$
+				if (ex == -1 || !cqpNames.contains(name.substring(0, ex))) {
+					attributes.put(name, new ArrayList<String>());
+				}
+				else {
+					String unitName = name.substring(0, ex);
+					String attributeName = name.substring(ex + 1);
+					if (!attributes.containsKey(unitName)) {
+						attributes.put(unitName, new ArrayList<String>());
+					}
+					attributes.get(unitName).add(attributeName);
+				}
+			}
+		}
+		
+		this.structuralUnits = new ArrayList<>();
+		for (String strucuralUnit : attributes.keySet())
+			this.structuralUnits.add(new StructuralUnit(strucuralUnit,
+					attributes.get(strucuralUnit), this));
+		
+		return this.structuralUnits;
+	}
+	
+	
+	public boolean isModified() {
+		return modified;
+	}
+	
+	@Override
+	public boolean loadParameters() throws Exception {
+		return true;
+	}
+	
+	@Override
+	public boolean saveParameters() throws Exception {
+		return true;
+	}
+	
+	@Override
+	protected void setID(String id) {
+		this.pID = id;
+	}
+	
+	@Override
+	public void setIsModified(boolean b) {
+		modified = b;
+	}
+	
+	@Override
+	public void setName(String name) {
+		this.setUserName(name);
+	}
+	
+	@Override
+	public boolean setParameters(TXMParameters parameters) throws Exception {
+		return true;
+	}
+	
+	/*
+	 * (non-Javadoc)
+	 * @see java.lang.Object#toString()
+	 */
+	@Override
+	public String toString() {
+		return this.pID;
+	}
+	
+	@Override
+	public boolean _toTxt(File arg0, String arg1, String arg2, String arg3) throws Exception {
+		// TODO Auto-generated method stub
+		return true;
+	}
+	
+	@Override
+	public CorpusBuild getRootCorpusBuild() {
+		return this;
+	}
+	
+	/**
+	 * Return the CQP START positions of the main corpus texts
+	 */
+	@Override
+	public int[] getTextStartLimits() throws CqiClientException, IOException, CqiServerError, InvalidCqpIdException {
+		if (textLimits == null) {
+			textLimits = getStartLimits("<text>[]");
+		}
+		return textLimits;
+	}
+	
+	/**
+	 * Return the CQP END positions of the main corpus texts
+	 */
+	@Override
+	public int[] getTextEndLimits() throws CqiClientException, IOException, CqiServerError, InvalidCqpIdException {
+		if (textEndLimits == null) {
+			String queryResultId = queryResultNamePrefix + UUID.randomUUID().toString();
+			CorpusManager.getCorpusManager().getCqiClient().cqpQuery(
+					this.getQualifiedCqpId(), queryResultId, "<text>[] expand to text"); //$NON-NLS-1$
+			QueryResult queryResult = new QueryResult(queryResultId, queryResultId, this, new CQLQuery("<text>[] expand to text")); //$NON-NLS-1$
+			textEndLimits = queryResult.getEnds();
+		}
+		return textEndLimits;
+	}
+	
+	/**
+	 * Gets the nb texts.
+	 *
+	 * @return the nb texts
+	 * @throws CqiClientException the cqi client exception
+	 * @throws CqiServerError
+	 * @throws IOException
+	 */
+	@Override
+	public int getNbTexts() throws CqiClientException, IOException, CqiServerError {
+		if (nbtext == -1) {
+			StructuralUnit text_su = this.getStructuralUnit("text"); //$NON-NLS-1$
+			StructuralUnitProperty text_id_sup = text_su.getProperty("id"); //$NON-NLS-1$
+			nbtext = CorpusManager.getCorpusManager().getCqiClient().attributeSize(text_id_sup.getQualifiedName());
+		}
+		return nbtext;
+	}
+	
+	/**
+	 * 
+	 * @return the text_id values of the CQP corpus ordered by position
+	 * @throws CqiClientException
+	 * @throws IOException
+	 * @throws CqiServerError
+	 */
+	@Override
+	public String[] getCorpusTextIdsList() throws CqiClientException, IOException, CqiServerError {
+		if (cqpTextIDS == null) {
+			
+			int nbtext = getNbTexts();
+			int[] structs = new int[nbtext];
+			for (int i = 0; i < nbtext; i++) {
+				structs[i] = i;
+			}
+			StructuralUnit text_su = this.getStructuralUnit("text"); //$NON-NLS-1$
+			StructuralUnitProperty text_id_sup = text_su.getProperty("id"); //$NON-NLS-1$
+			
+			cqpTextIDS = CorpusManager.getCorpusManager().getCqiClient().struc2Str(text_id_sup.getQualifiedName(), structs);
+		}
+		return cqpTextIDS;
+	}
+	
+	/**
+	 * Gets the texts ids and order number in corpus.
+	 *
+	 * @return the texts ids
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiServerError the cqi server error
+	 * @throws CqiClientException the cqi client exception
+	 */
+	@Override
+	public HashMap<String, Integer> getTextsIds() throws IOException, CqiServerError, CqiClientException {
+		if (textids == null) {
+			textids = new HashMap<>();
+			int nbtext = getNbTexts();
+			int[] structs = new int[nbtext];
+			for (int i = 0; i < nbtext; i++)
+				structs[i] = i;
+			
+			StructuralUnit text_su = this.getStructuralUnit("text"); //$NON-NLS-1$
+			StructuralUnitProperty text_id_sup = text_su.getProperty("id"); //$NON-NLS-1$
+			
+			String[] ids = CorpusManager.getCorpusManager().getCqiClient().struc2Str(text_id_sup.getQualifiedName(), structs);
+			for (int i = 0; i < ids.length; i++) {
+				textids.put(ids[i], structs[i]);
+			}
+		}
+		return textids;
+	}
+	
+	public File getRegistryFile() {
+		return registryFile;
+	}
+	
+	public File getDataDirectory() {
+		return dataDirectory;
+	}
+
+	@Override
+	public List<String> isBuildValid() {
+		
+		LinkedList<String> errors = new LinkedList<>();
+		
+		if (!dataDirectory.exists()) {
+			errors.add("no data directory: "+dataDirectory);
+		}
+		
+		//File registryFile = new File(this.registryFile);
+		if (!registryFile.exists()) {
+			errors.add("no registry file: "+registryFile);
+		}
+		
+		errors.addAll(new ReadRegistryFile(registryFile).isCorpusBuildValid(dataDirectory));
+		
+		return errors;
+	}
+
+	@Override
+	public String isReady() {
+		
+		if (!hasBeenComputedOnce()) return "the Maincorpus is not a computed TXMResult";
+		
+		try {
+			int s = this.getSize();
+			if (s >= 0) return null;
+			return "negative size";
+		}
+		catch (CqiClientException e) {
+			return e.getMessage();
+		}
+	}
+}

Property changes on: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/MainCorpus.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/Alignement.java
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/Alignement.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/Alignement.java	(revision 3659)
@@ -0,0 +1,273 @@
+package org.txm.searchengine.cqp.corpus;
+
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.List;
+
+import org.txm.Toolbox;
+import org.txm.objects.Edition;
+import org.txm.objects.Page;
+import org.txm.searchengine.cqp.CQPSearchEngine;
+import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
+import org.txm.searchengine.cqp.clientExceptions.InvalidCqpIdException;
+import org.txm.searchengine.cqp.corpus.query.Match;
+import org.txm.searchengine.cqp.corpus.query.CQLQuery;
+import org.txm.searchengine.cqp.serverException.CqiServerError;
+
+public class Alignement {
+	protected String from;
+	protected String to;
+	protected String struct;
+	protected int level;
+
+	public Alignement(String from , String to, String struct, int level)
+	{
+		this.from = from;
+		this.to = to;
+		this.struct = struct;
+		this.level = level;
+		if(level > 1)
+			this.struct = this.struct + level;
+	}
+
+	public Alignement(String from , String to)
+	{
+		this(from, to, "w", 1);
+	}
+
+	public Alignement(String from, String to, String struct)
+	{
+		this(from, to, struct, 1);
+	}
+
+	/**
+	 * 
+	 * @param wordid
+	 * @param txtid
+	 * @return the word id and text id of the [to] corpus.
+	 * @throws CqiClientException
+	 * @throws InvalidCqpIdException
+	 * @throws IOException
+	 * @throws CqiServerError
+	 */
+	public List<String> resolve(String wordid, String textid) throws CqiClientException, InvalidCqpIdException, IOException, CqiServerError
+	{
+		System.out.println("resolve "+wordid+" "+textid+" "+struct);
+		CQPCorpus src = CorpusManager.getCorpusManager().getCorpus(from);
+		StructuralUnitProperty align_src = src.getStructuralUnit(struct).getProperty("align");
+		
+		CQPCorpus dest = CorpusManager.getCorpusManager().getCorpus(to);
+		Property id_dest = dest.getProperty("id");
+		StructuralUnitProperty text_dest = dest.getStructuralUnit("text").getProperty("id");
+
+		if (struct.equals("w"))
+		{
+			QueryResult rez = src.query(new CQLQuery("[_.text_id=\""+textid+"\" & id=\""+wordid+"\"]"), "Align", false);
+			int[] position = {rez.getMatch(0).getStart()};
+			int[] struct_align_pos = CQPSearchEngine.getCqiClient().cpos2Struc(align_src.getQualifiedName(), position);
+			String[] struct_align_str = CQPSearchEngine.getCqiClient().struc2Str(align_src.getQualifiedName(), struct_align_pos);
+			if(struct_align_str.length > 0)
+			{
+				String aligned_struct = struct_align_str[0]; // the struct align value
+				// get the position of the first token of this struct
+				QueryResult rez2 = dest.query(new CQLQuery("<"+struct+"_align=\""+aligned_struct+"\">[]"), "Align", false);
+				int[] position2 = {rez2.getMatch(0).getStart()};
+				// get the id of this position
+				int[] struct_text_pos = CQPSearchEngine.getCqiClient().cpos2Struc(text_dest.getQualifiedName(), position2);
+				String[] struct_text_str = CQPSearchEngine.getCqiClient().struc2Str(text_dest.getQualifiedName(), struct_text_pos);
+				return Arrays.asList(wordid, struct_text_str[0]);
+			}
+			else
+			{
+				return null;
+			}
+		}
+		else
+		{
+			//get the position for the word id and the text
+			String query = "[_.text_id=\""+textid+"\" & id=\""+wordid+"\"]";
+			//System.out.println("query: "+query);
+			QueryResult rez = src.query(new CQLQuery(query), "Align", false);
+			//System.out.println(rez.getMatches());
+			int[] position = {rez.getMatch(0).getStart()};
+			//get the struct@align value for this position
+			int[] struct_align_pos = CQPSearchEngine.getCqiClient().cpos2Struc(align_src.getQualifiedName(), position);
+			String[] struct_align_str = CQPSearchEngine.getCqiClient().struc2Str(align_src.getQualifiedName(), struct_align_pos);
+			if(struct_align_str.length > 0)
+			{
+				String aligned_struct = struct_align_str[0]; // the struct align value
+				// get the position of the first token of this struct
+				query = "<"+struct+"_align=\""+aligned_struct+"\">[]";
+				QueryResult rez2 = dest.query(new CQLQuery(query), "Align", false);
+				int[] position2 = {rez2.getMatch(0).getStart()};
+				// get the id of this position
+				String[] ids = CQPSearchEngine.getCqiClient().cpos2Str(id_dest.getQualifiedName(), position2);
+
+				if(ids.length > 0)
+				{
+					int[] struct_text_pos = CQPSearchEngine.getCqiClient().cpos2Struc(text_dest.getQualifiedName(), position2);
+					String[] struct_text_str = CQPSearchEngine.getCqiClient().struc2Str(text_dest.getQualifiedName(), struct_text_pos);
+					return Arrays.asList(ids[0], struct_text_str[0]);
+				}
+				else
+					return null;
+			}
+			else
+			{
+				return null;
+			}
+		}
+	}
+
+	public List<String> resolve(Page p) throws CqiClientException, InvalidCqpIdException, IOException, CqiServerError
+	{	
+		System.out.println("resolve "+p);
+		return resolve(p.getWordId(), p.getEdition().getText().getName());
+	}
+	
+	public List<String> resolve(Match match) throws IOException, CqiServerError, CqiClientException, InvalidCqpIdException
+	{
+		return resolve(match.getStart());
+	} 
+	
+	/**
+	 * resolve alignemnt by a position:
+	 * 1) get seg
+	 * 2) resolve seg
+	 * @param idx
+	 * @return
+	 * @throws IOException
+	 * @throws CqiServerError
+	 * @throws CqiClientException
+	 * @throws InvalidCqpIdException
+	 */
+	public List<String> resolve(int idx) throws IOException, CqiServerError, CqiClientException, InvalidCqpIdException
+	{
+		CQPCorpus src = CorpusManager.getCorpusManager().getCorpus(from);
+		StructuralUnitProperty align_src = src.getStructuralUnit(struct).getProperty("align");
+		int[] position = {idx};
+		int[] struct_align_pos = CQPSearchEngine.getCqiClient().cpos2Struc(align_src.getQualifiedName(), position);
+		String[] struct_align_str = CQPSearchEngine.getCqiClient().struc2Str(align_src.getQualifiedName(), struct_align_pos);
+		if (struct_align_str.length > 0) {
+			return resolveSeg(struct_align_str[0]);
+		}
+		return null;
+	}
+
+
+	public List<String> resolveSeg(String seg_id) throws IOException, CqiServerError, CqiClientException, InvalidCqpIdException
+	{
+		System.out.println("resolve seg "+seg_id);
+		CQPCorpus dest = CorpusManager.getCorpusManager().getCorpus(to);
+		String query = "<"+struct+"_align=\""+seg_id+"\">[]";
+		//System.out.println("query: "+query);
+		QueryResult rez = dest.query(new CQLQuery(query), "Align", false);
+		//System.out.println("rez: "+rez.getMatches());
+		int[] position = {rez.getMatch(0).getStart()};
+
+		Property id_dest = dest.getProperty("id");
+		String[] ids = CQPSearchEngine.getCqiClient().cpos2Str(id_dest.getQualifiedName(), position);
+		String wordid = ids[0];
+
+		StructuralUnitProperty text_dest = dest.getStructuralUnit("text").getProperty("id");
+		int[] struct_text_pos = CQPSearchEngine.getCqiClient().cpos2Struc(text_dest.getQualifiedName(), position);
+		String[] struct_text_str = CQPSearchEngine.getCqiClient().struc2Str(text_dest.getQualifiedName(), struct_text_pos);
+		String textid = struct_text_str[0];
+		
+		return Arrays.asList(wordid, textid);
+	}
+
+	public Page getPage(String edition, String wordid, String txtid) throws CqiClientException, InvalidCqpIdException
+	{
+		System.out.println("get edition: from "+to+" : "+edition+" "+wordid+" "+txtid);
+		CQPCorpus dest = CorpusManager.getCorpusManager().getCorpus(to);
+		Edition ed = dest.getProject().getText(txtid).getEdition(edition);
+		if(ed == null)
+			ed = dest.getProject().getText(txtid).getEdition("default");
+		
+		return ed.getPageForWordId(wordid);
+	}
+
+	/* (non-Javadoc)
+	 * @see java.lang.Object#hashCode()
+	 */
+	@Override
+	public int hashCode() {
+		final int prime = 31;
+		int result = 1;
+		result = prime * result + ((from == null) ? 0 : from.hashCode());
+		result = prime * result + level;
+		result = prime * result + ((struct == null) ? 0 : struct.hashCode());
+		result = prime * result + ((to == null) ? 0 : to.hashCode());
+		return result;
+	}
+
+	/* (non-Javadoc)
+	 * @see java.lang.Object#equals(java.lang.Object)
+	 */
+	@Override
+	public boolean equals(Object obj) {
+		if (this == obj)
+			return true;
+		if (obj == null)
+			return false;
+		if (getClass() != obj.getClass())
+			return false;
+		Alignement other = (Alignement) obj;
+		if (from == null) {
+			if (other.from != null)
+				return false;
+		} else if (!from.equals(other.from))
+			return false;
+		if (level != other.level)
+			return false;
+		if (struct == null) {
+			if (other.struct != null)
+				return false;
+		} else if (!struct.equals(other.struct))
+			return false;
+		if (to == null) {
+			if (other.to != null)
+				return false;
+		} else if (!to.equals(other.to))
+			return false;
+		return true;
+	}
+
+	/* (non-Javadoc)
+	 * @see java.lang.Object#toString()
+	 */
+	@Override
+	public String toString() {
+		return "Alignement [from=" + from + ", to=" + to + ", struct=" + struct
+				+ ", level=" + level + "]";
+	}
+
+	/**
+	 * @return the from
+	 */
+	public String getFrom() {
+		return from;
+	}
+
+	/**
+	 * @return the to
+	 */
+	public String getTo() {
+		return to;
+	}
+
+	/**
+	 * @return the struct
+	 */
+	public String getStruct() {
+		return struct;
+	}
+
+	/**
+	 * @return the level
+	 */
+	public int getLevel() {
+		return level;
+	}
+}

Property changes on: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/Alignement.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/Property.java
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/Property.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/Property.java	(revision 3659)
@@ -0,0 +1,188 @@
+// Copyright © 2010-2020 ENS de Lyon., University of Franche-Comté
+// 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: 2013-05-06 17:38:43 +0200 (lun., 06 mai 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.searchengine.cqp.corpus;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.commons.lang.StringUtils;
+import org.txm.core.messages.TXMCoreMessages;
+import org.txm.core.preferences.TXMPreferences;
+import org.txm.searchengine.core.SearchEngine;
+import org.txm.searchengine.core.SearchEngineProperty;
+import org.txm.searchengine.core.SearchEnginesManager;
+import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
+import org.txm.utils.logger.Log;
+
+
+/**
+ * An abstract CQP corpus property. Represents a <strong>type</strong>, not a the value for a specific unit.
+ * 
+ * see WordProperty and StructuralUnitProperty form implementations
+ * 
+ * @author Jean-Philippe Magué, mdecorde
+ */
+public abstract class Property extends org.txm.searchengine.core.Property implements Comparable<Property>, SearchEngineProperty {
+		
+	/** The corpus. */
+	protected CQPCorpus corpus;
+	
+	/**
+	 * Instantiates a new property.
+	 * 
+	 * Not intended to be used directly. See {@link CQPCorpus#getProperty(String)}
+	 * 
+	 * @param name
+	 *            the name
+	 * @param corpus
+	 *            the corpus
+	 */
+	protected Property(String name, CQPCorpus corpus) {
+		super(name);
+		this.corpus = corpus;
+	}
+	
+	public SearchEngine getSearchEngine() {
+		return SearchEnginesManager.getCQPSearchEngine();
+	}
+	
+	/**
+	 * Gets the qualified name = corpus name + "." + this.getFullName() .
+	 * 
+	 * @return the qualified name
+	 */
+	public String getQualifiedName() {
+		return this.corpus.getMainCorpus().getCqpId() + "." + this.getFullName(); //$NON-NLS-1$
+	}
+	
+	/**
+	 * 
+	 * @return the full name of the property without corpus reference
+	 */
+	@Override
+	public abstract String getFullName();
+	
+	
+	/**
+	 * Gets the corpus over which the property is defined.
+	 * 
+	 * @return the name
+	 */
+	public CQPCorpus getCorpus() {
+		return corpus;
+	}
+	
+	/**
+	 * Creates a readable formated string from the property.
+	 * 
+	 * @return
+	 */
+	public String asString() {
+		return "@" + this.name; //$NON-NLS-1$
+	}
+	
+	@Override
+	// FIXME: SJ: can we remove this method, is it used in real query?
+	// I think it should not, toString() is more generally dedicated to log not to be used
+	// The rename the above method asString() to toString()
+	public String toString() {
+		return this.getName();
+	}
+	
+	
+	/**
+	 * Equals.
+	 *
+	 * @param p the p
+	 * @return true, if successful
+	 */
+	public boolean equals(Property p) {
+		return this.getQualifiedName().equals(p.getQualifiedName());
+	}
+	
+	/*
+	 * (non-Javadoc)
+	 * @see java.lang.Comparable#compareTo(java.lang.Object)
+	 */
+	@Override
+	public int compareTo(Property p) {
+		return (this.getQualifiedName().compareTo((p).getQualifiedName()));
+	}
+	
+	/**
+	 * Converts the specified string to a list of Property from the specified Corpus.
+	 * 
+	 * @param corpus
+	 * @param str the String to 'deserialize'. Each property is separated with 1 tabulation. Then calls fromString on each token
+	 * @return a list of StructuralUnitProperty if the s param is well formed
+	 * @throws CqiClientException
+	 */
+	public static List<? extends Property> stringToProperties(CQPCorpus corpus, String str) {
+		ArrayList<Property> properties = new ArrayList<>();
+		
+		if (str == null || corpus == null) {
+			return properties;
+		}
+		
+		String[] split = str.split(TXMPreferences.LIST_SEPARATOR);
+		for (String s : split) {
+			try {
+				Property p = corpus.getProperty(s); // manage all Property implementations : Word, StructuralUnits and Virtual
+				
+				if (p != null) {
+					properties.add(p);
+				}
+			}
+			catch (CqiClientException e) {
+				Log.warning(TXMCoreMessages.bind("** Could not find the ''{0}'' word property found in the ''{1}'' corpus: {2}", s, corpus, e));
+				Log.printStackTrace(e);
+			}
+		}
+		return properties;
+	}
+	
+	/**
+	 * Converts the specified list of Property to a string.
+	 * 
+	 * @param pProperties the list of properties. May be null (return "")
+	 * @return
+	 */
+	public static String propertiesToString(List<? extends Property> pProperties) {
+		if (pProperties == null) {
+			return ""; //$NON-NLS-1$
+		}
+		
+		ArrayList<String> names = new ArrayList<>();
+		
+		for (Property p : pProperties) {
+			names.add(p.getFullName());
+		}
+		
+		return StringUtils.join(names, TXMPreferences.LIST_SEPARATOR);
+	}
+}

Property changes on: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/Property.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/Subcorpus.java
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/Subcorpus.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/Subcorpus.java	(revision 3659)
@@ -0,0 +1,810 @@
+// Copyright © 2010-2020 ENS de Lyon., University of Franche-Comté
+// 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: 2015-12-01 16:28:17 +0100 (Tue, 01 Dec 2015) $
+// $LastChangedRevision: 3073 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.searchengine.cqp.corpus;
+
+import java.io.File;
+import java.io.IOException;
+import java.text.NumberFormat;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.UUID;
+
+import org.eclipse.osgi.util.NLS;
+import org.txm.core.messages.TXMCoreMessages;
+import org.txm.core.preferences.TBXPreferences;
+import org.txm.core.preferences.TXMPreferences;
+import org.txm.core.results.Parameter;
+import org.txm.core.results.TXMParameters;
+import org.txm.objects.CorpusBuild;
+import org.txm.objects.Match;
+import org.txm.searchengine.core.IQuery;
+import org.txm.searchengine.core.QueryBasedTXMResult;
+import org.txm.searchengine.core.Selection;
+import org.txm.searchengine.core.messages.SearchEngineCoreMessages;
+import org.txm.searchengine.cqp.AbstractCqiClient;
+import org.txm.searchengine.cqp.CQPSearchEngine;
+import org.txm.searchengine.cqp.NetCqiClient;
+import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
+import org.txm.searchengine.cqp.clientExceptions.InvalidCqpIdException;
+import org.txm.searchengine.cqp.clientExceptions.UnexpectedAnswerException;
+import org.txm.searchengine.cqp.core.functions.selection.SelectionResult;
+import org.txm.searchengine.cqp.core.messages.CQPSearchEngineCoreMessages;
+import org.txm.searchengine.cqp.corpus.query.CQLQuery;
+import org.txm.searchengine.cqp.corpus.query.SubcorpusCQLQuery;
+import org.txm.searchengine.cqp.serverException.CqiServerError;
+import org.txm.utils.TXMProgressMonitor;
+import org.txm.utils.logger.Log;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+
+/**
+ * The Class Subcorpus represent a MainCorpus subcorpus
+ * 
+ * @author jmague
+ */
+public class Subcorpus extends CQPCorpus {
+	
+	/**
+	 * Query used to build the corpus.
+	 */
+	@Parameter(key = TXMPreferences.QUERY)
+	protected IQuery pQuery;
+	
+	protected Selection qresult;
+	
+	protected SelectionResult selectionResult;
+	
+	/**
+	 * CQP text ids cache
+	 */
+	protected String[] cqpTextIDS = null;
+
+
+	
+	/**
+	 * 
+	 * @param corpus
+	 */
+	public Subcorpus(CQPCorpus corpus) {
+		super(corpus);
+	}
+	
+	/**
+	 * 
+	 * @param partition
+	 */
+	public Subcorpus(Partition partition) {
+		super(partition);
+	}
+	
+	/**
+	 * 
+	 * @param partition
+	 */
+	public Subcorpus(QueryBasedTXMResult result) {
+		super(result);
+		this.pQuery = result.getQuery();
+		this.setUserName(pQuery.toString());
+	}
+	
+	/**
+	 * 
+	 * @param parametersNodePath
+	 */
+	public Subcorpus(String parametersNodePath) {
+		super(parametersNodePath);
+	}
+	
+	/**
+	 * Instantiates a new subcorpus.
+	 * 
+	 * Not intended to be used directly.
+	 *
+	 * @param pID the cqp id
+	 * @param name the name
+	 * @param parent the parent
+	 * @param query the query
+	 * @throws InvalidCqpIdException the invalid cqp id exception
+	 *             {@link CQPCorpus#createSubcorpus(CQLQuery, String)}
+	 */
+	@Override
+	protected boolean __compute(TXMProgressMonitor monitor) throws Exception {
+		
+		if (this.getParent() instanceof QueryBasedTXMResult) { // update the pQuery
+			this.pQuery = ((QueryBasedTXMResult)this.getParent()).getQuery();
+			this.setName(pQuery.getName());
+		}
+		
+		if (pID == null || pID.length() == 0) {
+			pID = subcorpusNamePrefix + getNextSubcorpusCounter().toString();
+		}
+		
+		if (this.pQuery != null) {
+			this.qresult = null; // reset
+			String parent_id = this.getCorpusParent().getQualifiedCqpId();
+			if (pQuery.getQueryString().length() > CQLQuery.MAX_CQL_LENGTH) {
+				Log.warning(NLS.bind("Error: CQL length limit reached ({0}) with {1} length.", CQLQuery.MAX_CQL_LENGTH, pQuery.getQueryString().length())); 
+				return false;
+			}
+			
+			String q = this.pQuery.getQueryString();
+			if (q.matches("undump \"[^ ]+\";")) { // undump query
+				String path = q.substring(8, q.length() - 2);
+				if (!new File(path).exists()) {
+					Log.severe(NLS.bind("Error: could not compute subcorpus from the dump file: {0}.", path));
+					return false;
+				}
+				CorpusManager.getCorpusManager().getCqiClient().query(";");
+				CorpusManager.getCorpusManager().getCqiClient().query("undump "+this.pID+" < "+q.substring(7));
+			} else if (q.matches("(union|join|intersect|inter|difference|diff) [^ ]+ [^ ]+;")) {
+				CorpusManager.getCorpusManager().getCqiClient().query(";");
+				CorpusManager.getCorpusManager().getCqiClient().query(this.pID+" = "+q);
+			} else {
+				CorpusManager.getCorpusManager().getCqiClient().cqpQuery(parent_id, this.pID, CQLQuery.fixQuery(q, this.getLang()));
+//				if (q.contains("@[") || q.contains("@\"")) {
+//					Log.fine("Target detected in "+q+", recentering on target.");
+//					CorpusManager.getCorpusManager().getCqiClient().cqpQuery(this.getQualifiedCqpId(), this.pID, "<target>[]");
+//				}
+			}
+			
+			this.qresult = this.pQuery.getSearchEngine().query(this.getCorpusParent(), this.pQuery, this.getUserName(), true);
+			
+			//this.qresult = new QueryResult(this.pID, this.getUserName(), this.getCorpusParent(), this.pQuery); // getCorpusParent().query(pQuery, this.pID, true);
+		}
+		
+		cqpTextIDS = null; // reset text ids cache
+		
+		return qresult != null;
+	}
+	
+	
+	@Override
+	public String getComputingStartMessage() {
+		
+		if (this.pQuery == null) {
+			return TXMCoreMessages.bind(SearchEngineCoreMessages.info_computingTheP0SubCorpusOfP1CommaQueryP2, this.getSimpleName(), this.getParent().getName(), "<no query>");
+		}
+		
+		// created with structure, property and value(s)
+		if (this.pQuery instanceof SubcorpusCQLQuery) {
+			SubcorpusCQLQuery query = (SubcorpusCQLQuery) this.pQuery;
+			return TXMCoreMessages.bind(SearchEngineCoreMessages.info_computingTheP0SubCorpusOfP1CommaStructureP2CommaPropertyP3ColonP4, this.getSimpleName(), this.getParent().getName(),
+					query.getStructure(), query.getProperty().asString(), query.getPropertyValues());
+		}
+		// created directly from a query
+		else {
+			return TXMCoreMessages.bind(SearchEngineCoreMessages.info_computingTheP0SubCorpusOfP1CommaQueryP2, this.getSimpleName(), this.getParent().getName(), this.getQuery().asString());
+		}
+	}
+	
+	/*
+	 * retro compatibility method for import.xml file
+	 * @see org.txm.searchengine.cqp.corpus.Corpus#getLocale()
+	 */
+	@Override
+	protected boolean _load(Element e) {
+		if (e != null) {
+			this.setUserName(e.getAttribute(NAME));
+			this.pID = "S" + getNextSubcorpusCounter();
+			this.pQuery = new CQLQuery(e.getAttribute("query")); //$NON-NLS-1$
+			
+			NodeList subcorpusElems = e.getElementsByTagName("subcorpus"); //$NON-NLS-1$
+			for (int i = 0; i < subcorpusElems.getLength(); i++) {
+				Element subcorpusElem = (Element) subcorpusElems.item(i);
+				try {
+					Subcorpus subcorp = new Subcorpus(this);
+					subcorp._load(subcorpusElem);
+				}
+				catch (Exception ex) {
+					Log.warning(this.pID + TXMCoreMessages.failedToRestoreSubcorpus + subcorpusElem.getAttribute("name")
+					+ " : " + ex); //$NON-NLS-1$
+				}
+			}
+			
+			NodeList partitionElems = e.getElementsByTagName("partition"); //$NON-NLS-1$
+			for (int i = 0; i < partitionElems.getLength(); i++) {
+				Element partitionElem = (Element) partitionElems.item(i);
+				String name = partitionElem.getAttribute("name"); //$NON-NLS-1$
+				List<String> names = new ArrayList<>();
+				List<String> queries = new ArrayList<>();
+				
+				NodeList partElems = partitionElem.getElementsByTagName("part"); //$NON-NLS-1$
+				for (int j = 0; j < partElems.getLength(); j++) {
+					Element part = (Element) partElems.item(j);
+					names.add(part.getAttribute("name")); //$NON-NLS-1$
+					queries.add(part.getAttribute("query")); //$NON-NLS-1$
+				}
+				try {
+					// System.out.println("Create Partition with corpus "+this+" : "+name+", queries "+queries+", names "+names);
+					Partition partition = new Partition(this);
+					partition.setParameters(name, queries, names);
+					// partition.setSelfElement(partitionElem);
+					partition._load(partitionElem);
+				}
+				catch (Exception ex) {
+					Log.warning(TXMCoreMessages.bind(TXMCoreMessages.failedToRestoreSubcorpus, name, this.pID, ex));
+				}
+			}
+		}
+		initSelectionResult(e);
+		// System.out.println("Subcorpus.load: Selection of "+this+" = "+selectionResult);
+		// return super.load();
+		return true;
+	}
+	
+	@Override
+	public boolean canCompute() {
+		return getUserName() != null && getUserName().length() > 0 &&
+				((pQuery != null && pQuery.getQueryString().length() > 0) || qresult != null);
+	}
+	
+	/*
+	 * (non-Javadoc)
+	 * @see
+	 * org.txm.searchengine.cqp.corpus.CqpObject#checkCqpId(java.lang
+	 * .String)
+	 */
+	@Override
+	public boolean checkCqpId(String pID) throws InvalidCqpIdException {
+		if (!AbstractCqiClient.checkSubcorpusId(pID))
+			throw new InvalidCqpIdException(TXMCoreMessages.bind(CQPSearchEngineCoreMessages.p0IsNotAValidCQPIDForASubcorpusItMustBeAnUppercaseCharacterFollowedByLowercaseCharacters, pID));
+		return true;
+	}
+	
+	@Override
+	public void clean() {
+		super.clean();
+		
+		// nothing to do if the corpus has not yet been computed
+		if (this.hasBeenComputedOnce()) {
+			try {
+				AbstractCqiClient CQI = CorpusManager.getCorpusManager().getCqiClient();
+				if (CQPSearchEngine.isInitialized()) {
+					CQI.dropSubCorpus(this.getQualifiedCqpId());
+				}
+			}
+			catch (Exception e) {
+				Log.severe(e.getLocalizedMessage());
+				Log.severe(TXMCoreMessages.bind("Qualified CQP id: {0}.", this.getQualifiedCqpId()));
+				Log.printStackTrace(e);
+			}
+		}
+		
+		qresult = null;
+		selectionResult = null;
+	}
+	
+	
+	@Override
+	public List<? extends Match> getMatches() {
+		if (qresult == null) { // not computed
+			return new ArrayList<>();
+		}
+		try {
+			return qresult.getMatches();
+		}
+		catch (Exception e) {
+			org.txm.utils.logger.Log.printStackTrace(e);
+			return new ArrayList<>();
+		}
+	}
+	
+	public int getNMatch() {
+		try {
+			return qresult.getNMatch();
+		}
+		catch (Exception e) {
+			// TODO Auto-generated catch block
+			org.txm.utils.logger.Log.printStackTrace(e);
+			return 0;
+		}
+	}
+	
+	// protected void finalize() throws Throwable {
+	// try {
+	// //
+	//
+	// //As finalize is run in a separate thread, we have problems of concurrent
+	// accesses to the cqi server if we drop the subcorpus here.
+	// //It as to be done manually
+	// } catch (Exception e) {
+	// Log.finest("Subcorpus failed to finalize", e);
+	// }
+	// finally {
+	// super.finalize();
+	// }
+	// }
+	
+	/*
+	 * (non-Javadoc)
+	 * @see
+	 * org.txm.searchengine.cqp.corpus.CqpObject#getQualifiedCqpId()
+	 */
+	@Override
+	public String getQualifiedCqpId() {
+		return getMainCorpus().getCqpId() + ":" + this.pID; //$NON-NLS-1$
+	}
+	
+	// /**
+	// * Register to parent.
+	// *
+	// * @param subcorpusName the subcorpus name
+	// * @param query the query
+	// */
+	// private void registerToParent(String subcorpusName, CQLQuery query) {
+	// if (this.getSelfElement() == null && this.getParent() != null)
+	// try {
+	// Element parentElem = (Element) this.getParent().getSelfElement();
+	// if (parentElem == null) return;
+	// Document doc = parentElem.getOwnerDocument();
+	// Element subcorpusElem = doc.createElement("subcorpus"); //$NON-NLS-1$
+	// subcorpusElem.setAttribute("name", subcorpusName); //$NON-NLS-1$
+	// subcorpusElem.setAttribute("desc", subcorpusName); //$NON-NLS-1$
+	// if (query != null)
+	// subcorpusElem.setAttribute("query", query.getQueryString()); //$NON-NLS-1$
+	// Element corporaElem;
+	// if (this.getParent() instanceof MainCorpus) {
+	// NodeList corporaList = parentElem.getElementsByTagName("preBuild"); //$NON-NLS-1$
+	// corporaElem = (Element) corporaList.item(0);
+	// } else {
+	// corporaElem = parentElem;
+	// }
+	// corporaElem.appendChild(subcorpusElem);
+	// this.setSelfElement(subcorpusElem);
+	// } catch (Exception e) {
+	// System.out.println(TXMCoreMessages.Subcorpus_2+Log.toString(e));
+	// }
+	//
+	// this._load();
+	// }
+	
+	/**
+	 * Gets the query.
+	 *
+	 * @return the query
+	 */
+	public IQuery getQuery() {
+		return pQuery;
+	}
+	
+	@Override
+	public String getResultType() {
+		return "Corpus";
+	}
+	
+	public SelectionResult getSelectionResult() {
+		return selectionResult;
+	}
+	
+	
+	/**
+	 * Returns the number of occurrences in the subcorpus.
+	 * 
+	 * @return the size
+	 * 
+	 * @throws CqiClientException
+	 *             the cqi client exception
+	 * 
+	 * @see org.txm.searchengine.cqp.corpus.CQPCorpus#getSize()
+	 */
+	@Override
+	public int getSize() throws CqiClientException {
+		if (!this.hasBeenComputedOnce()) return 0;
+		
+		if (this.size == -1) {
+			// Log.finest(TXMCoreMessages.bind(TXMCoreMessages.SUBCORPUS_SIZE, new Object[]{this.pName, "N/A"}));
+			long start = System.currentTimeMillis();
+			
+			try {
+				AbstractCqiClient cqiClient = CorpusManager.getCorpusManager().getCqiClient();
+				String qid = this.getQualifiedCqpId();
+				int nMatch = cqiClient.subCorpusSize(qid);
+				// System.out.println("n matchs: "+nMatch);
+				if (nMatch == 0) {
+					this.size = 0;
+				}
+				else {
+					int[] match = cqiClient.dumpSubCorpus(getQualifiedCqpId(), NetCqiClient.CQI_CONST_FIELD_MATCH, 0, nMatch - 1);
+					int[] matchend = cqiClient.dumpSubCorpus(getQualifiedCqpId(), NetCqiClient.CQI_CONST_FIELD_MATCHEND, 0, nMatch - 1);
+					if (match.length != matchend.length) {
+						throw new UnexpectedAnswerException();
+					}
+					this.size = 0;
+					
+					for (int i = 0; i < match.length; i++) {
+						size += matchend[i] - match[i] + 1;
+					}
+				}
+			}
+			catch (Exception e) {
+				throw new CqiClientException(e);
+			}
+			long end = System.currentTimeMillis();
+			Log.finest(NLS.bind(SearchEngineCoreMessages.sizeOfSubcorpusP0P1ComputedInP2Ms, new Object[] { this.pID, this.size, (end - start) }));
+		}
+		return this.size;
+	}
+	
+	@Override
+	public int[] getStartLimits(String sup) throws IOException,
+	CqiServerError, InvalidCqpIdException, CqiClientException {
+		return this.getMainCorpus().getStartLimits(sup);
+	}
+	
+	/*
+	 * (non-Javadoc)
+	 * @see
+	 * org.txm.searchengine.cqp.corpus.Corpus#getStructuralUnit(java
+	 * .lang.String)
+	 */
+	@Override
+	public StructuralUnit getStructuralUnit(String name)
+			throws CqiClientException {
+		return getMainCorpus().getStructuralUnit(name);
+	}
+	
+	/*
+	 * (non-Javadoc)
+	 * @see org.txm.searchengine.cqp.corpus.Corpus#getStructuralUnits()
+	 */
+	@Override
+	public List<StructuralUnit> getStructuralUnits() throws CqiClientException {
+		return getMainCorpus().getStructuralUnits();
+	}
+	
+	public SelectionResult initSelectionResult(Element e) {
+		
+		if (e != null) {
+			selectionResult = new SelectionResult();
+			NodeList selectionList = e.getElementsByTagName("selection"); //$NON-NLS-1$
+			for (int i = 0; i < selectionList.getLength();) {
+				Element selection = (Element) selectionList.item(i); // the selection element
+				
+				NodeList textList = selection.getElementsByTagName("selText"); // get text ids //$NON-NLS-1$
+				for (int j = 0; j < textList.getLength(); j++) {
+					Element text = (Element) textList.item(j);
+					selectionResult.add(text.getAttribute("id")); //$NON-NLS-1$
+				}
+				
+				NodeList critList = selection.getElementsByTagName("selCrit"); // get the criteria //$NON-NLS-1$
+				for (int j = 0; j < critList.getLength(); j++) {
+					Element crit = (Element) critList.item(j);
+					String name = crit.getAttribute("id"); // the name of the critera //$NON-NLS-1$
+					if (!selectionResult.critera.containsKey(name)) // create new list if new critera
+						selectionResult.critera.put(name, new ArrayList<String>());
+					selectionResult.critera.get(name).add(crit.getAttribute("value")); // add the value //$NON-NLS-1$
+				}
+				break; // process only one selection node
+			}
+		}
+		return selectionResult;
+	}
+	
+	@Override
+	public boolean loadParameters() throws Exception {
+		String q = this.getStringParameterValue(TXMPreferences.QUERY);
+		if (!q.isEmpty()) {
+			pQuery = new CQLQuery(q);
+		}
+		
+		return true;
+	}
+	
+	@Override
+	public boolean saveParameters() throws Exception {
+		if (pQuery != null) {
+			this.saveParameter(TBXPreferences.QUERY, pQuery.getQueryString());
+		}
+		return true;
+	}
+	
+	/**
+	 * Instantiates a new subcorpus.
+	 * 
+	 * Not intended to be used directly.
+	 *
+	 * @param pID the cqp id
+	 * @param name the name
+	 * @param parent the parent
+	 * @param query the query
+	 * @throws InvalidCqpIdException the invalid cqp id exception
+	 *             {@link CQPCorpus#createSubcorpus(CQLQuery, String)}
+	 */
+	protected void setParameters(String pID, String name, CQLQuery query) throws InvalidCqpIdException {
+		this.pID = pID;
+		this.pQuery = query;
+		this.setUserName(name);
+	}
+	
+	/**
+	 * 
+	 * @param cqpId
+	 * @param name
+	 * @param queryResult
+	 */
+	public void setParameters(String cqpId, String name, QueryResult queryResult) {
+		this.pID = cqpId;
+		this.setUserName(name);
+		this.pQuery = queryResult.getQuery();
+		this.qresult = queryResult;
+		
+		this.setDirty();
+	}
+	
+	@Override
+	public boolean setParameters(TXMParameters parameters) {
+		// TODO Auto-generated method stub
+		System.err.println("Subcorpus.setParameters(): not yet implemented.");
+		return true;
+	}
+	
+	/**
+	 * Sets the query to use.
+	 * 
+	 * @param query
+	 */
+	public void setQuery(CQLQuery query) {
+		this.pQuery = query;
+	}
+	
+	
+	// TODO merge SelectionResult and Subcorpus ?
+	public void setSelectionResult(SelectionResult selectionResult) {
+		this.selectionResult = selectionResult;
+		// TODO persists the selectionResult ?
+		// if (this.getSelfElement() != null) {
+		// //remove old node if any
+		// NodeList selectionList = getSelfElement().getElementsByTagName("selection"); //$NON-NLS-1$
+		// for (int i = 0 ; i < selectionList.getLength() ; i++)
+		// getSelfElement().removeChild(selectionList.item(i));
+		//
+		// Document doc = this.getParent().getSelfElement().getOwnerDocument();
+		// Element selectionElem = doc.createElement("selection"); // the selection element //$NON-NLS-1$
+		// for (String txt : selectionResult) // the text ids
+		// {
+		// Element textElem = doc.createElement("selText"); //$NON-NLS-1$
+		// textElem.setAttribute("id", txt); //$NON-NLS-1$
+		// selectionElem.appendChild(textElem);
+		// }
+		// for (String crit : selectionResult.critera.keySet()) // the critera
+		// {
+		// ArrayList<String> values = selectionResult.critera.get(crit);
+		// for (String value : values) {
+		// Element criteraElem = doc.createElement("selCrit"); //$NON-NLS-1$
+		// criteraElem.setAttribute("id", crit); //$NON-NLS-1$
+		// criteraElem.setAttribute("value", value); //$NON-NLS-1$
+		// selectionElem.appendChild(criteraElem);
+		// }
+		// }
+		// getSelfElement().appendChild(selectionElem);// append selection elem to self
+		// }
+	}
+	
+	/*
+	 * (non-Javadoc)
+	 * @see java.lang.Object#toString()
+	 */
+	@Override
+	public String toString() {
+		return this.getName();
+	}
+	
+	@Override
+	@Deprecated
+	public boolean _toTxt(File outfile, String encoding, String colseparator, String txtseparator) throws Exception {
+		return false;
+	}
+	
+	@Override
+	public void setIsModified(boolean b) {
+		// nothing
+	}
+	
+	@Override
+	public CorpusBuild getRootCorpusBuild() {
+		return getMainCorpus();
+	}
+	
+	/**
+	 * Return the CQP START positions of the main corpus texts
+	 */
+	@Override
+	public int[] getTextStartLimits() throws CqiClientException, IOException, CqiServerError, InvalidCqpIdException {
+		if (textLimits == null) {
+			textLimits = getStartLimits("[text] expand left to text");
+		}
+		return textLimits;
+	}
+	
+	/**
+	 * Return the CQP END positions of the main corpus texts
+	 */
+	@Override
+	public int[] getTextEndLimits() throws CqiClientException, IOException, CqiServerError, InvalidCqpIdException {
+		if (textEndLimits == null) {
+			String queryResultId = queryResultNamePrefix + UUID.randomUUID().toString();
+			CorpusManager.getCorpusManager().getCqiClient().cqpQuery(
+					this.getQualifiedCqpId(), queryResultId, "[text] expand right to text"); //$NON-NLS-1$
+			QueryResult queryResult = new QueryResult(queryResultId, queryResultId, this, new CQLQuery("[text] expand right to text")); //$NON-NLS-1$
+			textEndLimits = queryResult.getEnds();
+		}
+		return textEndLimits;
+	}
+	
+	/**
+	 * Gets the nb texts.
+	 *
+	 * @return the nb texts
+	 * @throws CqiClientException the cqi client exception
+	 * @throws CqiServerError
+	 * @throws IOException
+	 */
+	@Override
+	public int getNbTexts() throws CqiClientException, IOException, CqiServerError {
+		if (nbtext == -1) {
+			
+			List<Integer> structsIncorpus = getTextNumberInCorpus();
+			
+			nbtext = structsIncorpus.size();
+		}
+		return nbtext;
+	}
+	
+	private List<Integer> getTextNumberInCorpus() throws CqiClientException, IOException, CqiServerError {
+		
+		StructuralUnit text_su = this.getStructuralUnit("text"); //$NON-NLS-1$
+		StructuralUnitProperty text_id_sup = text_su.getProperty("id"); //$NON-NLS-1$
+		nbtext = CorpusManager.getCorpusManager().getCqiClient().attributeSize(text_id_sup.getQualifiedName());
+		
+		int[] structs = new int[nbtext];
+		int[][] structs_positions = new int[structs.length][2];
+		for (int i = 0; i < nbtext; i++) {
+			structs[i] = i;
+			structs_positions[i] = CorpusManager.getCorpusManager().getCqiClient().struc2Cpos(text_id_sup.getQualifiedName(), i);
+		}
+		
+		List<Integer> structsIncorpus = new ArrayList<>();
+		// filter structs with matches
+		List<? extends Match> matches = this.getMatches();
+		int iText = 0;
+		int iMatch = 0;
+		nbtext = 0;
+		while (iText < structs.length && iMatch < matches.size()) {
+			if (structs_positions[iText][1] < matches.get(iMatch).getStart()) { // match before text
+				iText++;
+			}
+			else if (matches.get(iMatch).getEnd() < structs_positions[iText][0]) { // text before match
+				iMatch++;
+			}
+			else { // a match in the text
+				structsIncorpus.add(iText);
+				iText++;
+			}
+		}
+		return structsIncorpus;
+	}
+	
+	/**
+	 * 
+	 * @return the text_id values of the CQP corpus ordered by position
+	 * @throws CqiClientException
+	 * @throws IOException
+	 * @throws CqiServerError
+	 */
+	@Override
+	public String[] getCorpusTextIdsList() throws CqiClientException, IOException, CqiServerError {
+		
+		if (cqpTextIDS == null) {
+			StructuralUnit text_su = this.getStructuralUnit("text"); //$NON-NLS-1$
+			StructuralUnitProperty text_id_sup = text_su.getProperty("id"); //$NON-NLS-1$
+			
+			List<Integer> list = getTextNumberInCorpus();
+			int[] structs = new int[list.size()];
+			for (int i = 0; i < list.size(); i++) {
+				structs[i] = list.get(i);
+			}
+			
+			cqpTextIDS = CorpusManager.getCorpusManager().getCqiClient().struc2Str(text_id_sup.getQualifiedName(), structs);
+		}
+		return cqpTextIDS;
+	}
+	
+	/**
+	 * Gets the texts ids and order number in corpus.
+	 *
+	 * @return the texts ids
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiServerError the cqi server error
+	 * @throws CqiClientException the cqi client exception
+	 */
+	@Override
+	public HashMap<String, Integer> getTextsIds() throws IOException, CqiServerError, CqiClientException {
+		if (textids == null) {
+			textids = new HashMap<>();
+			List<Integer> list = getTextNumberInCorpus();
+			int[] structs = new int[list.size()];
+			for (int i = 0; i < list.size(); i++) {
+				structs[i] = list.get(i);
+			}
+			
+			StructuralUnit text_su = this.getStructuralUnit("text"); //$NON-NLS-1$
+			StructuralUnitProperty text_id_sup = text_su.getProperty("id"); //$NON-NLS-1$
+			
+			String[] ids = CorpusManager.getCorpusManager().getCqiClient().struc2Str(text_id_sup.getQualifiedName(), structs);
+			for (int i = 0; i < ids.length; i++) {
+				textids.put(ids[i], structs[i]);
+			}
+		}
+		return textids;
+	}
+	
+	@Override
+	public String getName() {
+		return this.getCorpusParent().getSimpleName() + TXMPreferences.PARENT_NAME_SEPARATOR + this.getSimpleName();
+	}
+	
+	@Override
+	public String getDetails() {
+		try {
+			if (hasBeenComputedOnce()) {
+				return "CQP ID "+this.pID+" T " + NumberFormat.getInstance().format(this.getSize());
+			} else {
+				return this.getName();
+			}
+		}
+		catch (CqiClientException e) {
+			return this.getName() + " (" + this.getQualifiedCqpId() + ")";
+		}
+	}
+
+	@Override
+	public List<?> isBuildValid() {
+		
+		if (this.getParent() != null) return new LinkedList<String>(); // ok
+		
+		return Arrays.asList("No parent corpus result");
+	}
+
+	@Override
+	public String isReady() {
+		
+		if (!hasBeenComputedOnce()) return "the subcorpus is not a computed TXMResult";
+		
+		try {
+			int s = this.getSize();
+			if (s >= 0) return null;
+			return "negative size";
+		}
+		catch (CqiClientException e) {
+			return e.getMessage();
+		}
+	}
+}

Property changes on: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/Subcorpus.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/query/CqpQueryConstant.java
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/query/CqpQueryConstant.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/query/CqpQueryConstant.java	(revision 3659)
@@ -0,0 +1,87 @@
+// Copyright © 2010-2020 ENS de Lyon., University of Franche-Comté
+// 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: 2013-05-06 17:38:43 +0200 (lun., 06 mai 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.searchengine.cqp.corpus.query;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class CqpQueryConstant.
+ */
+public class CqpQueryConstant {
+
+	/** The Constant OR. */
+	public final static String OR = "|"; //$NON-NLS-1$
+	
+	/** The Constant AND. */
+	public final static String AND = "&"; //$NON-NLS-1$
+	
+	/** The Constant EQUALS. */
+	public final static String EQUALS = "="; //$NON-NLS-1$
+	
+	/** The Constant START_ATTRIBUTE. */
+	public final static String START_ATTRIBUTE = "["; //$NON-NLS-1$
+	
+	/** The Constant END_ATTRIBUTE. */
+	public final static String END_ATTRIBUTE = "]"; //$NON-NLS-1$
+	
+	/** The Constant END_QUERY_EXPR. */
+	public final static String END_QUERY_EXPR = ";"; //$NON-NLS-1$
+	
+	/** The Constant START_QUOTE. */
+	public final static String START_QUOTE = "'"; //$NON-NLS-1$
+	
+	/** The Constant END_QUOTE. */
+	public final static String END_QUOTE = "'"; //$NON-NLS-1$
+	
+	/** The Constant START_DOUBLE_QUOTE. */
+	public final static String START_DOUBLE_QUOTE = "\""; //$NON-NLS-1$
+	
+	/** The Constant END_DOUBLE_QUOTE. */
+	public final static String END_DOUBLE_QUOTE = "\""; //$NON-NLS-1$
+	
+	/** The Constant DOT. */
+	public final static String DOT = "."; //$NON-NLS-1$
+	
+	/** The Constant TAG_ATTRIBUTE_SEPARATOR. */
+	public final static String TAG_ATTRIBUTE_SEPARATOR = "_"; //$NON-NLS-1$
+	
+	/** The Constant REGION_MACRO. */
+	public final static String REGION_MACRO = "/region"; //$NON-NLS-1$
+	
+	/** The Constant START_MACRO_ARGS. */
+	public final static String START_MACRO_ARGS = "["; //$NON-NLS-1$
+	
+	/** The Constant END_MACRO_ARGS. */
+	public final static String END_MACRO_ARGS = "]"; //$NON-NLS-1$
+	
+	/** The Constant MACRO_ARGS_SEPARATOR. */
+	public final static String MACRO_ARGS_SEPARATOR = ","; //$NON-NLS-1$
+	
+	/** The Constant START_GLOBAL_CONSTRAINT. */
+	public final static String START_GLOBAL_CONSTRAINT = "::"; //$NON-NLS-1$
+
+}

Property changes on: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/query/CqpQueryConstant.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/query/CQLQuery.java
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/query/CQLQuery.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/query/CQLQuery.java	(revision 3659)
@@ -0,0 +1,414 @@
+// Copyright © 2010-2020 ENS de Lyon., University of Franche-Comté
+// 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: 2015-05-13 09:46:56 +0200 (Wed, 13 May 2015) $
+// $LastChangedRevision: 2967 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.searchengine.cqp.corpus.query;
+
+import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.apache.commons.lang.StringUtils;
+import org.txm.libs.cqp.CQPLibPreferences;
+import org.txm.searchengine.core.IQuery;
+import org.txm.searchengine.core.Query;
+import org.txm.searchengine.core.SearchEngine;
+import org.txm.searchengine.core.SearchEnginesManager;
+import org.txm.searchengine.cqp.CQPPreferences;
+import org.txm.searchengine.cqp.CQPSearchEngine;
+import org.txm.tokenizer.SimpleStringTokenizer;
+
+/**
+ * Implements a CQL query. Use fixQuery to use query sugar.
+ * 
+ * @author sloiseau
+ * @author jpmague
+ * @author sheiden
+ * @author sjacquot
+ */
+
+public class CQLQuery extends Query implements IQuery {
+	
+	/** The Constant NoStrategy. */
+	private static final Integer NoStrategy = 0;
+	
+	/** The Constant JPMStrategy. */
+	private static final Integer JPMStrategy = 1;
+	
+	/** The Constant WLXStrategy. */
+	private static final Integer WLXStrategy = 2;
+	
+	/** The Constant ElectricStrategy. */
+	private static final Integer ElectricStrategy = 3;
+
+	public static final int MAX_CQL_LENGTH = 16000; // current CQL length limit is set to ~16000. The corpus name will affect the query limit length
+	
+	
+	/** espace char |"{()}+*. */
+	private static String chars = "^$<>|\\\"{([])}?+*."; //$NON-NLS-1$
+	
+	
+	public CQLQuery() {
+		super("", CQPSearchEngine.getEngine());
+	}
+	
+//	/**
+//	 * The query string.
+//	 */
+//	protected String queryString = "";
+	
+	/**
+	 * Instantiates a new query.
+	 * 
+	 * @param queryString
+	 *            the query string
+	 * 
+	 *            public Query(String queryString){
+	 *            this.queryString=queryString.trim(); }
+	 */
+	public CQLQuery(String queryString) {
+		super(queryString, CQPSearchEngine.getEngine());
+		if (queryString != null) {
+			this.queryString = queryString.trim();
+		}
+		else {
+			this.queryString = ""; //$NON-NLS-1$
+		}
+	}
+	
+	/**
+	 * Creates a readable formated string from the query.
+	 * 
+	 * @return
+	 */
+	@Override
+	public String asString() {
+		return "<" + this.queryString + ">"; //$NON-NLS-1$ //$NON-NLS-2$
+	}
+	
+	
+	// FIXME: SJ: can we remove this method, is it used in real query?
+	// I think it should not, toString() is more generally dedicated to log not to be used
+	// The rename the above method asString() to toString()
+	@Override
+	public String toString() {
+		return queryString;
+	}
+	
+	
+	/**
+	 * Creates a readable formated string from the specified queries list.
+	 * 
+	 * @param queries
+	 * @return
+	 */
+	public static String asString(List<CQLQuery> queries) {
+		String queriesString = StringUtils.join(queries, ">, <"); //$NON-NLS-1$
+		queriesString = "<" + queriesString + ">";  //$NON-NLS-1$ //$NON-NLS-2$
+		return "[" + queriesString + "]";  //$NON-NLS-1$ //$NON-NLS-2$
+	}
+	
+	/**
+	 * Normalize white chars.
+	 * 
+	 * SLH algorithm :
+	 * - first normalize white chars : We don't know from where the query
+	 * comes from and how it was produced (pasted from a text editor after
+	 * having been double-clicked and copied, typed in the query input
+	 * field, etc.) The CQP syntax analyzer is sensible to white chars, so
+	 * we have to normalize what the user may have leaved inadvertently
+	 * because she may not see well the true query string (white chars are
+	 * invisible), and it is dif ficult to accept and manage a syntax error
+	 * when you can't "see" the source of the problem. That strategy decides
+	 * to interpret every white chars contiguous sequence as one space
+	 * character.
+	 * 
+	 * Please note that this may be compatible (or not) with other Search
+	 * Engines query scanners.
+	 * 
+	 * Please note also that this may be compatible (or not) with the
+	 * tokenization policy of a given corpus dealing with compound words.
+	 * That strategy is compatible with a policy which separates words in
+	 * compound words by one space character.
+	 * 
+	 * - then remove outer white chars : What is not seen should not be
+	 * there if no explicit expression deals with it from the user's point
+	 * of view. So white chars at the beginning or at the end of the query
+	 * are removed. Those characters often come from rapid copy/paste or
+	 * double-click/copy/paste (in a word processing software, the
+	 * double-click strategy can for example select the white chars on the
+	 * right of the selected strings to help the user move words around with
+	 * their delimiters).
+	 * 
+	 * That strategy may seem aggressive, but experience shows that this
+	 * little service helps silently users a lot and is rarely
+	 * inappropriate.
+	 * 
+	 * In case of doubt, the user should be able to switch to another
+	 * strategy.
+	 *
+	 * @param str the str
+	 * @return the string with white chars normalized
+	 */
+	public static String normalizeWhiteChars(String str) {
+		
+		// normalize everything white to space
+		String str1 = str.replaceAll("\\s+", " "); //$NON-NLS-1$ //$NON-NLS-2$
+		// remove border whites
+		str1 = str1.trim(); //$NON-NLS-1$ //$NON-NLS-2$
+		return str1;
+	}
+	
+	/**
+	 * Transforms a simplified query string into a proper CQP query string
+	 * 
+	 * Follows several different strategies to do that :
+	 * 
+	 * JPM Strategy : if the input query matches \w quote are added if the input
+	 * query matches \w*="\w*", square brackets are added if the input query
+	 * matches .\w=.\w (i.e. without quotes), quotes and square brackets are
+	 * added (i.e. -> [$1="$2"]) otherwise, the query is left as if
+	 * 
+	 * Weblex Strategy : normalize white chars add double quotes if no double
+	 * quotes and no brackets
+	 * 
+	 * Electric Strategy : normalize white chars add double quote, equal,
+	 * brackets, etc. depending on the presence/absence of those chars in the
+	 * original query
+	 * 
+	 * No Strategy : do nothing
+	 * 
+	 * @param query
+	 *            The query string to fix
+	 * @return the fixed query string
+	 */
+	static public String fixQuery(String query, String lang) {
+		
+		// if (query.startsWith("intersect ")) return query;
+		
+		if ("\"".equals(query)) return "\"\\\"\""; //$NON-NLS-1$ //$NON-NLS-2$
+		
+		Integer QueryFixStrategy = WLXStrategy;
+		
+		if (QueryFixStrategy == JPMStrategy) {
+			
+			// query = abc -> put double quotes
+			Pattern simple = Pattern.compile("\\p{L}*"); //$NON-NLS-1$
+			if (simple.matcher(query).matches()) {
+				// System.out.println("match 1");
+				return '"' + StringUtils.join(query.split(" "), "\" \"") + '"'; // $NON-NLS-1$
+			}
+			
+			// query = prop="abc" -> put square brackets
+			Pattern equalsWithQuotes = Pattern.compile("\\p{L}+=\"\\p{L}*\""); //$NON-NLS-1$
+			if (equalsWithQuotes.matcher(query).matches()) {
+				// System.out.println("match 2");
+				return '[' + query + ']';
+			}
+			
+			// query = abc=def -> put brackets + equal sign + double quotes
+			Pattern equalsWithoutQuotes = Pattern.compile("(\\p{L}*)=(\\p{L}*)"); //$NON-NLS-1$
+			Matcher matcher = equalsWithoutQuotes.matcher(query);
+			if (matcher.matches()) {
+				// System.out.println("match 2");
+				return '[' + matcher.group(1) + '=' + '"' + matcher.group(2) + '"' + ']';
+			}
+			
+			// query doesn't start with ", ' and [ -> put double quotes
+			if (!query.startsWith("\"") && !query.startsWith("\'") && !query.startsWith("[")) //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+			{
+				return '"' + StringUtils.join(query.split(" "), "\" \"") + '"'; // $NON-NLS-1$
+			}
+			
+			// do nothing
+			return query;
+		}
+		else if (QueryFixStrategy == WLXStrategy) {
+			
+			// empty query
+			if (query.isEmpty()) {
+				return query;
+			}
+			// query contains double quotes
+			else if (query.contains("\"")) { //$NON-NLS-1$
+				return query;
+			}
+			// query contains brackets
+			else if (query.contains("[") && query.contains("]")) { //$NON-NLS-1$ //$NON-NLS-2$
+				return query; // probably [] or [...]
+			}
+			else {
+				if (CQPLibPreferences.getInstance().getBoolean(CQPLibPreferences.QUERY_FIX_TOKENIZE)) {
+					List<List<String>> sentences = new SimpleStringTokenizer(lang).processText(query);
+					StringBuilder buffer = new StringBuilder();
+					for (List<String> sent : sentences) {
+						for (String word : sent) {
+							buffer.append(" \""+addBackSlash(word)+"\"");
+						}
+					}
+					return buffer.substring(1);
+				} else {
+					return '"' + query + '"'; // $NON-NLS-1$
+				}
+				
+				
+//				query = normalizeWhiteChars(query);
+//				return '"' + StringUtils.join(query.split(" "), "\" \"") + '"'; // $NON-NLS-1$
+			}
+		}
+		else if (QueryFixStrategy == ElectricStrategy) {
+			
+			// DON'T USE THAT STRATEGY : CODE NEEDS TO BE FIXED
+			query = normalizeWhiteChars(query);
+			
+			if (query.contains("\"")) { //$NON-NLS-1$
+				if (query.contains("=")) { //$NON-NLS-1$
+					if (query.contains("[")) { //$NON-NLS-1$
+						return query;
+					}
+					else {
+						return '[' + query + ']';
+					}
+				}
+				else {
+					return query;
+				}
+			}
+			else {
+				if (query.contains("=")) { //$NON-NLS-1$
+					return query.replaceAll("=([^= \"]+)", "=\"$1\""); //$NON-NLS-1$ //$NON-NLS-2$
+				}
+				else {
+					return '"' + query + '"'; // $NON-NLS-1$
+				}
+			}
+		}
+		else if (QueryFixStrategy == NoStrategy) {
+			
+			// no strategy to apply : do nothing
+			return query;
+			
+		}
+		else {
+			
+			// we shouldn't be there
+			// let silently return the query for the moment
+			return query;
+		}
+	}
+	
+	
+	
+	/**
+	 * Adds the back slash.
+	 *
+	 * @param squery the squery
+	 * @return the string
+	 */
+	public static String addBackSlash(String squery) {
+		if ("\"".equals(squery)) return "\\\""; //$NON-NLS-1$ //$NON-NLS-2$
+		StringBuffer buff = new StringBuffer();
+		// for(char c : chars.)
+		for (int i = 0; i < squery.length(); i++) {
+			int j = chars.indexOf(squery.charAt(i));
+			// System.out.println(""+i+" : "+squery.charAt(i)+ " >> "+j);
+			
+			if (j >= 0) {
+				buff.append("\\" + squery.charAt(i)); //$NON-NLS-1$
+			}
+			else {
+				buff.append(squery.charAt(i));
+			}
+		}
+		return buff.toString();
+	}
+	
+	
+	/**
+	 * Sets the string of the query.
+	 * 
+	 * @param queryString
+	 */
+	public void setQueryString(String queryString) {
+		this.queryString = queryString;
+	}
+	
+	/**
+	 * Checks whatever the query is empty (null, empty or contains only double quotes) or not.
+	 * 
+	 * @return true if empty otherwise false
+	 */
+	@Override
+	public boolean isEmpty() {
+		return queryString == null || queryString.length() == 0 || "\"\"".equals(queryString);
+	}
+	
+	
+	@Override
+	public boolean equals(Object obj) {
+		if (obj == null) return false;
+		if (!(obj instanceof CQLQuery)) {
+			return false;
+		}
+		if (this.queryString == null) return false;
+		
+		return this.queryString.equals(((CQLQuery) obj).queryString);
+	}
+	
+	
+	
+	/**
+	 * The main method.
+	 *
+	 * @param args the arguments
+	 */
+	public static void main(String[] args) {
+		String test = "^$sdf<>sdf|\\sdf\"{(sdf)}?+sdf*."; //$NON-NLS-1$
+		System.out.println(CQLQuery.addBackSlash(test));
+	}
+	
+	@Override
+	public SearchEngine getSearchEngine() {
+		return SearchEnginesManager.getCQPSearchEngine();
+	}
+	
+	@Override
+	public IQuery setQuery(String rawQuery) {
+		this.queryString = rawQuery;
+		return this;
+	}
+	
+	@Override
+	public IQuery fixQuery(String lang) {
+		this.queryString = fixQuery(this.queryString, lang);
+		return this;
+	}
+	
+	@Override
+	public boolean equals(IQuery q) {
+		return this.getClass().equals(q.getClass()) && this.getQueryString().equals(q.getQueryString());
+	}
+}

Property changes on: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/query/CQLQuery.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/query/QueryFocus.java
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/query/QueryFocus.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/query/QueryFocus.java	(revision 3659)
@@ -0,0 +1,48 @@
+// Copyright © 2010-2020 ENS de Lyon., University of Franche-Comté
+// 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: 2013-05-06 17:38:43 +0200 (lun., 06 mai 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.searchengine.cqp.corpus.query;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class QueryFocus.
+ */
+public class QueryFocus extends CQLQuery {
+	
+	/** The focus. */
+	private final Focus focus;
+	
+	/**
+	 * Instantiates a new query focus.
+	 *
+	 * @param focus the focus
+	 */
+	public QueryFocus(Focus focus) {
+		super(focus.getQueryString());
+		this.focus = focus;
+	}
+}

Property changes on: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/query/QueryFocus.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/query/TXTQuery.java
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/query/TXTQuery.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/query/TXTQuery.java	(revision 3659)
@@ -0,0 +1,34 @@
+package org.txm.searchengine.cqp.corpus.query;
+
+import java.util.Locale;
+
+import org.txm.searchengine.core.IQuery;
+import org.txm.searchengine.core.Query;
+import org.txm.searchengine.cqp.TXTSearchEngine;
+
+public class TXTQuery extends Query {
+	
+	public TXTQuery(String query) {
+		super(query, TXTSearchEngine.getEngine());
+	}
+	
+	
+	public IQuery fixQuery() {
+		return fixQuery(Locale.getDefault().getCountry());
+	}
+	
+	@Override
+	public IQuery fixQuery(String lang) {
+		// SimpleStringTokenizer tokenizer = new SimpleStringTokenizer(lang); // TODO setup the tokenizer to not create tokens * and ? when they are next to letters
+		StringBuilder buffer = new StringBuilder();
+		String[] rs = queryString.split(" ");
+		for (int i = 0; i < rs.length; i++) {
+			String r = rs[i];
+			if (i > 0) buffer.append(" ");
+			r = CQLQuery.addBackSlash(r);
+			buffer.append("\"" + r.replace("\\*", ".*") + "\"%cd");
+		}
+		System.out.println("CQL QUERY=" + buffer.toString());
+		return new CQLQuery(buffer.toString());
+	}
+}

Property changes on: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/query/TXTQuery.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/query/Occurrence.java
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/query/Occurrence.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/query/Occurrence.java	(revision 3659)
@@ -0,0 +1,74 @@
+// Copyright © 2010-2020 ENS de Lyon., University of Franche-Comté
+// 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: 2013-05-06 17:38:43 +0200 (lun., 06 mai 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.searchengine.cqp.corpus.query;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class Occurrence.
+ */
+public class Occurrence {
+	
+	/** The position. */
+	int position;
+	
+	/** The signature. */
+	int[] signature;
+	
+	/** The signsum. */
+	int signsum = 0;
+
+	/**
+	 * Instantiates a new occurrence.
+	 *
+	 * @param p the p
+	 * @param props the props
+	 */
+	public Occurrence(int p, int[] props) {
+		position = p;
+		signature = props;
+		for (int i = 0; i < signature.length; i++)
+			signsum += signature[i];
+	}
+
+	/**
+	 * Equals.
+	 *
+	 * @param o the o
+	 * @return true, if successful
+	 */
+	public boolean equals(Occurrence o) {
+		if (signature.length != o.signature.length)
+			return false;
+		if (signsum != o.signsum)
+			return false;
+		for (int i = 0; i < signature.length; i++)
+			if (signature[i] != o.signature[i])
+				return false;
+		return true;
+	}
+}

Property changes on: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/query/Occurrence.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/query/PartitionFocus.java
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/query/PartitionFocus.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/query/PartitionFocus.java	(revision 3659)
@@ -0,0 +1,173 @@
+// Copyright © 2010-2020 ENS de Lyon., University of Franche-Comté
+// 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: 2013-09-05 09:27:13 +0200 (jeu., 05 sept. 2013) $
+// $LastChangedRevision: 2529 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.searchengine.cqp.corpus.query;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.txm.core.messages.TXMCoreMessages;
+import org.txm.searchengine.cqp.corpus.Part;
+import org.txm.searchengine.cqp.corpus.Partition;
+import org.txm.utils.logger.Log;
+
+// TODO: Auto-generated Javadoc
+/**
+ * Denote a part in a partition.
+ * 
+ * @author sloiseau
+ */
+public class PartitionFocus {
+
+	/** The analysis property. */
+	private final Partition partition;
+
+	/** The modality. */
+	private final List<String> modality;
+	
+	/** The focus index. */
+	private int[] focusIndex = null;
+
+	/**
+	 * Instantiates a new focus.
+	 *
+	 * @param partition the partition
+	 * @param modality the modality
+	 */
+	public PartitionFocus(Partition partition, String modality) {
+		// this(analysisProperty, new ArrayList<String>().add(modality));
+		super();
+		this.partition = partition;
+		this.modality = new ArrayList<String>();
+		this.modality.add(modality);
+		checkModalityList();
+	}
+
+	/**
+	 * Instantiates a new focus.
+	 *
+	 * @param partition the partition
+	 * @param modality the modality
+	 */
+	public PartitionFocus(Partition partition, List<String> modality) {
+		super();
+		this.partition = partition;
+		this.modality = modality;
+		checkModalityList();
+	}
+
+	/**
+	 * Check modality list.
+	 */
+	private void checkModalityList() {
+		List<String> partNames = partition.getPartNames();
+		for (String mod : modality) {
+			if (mod == null || mod.equals("")) { //$NON-NLS-1$
+				Log.finest(TXMCoreMessages.theFocusCannotBeNullOrEmpty);
+				throw new IllegalArgumentException(TXMCoreMessages.focusIsEmptyOrNull);
+			}
+			if (!partNames.contains(mod)) {
+				Log.finest(TXMCoreMessages.bind(TXMCoreMessages.theP0PartFocusDoesntBelongToPartitionP1, mod, partNames));
+				throw new IllegalArgumentException(TXMCoreMessages.unknownPartitionName);
+			}
+		}
+	}
+
+	/**
+	 * Gets the focused parts.
+	 *
+	 * @return the focused parts
+	 */
+	public List<Part> getFocusedParts() {
+		List<Part> focused = new ArrayList<Part>(modality.size());
+		for (int i = 0; i < partition.getPartsCount(); i++) {
+			if (modality.contains(partition.getParts().get(i).getName())) {
+				focused.add(partition.getParts().get(i));
+			}
+		}
+		return focused;
+	}
+
+	/**
+	 * Gets the not focused parts.
+	 *
+	 * @return the not focused parts
+	 */
+	public List<Part> getNotFocusedParts() {
+		List<Part> notFocused = new ArrayList<Part>(modality.size());
+		for (int i = 0; i < partition.getPartsCount(); i++) {
+			if (!modality.contains(partition.getParts().get(i).getName())) {
+				notFocused.add(partition.getParts().get(i));
+			}
+		}
+		return notFocused;
+	}
+
+	/**
+	 * Gets the analysis property.
+	 * 
+	 * @return the analysis property
+	 */
+	public Partition getPartition() {
+		return partition;
+	}
+
+	/**
+	 * Gets the modality.
+	 * 
+	 * @return the modality
+	 */
+	public List<String> getModality() {
+		return modality;
+	}
+
+	/**
+	 * Gets the focus index.
+	 *
+	 * @return the focus index
+	 */
+	public int[] getFocusIndex() {
+		if (focusIndex == null)
+			computeFocusIndex();
+		return focusIndex;
+	}
+
+	/**
+	 * Compute focus index.
+	 */
+	private void computeFocusIndex() {
+		focusIndex = new int[modality.size()];
+		List<String> partNames = partition.getPartNames();
+		int y = 0;
+		for (int i = 0; i < modality.size(); i++) {
+			if (partNames.contains(modality.get(i))) {
+				focusIndex[y] = i;
+				y++;
+			}
+		}
+	}
+}
\ No newline at end of file

Property changes on: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/query/PartitionFocus.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/query/StructuredCQLQuery.java
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/query/StructuredCQLQuery.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/query/StructuredCQLQuery.java	(revision 3659)
@@ -0,0 +1,69 @@
+// Copyright © 2010-2020 ENS de Lyon., University of Franche-Comté
+// 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: 2015-06-15 15:29:16 +0200 (Mon, 15 Jun 2015) $
+// $LastChangedRevision: 2989 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.searchengine.cqp.corpus.query;
+
+import org.txm.searchengine.cqp.corpus.StructuralUnit;
+import org.txm.searchengine.cqp.corpus.StructuralUnitProperty;
+
+/**
+ * A query that select a structured subcorpus.
+ * 
+ * @author mdecorde
+ */
+public class StructuredCQLQuery extends CQLQuery {
+	
+	/** The structure. */
+	protected StructuralUnit structure;
+	
+	/** The property. */
+	protected StructuralUnitProperty property;
+	
+	/** The value. */
+	protected String value;
+	
+	/**
+	 * Instantiates a new query part.
+	 * 
+	 * @param structure the structure
+	 * @param property the property
+	 * @param query the query
+	 */
+	public StructuredCQLQuery(StructuralUnit structure, StructuralUnitProperty property, String query) {
+		super(query);
+		this.structure = structure;
+		this.property = property;
+	}
+	
+	public StructuralUnit getStructure() {
+		return structure;
+	}
+	
+	public StructuralUnitProperty getProperty() {
+		return property;
+	}
+}

Property changes on: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/query/StructuredCQLQuery.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/query/SubcorpusCQLQuery.java
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/query/SubcorpusCQLQuery.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/query/SubcorpusCQLQuery.java	(revision 3659)
@@ -0,0 +1,157 @@
+// Copyright © 2010-2020 ENS de Lyon., University of Franche-Comté
+// 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: 2015-06-15 15:29:16 +0200 (Mon, 15 Jun 2015) $
+// $LastChangedRevision: 2989 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.searchengine.cqp.corpus.query;
+
+import java.util.List;
+
+import org.txm.searchengine.cqp.core.preferences.SubcorpusPreferences;
+import org.txm.searchengine.cqp.corpus.StructuralUnit;
+import org.txm.searchengine.cqp.corpus.StructuralUnitProperty;
+
+/**
+ * A query that select a structured subcorpus from a corpus using a regular expression.
+ * 
+ * @author mdecorde
+ */
+public class SubcorpusCQLQuery extends CQLQuery {
+	
+	/** The structure. */
+	protected StructuralUnit structure;
+	
+	/** The property. */
+	protected StructuralUnitProperty property;
+	
+	/**
+	 * Selected values of the property.
+	 */
+	protected List<String> propertyValues;
+	
+	/** The value. */
+	protected String regexp;
+	
+	
+	/**
+	 * 
+	 * 
+	 * @param structure the structure
+	 * @param property the property
+	 * @param regexp the regexp
+	 */
+	public SubcorpusCQLQuery(StructuralUnit structure, StructuralUnitProperty property, String regexp) {
+		this(structure, property, regexp, null);
+	}
+	
+	/**
+	 * 
+	 * @param structure
+	 * @param property
+	 * @param regexp
+	 * @param propertyValues
+	 */
+	public SubcorpusCQLQuery(StructuralUnit structure, StructuralUnitProperty property, String regexp, List<String> propertyValues) {
+		super(null); // set later in this method
+		this.structure = structure;
+		this.property = property;
+		this.propertyValues = propertyValues;
+		this.regexp = regexp;
+		
+		// String tag = structure.getName() + TAG_ATTRIBUTE_SEPARATOR + property.getName();
+		// String label = "a"; //$NON-NLS-1$
+		// StringBuffer query = new StringBuffer();
+		// query.append(REGION_MACRO + START_MACRO_ARGS);
+		// query.append(tag + MACRO_ARGS_SEPARATOR + label + END_MACRO_ARGS);
+		// query.append(START_GLOBAL_CONSTRAINT + label + DOT + tag + EQUALS
+		// + START_DOUBLE_QUOTE + value + END_DOUBLE_QUOTE);
+		// queryString = query.toString();
+		
+		// if ("text".equals(structure.getName())) { // optimisation only for the text structure
+		// queryString = "<" + property.getFullName() + "=\"" + regexp + "\">[] expand to " + structure.getName();
+		// }
+		// else {
+		// queryString = "[_." + property.getFullName() + "=\"" + regexp + "\"] expand to " + structure.getName();
+		// }
+		
+		if (SubcorpusPreferences.getInstance().getBoolean(SubcorpusPreferences.OPTIMIZED_MODE)) {
+			queryString = "<" + property.getFullName() + "=\"" + regexp + "\">[] expand to " + structure.getName();
+		}
+		else {
+			queryString = "[_." + property.getFullName() + "=\"" + regexp + "\"] expand to " + structure.getName();
+		}
+	}
+	
+	
+	public String getRegExp() {
+		return regexp;
+	}
+	
+	
+	/**
+	 * Gets the structure used to build the query.
+	 * 
+	 * @return the structure
+	 */
+	public StructuralUnit getStructure() {
+		return structure;
+	}
+	
+	
+	/**
+	 * Gets the property used to build the query.
+	 * 
+	 * @return the property
+	 */
+	public StructuralUnitProperty getProperty() {
+		return property;
+	}
+	
+	
+	/**
+	 * @return the propertyValues
+	 */
+	public List<String> getPropertyValues() {
+		return propertyValues;
+	}
+	
+	// /*
+	// * (non-Javadoc)
+	// *
+	// * @see org.txm.searchengine.cqp.corpus.query.Query#getQueryString()
+	// */
+	// /*
+	// * Produce a query such as: [_.struct_property="value"] expand to struct
+	// *
+	// * OLD VERSION: /region[TEI_type,a]::a.TEI_type="value"
+	// */
+	// @Override
+	// public String getQueryString() {
+	// return queryString;
+	//
+	// // another way to query parts less restrictif but missleading
+	// //return String.format("[_.%s=\"%s\"] expand to %s", tag, value, structure.getName());
+	// }
+}

Property changes on: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/query/SubcorpusCQLQuery.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/query/Match.java
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/query/Match.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/query/Match.java	(revision 3659)
@@ -0,0 +1,301 @@
+// Copyright © 2010-2020 ENS de Lyon., University of Franche-Comté
+// 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: 2016-04-04 14:59:04 +0200 (Mon, 04 Apr 2016) $
+// $LastChangedRevision: 3188 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.searchengine.cqp.corpus.query;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.txm.searchengine.cqp.AbstractCqiClient;
+import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
+import org.txm.searchengine.cqp.corpus.CorpusManager;
+import org.txm.searchengine.cqp.corpus.Property;
+import org.txm.searchengine.cqp.corpus.StructuralUnitProperty;
+
+/**
+ * A Match of a query on a corpus = [start -> end]
+ * 
+ * @author jmague, mdecorde
+ */
+public class Match extends org.txm.objects.Match {
+	
+	/** The start. */
+	protected int start;
+	
+	/** The end. */
+	protected int end;
+	
+	/** The target position */
+	protected int target = -1;
+	
+	/** The query result. */
+	// private QueryResult queryResult;
+	
+	/**
+	 * Instantiates a new match.
+	 * 
+	 * @param start
+	 *            the cqp index of the start of the match
+	 * @param end
+	 *            the cqp index of the end of the match
+	 */
+	public Match(int start, int end) {
+		this.start = start;
+		this.end = end;
+		// this.queryResult = queryResult;
+	}
+	
+	public Match(int start, int end, int target) {
+		this(start, end);
+		this.target = target;
+	}
+	
+	/**
+	 * Gets the start.
+	 * 
+	 * @return the start
+	 */
+	@Override
+	public int getStart() {
+		return start;
+	}
+	
+	/**
+	 * Gets the start.
+	 * 
+	 * @return the start
+	 */
+	@Override
+	public int getTarget() {
+		return target;
+	}
+	
+	/**
+	 * Gets the end.
+	 * 
+	 * @return the end
+	 */
+	@Override
+	public int getEnd() {
+		return end;
+	}
+	
+	// /**
+	// * Gets the query result.
+	// *
+	// * @return the query result
+	// */
+	// public QueryResult getQueryResult() {
+	// return queryResult;
+	// }
+	
+	/**
+	 * Gets the value for property for the first position of the match.
+	 * 
+	 * @param property
+	 *            the property
+	 * 
+	 * @return the value for property
+	 * 
+	 * @throws CqiClientException
+	 *             the cqi client exception
+	 */
+	public String getValueForProperty(Property property)
+			throws CqiClientException {
+		List<Match> match = new ArrayList<>();
+		match.add(this);
+		return Match.getValuesForProperty(property, match).get(0);
+	}
+	
+	/**
+	 * Gets the values for property for all the positions of the match.
+	 * 
+	 * @param property
+	 *            the property
+	 * 
+	 * @return the value for property
+	 * 
+	 * @throws CqiClientException
+	 *             the cqi client exception
+	 */
+	public List<String> getValuesForProperty(Property property)
+			throws CqiClientException {
+		int[] positions = new int[this.end - this.start + 1];
+		for (int i = 0; i < this.end - this.start + 1; i++)
+			positions[i] = this.start + i;
+		return getValuesForProperty(property, positions);
+	}
+	
+	/**
+	 * Gets the values for property.
+	 * 
+	 * @param property
+	 *            the property
+	 * @param matches
+	 *            the matches to get the values for
+	 * 
+	 * @return the values for property
+	 * 
+	 * @throws CqiClientException
+	 *             the cqi client exception
+	 */
+	public static List<String> getValuesForProperty(Property property,
+			List<? extends Match> matches) throws CqiClientException {
+		int[] starts = new int[matches.size()];
+		for (int i = 0; i < matches.size(); i++)
+			starts[i] = matches.get(i).start;
+		return getValuesForProperty(property, starts);
+	}
+	
+	/**
+	 * Gets the values for property.
+	 * 
+	 * @param property
+	 *            the property
+	 * @param matches
+	 *            the matches to get the values for
+	 * 
+	 * @return the values for property
+	 * 
+	 * @throws CqiClientException
+	 *             the cqi client exception
+	 */
+	public static List<String> getValuesForProperty(Property property, org.txm.objects.Match match) throws CqiClientException {
+		int[] starts = new int[match.size()];
+		for (int i = 0 ; i < match.size() ; i++) starts[i] = match.getStart()+i;
+		
+		return getValuesForProperty(property, starts);
+	}
+	
+	/**
+	 * Gets the values for property.
+	 * 
+	 * @param property
+	 *            the property
+	 * @param positions
+	 *            the positions to get the values for
+	 * 
+	 * @return the values for property
+	 * 
+	 * @throws CqiClientException
+	 *             the cqi client exception
+	 */
+	public static List<String> getValuesForProperty(Property property, int[] positions) throws CqiClientException {
+		
+		AbstractCqiClient cqiClient = CorpusManager.getCorpusManager().getCqiClient();
+		try {
+			if (property instanceof StructuralUnitProperty) {
+				int[] struc = cqiClient.cpos2Struc(property.getQualifiedName(), positions);
+				return Arrays.asList(cqiClient.struc2Str(property.getQualifiedName(), struc));
+			}
+			else {
+				return Arrays.asList(property.id2Str(property.cpos2Id(positions)));
+			}
+		}
+		catch (Exception e) {
+			throw new CqiClientException(e);
+		}
+	}
+	
+	/**
+	 * Gets the values for property.
+	 * 
+	 * @param property
+	 *            the property
+	 * @param positions
+	 *            the positions to get the values for
+	 * 
+	 * @return the values for property
+	 * 
+	 * @throws CqiClientException
+	 *             the cqi client exception
+	 */
+	public static String getValueForProperty(Property property,
+			int position) throws CqiClientException {
+		AbstractCqiClient cqiClient = CorpusManager.getCorpusManager().getCqiClient();
+		try {
+			if (property instanceof StructuralUnitProperty) {
+				int[] struc = cqiClient.cpos2Struc(property.getQualifiedName(),
+						new int[] { position });
+				return cqiClient.struc2Str(property
+						.getQualifiedName(), struc)[0];
+			}
+			else {
+				return cqiClient.cpos2Str(property
+						.getQualifiedName(), new int[] { position })[0];
+			}
+		}
+		catch (Exception e) {
+			throw new CqiClientException(e);
+		}
+	}
+	
+	/**
+	 * Gets the ids.
+	 *
+	 * @param property the property
+	 * @param positions the positions
+	 * @return the ids
+	 * @throws CqiClientException the cqi client exception
+	 */
+	public int[] getIds(Property property, int[] positions)
+			throws CqiClientException {
+		AbstractCqiClient cqiClient = CorpusManager.getCorpusManager().getCqiClient();
+		
+		try {
+			if (property instanceof StructuralUnitProperty) {
+				int[] struc = cqiClient.cpos2Struc(property.getQualifiedName(),
+						positions);
+				return struc;
+			}
+			else {
+				int[] ids = cqiClient.cpos2Id(property.getQualifiedName(),
+						positions);
+				return ids;
+			}
+		}
+		catch (Exception e) {
+			throw new CqiClientException(e);
+		}
+	}
+	
+	@Override
+	public void setEnd(int p) {
+		this.end = p;
+	}
+	
+	@Override
+	public void setStart(int p) {
+		this.start = p;
+	}
+	
+	@Override
+	public void setTarget(int p) {
+		this.target = p;
+	}
+}

Property changes on: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/query/Match.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/query/QueryPart.java
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/query/QueryPart.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/query/QueryPart.java	(revision 3659)
@@ -0,0 +1,61 @@
+// Copyright © 2010-2020 ENS de Lyon., University of Franche-Comté
+// 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: 2015-06-15 15:29:16 +0200 (Mon, 15 Jun 2015) $
+// $LastChangedRevision: 2989 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.searchengine.cqp.corpus.query;
+
+import org.txm.searchengine.cqp.corpus.StructuralUnit;
+import org.txm.searchengine.cqp.corpus.StructuralUnitProperty;
+
+/**
+ * Wrapper of SubcorpusCQLQuery to fix the value part of the query.
+ * 
+ * A query that select a structured subcorpus from a corpus.
+ * 
+ * @author Jean Philippe Magué
+ * @author sloiseau
+ */
+public class QueryPart extends SubcorpusCQLQuery {
+	
+	String value;
+	
+	/**
+	 * Instantiates a new query part.
+	 * 
+	 * @param structure the structure
+	 * @param property the property
+	 * @param value the value, not a regexp
+	 */
+	
+	public QueryPart(StructuralUnit structure, StructuralUnitProperty property, String value) {
+		super(structure, property, CQLQuery.addBackSlash(value));
+		this.value = value;
+	}
+	
+	public String getValue() {
+		return value;
+	}
+}

Property changes on: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/query/QueryPart.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/query/MatchUtils.java
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/query/MatchUtils.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/query/MatchUtils.java	(revision 3659)
@@ -0,0 +1,104 @@
+package org.txm.searchengine.cqp.corpus.query;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.txm.objects.Match;
+
+public class MatchUtils {
+	
+	/**
+	 * 
+	 * @param list the matches to cover
+	 * @param b the matches that covers
+	 * @return the indexes of 'b' matches that covers the 'a' matches
+	 */
+	public static ArrayList<Integer> matchesCoveredByB(List<Match> list, List<Match> b) {
+		int ai = 0, bi = 0;
+		ArrayList<Integer> result = new ArrayList<>();
+		
+		while (ai < list.size() && bi < b.size()) {
+			if (b.get(bi).contains(list.get(ai))) {
+				result.add(bi);
+				bi++;
+			}
+			else {
+				ai++;
+			}
+		}
+		
+		return result;
+	}
+	
+	/**
+	 * Gets an array of all positions of the specified list of matches.
+	 * 
+	 * @param list the list of matches
+	 * @return an array of all positions of the specified list of matches
+	 */
+	public static int[] toPositions(List<? extends Match> list) {
+		ArrayList<Integer> result = new ArrayList<>();
+		for (Match m : list) {
+			if (m.getStart() == m.getEnd()) {
+				result.add(m.getStart());
+			}
+			else {
+				for (int i = m.getStart(); i <= m.getEnd(); i++) {
+					result.add(i);
+				}
+			}
+		}
+		
+		int[] positions = new int[result.size()];
+		for (int i = 0; i < result.size(); i++) {
+			positions[i] = result.get(i);
+		}
+		return positions;
+	}
+	
+	/**
+	 * 
+	 * @param match
+	 * @return array of int position from a Match
+	 */
+	public static int[] toPositions(Match match) {
+		return toPositions(match, match);
+	}
+	
+	/**
+	 * 
+	 * @param match1
+	 * @param match2
+	 * @return array of int position from a Match start to another Match end
+	 */
+	public static int[] toPositions(Match match1, Match match2) {
+		return toPositions(match1.getStart(), match2.getEnd());
+	}
+	
+	/**
+	 * 
+	 * @param match1
+	 * @param match2
+	 * @return array of int position from a Match start to another Match end
+	 */
+	public static int[] toPositions(int from, int to) {
+		int len = to - from + 1;
+		
+		if (len <= 0) {
+			return new int[0];
+		}
+		else if (len == 1) {
+			return new int[] { from };
+		}
+		else if (len == 2) {
+			return new int[] { from, to };
+		}
+		else {
+			int[] positions = new int[len];
+			int n = 0;
+			for (int i = from; i <= to; i++) {
+				positions[n++] = i;
+			}
+			return positions;
+		}
+	}
+}

Property changes on: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/query/MatchUtils.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/query/package.html
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/query/package.html	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/query/package.html	(revision 3659)
@@ -0,0 +1,6 @@
+<html>
+<body>
+	<p>Classes representing a query, wrapping and hidding internal cqp
+		query syntax.</p>
+</body>
+</html>
\ No newline at end of file

Property changes on: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/query/package.html
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/query/Focus.java
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/query/Focus.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/query/Focus.java	(revision 3659)
@@ -0,0 +1,145 @@
+// Copyright © 2010-2020 ENS de Lyon., University of Franche-Comté
+// 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: 2013-05-06 17:38:43 +0200 (lun., 06 mai 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.searchengine.cqp.corpus.query;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.txm.core.messages.TXMCoreMessages;
+import org.txm.searchengine.cqp.corpus.Property;
+
+/**
+ * A focus is a modality of a {@link Property}.
+ * 
+ * @author sloiseau
+ */
+public class Focus {
+
+	/** The analysis property. */
+	private final Property analysisProperty;
+
+	/** The modality. */
+	private final List<String> modality;
+
+	/**
+	 * Instantiates a new focus.
+	 * 
+	 * @param analysisProperty
+	 *            the analysis property
+	 * @param modality
+	 *            the modality
+	 */
+	public Focus(Property analysisProperty, String modality) {
+		// this(analysisProperty, new ArrayList<String>().add(modality));
+		super();
+		this.analysisProperty = analysisProperty;
+		this.modality = new ArrayList<String>();
+		this.modality.add(modality);
+		checkModalityList();
+	}
+
+	/**
+	 * Instantiates a new focus.
+	 * 
+	 * @param analysisProperty
+	 *            the analysis property
+	 * @param modality
+	 *            the modality
+	 */
+	public Focus(Property analysisProperty, List<String> modality) {
+		super();
+		this.analysisProperty = analysisProperty;
+		this.modality = modality;
+		checkModalityList();
+	}
+
+	/**
+	 * Check modality list.
+	 */
+	private void checkModalityList() {
+		for (String mod : modality) {
+			if (mod == null || mod.equals(""))throw new IllegalArgumentException(TXMCoreMessages.theFocusIsEmptyOrNull); //$NON-NLS-1$
+		}
+	}
+
+	/**
+	 * Gets the analysis property.
+	 * 
+	 * @return the analysis property
+	 */
+	public Property getAnalysisProperty() {
+		return analysisProperty;
+	}
+
+	/**
+	 * Gets the modality.
+	 * 
+	 * @return the modality
+	 */
+	public List<String> getModality() {
+		return modality;
+	}
+
+	/**
+	 * Gets the query string.
+	 * 
+	 * @return the query string
+	 */
+	public String getQueryString() {
+		StringBuffer queryString = new StringBuffer();
+		queryString.append(CqpQueryConstant.START_ATTRIBUTE);
+		queryString.append(analysisProperty.getName());
+		queryString.append(CqpQueryConstant.EQUALS);
+		queryString.append(CqpQueryConstant.START_QUOTE);
+		if (modality.size() == 1) {
+			queryString.append(modality.get(0));
+		} else {
+			for (Iterator<String> iter = modality.iterator(); iter.hasNext();) {
+				String element = iter.next();
+				queryString.append(element);
+				if (iter.hasNext()) {
+					queryString.append(CqpQueryConstant.OR);
+				}
+			}
+		}
+		queryString.append(CqpQueryConstant.END_QUOTE);
+		queryString.append(CqpQueryConstant.END_ATTRIBUTE);
+		queryString.append(CqpQueryConstant.END_QUERY_EXPR);
+		return queryString.toString();
+	}
+
+	/* (non-Javadoc)
+	 * @see java.lang.Object#toString()
+	 */
+	@Override
+	public String toString() {
+		return getQueryString();
+	}
+
+}
\ No newline at end of file

Property changes on: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/query/Focus.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/PropertyHashMap.java
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/PropertyHashMap.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/PropertyHashMap.java	(revision 3659)
@@ -0,0 +1,83 @@
+// Copyright © 2010-2020 ENS de Lyon., University of Franche-Comté
+// 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: 2013-05-06 17:38:43 +0200 (lun., 06 mai 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.searchengine.cqp.corpus;
+
+import java.lang.reflect.Constructor;
+import java.util.HashMap;
+
+/**
+ * The Class PropertyHashMap.
+ *
+ * @param <E> the element type
+ */
+public class PropertyHashMap<E> extends HashMap<Property, E> {
+
+	/** The Constant serialVersionUID. */
+	private static final long serialVersionUID = -6560650525642894582L;
+
+	/** The corpus. */
+	CQPCorpus corpus;
+	
+	/** The clazz. */
+	Class<E> clazz;
+
+	/**
+	 * Instantiates a new property hash map.
+	 *
+	 * @param corpus the corpus
+	 * @param clazz the clazz
+	 */
+	public PropertyHashMap(CQPCorpus corpus, Class<E> clazz) {
+		this.corpus = corpus;
+		this.clazz = clazz;
+	}
+
+	/**
+	 * Gets the.
+	 *
+	 * @param property the property
+	 * @return the e
+	 */
+	public E get(Property property) {
+		if (!this.containsKey(property)) {
+			//	
+			Object o = null;
+			for (Constructor<?> constructor : clazz.getConstructors()) {
+				try {
+					o = constructor.newInstance(corpus, property);
+					break;
+				} catch (Exception e) {
+				}
+			}
+			if (o == null)
+				return null;
+			this.put(property, (E) o);
+		}
+		return super.get(property);
+	}
+}

Property changes on: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/PropertyHashMap.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/LengthProperty.java
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/LengthProperty.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/LengthProperty.java	(revision 3659)
@@ -0,0 +1,136 @@
+package org.txm.searchengine.cqp.corpus;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.TreeSet;
+
+import org.txm.searchengine.cqp.CQPSearchEngine;
+import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
+import org.txm.searchengine.cqp.clientExceptions.UnexpectedAnswerException;
+import org.txm.searchengine.cqp.serverException.CqiServerError;
+
+/**
+ * A CQP property at token/word level
+ * 
+ * @author mdecorde
+ *
+ */
+public class LengthProperty extends VirtualProperty {
+	
+	/**
+	 * Creates a new WordProperty.
+	 * 
+	 * @param name
+	 * @param corpus
+	 */
+	public LengthProperty(CQPCorpus corpus) {
+		super("length", corpus);
+	}
+	
+	public String cpos2Str(int position) {
+		
+		try {
+			String[] rez = CQPSearchEngine.getCqiClient().cpos2Str(corpus.getWordProperty().getQualifiedName(), new int[] {position});
+			return Integer.toString(rez[0].length());
+		} catch (Exception e) {
+			return "0";
+		}
+	}
+	
+	public List<String> getValues(int[] positions) {
+		return Arrays.asList(cpos2Str(positions));
+	}
+	
+	public String[] cpos2Str(int[] positions) {
+		try {
+			String[] rez = CQPSearchEngine.getCqiClient().cpos2Str(corpus.getWordProperty().getQualifiedName(), positions);
+			for (int i = 0 ; i < rez.length ; i++) {
+				rez[i] = Integer.toString(rez[i].length());
+			}
+			return rez;
+		} catch (Exception e) {
+			return new String[positions.length];
+		}
+	}
+
+	@Override
+	public int[] cpos2Id(int[] positions) {
+		try {
+			String[] tmp = CQPSearchEngine.getCqiClient().cpos2Str(corpus.getWordProperty().getQualifiedName(), positions);
+			int[] rez = new int[tmp.length];
+			for (int i = 0 ; i < rez.length ; i++) {
+				rez[i] = tmp[i].length();
+			}
+			return rez;
+		} catch (Exception e) {
+			return new int[positions.length];
+		}
+	}
+
+	@Override
+	public int cpos2Id(int position) {
+		return cpos2Id(new int[] {position})[0];
+	}
+	
+	@Override
+	public String[] id2Str(int[] indices) {
+		String[] rez = new String[indices.length];
+		for (int i = 0 ; i < rez.length ; i++) {
+			rez[i] = Integer.toString(indices[i]);
+		}
+		return rez;
+	}
+
+	@Override
+	public String id2Str(int indice) {
+		return Integer.toString(indice);
+	}
+
+	@Override
+	public String getCQLTest(String value) {
+		try {
+			int l = Integer.parseInt(value);
+			StringBuilder sb = new StringBuilder();
+			sb.append("word=\"");
+			for (int i = 0 ; i < l ; i++) {
+				sb.append(".");
+			}
+			sb.append("\"");
+			return sb.toString();
+		} catch(Exception e) {
+			
+		}
+		return null;
+	}
+
+	@Override
+	public String getCQLTest(List<String> values) {
+		try {
+			TreeSet<String> hash = new TreeSet<>();
+			StringBuilder sb = new StringBuilder();
+			for (String value : values) {
+				int l = Integer.parseInt(value);
+				
+				sb.setLength(0);
+				for (int i = 0 ; i < l ; i++) {
+					sb.append(".");
+				}
+				hash.add(sb.toString());
+			}
+			
+			sb.setLength(0);
+			sb.append("word=\"");
+			for (String dots : hash) {
+				sb.append(dots);
+			}
+			sb.append("\"");
+			return sb.toString();
+		} catch(Exception e) {
+			
+		}
+		return null;
+	}
+}
+

Property changes on: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/LengthProperty.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/SubcorpusSelectionResult.java
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/SubcorpusSelectionResult.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/SubcorpusSelectionResult.java	(revision 3659)
@@ -0,0 +1,72 @@
+package org.txm.searchengine.cqp.corpus;
+
+import java.util.ArrayList;
+
+//import org.txm.searchengine.cqp.core.functions.selection.SelectionResult;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+
+public class SubcorpusSelectionResult {
+//	public void setSelectionResult(SelectionResult selectionResult) {
+//		this.selectionResult = selectionResult;
+//		if (this.getSelfElement() != null) {
+//			//remove old node if any
+//			NodeList selectionList = getSelfElement().getElementsByTagName("selection"); //$NON-NLS-1$
+//			for (int i = 0 ; i < selectionList.getLength() ; i++)
+//				getSelfElement().removeChild(selectionList.item(i));
+//
+//			Document doc = this.getParent().getSelfElement().getOwnerDocument();
+//			Element selectionElem = doc.createElement("selection"); // the selection element //$NON-NLS-1$
+//			for (String txt : selectionResult) // the text ids
+//			{
+//				Element textElem = doc.createElement("selText"); //$NON-NLS-1$
+//				textElem.setAttribute("id", txt); //$NON-NLS-1$
+//				selectionElem.appendChild(textElem);
+//			}
+//			for (String crit : selectionResult.critera.keySet()) // the critera
+//			{
+//				ArrayList<String> values = selectionResult.critera.get(crit);
+//				for (String value : values) {
+//					Element criteraElem = doc.createElement("selCrit"); //$NON-NLS-1$
+//					criteraElem.setAttribute("id", crit); //$NON-NLS-1$
+//					criteraElem.setAttribute("value", value); //$NON-NLS-1$
+//					selectionElem.appendChild(criteraElem);
+//				}
+//			}
+//			getSelfElement().appendChild(selectionElem);// append selection elem to self
+//		}
+//	}
+//
+//	public SelectionResult initSelectionResult() {
+//
+//		if (getSelfElement() != null) {
+//			selectionResult = new SelectionResult();
+//			NodeList selectionList = getSelfElement().getElementsByTagName("selection"); //$NON-NLS-1$
+//			for (int i = 0 ; i < selectionList.getLength() ;) {
+//				Element selection = (Element) selectionList.item(i); // the selection element
+//
+//				NodeList textList = selection.getElementsByTagName("selText"); // get text ids //$NON-NLS-1$
+//				for (int j = 0 ; j < textList.getLength() ; j++) {
+//					Element text = (Element) textList.item(j);
+//					selectionResult.add(text.getAttribute("id")); //$NON-NLS-1$
+//				}
+//
+//				NodeList critList = selection.getElementsByTagName("selCrit"); // get the criteria //$NON-NLS-1$
+//				for (int j = 0 ; j < critList.getLength() ; j++) {
+//					Element crit = (Element) critList.item(j);
+//					String name = crit.getAttribute("id"); // the name of the critera //$NON-NLS-1$
+//					if (!selectionResult.critera.containsKey(name)) // create new list if new critera
+//						selectionResult.critera.put(name, new ArrayList<String>());
+//					selectionResult.critera.get(name).add(crit.getAttribute("value")); // add the value //$NON-NLS-1$
+//				}
+//				break; // process only one selection node
+//			}
+//		}
+//		return selectionResult;
+//	}
+//
+//	public SelectionResult getSelectionResult() {
+//		return selectionResult;
+//	}
+}

Property changes on: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/SubcorpusSelectionResult.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/FakeQueryResult.java
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/FakeQueryResult.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/FakeQueryResult.java	(revision 3659)
@@ -0,0 +1,201 @@
+// Copyright © 2010-2020 ENS de Lyon., University of Franche-Comté
+// 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: 2016-03-01 10:10:58 +0100 (mar., 01 mars 2016) $
+// $LastChangedRevision: 3133 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.searchengine.cqp.corpus;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
+import org.txm.searchengine.cqp.clientExceptions.InvalidCqpIdException;
+import org.txm.searchengine.cqp.clientExceptions.UnexpectedAnswerException;
+import org.txm.searchengine.cqp.corpus.query.Match;
+import org.txm.searchengine.cqp.corpus.query.CQLQuery;
+import org.txm.searchengine.cqp.serverException.CqiServerError;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The result of a CQP query on a corpus.
+ * 
+ * @author mdecorde
+ */
+public class FakeQueryResult extends QueryResult {
+
+	protected int[] starts;
+	protected int[] ends;
+	protected int[] targets;
+	
+	/**
+	 * Instantiates a new query result.
+	 * 
+	 * Not intended to be used directly. See {@link CQPCorpus#query(CQLQuery, String)}
+	 * 
+	 * @param cqpId
+	 *            the cqp id
+	 * @param name
+	 *            the name
+	 * @param queriedCorpus
+	 *            the queried corpus
+	 * @param query
+	 *            the query
+	 * 
+	 * @throws InvalidCqpIdException
+	 *             the invalid cqp id exception
+	 */
+	public FakeQueryResult(String name, CQPCorpus queriedCorpus,
+			CQLQuery query, int[] starts, int[] ends, int[] targets) throws InvalidCqpIdException {
+		super("Fakeqr", name, queriedCorpus, query);
+		this.starts = starts;
+		this.ends = ends;
+		this.targets = targets;
+	}
+
+	/**
+	 * Gets the number of matches.
+	 * 
+	 * @return the number of matches
+	 * 
+	 * @throws CqiClientException
+	 *             the cqi client exception
+	 */
+	public int getNMatch() throws CqiClientException {
+		if (nMatch == -1) 
+				nMatch = starts.length;
+		return nMatch;
+	}
+
+	/**
+	 * Retrieves some of the matches of a query
+	 * 
+	 * Not all the matches are returned, but only those between from and to. For
+	 * example, getMatches(0,9) returns the first 10 matches while
+	 * getMatches(0,getNMatches()) return them all.
+	 * 
+	 * @param from
+	 *            the from
+	 * @param to
+	 *            the to
+	 * 
+	 * @return the matches
+	 * 
+	 * @throws CqiClientException
+	 *             the cqi client exception
+	 */
+	/**
+	 * @return
+	 * @throws CqiClientException
+	 */
+	public int[] getStartMatches(int from, int to) throws CqiClientException {
+		int[] substarts = new int[to-from]; 
+		System.arraycopy(starts, from, substarts, 0, to-from);
+		return substarts;
+	}
+
+	/**
+	 * Retrieves some of the matches of a query
+	 * 
+	 * Not all the matches are returned, but only those between from and to. For
+	 * example, getMatches(0,9) returns the first 10 matches while
+	 * getMatches(0,getNMatches()) return them all.
+	 * 
+	 * @param from
+	 *            the from
+	 * @param to
+	 *            the to
+	 * 
+	 * @return the matches
+	 * 
+	 * @throws CqiClientException
+	 *             the cqi client exception
+	 */
+	/**
+	 * @return
+	 * @throws CqiClientException
+	 */
+	public List<Match> getMatches(int from, int to) throws CqiClientException {
+		List<Match> res = new ArrayList<Match>();
+		
+		for (int i = 0; i <= to - from; i++) {
+			if (targets == null) res.add(new Match(starts[i], ends[i]));
+			else res.add(new Match(starts[i], ends[i], targets[i]));
+		}
+		return res;
+	}
+
+	public int[] getEnds(int from, int to) throws UnexpectedAnswerException, IOException, CqiServerError
+	{
+		int[] subends = new int[to-from]; 
+		System.arraycopy(starts, from, subends, 0, to-from);
+		return subends;
+	}
+
+	public int[] getEnds() throws CqiClientException, IOException, CqiServerError {
+		return ends;
+	}
+	
+	public int[] getStarts(int from, int to) throws UnexpectedAnswerException, IOException, CqiServerError
+	{
+		int[] substarts = new int[to-from]; 
+		System.arraycopy(starts, from, substarts, 0, to-from);
+		return substarts;
+	}
+
+	public int[] getStarts() throws CqiClientException, IOException, CqiServerError {
+		return starts;
+	}
+
+	/**
+	 * FAKE Drops the query results. More specifically, it drops its CQP counterpart.
+	 * 
+	 * This method has to be called when a query result is no longer usefull.
+	 * 
+	 * @throws CqiClientException
+	 *             the cqi client exception
+	 */
+	public void drop() throws CqiClientException {
+		 // lol
+	}
+	
+	@Override
+	public void finalize() {
+		// lol
+	}
+
+	/**
+	 * get the Nth match
+	 * 
+	 * @param i
+	 * @return
+	 * @throws UnexpectedAnswerException
+	 * @throws IOException
+	 * @throws CqiServerError
+	 */
+	public Match getMatch(int i) throws UnexpectedAnswerException, IOException, CqiServerError {
+		return new Match(starts[i], ends[i]);
+	}
+}

Property changes on: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/FakeQueryResult.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/VirtualProperty.java
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/VirtualProperty.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/VirtualProperty.java	(revision 3659)
@@ -0,0 +1,63 @@
+package org.txm.searchengine.cqp.corpus;
+
+import java.util.List;
+
+/**
+ * A CQP property at token/word level
+ * 
+ * @author mdecorde
+ *
+ */
+public abstract class VirtualProperty extends WordProperty {
+	
+	/**
+	 * Creates a new WordProperty.
+	 * 
+	 * @param name
+	 * @param corpus
+	 */
+	public VirtualProperty(String name, CQPCorpus corpus) {
+		super(name, corpus);
+	}
+	
+	@Override
+	public String getFullName() {
+		return "(" + getName() + ")";
+	}
+	
+	public abstract String cpos2Str(int position);
+	
+	public abstract String[] cpos2Str(int[] positions);
+	
+	public abstract int[] cpos2Id(int[] allpositionsarray);
+	
+	public abstract int cpos2Id(int position);
+
+	public abstract String[] id2Str(int[] indices);
+	
+	public abstract String id2Str(int indice);
+	
+	public String toString() {
+		return getFullName();
+	}
+
+	public static boolean isAVirtualPropertyFullName(String name) {
+		return name != null && name.startsWith("(") && name.endsWith(")")&& name.length() > 2 ;
+	}
+	
+	public static String fullnameToName(String fullname) {
+		return fullname.substring(1, fullname.length() - 1);
+	}
+	
+	@Override
+	public String getCQLTest(String value) {
+		return null;
+	}
+	
+	@Override
+	public String getCQLTest(List<String> values) {
+		return null;
+	}
+	
+}
+

Property changes on: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/VirtualProperty.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/TXTSearchEngine.java
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/TXTSearchEngine.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/TXTSearchEngine.java	(revision 3659)
@@ -0,0 +1,104 @@
+package org.txm.searchengine.cqp;
+
+import java.util.List;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.txm.Toolbox;
+import org.txm.core.engines.EngineType;
+import org.txm.core.results.TXMResult;
+import org.txm.objects.CorpusBuild;
+import org.txm.objects.Match;
+import org.txm.searchengine.core.EmptySelection;
+import org.txm.searchengine.core.IQuery;
+import org.txm.searchengine.core.SearchEngine;
+import org.txm.searchengine.core.SearchEngineProperty;
+import org.txm.searchengine.core.Selection;
+import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
+import org.txm.searchengine.cqp.corpus.CQPCorpus;
+import org.txm.searchengine.cqp.corpus.query.TXTQuery;
+
+public class TXTSearchEngine extends SearchEngine {
+	
+	public static final String NAME = "TXT";
+	
+	/**
+	 * initialization state
+	 */
+	boolean state = false;
+	
+	boolean useNetCQi = false;
+	
+	@Override
+	public String getName() {
+		return TXTSearchEngine.NAME;
+	}
+	
+	/**
+	 * Starts the corpus engine if not remove then launch cqpserver.
+	 *
+	 * @return true, if successful
+	 */
+	@Override
+	public boolean start(IProgressMonitor monitor) throws Exception {
+		return true;
+	}
+	
+	
+	@Override
+	public boolean initialize() {
+		return true;
+	}
+	
+	/**
+	 * Shutdown.
+	 */
+	@Override
+	public boolean stop() {
+		return true;
+	}
+	
+	@Override
+	public boolean isRunning() {
+		return CQPSearchEngine.getEngine().isRunning();
+	}
+	
+	@Override
+	public Selection query(CorpusBuild corpus, IQuery query, String name, boolean saveQuery) throws CqiClientException {
+		if (query instanceof TXTQuery && corpus instanceof CQPCorpus) {
+			TXTQuery tquery = (TXTQuery) query;
+			return CQPSearchEngine.getEngine().query(corpus, tquery.fixQuery(corpus.getLang()), name, saveQuery);
+		}
+		else {
+			return new EmptySelection(query);
+		}
+	}
+	
+	@Override
+	public TXTQuery newQuery() {
+		return new TXTQuery(""); //$NON-NLS-1$
+	}
+	
+	@Override
+	public boolean hasIndexes(CorpusBuild corpus) {
+		return CQPSearchEngine.getEngine().hasIndexes(corpus);
+	}
+	
+	@Override
+	public void notify(TXMResult r, String state) {
+		// nothing to do the CQPEngine will manage the notifications
+	}
+	
+	public static TXTSearchEngine getEngine() {
+		return (TXTSearchEngine) Toolbox.getEngineManager(EngineType.SEARCH).getEngine(TXTSearchEngine.NAME);
+	}
+	
+	@Override
+	public String getValueForProperty(Match match, SearchEngineProperty property) {
+		return CQPSearchEngine.getEngine().getValueForProperty(match, property);
+	}
+	
+	@Override
+	public List<String> getValuesForProperty(Match match, SearchEngineProperty property) {
+		return CQPSearchEngine.getEngine().getValuesForProperty(match, property);
+	}
+}

Property changes on: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/TXTSearchEngine.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/ReferencePattern.java
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/ReferencePattern.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/ReferencePattern.java	(revision 3659)
@@ -0,0 +1,488 @@
+// Copyright © 2010-2020 ENS de Lyon., University of Franche-Comté
+// 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: 2015-10-22 09:15:18 +0200 (Thu, 22 Oct 2015) $
+// $LastChangedRevision: 3040 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.searchengine.cqp;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.txm.core.messages.TXMCoreMessages;
+import org.txm.searchengine.cqp.corpus.CQPCorpus;
+import org.txm.searchengine.cqp.corpus.Property;
+import org.txm.searchengine.cqp.corpus.StructuralUnit;
+import org.txm.searchengine.cqp.corpus.StructuralUnitProperty;
+import org.txm.searchengine.cqp.corpus.VirtualProperty;
+import org.txm.searchengine.cqp.corpus.WordProperty;
+import org.txm.utils.logger.Log;
+
+import com.google.gson.Gson;
+
+/**
+ * References configuration : a list of properties and optionally a sprintf like pattern
+ *
+ * @author mdecorde
+ */
+public class ReferencePattern implements Iterable<Property> {
+	
+	/** The properties. */
+	private List<Property> properties = new ArrayList<>();
+	
+	private String pattern;
+	
+	/**
+	 * 
+	 * @param corpus
+	 * @param v
+	 * @return a list of word and structure properties read from a String
+	 */
+	@SuppressWarnings("unlikely-arg-type")
+	public static ReferencePattern stringToReferencePattern(CQPCorpus corpus, String v) {
+		ReferencePattern ref = fromGSonString(corpus, v);
+		if (ref == null) {
+			ref = fromNLSString(corpus, v);
+		}
+		if (ref == null) {
+			ref = fromTabulatedString(corpus, v);
+		}
+		return ref;
+	}
+	
+	/**
+	 * 
+	 * @param corpus
+	 * @param v
+	 * @return a list of word and structure properties read from a String
+	 */
+	public static boolean isGsonString(String gsonString) {
+		try {
+			return new Gson().fromJson(gsonString, HashMap.class) != null;
+		} catch(Exception e) {
+			return false;
+		}
+	}
+	
+	/**
+	 * 
+	 * @param corpus
+	 * @param v
+	 * @return a list of word and structure properties read from a String
+	 */
+	public static String fromGSonToPattern(String gsonString) {
+		try {
+			Gson gson = new Gson();
+			
+			HashMap<?, ?> values = gson.fromJson(gsonString, HashMap.class);
+			if (values == null) return "";
+			
+			Object oFormat = values.get("format");
+			if (oFormat != null) {
+				return oFormat.toString();
+			}
+			
+		} catch(Exception e) {
+			e.printStackTrace();
+		}
+		return "";
+	}
+	
+	/**
+	 * 
+	 * @param corpus
+	 * @param v
+	 * @return a list of word and structure properties read from a String
+	 */
+	public static List<String> fromGSonToPropertyNames(String gsonString) {
+		ArrayList<String> props = new ArrayList<>();
+		try {
+			Gson gson = new Gson();
+			
+			HashMap<?, ?> values = gson.fromJson(gsonString, HashMap.class);
+			if (values == null) return props;
+			
+			Object oProperties = values.get("properties");
+			
+			if (oProperties != null && oProperties instanceof List) {
+				List<?> propertyNames = (List<?>) oProperties;
+				for (Object o : propertyNames) {
+					if (o == null) continue;
+					String s = o.toString();
+					props.add(s);
+				}
+			}
+		}
+		catch (Exception e) {
+			e.printStackTrace();
+		}
+		return props;
+	}
+	
+	/**
+	 * 
+	 * @param corpus
+	 * @param v
+	 * @return a list of word and structure properties read from a String
+	 */
+	@SuppressWarnings("unlikely-arg-type")
+	public static ReferencePattern fromGSonString(CQPCorpus corpus, String v) {
+		try {
+			Gson gson = new Gson();
+			
+			HashMap<?, ?> values = gson.fromJson(v, HashMap.class);
+			
+			if (values == null) return new ReferencePattern();
+			
+			Object oProperties = values.get("properties");
+			Object oFormat = values.get("format");
+			String pattern = null;
+			if (oFormat != null) {
+				pattern = oFormat.toString();
+			}
+			
+			ReferencePattern props = new ReferencePattern(pattern);
+			
+			if (oProperties != null && oProperties instanceof List) {
+				List<?> propertyNames = (List<?>) oProperties;
+				for (Object o : propertyNames) {
+					if (o == null) continue;
+					String s = o.toString();
+					if (s.contains("_")) {
+						String[] split2 = s.split("_", 2);
+						StructuralUnit su = corpus.getStructuralUnit(split2[0]);
+						if (su != null) {
+							Property prop = su.getProperty(split2[1]);
+							if (prop != null) {
+								props.addProperty(prop);
+							}
+						}
+					}
+					else {
+						Property prop = corpus.getProperty(s);
+						if (prop != null) {
+							props.addProperty(prop);
+						}
+					}
+				}
+			}
+			
+			return props;
+		}
+		catch (Exception e) {
+			// System.out.println("Error: " + v + " property not found in " + corpus);
+			return null;
+		}
+	}
+	
+	
+	
+	/**
+	 * 
+	 * @param corpus
+	 * @param v "${strct_prop} like string"
+	 * @return
+	 */
+	protected static ReferencePattern fromNLSString(CQPCorpus corpus, String v) {
+		try {
+			ReferencePattern props = new ReferencePattern();
+			if (v == null) return props;
+			if (v.length() == 0) return props;
+			
+			Pattern pattern = Pattern.compile("\\$\\{([^\\}]+)\\}");
+			Matcher matcher = pattern.matcher(v);
+			int nPropExpected = 0;
+			while (matcher.find()) {
+				nPropExpected++;
+				String gg = matcher.group(1).trim();
+				String[] split = gg.split("_");
+				if (split.length == 2) {
+					String sstruct = split[0];
+					String sprop = split[1];
+					StructuralUnit struct = corpus.getStructuralUnit(sstruct);
+					if (struct != null) {
+						StructuralUnitProperty prop = struct.getProperty(sprop);
+						if (prop != null) {
+							props.addProperty(prop);
+						}
+					}
+				}
+				else if (split.length == 1) {
+					String sprop = split[0];
+					WordProperty prop = corpus.getProperty(sprop);
+					if (prop != null) {
+						props.addProperty(prop);
+					}
+				}
+			}
+			
+			if (nPropExpected > 0 && props.getProperties().size() == nPropExpected) {
+				props.setPattern(matcher.replaceAll("%s"));
+				return props;
+			}
+			else {
+				return null;
+			}
+		}
+		catch (Exception e) {
+			// System.out.println("Error: " + v + " property not found in " + corpus);
+			return null;
+		}
+	}
+	
+	protected static ReferencePattern fromTabulatedString(CQPCorpus corpus, String v) {
+		try {
+			ReferencePattern props = new ReferencePattern();
+			if (v == null) return props;
+			if (v.length() == 0) return props;
+			
+			String[] split = v.split("\t");
+			for (String s : split) {
+				s = s.trim();
+				if (s.contains("_")) {
+					String[] split2 = s.split("_", 2);
+					StructuralUnit su = corpus.getStructuralUnit(split2[0]);
+					if (su != null) {
+						Property prop = su.getProperty(split2[1]);
+						if (prop != null) {
+							props.addProperty(prop);
+						}
+					}
+				}
+				else {
+					Property prop = corpus.getProperty(s);
+					if (prop != null) {
+						props.addProperty(prop);
+					}
+				}
+			}
+			return props;
+		}
+		catch (Exception e) {
+			// System.out.println("Error: " + v + " property not found in " + corpus);
+			return null;
+		}
+	}
+	
+	/**
+	 * Instantiates a new reference pattern.
+	 */
+	public ReferencePattern() {
+		properties = new ArrayList<>();
+	}
+	
+	/**
+	 * Instantiates a new reference pattern.
+	 *
+	 * @param parameters the properties
+	 */
+	public ReferencePattern(Property prop) {
+		this.properties = new ArrayList<>();
+		properties.add(prop);
+	}
+	
+	/**
+	 * Instantiates a new reference pattern.
+	 *
+	 * @param parameters the properties
+	 */
+	public ReferencePattern(StructuralUnitProperty prop) {
+		properties.add(prop);
+		this.pattern = null;
+	}
+	
+	/**
+	 * Instantiates a new reference pattern.
+	 *
+	 * @param properties the properties
+	 */
+	public ReferencePattern(List<Property> properties) {
+		this.properties = properties;
+		this.pattern = null;
+	}
+	
+	/**
+	 * Instantiates a new reference pattern.
+	 *
+	 * @param properties the properties
+	 */
+	public ReferencePattern(List<Property> properties, String pattern) {
+		this.properties = properties;
+		this.pattern = pattern;
+	}
+	
+	public ReferencePattern(Property property, String pattern) {
+		this.properties.add(property);
+		this.pattern = pattern;
+	}
+	
+	/**
+	 * Don't forget to set the properties latter
+	 * 
+	 * @param pattern the sprintf pattern
+	 */
+	public ReferencePattern(String pattern) {
+		this.pattern = pattern;
+	}
+	
+	/**
+	 * Adds the property.
+	 *
+	 * @param property the property
+	 * @return the reference pattern
+	 */
+	public ReferencePattern addProperty(Property property) {
+		this.properties.add(property);
+		return this;
+	}
+	
+	public String format(Collection<?> collection) {
+		return String.format(pattern, collection.toArray()).toString();
+	}
+	
+	public String format(Object[] values) {
+		return String.format(pattern, values).toString();
+	}
+	
+	/*
+	 * (non-Javadoc)
+	 * @see java.lang.Iterable#iterator()
+	 */
+	@Override
+	public Iterator<Property> iterator() {
+		return properties.iterator();
+	}
+	
+	/**
+	 * Gets the properties.
+	 *
+	 * @return the properties
+	 */
+	public List<Property> getProperties() {
+		return properties;
+	}
+	
+	public String getPattern() {
+		return pattern;
+	}
+	
+	public void setPattern(String pattern) {
+		this.pattern = pattern;
+	}
+	
+	/*
+	 * (non-Javadoc)
+	 * @see java.lang.Object#toString()
+	 */
+	@Override
+	public String toString() {
+		StringBuffer buffer = new StringBuffer();
+		for (Property property : properties) {
+			buffer.append(property.getName() + " "); //$NON-NLS-1$
+		}
+		return buffer.toString().trim();
+	}
+	
+	/**
+	 * Gets the title.
+	 *
+	 * @return the title
+	 */
+	public String getTitle() {
+		if (this.properties == null || this.properties.size() == 0) return "none";
+		
+		if (pattern != null && pattern.length() > 0) {
+			return this.format(this.properties);
+		}
+		
+		String title = ""; //$NON-NLS-1$
+		for (Property p : this.properties) {
+			if (p == null) {
+				continue;
+			}
+			if (p instanceof StructuralUnitProperty || p instanceof VirtualProperty) {
+				title += p.getFullName() + ", "; //$NON-NLS-1$
+			}
+			else {
+				title += p.getName() + ", "; //$NON-NLS-1$
+			}
+		}
+		if (title.length() == 0) {
+			title = TXMCoreMessages.common_reference;
+		}
+		else {
+			title = title.substring(0, title.length() - 2);
+		}
+		return title;
+	}
+	
+	public static String referenceToString(List<String> names, String patternString) {
+		Gson gson = new Gson();
+		HashMap<String, Object> values = new HashMap<>();
+		values.put("properties", names);
+		values.put("format", patternString);
+		return gson.toJson(values);
+	}
+	
+	public static String referenceToString(ReferencePattern pattern) {
+		ArrayList<String> names = new ArrayList<>();
+		for (Property p : pattern.getProperties()) {
+			names.add(p.getFullName());
+		}
+		
+		return referenceToString(names, pattern.getPattern());
+	}
+	
+	public CQPCorpus getCorpus() {
+		if (properties.size() == 0) {
+			return null;
+		}
+		return properties.get(0).getCorpus();
+	}
+	
+	public static List<Property> getAvailableProperties(CQPCorpus corpus) {
+		List<Property> availableReferenceItems = new ArrayList<>();
+		try {
+			// add word properties
+			availableReferenceItems.addAll(corpus.getOrderedProperties());
+			
+			// add structural units properties
+			for (StructuralUnit unit : corpus.getOrderedStructuralUnits()) {
+				availableReferenceItems.addAll(unit.getOrderedProperties());
+			}
+			
+			// add virtual properties
+			availableReferenceItems.addAll(corpus.getVirtualProperties());
+		}
+		catch (Exception e) {
+			Log.printStackTrace(e);
+		}
+		return availableReferenceItems;
+	}
+}

Property changes on: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/ReferencePattern.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/Reference.java
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/Reference.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/Reference.java	(revision 3659)
@@ -0,0 +1,172 @@
+// Copyright © 2010-2020 ENS de Lyon., University of Franche-Comté
+// 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: 2013-09-04 11:17:02 +0200 (mer., 04 sept. 2013) $
+// $LastChangedRevision: 2526 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.searchengine.cqp;
+
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
+import org.txm.searchengine.cqp.corpus.Property;
+import org.txm.searchengine.cqp.corpus.query.Match;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class Reference:
+ * defines a pattern of word and/or structure properties
+ *
+ * @author mdecorde
+ */
+public class Reference {
+	
+	/** The values. */
+	LinkedHashMap<Property, String> values;
+	
+	/** The reference pattern. */
+	private ReferencePattern referencePattern = new ReferencePattern();
+	
+	/**
+	 * Instantiates a new reference.
+	 *
+	 * @param values the values
+	 * @param referencePattern the reference pattern
+	 */
+	public Reference(LinkedHashMap<Property, String> values, ReferencePattern referencePattern) {
+		this.values = values;
+		this.referencePattern = referencePattern;
+	}
+	
+	/**
+	 * Instantiates a new reference.
+	 *
+	 * @param match the match
+	 * @param referencePattern the reference pattern
+	 * @throws CqiClientException the cqi client exception
+	 */
+	public Reference(Match match, ReferencePattern referencePattern)
+			throws CqiClientException {
+		this.referencePattern = referencePattern;
+		this.values = new LinkedHashMap<>();
+		for (Property property : referencePattern) {
+			values.put(property, match.getValueForProperty(property));
+		}
+	}
+	
+	/**
+	 * Gets the reference pattern.
+	 *
+	 * @return the reference pattern
+	 */
+	public ReferencePattern getReferencePattern() {
+		return referencePattern;
+	}
+	
+	/**
+	 * Gets the properties.
+	 *
+	 * @return the properties
+	 */
+	public List<Property> getProperties() {
+		return referencePattern.getProperties();
+	}
+	
+	/**
+	 * Gets the properties.
+	 *
+	 * @return the properties
+	 */
+	public String format() {
+		if (referencePattern.getPattern() != null && referencePattern.getPattern().length() > 0) {
+			return referencePattern.format(values.values());
+		}
+		else {
+			return toString();
+		}
+	}
+	
+	/**
+	 * Gets the value.
+	 *
+	 * @param property the property
+	 * @return the value
+	 */
+	public String getValue(Property property) {
+		return values.get(property);
+	}
+	
+	/**
+	 * Checks if is oK.
+	 *
+	 * @return true, if is oK
+	 */
+	public boolean isOK() {
+		return (referencePattern != null && !values.isEmpty());
+	}
+	
+	/*
+	 * (non-Javadoc)
+	 * @see java.lang.Object#toString()
+	 */
+	@Override
+	public String toString() {
+		if (values.isEmpty())
+			return ""; //$NON-NLS-1$
+		// Iterator<Entry<Property, String>> iter = values.entrySet().iterator();
+		// Entry<Property, String> entry = iter.next();
+		StringBuffer buffer = new StringBuffer(""); //$NON-NLS-1$
+		/*
+		 * if (StructuralUnitProperty.class.isInstance(entry.getKey())) {
+		 * StructuralUnitProperty sProperty = (StructuralUnitProperty) entry.getKey();
+		 * //buffer.append(sProperty.getStructuralUnit() + "(" + entry.getKey().toString() + "):" + entry.getValue()); //$NON-NLS-1$ //$NON-NLS-2$
+		 * buffer.append(entry.getValue()); //$NON-NLS-1$ //$NON-NLS-2$
+		 * } else {
+		 * //buffer.append(entry.getKey().toString() + ":" + entry.getValue()); //$NON-NLS-1$
+		 * buffer.append(entry.getValue()); //$NON-NLS-1$
+		 * }
+		 * while (iter.hasNext()) {
+		 * entry = iter.next();
+		 * if (StructuralUnitProperty.class.isInstance(entry.getKey())) {
+		 * StructuralUnitProperty sProperty = (StructuralUnitProperty) entry.getKey();
+		 * //buffer.append(", " + sProperty.getStructuralUnit() + "(" + entry.getKey().toString() + "):" + entry.getValue()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+		 * buffer.append(", " +entry.getValue()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+		 * } else {
+		 * //buffer.append(", " + entry.getKey().toString() + ":" + entry.getValue()); //$NON-NLS-1$ //$NON-NLS-2$
+		 * buffer.append(", " + entry.getValue()); //$NON-NLS-1$ //$NON-NLS-2$
+		 * }
+		 * }
+		 */
+		for (Property p : this.getProperties()) {
+			buffer.append(values.get(p) + ", "); //$NON-NLS-1$
+		}
+		if (buffer.length() > 0)
+			return buffer.substring(0, buffer.length() - 2);
+		else
+			return ""; //$NON-NLS-1$
+	}
+}

Property changes on: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/Reference.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/AbstractCqiClient.java
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/AbstractCqiClient.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/AbstractCqiClient.java	(revision 3659)
@@ -0,0 +1,822 @@
+// Copyright © 2010-2020 ENS de Lyon., University of Franche-Comté
+// 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: 2012-03-01 08:14:11 +0100 (jeu., 01 mars 2012) $
+// $LastChangedRevision: 2134 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.searchengine.cqp;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.List;
+import java.util.SortedMap;
+import java.util.TreeMap;
+import java.util.UUID;
+import java.util.regex.Pattern;
+
+import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
+import org.txm.searchengine.cqp.clientExceptions.UnexpectedAnswerException;
+import org.txm.searchengine.cqp.core.messages.CQPSearchEngineCoreMessages;
+import org.txm.searchengine.cqp.corpus.CQPCorpus;
+import org.txm.searchengine.cqp.corpus.CorpusManager;
+import org.txm.searchengine.cqp.corpus.Property;
+import org.txm.searchengine.cqp.corpus.QueryResult;
+import org.txm.searchengine.cqp.corpus.StructuralUnitProperty;
+import org.txm.searchengine.cqp.corpus.VirtualProperty;
+import org.txm.searchengine.cqp.corpus.WordProperty;
+import org.txm.searchengine.cqp.corpus.query.CQLQuery;
+import org.txm.searchengine.cqp.corpus.query.Match;
+import org.txm.searchengine.cqp.serverException.CqiCqpErrorNoSuchCorpus;
+import org.txm.searchengine.cqp.serverException.CqiServerError;
+import org.txm.utils.logger.Log;
+
+/**
+ * This class implements a Java Interface CQi client.
+ *
+ * @author mdecorde
+ */
+public abstract class AbstractCqiClient implements ICqiClient {
+	
+	static Pattern pattern = Pattern.compile("\\p{Upper}(\\p{Upper}|\\p{Digit}|[_-])*"); //$NON-NLS-1$
+	
+	static Pattern pattern2 = Pattern.compile("\\p{Upper}(\\p{Lower}|\\p{Digit}|[_-])*"); //$NON-NLS-1$
+	
+	String lastError;
+	
+	/**
+	 * Check wether <code>id</code> is a valid CQi for a corpus.
+	 *
+	 * @param id the id
+	 * @return true if <code>id</code> is in uppercase chararcters
+	 */
+	public static synchronized boolean checkCorpusId(String id) {
+		// System.out.println("Pattern: "+pattern+" test with "+id);
+		return pattern.matcher(id).matches();
+	}
+	
+	/**
+	 * Check whether <code>id</code> is a valid CQi for a subcorpus.
+	 *
+	 * @param id the id
+	 * @return true if <code>id</code> is an uppercase character followed by
+	 *         lowercase characters
+	 */
+	public static synchronized boolean checkSubcorpusId(String id) {
+		// System.out.println("Pattern: "+pattern+" test with "+id);
+		return pattern2.matcher(id).matches();
+	}
+	
+	public synchronized String getLastError() {
+		if (lastError != null && lastError.length() > 0) {
+			return lastError;
+		}
+		return CQPSearchEngineCoreMessages.noError;
+	}
+	
+	public List<String> getSingleData(Property prop) throws IOException, CqiServerError, CqiClientException {
+		boolean isWordProperty = !(prop instanceof StructuralUnitProperty);
+		String qname = prop.getQualifiedName();
+		AbstractCqiClient cqiClient = CorpusManager.getCorpusManager().getCqiClient();
+		
+		if (!isWordProperty) {
+			StructuralUnitProperty sprop = (StructuralUnitProperty) prop;
+			QueryResult qresult = prop.getCorpus().query(new CQLQuery("<" + sprop.getFullName() + ">[] expand to " + sprop.getName()), "TMP", false); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+			int[] strucs = this.cpos2Struc(qname, qresult.getStarts());
+			return Arrays.asList(cqiClient.struc2Str(qname, strucs));
+		}
+		else {
+			int[] positions = { 0, 1, 2, 3 };
+			return Arrays.asList(cqiClient.cpos2Str(qname, positions));
+		}
+	}
+	
+	public List<String> getSingleData(Property prop, int[] positions) throws UnexpectedAnswerException, IOException, CqiServerError {
+		String qname = prop.getQualifiedName();
+		AbstractCqiClient cqiClient = CorpusManager.getCorpusManager().getCqiClient();
+		if (prop instanceof StructuralUnitProperty) {
+			int[] strucs = cqiClient.cpos2Struc(qname, positions);
+			return Arrays.asList(cqiClient.struc2Str(qname, strucs));
+		}
+		else if (prop instanceof WordProperty) {
+			return Arrays.asList(cqiClient.cpos2Str(qname, positions));
+		}
+		return null;
+	}
+	
+	public List<List<String>> getData(Property prop, List<Integer> positions,
+			List<Integer> nWords) throws CqiClientException, IOException, CqiServerError {
+		
+		// System.out.println("START prop: "+prop);
+		// System.out.println("positions : "+positions);
+		// System.out.println("nwords : "+nWords);
+		
+		List<List<String>> result = new ArrayList<>();
+		
+		// get all the positions needed, possible overlap
+		HashSet<Integer> allPositionsNeeded = new HashSet<>();
+		for (int i = 0; i < positions.size(); i++) {
+			int n = nWords.get(i);
+			for (int j = 0; j < n; j++) {
+				allPositionsNeeded.add(positions.get(i) + j);
+			}
+		}
+		
+		// conversion from List<Integer> to int[]
+		int[] cpos = new int[allPositionsNeeded.size()];
+		int c = 0;
+		for (int i : allPositionsNeeded) {
+			cpos[c++] = i;
+		}
+		
+		// get values for positions
+		String[] values;
+		if (prop instanceof StructuralUnitProperty) {
+			String qname = ((StructuralUnitProperty) prop).getQualifiedName();
+			int[] structs = this.cpos2Struc(qname, cpos);
+			values = this.struc2Str(qname, structs);
+		}
+		else if (prop instanceof WordProperty) {
+			values = ((WordProperty)prop).cpos2Str(cpos);
+		} else {
+			return null;
+		}
+		
+		// sort results by position
+		TreeMap<Integer, String> map = new TreeMap<>();
+		for (int i = 0; i < values.length; i++) {
+			map.put(cpos[i], values[i]);
+		}
+		
+		// fill results
+		int start, end;
+		SortedMap<Integer, String> smap;
+		for (int i = 0; i < positions.size(); i++) {
+			start = positions.get(i);
+			end = positions.get(i) + nWords.get(i);
+			if (start > end) {
+				Log.warning("Error: trying to get " + prop + " values from " + start + " to " + end);
+				result.add(new ArrayList<String>());
+			}
+			else {
+				smap = map.subMap(start, end);
+				result.add(new ArrayList<>(smap.values()));
+			}
+		}
+		
+		return result;
+	}
+	
+	/**
+	 * Return lists of strings.
+	 *
+	 * @return the data
+	 * @throws CqiClientException the cqi client exception
+	 */
+	public List<String> getData(StructuralUnitProperty property, CQPCorpus corpus) throws CqiClientException {
+		QueryResult tmp = corpus.query(new CQLQuery("<" + property.getFullName() + ">[]"), UUID.randomUUID().toString(), false); //$NON-NLS-1$ //$NON-NLS-2$
+		List<Match> matches = tmp.getMatches();
+		tmp.drop();
+		
+		ArrayList<String> ret = new ArrayList<>(new HashSet<>(Match.getValuesForProperty(property, matches)));
+		return ret;
+	}
+	
+	/**
+	 * Gets the data.
+	 *
+	 * @param number the number
+	 * @return return an abstract of values
+	 * @throws CqiClientException the cqi client exception
+	 */
+	public List<String> getData(StructuralUnitProperty prop, int number) throws CqiClientException {
+		
+		QueryResult tmp = prop.getCorpus().query(new CQLQuery("<" + prop.getFullName() + ">[] expand to " + prop.getName()), UUID.randomUUID().toString(), false); //$NON-NLS-1$ //$NON-NLS-2$
+		if (number > tmp.getNMatch()) {
+			number = tmp.getNMatch();
+		}
+		List<Match> matches = tmp.getMatches(0, number);
+		tmp.drop();
+		
+		return new ArrayList<>(new HashSet<>(Match.getValuesForProperty(prop, matches)));
+		// System.out.println("Data "+property.getQualifiedName()+": "+data);
+		
+	}
+	
+	// CQI_ERROR_CONNECT_REFUSED
+	/**
+	 * Connect the client to a server.
+	 *
+	 * @param username the username
+	 * @param password the password
+	 * @return true, if successful
+	 */
+	@Override
+	public abstract boolean connect(String username, String password) throws UnexpectedAnswerException, IOException, CqiServerError;
+	
+	// None
+	/**
+	 * Disconnect.
+	 * T
+	 * 
+	 * @return true, if successful
+	 */
+	@Override
+	public abstract boolean disconnect() throws UnexpectedAnswerException, CqiServerError, IOException;
+	
+	// CQI_CTRL_LAST_GENERAL_ERROR
+	/**
+	 * return the last CQP error.
+	 *
+	 * @return the last error
+	 */
+	@Override
+	public abstract String getLastCqiError() throws UnexpectedAnswerException, IOException, CqiServerError;
+	
+	// CQI_CTRL_LAST_CQP_ERROR
+	/**
+	 * return the last CQP error.
+	 *
+	 * @return the last error
+	 */
+	@Override
+	public abstract String getLastCQPError() throws UnexpectedAnswerException, IOException, CqiServerError;
+	
+	// None
+	/**
+	 * Lists the corpora available on the server.
+	 *
+	 * @return the name of the corpora
+	 */
+	@Override
+	public abstract String[] listCorpora() throws UnexpectedAnswerException, IOException, CqiServerError;
+	
+
+	
+	
+	// None
+	/**
+	 * Gives the corpus charset.
+	 *
+	 * @param corpus the corpus
+	 * @return the name of the charset
+	 */
+	@Override
+	public abstract String corpusCharset(String corpus) throws UnexpectedAnswerException, IOException, CqiServerError;
+	
+	
+	// None (not really implemented anyway)
+	/**
+	 * Gives the corpus properties.
+	 *
+	 * @param corpus the corpus
+	 * @return the properties
+	 */
+	@Override
+	public abstract String[] corpusProperties(String corpus) throws UnexpectedAnswerException, IOException, CqiServerError;
+	
+	// CQI_CQP_ERROR_NO_SUCH_CORPUS
+	/**
+	 * Gives the corpus positional attributes.
+	 *
+	 * @param corpusID the corpus id
+	 * @return the name of the attributes
+	 */
+	@Override
+	public abstract String[] corpusPositionalAttributes(String corpusID) throws UnexpectedAnswerException, IOException, CqiServerError;
+	
+	// CQI_CQP_ERROR_NO_SUCH_CORPUS
+	/**
+	 * Gives the corpus structural attributes.
+	 *
+	 * @param corpus the corpus
+	 * @return the name of the attributes
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiServerError Signals that the cqi server raised an error
+	 */
+	@Override
+	public abstract String[] corpusStructuralAttributes(String corpus) throws UnexpectedAnswerException, IOException, CqiServerError;
+	
+	// CQI_CQP_ERROR_NO_SUCH_CORPUS, CQI_CL_ERROR_NO_SUCH_ATTRIBUTE,
+	// CQI_CL_ERROR_WRONG_ATTRIBUTE_TYPE
+	/**
+	 * Check wether a structural attribute has values.
+	 *
+	 * @param attribute the attribute
+	 * @return true, if it has values
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiServerError Signals that the cqi server raised an error
+	 */
+	@Override
+	public abstract boolean corpusStructuralAttributeHasValues(String attribute) throws UnexpectedAnswerException, IOException,
+			CqiServerError;
+	
+	// CQI_CQP_ERROR_NO_SUCH_CORPUS
+	/**
+	 * Gives the corpus alignement attributes.
+	 *
+	 * @param corpus the corpus
+	 * @return the name of attributes
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiServerError Signals that the cqi server raised an error
+	 */
+	@Override
+	public abstract String[] corpusAlignementAttributes(String corpus) throws UnexpectedAnswerException, IOException, CqiServerError;
+	
+	// CQI_CQP_ERROR_NO_SUCH_CORPUS
+	/**
+	 * Gives the corpus full name.
+	 *
+	 * @param corpus the corpus
+	 * @return the full name
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiServerError Signals that the cqi server raised an error
+	 */
+	@Override
+	public abstract String corpusFullName(String corpus) throws UnexpectedAnswerException, IOException, CqiServerError;
+	
+	/**
+	 * Gives the corpus info listed in the .INFO file.
+	 *
+	 * @param corpus the corpus
+	 * @return the info
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiServerError Signals that the cqi server raised an error
+	 */
+	@Override
+	public abstract String[] corpusInfo(String corpus) throws UnexpectedAnswerException, IOException, CqiServerError;
+	
+	/**
+	 * Drop a corpus.
+	 * 
+	 * @param corpus
+	 *            the corpus
+	 */
+	@Override
+	public abstract void dropCorpus(String corpus) throws Exception;
+	
+	// CQI_CQP_ERROR_NO_SUCH_CORPUS, CQI_CL_ERROR_NO_SUCH_ATTRIBUTE,
+	// CQI_CL_ERROR_WRONG_ATTRIBUTE_TYPE, CQI_CL_ERROR_CORPUS_ACCESS
+	/**
+	 * Gives an attribute size (the number of token).
+	 *
+	 * @param attribute the attribute
+	 * @return the size
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws CqiServerError Signals that the cqi server raised an error
+	 */
+	@Override
+	public abstract int attributeSize(String attribute) throws IOException, UnexpectedAnswerException, CqiServerError;
+	
+	// CQI_CQP_ERROR_NO_SUCH_CORPUS, CQI_CL_ERROR_NO_SUCH_ATTRIBUTE,
+	// CQI_CL_ERROR_WRONG_ATTRIBUTE_TYPE, CQI_CL_ERROR_CORPUS_ACCESS
+	/**
+	 * Gives the lexicon size of an attribute.
+	 *
+	 * @param attribute the attribute
+	 * @return the int
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws CqiServerError Signals that the cqi server raised an error
+	 * @returns the number of entries in the lexicon of a positional attribute
+	 */
+	@Override
+	public abstract int lexiconSize(String attribute) throws IOException, UnexpectedAnswerException, CqiServerError;
+	
+	/**
+	 * Drop attribute.
+	 *
+	 * @param attribute the attribute
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws CqiServerError Signals that the cqi server raised an error
+	 */
+	@Override
+	public abstract void dropAttribute(String attribute) throws IOException, UnexpectedAnswerException, CqiServerError;
+	
+	/**
+	 * Converts an array of attribute values to their ID.
+	 *
+	 * @param attribute the attribute
+	 * @param strings the values
+	 * @return the IDs
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws CqiServerError Signals that the cqi server raised an error
+	 */
+	@Override
+	public abstract int[] str2Id(String attribute, String[] strings) throws IOException, UnexpectedAnswerException, CqiServerError;
+	
+	/**
+	 * Converts an array of attribute ID to their values.
+	 *
+	 * @param attribute the attribute
+	 * @param ids the ids
+	 * @return the values
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiServerError Signals that the cqi server raised an error
+	 */
+	@Override
+	public abstract String[] id2Str(String attribute, int[] ids) throws UnexpectedAnswerException, IOException, CqiServerError;
+	
+	/**
+	 * Converts an array of attribute IDs to their frequency.
+	 *
+	 * @param attribute the attribute
+	 * @param ids the ids
+	 * @return the frequencies
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiServerError Signals that the cqi server raised an error
+	 */
+	@Override
+	public abstract int[] id2Freq(String attribute, int[] ids) throws UnexpectedAnswerException, IOException, CqiServerError;
+	
+	/**
+	 * Converts an array of position to their ID given an attribute.
+	 *
+	 * @param attribute the attribute
+	 * @param cpos the positions
+	 * @return the IDs
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiServerError Signals that the cqi server raised an error
+	 */
+	@Override
+	public abstract int[] cpos2Id(String attribute, int[] cpos) throws UnexpectedAnswerException, IOException, CqiServerError;
+	
+	/**
+	 * Converts an array of position to their value given an attribute.
+	 *
+	 * @param attribute the attribute
+	 * @param cpos the cpos
+	 * @return the values
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiServerError the cqi server error
+	 */
+	@Override
+	public abstract String[] cpos2Str(String attribute, int[] cpos) throws UnexpectedAnswerException, IOException, CqiServerError;
+	
+	/**
+	 * Computes for each position of an array the Id of the enclosing structural
+	 * attribute.
+	 *
+	 * @param attribute the attribute
+	 * @param cpos the positions
+	 * @return the IDs
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiServerError the cqi server error
+	 */
+	@Override
+	public abstract int[] cpos2Struc(String attribute, int[] cpos) throws UnexpectedAnswerException, IOException, CqiServerError;
+	
+	/**
+	 * Computes for each position of an array the position of the left boundary
+	 * of the enclosing structural attribute.
+	 *
+	 * @param attribute the attribute
+	 * @param cpos the cpos
+	 * @return the positions of the left boundaries
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiServerError the cqi server error
+	 */
+	@Override
+	public abstract int[] cpos2LBound(String attribute, int[] cpos) throws UnexpectedAnswerException, IOException, CqiServerError;
+	
+	/**
+	 * Computes for each position of an array the position of the right boundary
+	 * of the enclosing structural attribute.
+	 *
+	 * @param attribute the attribute
+	 * @param cpos the cpos
+	 * @return the positions of the right boundaries
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiServerError the cqi server error
+	 */
+	@Override
+	public abstract int[] cpos2RBound(String attribute, int[] cpos) throws UnexpectedAnswerException, IOException, CqiServerError;
+	
+	/**
+	 * Computes for each position of an array the Id of the enclosing alignment
+	 * attribute.
+	 *
+	 * @param attribute the attribute
+	 * @param cpos the cpos
+	 * @return the int[]
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiServerError the cqi server error
+	 */
+	@Override
+	public abstract int[] cpos2Alg(String attribute, int[] cpos) throws UnexpectedAnswerException, IOException, CqiServerError;
+	
+	/**
+	 * Retrieves annotated string values of structure regions in <strucs>; "" if
+	 * out of range.
+	 *
+	 * @param attribute the attribute
+	 * @param strucs the strucs
+	 * @return the string[]
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiServerError the cqi server error
+	 */
+	@Override
+	public abstract String[] struc2Str(String attribute, int[] strucs) throws UnexpectedAnswerException, IOException, CqiServerError;
+	
+	/**
+	 * Retrieves all corpus positions where the given token occurs.
+	 *
+	 * @param attribute the attribute
+	 * @param id the id
+	 * @return the position
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiServerError the cqi server error
+	 */
+	@Override
+	public abstract int[] id2Cpos(String attribute, int id) throws UnexpectedAnswerException, IOException, CqiServerError;
+	
+	/**
+	 * Retrieves all corpus positions where one of the tokens in <id_list>
+	 * occurs; the returned list is sorted as a whole, not per token id.
+	 *
+	 * @param attribute the attribute
+	 * @param ids the ids
+	 * @return the positions
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiServerError the cqi server error
+	 */
+	@Override
+	public abstract int[] idList2Cpos(String attribute, int[] ids) throws UnexpectedAnswerException, IOException, CqiServerError;
+	
+	/**
+	 * Retrieves the lexicon IDs of all tokens that match <regex>; the returned
+	 * list may be empty (size 0).
+	 *
+	 * @param attribute the attribute
+	 * @param regex the regex
+	 * @return the IDs
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiServerError the cqi server error
+	 */
+	@Override
+	public abstract int[] regex2Id(String attribute, String regex) throws UnexpectedAnswerException, IOException, CqiServerError;
+	
+	/**
+	 * Retrieves the start and end corpus positions of structure region <struc>.
+	 *
+	 * @param attribute the attribute
+	 * @param struc the struc
+	 * @return an array of size 2 containing the start and end positions
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiServerError the cqi server error
+	 */
+	@Override
+	public abstract int[] struc2Cpos(String attribute, int struc) throws UnexpectedAnswerException, IOException, CqiServerError;
+	
+	/**
+	 * Retrieves start and end corpus positions of an alignement region in the
+	 * source and target corpora<struc>.
+	 *
+	 * @param attribute the attribute
+	 * @param struc the struc
+	 * @return an array of size 4 containing (src_start, src_end, target_start,
+	 *         target_end)
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiServerError the cqi server error
+	 */
+	@Override
+	public abstract int[] alg2Cpos(String attribute, int struc) throws UnexpectedAnswerException, IOException, CqiServerError;
+	
+	/**
+	 * Runs a CQL query.
+	 *
+	 * @param motherCorpus the mother corpus
+	 * @param subcorpus the subcorpus
+	 * @param query the query
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws CqiServerError the cqi server error
+	 */
+	@Override
+	public abstract void cqpQuery(String motherCorpus, String subcorpus, String query) throws IOException, UnexpectedAnswerException, CqiServerError;
+	
+	/**
+	 * Runs a CQP query line.
+	 *
+	 * @param motherCorpus the mother corpus
+	 * @param subcorpus the subcorpus
+	 * @param query the query
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws CqiServerError the cqi server error
+	 */
+	@Override
+	public abstract void query(String query) throws IOException, UnexpectedAnswerException, CqiServerError;
+	
+	/**
+	 * Load a CQP corpus (system) from a registry file
+	 *
+	 * @param motherCorpus the mother corpus
+	 * @param query the query
+	 * @return
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws CqiServerError the cqi server error
+	 */
+	@Override
+	public abstract boolean load_a_system_corpus(String regfilepath, String entry) throws IOException, UnexpectedAnswerException, CqiServerError;
+	
+	/**
+	 * Lists all the subcorpora of a corpus.
+	 *
+	 * @param corpus the corpus
+	 * @return the name of the subcorpora
+	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 * @throws CqiCqpErrorNoSuchCorpus the cqi cqp error no such corpus
+	 */
+	@Override
+	public abstract String[] listSubcorpora(String corpus) throws UnexpectedAnswerException, IOException, CqiServerError;
+	
+	/**
+	 * Gives the size of a subcorpus .
+	 * 
+	 * @param subcorpus
+	 *            the subcorpus
+	 * 
+	 * @return the size
+	 * 
+	 * @throws IOException
+	 *             Signals that an I/O exception has occurred.
+	 * @throws UnexpectedAnswerException
+	 *             Signals that the data read on the socket is unexpected
+	 * @throws CqiServerError
+	 *             the cqi server error
+	 */
+	@Override
+	public abstract int subCorpusSize(String subcorpus) throws IOException,
+			UnexpectedAnswerException, CqiServerError;
+	
+	/**
+	 * Checks wether a subcorpus has a field.
+	 * 
+	 * @param subcorpus
+	 *            the subcorpus
+	 * @param field
+	 *            the field
+	 * 
+	 * @return true, if the subcorpus has the field
+	 * 
+	 * @throws IOException
+	 *             Signals that an I/O exception has occurred.
+	 * @throws UnexpectedAnswerException
+	 *             Signals that the data read on the socket is unexpected
+	 * @throws CqiServerError
+	 *             the cqi server error
+	 */
+	@Override
+	public abstract boolean subCorpusHasField(String subcorpus, byte field) throws IOException, UnexpectedAnswerException, CqiServerError;
+	
+	/**
+	 * Dumps the values of <field> for match ranges <first> .. <last> in
+	 * <subcorpus>. <field> is one of the CQI_CONST_FIELD_* constants.
+	 * 
+	 * @param subcorpus
+	 *            the subcorpus
+	 * @param field
+	 *            the field
+	 * @param first
+	 *            the first
+	 * @param last
+	 *            the last
+	 * 
+	 * @return the values
+	 * 
+	 * @throws IOException
+	 *             Signals that an I/O exception has occurred.
+	 * @throws UnexpectedAnswerException
+	 *             Signals that the data read on the socket is unexpected
+	 * @throws CqiServerError
+	 *             the cqi server error
+	 */
+	@Override
+	public abstract int[] dumpSubCorpus(String subcorpus, byte field, int first, int last) throws IOException, UnexpectedAnswerException,
+			CqiServerError;
+	
+	/**
+	 * Drops a subcorpus.
+	 * 
+	 * @param subcorpus
+	 *            the subcorpus
+	 * 
+	 * @throws IOException
+	 *             Signals that an I/O exception has occurred.
+	 * @throws UnexpectedAnswerException
+	 *             Signals that the data read on the socket is unexpected
+	 * @throws CqiServerError
+	 *             the cqi server error
+	 */
+	@Override
+	public abstract void dropSubCorpus(String subcorpus) throws IOException,
+			UnexpectedAnswerException, CqiServerError;
+	
+	/**
+	 * Returns <n> (id, frequency) pairs flattened into a list of size 2*<n> NB:
+	 * pairs are sorted by frequency desc.
+	 * 
+	 * @param subcorpus
+	 *            the subcorpus
+	 * @param cutoff
+	 *            the cutoff
+	 * @param field
+	 *            the field : one of CQI_CONST_FIELD_MATCH,
+	 *            CQI_CONST_FIELD_TARGET, CQI_CONST_FIELD_KEYWORD
+	 * @param attribute
+	 *            the attribute
+	 * 
+	 * @return the int[][]
+	 * 
+	 * @throws IOException
+	 *             Signals that an I/O exception has occurred.
+	 * @throws UnexpectedAnswerException
+	 *             Signals that the data read on the socket is unexpected
+	 * @throws CqiServerError
+	 *             the cqi server error
+	 */
+	@Override
+	public abstract int[][] fdist1(String subcorpus, int cutoff,
+			byte field, String attribute) throws IOException,
+			UnexpectedAnswerException, CqiServerError;
+	
+	/**
+	 * Returns <n> (id1, id2, frequency) pairs flattened into a list of size
+	 * 3*<n> NB: triples are sorted by frequency desc. .
+	 * 
+	 * @param subcorpus
+	 *            the subcorpus
+	 * @param cutoff
+	 *            the cutoff
+	 * @param field1
+	 *            the field1
+	 * @param attribute1
+	 *            the attribute1
+	 * @param field2
+	 *            the field2
+	 * @param attribute2
+	 *            the attribute2
+	 * 
+	 * @return the int[]
+	 * 
+	 * @throws IOException
+	 *             Signals that an I/O exception has occurred.
+	 * @throws UnexpectedAnswerException
+	 *             Signals that the data read on the socket is unexpected
+	 * @throws CqiServerError
+	 *             the cqi server error
+	 */
+	@Override
+	public abstract int[][] fdist2(String subcorpus, int cutoff,
+			byte field1, String attribute1, byte field2, String attribute2) throws IOException, UnexpectedAnswerException, CqiServerError;
+	
+	@Override
+	public abstract boolean reconnect();
+}

Property changes on: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/AbstractCqiClient.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/CQPSearchEngine.java
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/CQPSearchEngine.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/CQPSearchEngine.java	(revision 3659)
@@ -0,0 +1,503 @@
+package org.txm.searchengine.cqp;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.List;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.txm.Toolbox;
+import org.txm.core.engines.EngineType;
+import org.txm.core.messages.TXMCoreMessages;
+import org.txm.core.results.TXMResult;
+import org.txm.libs.cqp.CQPLibPreferences;
+import org.txm.objects.CorpusBuild;
+import org.txm.objects.Match;
+import org.txm.searchengine.core.EmptySelection;
+import org.txm.searchengine.core.IQuery;
+import org.txm.searchengine.core.Query;
+import org.txm.searchengine.core.SearchEngine;
+import org.txm.searchengine.core.SearchEngineProperty;
+import org.txm.searchengine.core.Selection;
+import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
+import org.txm.searchengine.cqp.clientExceptions.ServerNotFoundException;
+import org.txm.searchengine.cqp.corpus.CQPCorpus;
+import org.txm.searchengine.cqp.corpus.CorpusManager;
+import org.txm.searchengine.cqp.corpus.Property;
+import org.txm.searchengine.cqp.corpus.WordProperty;
+import org.txm.searchengine.cqp.corpus.query.CQLQuery;
+import org.txm.utils.OSDetector;
+import org.txm.utils.Sh;
+import org.txm.utils.logger.Log;
+
+public class CQPSearchEngine extends SearchEngine {
+	
+	public static final String NAME = "CQP";
+	
+	/**
+	 * initialization state
+	 */
+	boolean state = false;
+	
+	boolean useNetCQi = false;
+	
+	@Override
+	public String getName() {
+		return CQPSearchEngine.NAME;
+	}
+	
+	/**
+	 * Starts the corpus engine if not remove then launch cqpserver.
+	 *
+	 * @return true, if successful
+	 */
+	@Override
+	public boolean start(IProgressMonitor monitor) throws Exception {
+		
+		boolean cqiserverok = false;
+		
+		if (monitor != null) {
+			monitor.subTask("Starting CQP Engine...");
+		}
+		
+		CorpusManager.cleanCorpora();// to be sure to call cqpserver
+		
+		useNetCQi = CQPLibPreferences.getInstance().getBoolean(CQPLibPreferences.CQI_NETWORK_MODE);
+		
+		Log.fine("Killing CQP processes if any...");
+		killSearchEngine();
+		
+		boolean remote = CQPLibPreferences.getInstance().getBoolean(CQPLibPreferences.CQI_SERVER_IS_REMOTE);
+		state = false;
+		// test if must-have properties for CWB are set
+		
+		String init_path = CQPLibPreferences.getInstance().getString(CQPLibPreferences.CQI_SERVER_PATH_TO_INIT_FILE);
+		if (init_path.length() > 0 && !new File(init_path).exists()) {
+			Log.warning(TXMCoreMessages.bind("Warning: the given CQP init file path can not be found in {0}.", init_path));
+			init_path = null;
+		}
+		
+		if (!remote) {
+			
+			if (!useNetCQi) {
+				try {
+					cqiServer = new MemCqiServer("",  //$NON-NLS-1$
+							init_path,
+							CQPLibPreferences.getInstance().getString(CQPLibPreferences.CQI_SERVER_ADDITIONAL_OPTIONS)
+									+ " -P " + CQPLibPreferences.getInstance().getString(CQPLibPreferences.CQI_SERVER_PORT), //$NON-NLS-1$
+							Boolean.parseBoolean(CQPLibPreferences.getInstance().getString(CQPLibPreferences.CQI_SERVER_MONITOR_OUTPUT)));
+				}
+				catch (Exception e) {
+					// TODO Auto-generated catch block
+					org.txm.utils.logger.Log.printStackTrace(e);
+				}
+			}
+			else {
+				
+				String exec_path = CQPLibPreferences.getInstance().getString(CQPLibPreferences.CQI_SERVER_PATH_TO_EXECUTABLE);
+				
+				if (exec_path == null || exec_path.length() == 0 || new File(exec_path).exists()) {
+					Log.severe(TXMCoreMessages.bind("Error: the '{0}' preference is not set.", CQPLibPreferences.CQI_SERVER_PATH_TO_EXECUTABLE));
+				}
+				// if (new File(exec_path).exists()) {
+				// System.out.println("Error: the '"+CQPLibPreferences.CQI_SERVER_PATH_TO_EXECUTABLE+"' preference is not set.");
+				// }
+				
+				cqiServer = new NetCqiServer(exec_path,
+						"",  //$NON-NLS-1$
+						init_path,
+						CQPLibPreferences.getInstance().getString(CQPLibPreferences.CQI_SERVER_ADDITIONAL_OPTIONS)
+								+ " -P " + CQPLibPreferences.getInstance().getString(CQPLibPreferences.CQI_SERVER_PORT), //$NON-NLS-1$
+						CQPLibPreferences.getInstance().getBoolean(CQPLibPreferences.CQI_SERVER_MONITOR_OUTPUT));
+			}
+			
+			if (cqiServer != null) {
+				cqiserverok = cqiServer.start();
+			}
+			
+		}
+		
+		// create cqi client
+		try {
+			if (cqiserverok) {
+				if (!useNetCQi) {
+					try {
+						cqiClient = new MemCqiClient((MemCqiServer) cqiServer);
+					}
+					catch (Exception e) {
+						Log.severe(TXMCoreMessages.failedToStartMemCqiClientColon);
+						Log.printStackTrace(e);
+						cqiserverok = false;
+					}
+				}
+				else {
+					int port = CQPLibPreferences.getInstance().getInt(CQPLibPreferences.CQI_SERVER_PORT);
+					String host = CQPLibPreferences.getInstance().getString(CQPLibPreferences.CQI_SERVER_HOST);
+					cqiClient = new NetCqiClient(host, port);
+				}
+			}
+		}
+		catch (NumberFormatException e1) {
+			Log.severe(TXMCoreMessages.bind(TXMCoreMessages.errorColonTheConnexionToTheServerFailedColonWrongPortFormat, CQPLibPreferences.getInstance().getString(CQPLibPreferences.CQI_SERVER_PORT)));
+		}
+		catch (ServerNotFoundException e1) {
+			Log.severe(TXMCoreMessages.bind(TXMCoreMessages.errorColonWhileConnectionToSearchEngineWithTheFollowingParametersColon, CQPLibPreferences.getInstance().getString(
+					CQPLibPreferences.CQI_SERVER_HOST),
+					CQPLibPreferences.getInstance().getString(CQPLibPreferences.CQI_SERVER_PORT)));
+		}
+		
+		// try connecting to the CWB server
+		try {
+			if (cqiserverok) {
+				String login = CQPLibPreferences.getInstance().getString(CQPLibPreferences.CQI_SERVER_LOGIN);
+				String password = CQPLibPreferences.getInstance().getString(CQPLibPreferences.CQI_SERVER_PASSWORD);
+				state = cqiClient.connect(login, password);
+			}
+		}
+		catch (Exception e1) {
+			Log.severe(Log.toString(e1));
+		}
+		
+		if (state == false) {
+			Log.severe(TXMCoreMessages.errorWhileConnectingToSearchEngine);
+			if (cqiClient instanceof NetCqiClient) {
+				Log.severe(TXMCoreMessages.bind(TXMCoreMessages.wrongLoginOrPasswordOrPortColon, CQPLibPreferences.getInstance().getString(CQPLibPreferences.CQI_SERVER_LOGIN),
+						CQPLibPreferences.getInstance().getString(CQPLibPreferences.CQI_SERVER_PASSWORD), CQPLibPreferences.getInstance().getString(CQPLibPreferences.CQI_SERVER_HOST),
+						CQPLibPreferences.getInstance().getInt(CQPLibPreferences.CQI_SERVER_PORT)));
+			}
+			if (cqiServer != null && cqiServer instanceof NetCqiServer) {
+				Log.severe(TXMCoreMessages.bind(TXMCoreMessages.orTheEngineWasNotStartedWithTheCommandLineColon, cqiServer.getLastCmdLine()));
+			}
+		}
+		else {
+			if (cqiServer == null || cqiServer instanceof NetCqiServer)
+				Log.fine(TXMCoreMessages.connectedToCQP);
+		}
+		
+		CorpusManager.setCqiClient(cqiClient);
+		
+		// wait for CQPSERVER TO BE READY
+		int scount = 0;
+		try {
+			CorpusManager.getCorpusManager().getCorpora();
+			do {
+				Thread.sleep(100);
+				CorpusManager.cleanCorpora();// to be sure to call cqpserver
+				CorpusManager.getCorpusManager().getCorpora();
+				scount++;
+				if (scount >= 10) {
+					Log.fine(TXMCoreMessages.endOfCQPWaitTest);
+					break;
+				}
+			}
+			while (CorpusManager.getCorpusManager().getCorpora().size() == 0);
+		}
+		catch (Exception e) {
+			org.txm.utils.logger.Log.printStackTrace(e);
+			Log.severe(TXMCoreMessages.bind(TXMCoreMessages.errorWhileWaitingForCQP, e));
+		}
+		
+		// FIXME: SJ: this test should be moved at start of this method? before running CQP?
+		if (Toolbox.workspace == null) {
+			Log.severe("Can't start CQP with workspace not ready.");
+			return false;
+		}
+		
+		//// initialize pre-configured subcorpus and partition of corpus registered in the default.xml workspace file
+		// System.out.print(TXMCoreMessages.Toolbox_workspace_init);
+		// for (Project b : Toolbox.workspace.getProjects()) {
+		//
+		// Log.info("Loading CQP corpora of " + b.getName() + " corpus...");
+		//
+		// if (!loadCQPCorpora(b, monitor)) {
+		// Log.severe("Failed to load CQP corpora of " + b.getName() + " corpus.");
+		// }
+		// }
+		
+		Log.fine(TXMCoreMessages.common_done);
+		
+		return state;
+	}
+	
+	// public boolean loadCQPCorpora(Project base, IProgressMonitor monitor) {
+	// //System.out.println("Load corpus from params: "+params.corpora);
+	// for (String corpusname : base.getProjectParameters().corpora.keySet()) {
+	// Element c = base.getProjectParameters().corpora.get(corpusname);
+	// try {
+	// MainCorpus corp = CorpusManager.getCorpusManager().getCorpus(corpusname);
+	// if (monitor != null) {
+	// monitor.subTask("Loading " + corp + " subcorpora and partitions of corpus " + corpusname + "...");
+	// }
+	// corp.setSelfElement(c);
+	// corp.setParent(base);
+	// corp.load(); // don't load corpus right now, wait for the search engine to be ready
+	// base.addChild(corp);
+	// if (!corp.getMetadatas().containsKey("lang")) { //$NON-NLS-1$
+	// corp.setAttribute("lang", c.getAttribute("lang")); //$NON-NLS-1$ //$NON-NLS-2$
+	// }
+	// } catch (Exception e) {
+	// System.out.println(e.getLocalizedMessage());
+	// org.txm.utils.logger.Log.printStackTrace(e);
+	// return false;
+	// }
+	// }
+	// return true;
+	// }
+	
+	@Override
+	public boolean initialize() {
+		// all initialization done in the start method because we need CQP executable/lib to restart from the beginning
+		return true;
+	}
+	
+	/** The CQI server. */
+	private static AbstractCqiServer cqiServer;
+	
+	/** The CQI client. */
+	private static AbstractCqiClient cqiClient;
+	
+	/**
+	 * Sets the CQI server.
+	 *
+	 * @param cqiServer the new cqi server
+	 */
+	public static void setCqiServer(AbstractCqiServer cqiServer) {
+		CQPSearchEngine.cqiServer = cqiServer;
+	}
+	
+	/**
+	 * Gets the cqi client.
+	 *
+	 * @return the cqi client
+	 */
+	public static AbstractCqiClient getCqiClient() {
+		return cqiClient;
+	}
+	
+	/**
+	 * Sets the cqi client.
+	 *
+	 * @param cqiClient the new cqi client
+	 */
+	public static void setCqiClient(NetCqiClient cqiClient) {
+		CQPSearchEngine.cqiClient = cqiClient;
+	}
+	
+	/**
+	 * Gets the CQI server.
+	 *
+	 * @return the CQI server
+	 */
+	public static AbstractCqiServer getCqiServer() {
+		return cqiServer;
+	}
+	
+	/**
+	 * Shuts the toolbox searchengine down.
+	 */
+	@Override
+	public boolean stop() {
+		try {
+			if (cqiClient != null) {
+				
+				if (cqiClient instanceof MemCqiClient) {
+					for (String name : ((MemCqiClient) cqiClient).listCorpora()) {
+						((MemCqiClient) cqiClient).dropCorpus(name);
+					}
+				}
+				cqiClient.disconnect();
+			}
+			
+			if (cqiServer != null && cqiServer.isRunning()) {
+				cqiServer.stop();
+				
+				CorpusManager.clean();
+				if (cqiServer instanceof NetCqiServer) {
+					killSearchEngine();
+				}
+				
+				cqiClient = null;
+				cqiServer = null;
+			}
+			System.gc();
+			
+			state = false;
+		}
+		catch (Exception e) {
+			Log.severe("Error while closing CQP: " + e.getLocalizedMessage());
+			return false;
+		}
+		return !state;
+	}
+	
+	/**
+	 * kill cqpserver process.
+	 */
+	private static void killSearchEngine() {
+		if (!CQPLibPreferences.getInstance().getBoolean(CQPLibPreferences.CQI_SERVER_IS_REMOTE) && cqiServer instanceof MemCqiServer) {
+			// Windows OS
+			if (OSDetector.isFamilyWindows()) {
+				try {
+					Process p = Runtime.getRuntime().exec("taskkill /IM cqpserver.exe /F"); //$NON-NLS-1$
+					p.waitFor();
+					p = Runtime.getRuntime().exec("taskkill /IM cqpserver.exe /F"); //$NON-NLS-1$
+					p.waitFor();
+				}
+				catch (IOException e) {
+					Log.severe(TXMCoreMessages.bind(TXMCoreMessages.failedToExecTaskkillIMCqpserverexeFColon, Log.toString(e)));
+					System.out.println(TXMCoreMessages.bind(TXMCoreMessages.failedToExecTaskkillIMCqpserverexeFColon, Log.toString(e)));
+					try {
+						Process p = Runtime.getRuntime().exec("tskill cqpserver.exe"); //$NON-NLS-1$
+						p.waitFor();
+						p = Runtime.getRuntime().exec("tskill cqpserver.exe"); //$NON-NLS-1$
+						p.waitFor();
+					}
+					catch (IOException e2) {
+						e2.printStackTrace();
+						Log.severe(TXMCoreMessages.bind(TXMCoreMessages.failedToExecTskillCqpserverexeColon, Log.toString(e2)));
+						System.out.println(TXMCoreMessages.bind(TXMCoreMessages.failedToExecTskillCqpserverexeColon, Log.toString(e2)));
+					}
+					catch (InterruptedException e3) {
+						e3.printStackTrace();
+						Log.severe(Log.toString(e3));
+						System.out.println(Log.toString(e3));
+					}
+				}
+				catch (InterruptedException e) {
+					Log.severe(TXMCoreMessages.bind("Error while closing CQP: {0}.", e.getLocalizedMessage()));
+					e.printStackTrace();
+					System.out.println(Log.toString(e));
+				}
+			}
+			else { // Mac, Linux
+				String cmd = "kill `ps aux | grep cqpserver | awk '/-P " + CQPLibPreferences.getInstance().getString(CQPLibPreferences.CQI_SERVER_PORT) + "/ {print $2}'`"; // //$NON-NLS-1$ //$NON-NLS-2$
+				try {
+					// Process p = Runtime.getRuntime().exec("killall -9 cqpserver"); //$NON-NLS-1$
+					// System.out.println("kill `ps aux | grep cqpserver | awk '/-P "
+					// + CQPPreferences.getInstance().getString(CQI_SERVER_PORT) + "/ {print $2}'`");
+					// String[] args =
+					// {"kill","`ps aux | grep cqpserver | awk '/-P " +
+					// CQPPreferences.getInstance().getString(CQI_SERVER_PORT) + "/ {print $2}'`"};
+					// System.out.println("before Sh constructor");
+					Sh sh = new Sh(""); //$NON-NLS-1$
+					// System.out.println("after Sh constructor");
+					// System.out.println("EXECUTE SH : "+"kill `ps aux | grep cqpserver | awk '/-P "
+					// + CQPPreferences.getInstance().getString(CQI_SERVER_PORT) + "/ {print $2}'`");
+					sh.setIsc(cmd);
+					sh.sh();
+					// Runtime.getRuntime().exec("sh kill `ps aux | grep cqpserver | awk '/-P "
+					// + CQPPreferences.getInstance().getString(CQI_SERVER_PORT) + "/ {print $2}'`");
+					
+				}
+				catch (Exception e) {
+					Log.severe(TXMCoreMessages.bind(TXMCoreMessages.failedToExec, cmd, Log.toString(e)));
+					System.out.println(TXMCoreMessages.bind(TXMCoreMessages.failedToExec, cmd, Log.toString(e)));
+					org.txm.utils.logger.Log.printStackTrace(e);
+				}
+			}
+		}
+	}
+	
+	/**
+	 * Restart the toolbox's searchengine.
+	 *
+	 * @return true, if successful
+	 */
+	public boolean restart() {
+		try {
+			boolean ret = stop();
+			Thread.sleep(10);
+			ret = ret && start(null);
+			return ret;
+		}
+		catch (Exception e) {
+			Log.severe(TXMCoreMessages.bind("Error while restarting CQP: {0}.", e.getLocalizedMessage()));
+		}
+		return false;
+	}
+	
+	/**
+	 * test if searchEngine is initialized.
+	 *
+	 * @return true, if is initialized
+	 */
+	public static boolean isInitialized() {
+		return Toolbox.getEngineManager(EngineType.SEARCH).getEngine(CQPSearchEngine.NAME).isRunning();
+	}
+	
+	@Override
+	public boolean isRunning() {
+		return state;
+	}
+	
+	@Override
+	public Selection query(CorpusBuild corpus, IQuery query, String name, boolean saveQuery) throws CqiClientException {
+		if (query instanceof CQLQuery && corpus instanceof CQPCorpus) {
+			return ((CQPCorpus) corpus).query((CQLQuery) query, name, saveQuery);
+		}
+		else {
+			return new EmptySelection(query);
+		}
+	}
+	
+	@Override
+	public Query newQuery() {
+		return new CQLQuery(""); //$NON-NLS-1$
+	}
+	
+	@Override
+	public boolean hasIndexes(CorpusBuild corpus) {
+		if (corpus instanceof CQPCorpus) return true;
+		
+		try {
+			String id = corpus.getID();
+			
+			return CorpusManager.getCorpusManager().getCorpus(id) != null;
+		}
+		catch (Exception e) {
+			e.printStackTrace();
+			return false;
+		}
+	}
+	
+	@Override
+	public void notify(TXMResult r, String state) {
+		// TODO Auto-generated method stub
+	}
+	
+	public static CQPSearchEngine getEngine() {
+		return (CQPSearchEngine) Toolbox.getEngineManager(EngineType.SEARCH).getEngine(CQPSearchEngine.NAME);
+	}
+	
+	@Override
+	public String getValueForProperty(Match match, SearchEngineProperty property) {
+		if (!(property instanceof Property)) return null;
+		Property p = (Property) property;
+		try {
+			return org.txm.searchengine.cqp.corpus.query.Match.getValueForProperty(p, match.getStart());
+		}
+		catch (CqiClientException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+		return null;
+	}
+	
+	@Override
+	public List<String> getValuesForProperty(Match match, SearchEngineProperty property) {
+		if (!(property instanceof Property)) return null;
+		
+		Property p = (Property) property;
+		try {
+			return org.txm.searchengine.cqp.corpus.query.Match.getValuesForProperty(p, match);
+		}
+		catch (CqiClientException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+		return null;
+	}
+	
+	public List<String> getValuesForProperty(int[] positions, WordProperty property) throws CqiClientException {
+		return org.txm.searchengine.cqp.corpus.query.Match.getValuesForProperty(property, positions);
+	}
+}

Property changes on: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/CQPSearchEngine.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/clientExceptions/package.html
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/clientExceptions/package.html	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/clientExceptions/package.html	(revision 3659)
@@ -0,0 +1,6 @@
+<html>
+<body>
+	<p>Exception during communication between the cqp server and the
+		cqp client.</p>
+</body>
+</html>
\ No newline at end of file

Property changes on: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/clientExceptions/package.html
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/clientExceptions/ServerNotFoundException.java
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/clientExceptions/ServerNotFoundException.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/clientExceptions/ServerNotFoundException.java	(revision 3659)
@@ -0,0 +1,75 @@
+// Copyright © 2010-2020 ENS de Lyon., University of Franche-Comté
+// 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: 2013-05-06 17:38:43 +0200 (lun., 06 mai 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.searchengine.cqp.clientExceptions;
+
+import java.io.IOException;
+
+// TODO: Auto-generated Javadoc
+/**
+ * Thrown to indicates that client do not find the server.
+ *
+ * @author Jean-Philippe Magué
+ */
+public class ServerNotFoundException extends CqiClientException {
+
+	/** The Constant serialVersionUID. */
+	private static final long serialVersionUID = 1L;
+
+	/**
+	 * Instantiates a new server not found exception.
+	 * 
+	 * @param string
+	 *            the message
+	 * @param e
+	 *            the cause
+	 */
+	public ServerNotFoundException(String string, IOException e) {
+		super(string, e);
+	}
+
+	/**
+	 * Instantiates a new server not found exception.
+	 * 
+	 * @param string
+	 *            the message
+	 */
+	public ServerNotFoundException(String string) {
+		super(string);
+	}
+
+	/**
+	 * Instantiates a new server not found exception.
+	 * 
+	 * @param e
+	 *            the cause
+	 */
+	public ServerNotFoundException(Throwable e) {
+		super(e);
+	}
+
+}

Property changes on: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/clientExceptions/ServerNotFoundException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/clientExceptions/UnexpectedAnswerException.java
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/clientExceptions/UnexpectedAnswerException.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/clientExceptions/UnexpectedAnswerException.java	(revision 3659)
@@ -0,0 +1,80 @@
+// Copyright © 2010-2020 ENS de Lyon., University of Franche-Comté
+// 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: 2013-05-06 17:38:43 +0200 (lun., 06 mai 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.searchengine.cqp.clientExceptions;
+
+// TODO: Auto-generated Javadoc
+/**
+ * Thrown to indicates that client recieved unexpected data from the server.
+ *
+ * @author Jean-Philippe Magué
+ */
+public class UnexpectedAnswerException extends CqiClientException {
+
+	/** The Constant serialVersionUID. */
+	private static final long serialVersionUID = 1L;
+
+	/**
+	 * Instantiates a new unexpected answer exception.
+	 */
+	public UnexpectedAnswerException() {
+		super();
+	}
+
+	/**
+	 * Instantiates a new unexpected answer exception.
+	 * 
+	 * @param arg0
+	 *            the message
+	 */
+	public UnexpectedAnswerException(String arg0) {
+		super(arg0);
+	}
+
+	/**
+	 * Instantiates a new unexpected answer exception.
+	 * 
+	 * @param arg0
+	 *            the cause
+	 */
+	public UnexpectedAnswerException(Throwable arg0) {
+		super(arg0);
+	}
+
+	/**
+	 * Instantiates a new unexpected answer exception.
+	 * 
+	 * @param arg0
+	 *            the message
+	 * @param arg1
+	 *            the cause
+	 */
+	public UnexpectedAnswerException(String arg0, Throwable arg1) {
+		super(arg0, arg1);
+	}
+
+}

Property changes on: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/clientExceptions/UnexpectedAnswerException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/clientExceptions/InvalidCqpIdException.java
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/clientExceptions/InvalidCqpIdException.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/clientExceptions/InvalidCqpIdException.java	(revision 3659)
@@ -0,0 +1,77 @@
+// Copyright © 2010-2020 ENS de Lyon., University of Franche-Comté
+// 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: 2013-05-06 17:38:43 +0200 (lun., 06 mai 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.searchengine.cqp.clientExceptions;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class InvalidCqpIdException.
+ */
+public class InvalidCqpIdException extends Exception {
+
+	/** The Constant serialVersionUID. */
+	private static final long serialVersionUID = 1L;
+
+	/**
+	 * Instantiates a new invalid cqp id exception.
+	 */
+	public InvalidCqpIdException() {
+		// TODO Auto-generated constructor stub
+	}
+
+	/**
+	 * Instantiates a new invalid cqp id exception.
+	 *
+	 * @param arg0 the arg0
+	 */
+	public InvalidCqpIdException(String arg0) {
+		super(arg0);
+		// TODO Auto-generated constructor stub
+	}
+
+	/**
+	 * Instantiates a new invalid cqp id exception.
+	 *
+	 * @param arg0 the arg0
+	 */
+	public InvalidCqpIdException(Throwable arg0) {
+		super(arg0);
+		// TODO Auto-generated constructor stub
+	}
+
+	/**
+	 * Instantiates a new invalid cqp id exception.
+	 *
+	 * @param arg0 the arg0
+	 * @param arg1 the arg1
+	 */
+	public InvalidCqpIdException(String arg0, Throwable arg1) {
+		super(arg0, arg1);
+		// TODO Auto-generated constructor stub
+	}
+
+}

Property changes on: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/clientExceptions/InvalidCqpIdException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/clientExceptions/CqiClientException.java
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/clientExceptions/CqiClientException.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/clientExceptions/CqiClientException.java	(revision 3659)
@@ -0,0 +1,96 @@
+// Copyright © 2010-2020 ENS de Lyon., University of Franche-Comté
+// 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: 2013-05-06 17:38:43 +0200 (lun., 06 mai 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.searchengine.cqp.clientExceptions;
+
+
+// TODO: Auto-generated Javadoc
+/**
+ * Base class for the Exception raised by the CQi client itself (i.e. not
+ * recieved from the CQi server)
+ * 
+ * @author Jean-Philippe Magué
+ */
+public class CqiClientException extends Exception {
+
+	/** The Constant serialVersionUID. */
+	private static final long serialVersionUID = 1L;
+
+	/**
+	 * Instantiates a new cqi client exception.
+	 * 
+	 * @param message
+	 *            the message
+	 */
+	public CqiClientException(String message) {
+		super(message);
+	}
+
+	static int counter = 0;
+	/**
+	 * Instantiates a new cqi client exception.
+	 * 
+	 * @param cause
+	 *            the cause
+	 */
+	public CqiClientException(Throwable cause) {
+		super(cause);
+		if(cause instanceof java.net.SocketException){
+			if (counter++ < 5) {
+				//if(!CQPSearchEngine.getCqiClient().reconnect()) CQPSearchEngine.restart();
+			}
+		}
+	}
+
+	/**
+	 * Instantiates a new cqi client exception.
+	 * 
+	 * @param message
+	 *            the message
+	 * @param cause
+	 *            the cause
+	 */
+	public CqiClientException(String message, Throwable cause) {
+		super(message, cause);
+		if (cause instanceof java.net.SocketException)
+		{
+			//if(!CQPSearchEngine.getCqiClient().reconnect()) CQPSearchEngine.restart();
+		}
+	}
+
+	/**
+	 * Instantiates a new cqi client exception.
+	 */
+	public CqiClientException() {
+		super();
+	}
+	
+	public String getMessage() {
+		return "CQP error: "+super.getMessage();
+	}
+
+}

Property changes on: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/clientExceptions/CqiClientException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/MemCqiServer.java
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/MemCqiServer.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/MemCqiServer.java	(revision 3659)
@@ -0,0 +1,1689 @@
+// Copyright © 2010-2020 ENS de Lyon., University of Franche-Comté
+// 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: 2011-12-14 10:52:18 +0100 (mer., 14 déc. 2011) $
+// $LastChangedRevision: 2080 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.searchengine.cqp;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
+import java.lang.reflect.Field;
+import java.util.ArrayList;
+import java.util.Arrays;
+
+import org.apache.commons.lang.StringUtils;
+import org.txm.libs.cqp.CQPLibPreferences;
+import org.txm.searchengine.cqp.clientExceptions.ServerNotFoundException;
+import org.txm.searchengine.cqp.clientExceptions.UnexpectedAnswerException;
+import org.txm.searchengine.cqp.serverException.CqiCqpErrorNoSuchCorpus;
+import org.txm.searchengine.cqp.serverException.CqiServerError;
+import org.txm.utils.ExecTimer;
+import org.txm.utils.OSDetector;
+import org.txm.utils.logger.Log;
+
+/**
+ * Memory implementation of CQP Server usqing the cqi JNI library
+ * 
+ * @author mdecorde
+ */
+public class MemCqiServer extends AbstractCqiServer {
+	
+	/**
+	 * Instantiates a new CQi server.
+	 * 
+	 * @param pathToExecutable
+	 *            the path to the executable
+	 * @param pathToRegistry
+	 *            the path to the registry
+	 * @param pathToInitFile
+	 *            the path to the init file
+	 * 
+	 * @throws ServerNotFoundException
+	 *             the server not found exception
+	 */
+	public MemCqiServer(String pathToExecutable, String pathToRegistry,
+			String pathToInitFile) throws ServerNotFoundException {
+		this(pathToExecutable, pathToRegistry, pathToInitFile, ""); //$NON-NLS-1$
+	}
+	
+	/**
+	 ** Instantiates a new CQi server.
+	 * 
+	 * @param pathToExecutable
+	 *            the path to the executable
+	 * @param pathToRegistry
+	 *            the path to the registry
+	 * @param pathToInitFile
+	 *            the path to the init file
+	 * @param additionalOptions
+	 *            the additional command line options
+	 * 
+	 * @throws ServerNotFoundException
+	 *             the server not found exception
+	 */
+	public MemCqiServer(String pathToExecutable, String pathToRegistry,
+			String pathToInitFile, String additionalOptions)
+			throws ServerNotFoundException {
+		
+	}
+	
+	/** The path to executable. */
+	String pathToExecutable;
+	
+	/** The path to registry. */
+	String pathToRegistry;
+	
+	/** The path to init file. */
+	String pathToInitFile;
+	
+	/** The additional options. */
+	String additionalOptions;
+	
+	/** The monitor output. */
+	boolean monitorOutput;
+	
+	/** The cmd line. */
+	static String[] cmdLine;
+	
+	public boolean debug = false;
+	
+	@Override
+	public void setDebug(boolean val) {
+		debug = val;
+	}
+	
+	public native int getErrorCode();
+	
+	
+	/**
+	 * Instantiates a new cqi server.
+	 *
+	 * @param pathToExecutable the path to executable
+	 * @param pathToRegistry the path to registry
+	 * @param pathToInitFile the path to init file
+	 * @param additionalOptions the additional options
+	 * @param monitorOutput the monitor output
+	 * @throws Exception
+	 */
+	public MemCqiServer(String pathToRegistry,
+			String pathToInitFile, String additionalOptions,
+			boolean monitorOutput) throws Exception {
+		
+		this.pathToRegistry = pathToRegistry;
+		this.pathToInitFile = pathToInitFile;
+		this.additionalOptions = additionalOptions;
+		this.monitorOutput = monitorOutput;
+	}
+	
+	/**
+	 * Gets the last cmd line.
+	 *
+	 * @return the last cmd line
+	 */
+	
+	@Override
+	public String getLastCmdLine() {
+		return StringUtils.join(cmdLine, " "); //$NON-NLS-1$
+	}
+	
+	/**
+	 * Start.
+	 *
+	 * @return true, if successful
+	 * @throws SecurityException
+	 * @throws NoSuchFieldException
+	 */
+	@Override
+	public Boolean start() throws Exception {
+		
+		if (!isLoaded) {
+			
+//			Field LIBRARIES = ClassLoader.class.getDeclaredField("loadedLibraryNames"); //$NON-NLS-1$
+//			LIBRARIES.setAccessible(true);
+			
+			// FIXME: Debug
+			// System.err.println(">>>>>>>>>>>>>>>>>>>> MemCqiServer.start() " + this.getClass().getClassLoader());
+			
+			try {
+				
+				String cqplibpath = CQPLibPreferences.getInstance().getString(CQPLibPreferences.CQI_SERVER_PATH_TO_CQPLIB);
+				if (cqplibpath == null || cqplibpath.length() == 0) {
+					System.err.println("Error: cqp lib path is not set in preferences");
+					return false;
+				}
+				String path = System.getProperty("java.library.path"); //$NON-NLS-1$
+//				String libpath = System.getProperty("path.separator") + cqplibpath; //$NON-NLS-1$
+//				
+//				if (!path.contains(libpath)) {
+//					path += libpath;
+//				}
+//				System.setProperty("java.library.path", path); //$NON-NLS-1$
+//				// System.out.println("Current java.library.path "+System.getProperty("java.library.path"));
+//				
+//				// this is a hack to force the JVM to reload java.library.path
+//				Field fieldSysPath = ClassLoader.class.getDeclaredField("sys_paths"); //$NON-NLS-1$
+//				fieldSysPath.setAccessible(true);
+//				fieldSysPath.set(null, null);
+				
+				
+				//System.loadLibrary("cqpjni"); //$NON-NLS-1$
+				if (OSDetector.isFamilyWindows()) {
+					System.load(cqplibpath+"/cqpjni.dll");
+				} else if (OSDetector.isFamilyMac()) {
+					System.load(cqplibpath+"/libcqpjni.dylib");
+				} else {
+					System.load(cqplibpath+"/libcqpjni.so");
+				}
+				
+				// FIXME: SJ: tests to use absolute path rather than lib name in Linux.
+				// It works and may avoid some problems about the JRE versions (e.g. Oracle or OpenJDK) and PATH configurations, but need to have the lib filename for each OS
+				// System.load(cqplibpath + "libcqpjni.so"); //$NON-NLS-1$
+				
+				Log.fine("cqpjni loaded from dirs: " + path + ".");
+				isLoaded = true;
+			}
+			catch (Throwable e) {
+				Log.severe("MemCqiServer: Failed to load CQP lib with exception: " + e);
+				Log.warning("Tried to load Cqi libs in: " + System.getProperty("java.library.path") + ".");
+				Log.warning("Current directory: " + new File(".").getAbsolutePath());
+				throw new Exception(e);
+			}
+		}
+		
+		// String[] cmd = { "", "-I", pathToInitFile, "-r", pathToRegistry }; //$NON-NLS-1$ //$NON-NLS-2$
+		ArrayList<String> cmd = new ArrayList<>();
+		cmd.add(""); //$NON-NLS-1$ executable path will be foudn in preferences
+		if (pathToInitFile != null && pathToInitFile.length() > 0) {
+			cmd.add("-I");//$NON-NLS-1$
+			cmd.add(pathToInitFile);
+		}
+		cmd.add("-r"); //$NON-NLS-1$
+		cmd.add(pathToRegistry);
+		cmd.addAll(Arrays.asList(additionalOptions.trim().split(" ")));
+		cmdLine = cmd.toArray(new String[cmd.size()]);
+		Log.fine("Starting NullSearchEngineServer: " + cmd + " ... ");
+		
+		// try {
+		isLoaded = start(cmdLine);
+		// System.out.println("IS LOADED: "+isLoaded);
+		if (isLoaded) {
+			// System.out.println(TXMCoreMessages.CqiClient_34);
+		}
+		else {
+			Log.severe("Failed to start SearchEngine in memory mode.");
+		}
+		return isLoaded;
+	}
+	
+	/**
+	 * Convert stream to string.
+	 *
+	 * @param is the is
+	 * @return the string
+	 */
+	
+	@Override
+	public String convertStreamToString(InputStream is) {
+		BufferedReader reader = new BufferedReader(new InputStreamReader(is));
+		StringBuilder sb = new StringBuilder();
+		String line = null;
+		try {
+			while ((line = reader.readLine()) != null) {
+				sb.append(line);
+			}
+		}
+		catch (IOException e) {
+			org.txm.utils.logger.Log.printStackTrace(e);
+		}
+		finally {
+			try {
+				is.close();
+			}
+			catch (IOException e) {
+				org.txm.utils.logger.Log.printStackTrace(e);
+			}
+		}
+		
+		return sb.toString();
+	}
+	
+	/**
+	 * Checks if the server is running.
+	 * 
+	 * @return true, if is running
+	 */
+	
+	@Override
+	public Boolean isRunning() {
+		return isLoaded;
+	}
+	
+	/*
+	 * (non-Javadoc)
+	 * @see java.lang.Object#finalize()
+	 */
+	@Override
+	protected void finalize() throws Throwable {
+		
+	}
+	
+	/**
+	 * Gets the error stream.
+	 *
+	 * @return the error stream
+	 */
+	
+	@Override
+	public InputStream getErrorStream() {
+		return null;
+	}
+	
+	/**
+	 * Gets the input stream.
+	 *
+	 * @return the input stream
+	 */
+	
+	@Override
+	public InputStream getInputStream() {
+		return new InputStream() {
+			
+			@Override
+			public int read() throws IOException {
+				return 0;
+			}
+		};
+	}
+	
+	/**
+	 * Gets the output stream.
+	 *
+	 * @return the output stream
+	 */
+	
+	@Override
+	public OutputStream getOutputStream() {
+		return new OutputStream() {
+			
+			@Override
+			public void write(int arg0) throws IOException {}
+		};
+	}
+	
+	static Boolean isLoaded = false;
+	
+	public native Boolean start(String[] args);
+	
+	public native Boolean load_a_system_corpus(String regfilepath, String entryname) throws IOException, UnexpectedAnswerException, CqiServerError;
+	
+	@Override
+	public native Boolean stop();
+	
+	public native int[] alg2Cpos(String arg0, int arg1) throws UnexpectedAnswerException, IOException, CqiServerError;
+	
+	public native Integer attributeSize(String arg0) throws IOException, UnexpectedAnswerException, CqiServerError;
+	
+	public boolean connect(String arg0, String arg1) {
+		return true;
+	};
+	
+	public native String[] corpusAlignementAttributes(String arg0) throws UnexpectedAnswerException, IOException, CqiServerError;
+	
+	public native String corpusCharset(String arg0) throws UnexpectedAnswerException, IOException, CqiServerError;
+	
+	public native String getOption(String name) throws UnexpectedAnswerException, IOException, CqiServerError;
+	
+	public native String setOption(String name, String value) throws UnexpectedAnswerException, IOException, CqiServerError;
+	
+	public native String corpusFullName(String arg0) throws UnexpectedAnswerException, IOException, CqiServerError;
+	
+	public native String[] corpusInfo(String arg0) throws UnexpectedAnswerException, IOException, CqiServerError;
+	
+	public native String[] corpusPositionalAttributes(String arg0) throws UnexpectedAnswerException, IOException, CqiServerError;
+	
+	public native String[] corpusProperties(String arg0) throws UnexpectedAnswerException, IOException, CqiServerError;
+	
+	public native Boolean corpusStructuralAttributeHasValues(String arg0) throws UnexpectedAnswerException, IOException, CqiServerError;
+	
+	public native String[] corpusStructuralAttributes(String arg0) throws UnexpectedAnswerException, IOException, CqiServerError;
+	
+	public native int[] cpos2Alg(String arg0, int[] arg1) throws UnexpectedAnswerException, IOException, CqiServerError;
+	
+	public native int[] cpos2Id(String arg0, int[] arg1) throws UnexpectedAnswerException, IOException, CqiServerError;
+	
+	public native int[] cpos2LBound(String arg0, int[] arg1) throws UnexpectedAnswerException, IOException, CqiServerError;
+	
+	public native int[] cpos2RBound(String arg0, int[] arg1) throws UnexpectedAnswerException, IOException, CqiServerError;
+	
+	public native String[] cpos2Str(String arg0, int[] arg1) throws UnexpectedAnswerException, IOException, CqiServerError;
+	
+	public native int[] cpos2Struc(String arg0, int[] arg1) throws UnexpectedAnswerException, IOException, CqiServerError;
+	
+	// TODO to implement in CQi and MemCQiServer
+	// public native int[] cpos2Struc2cpos(String arg0, ...) throws UnexpectedAnswerException, IOException, CqiServerError ;
+	
+	// TODO to implement in CQi and MemCQiServer
+	// public native String[] cpos2struc2str(String arg0, ...) throws UnexpectedAnswerException, IOException, CqiServerError ;
+	
+	public native Boolean cqpQuery(String arg0, String arg1, String arg2)
+			throws IOException, UnexpectedAnswerException, CqiServerError;
+	
+	public native Boolean query(String arg0)
+			throws IOException, UnexpectedAnswerException, CqiServerError;
+	
+	public Boolean disconnect() {
+		return true;
+	};
+	
+	public native Boolean dropAttribute(String arg0) throws IOException, UnexpectedAnswerException, CqiServerError;
+	
+	public native Boolean dropCorpus(String arg0) throws Exception;
+	
+	public native Boolean dropSubCorpus(String arg0) throws IOException, UnexpectedAnswerException, CqiServerError;
+	
+	public native int[] dumpSubCorpus(String arg0, byte arg1, int arg2, int arg3)
+			throws IOException, UnexpectedAnswerException, CqiServerError;
+	
+	public int[][] fdist1(String arg0, int arg1, byte arg2, String arg3)
+			throws IOException, UnexpectedAnswerException, CqiServerError {
+		int[] all = nfdist1(arg0, arg1, arg2, arg3);
+		if (all == null) {
+			return new int[0][0];
+		}
+		int[][] freqs = new int[all.length / 2][2];
+		int c = 0;
+		for (int i = 0; i < freqs.length; i++) {
+			freqs[i][0] = all[c++];
+			freqs[i][1] = all[c++];
+		}
+		return freqs;
+		
+	}
+	
+	public native int[] nfdist1(String arg0, int arg1, byte arg2, String arg3)
+			throws IOException, UnexpectedAnswerException, CqiServerError;
+	
+	public int[][] fdist2(String arg0, int arg1, byte arg2, String arg3,
+			byte arg4, String arg5) throws IOException,
+			UnexpectedAnswerException, CqiServerError {
+		int[] all = nfdist2(arg0, arg1, arg2, arg3, arg4, arg5);
+		if (all == null) {
+			return new int[0][0];
+		}
+		int[][] freqs = new int[all.length / 2][3];
+		int c = 0;
+		for (int i = 0; i < freqs.length; i++) {
+			freqs[i][0] = all[c++];
+			freqs[i][1] = all[c++];
+			freqs[i][2] = all[c++];
+		}
+		return freqs;
+	}
+	
+	public native int[] nfdist2(String arg0, int arg1, byte arg2, String arg3,
+			byte arg4, String arg5) throws IOException, UnexpectedAnswerException, CqiServerError;
+	
+	public native String getLastCQPError();
+	
+	public native String getLastCqiError() throws UnexpectedAnswerException, IOException, CqiServerError;
+	
+	public native int[] id2Cpos(String arg0, int arg1) throws UnexpectedAnswerException, IOException, CqiServerError;
+	
+	public native int[] id2Freq(String arg0, int[] arg1) throws UnexpectedAnswerException, IOException, CqiServerError;
+	
+	public native String[] id2Str(String arg0, int[] arg1) throws UnexpectedAnswerException, IOException, CqiServerError;
+	
+	public native int[] idList2Cpos(String arg0, int[] arg1) throws UnexpectedAnswerException, IOException, CqiServerError;
+	
+	public native Integer lexiconSize(String arg0) throws IOException, UnexpectedAnswerException, CqiServerError;
+	
+	public native String[] listCorpora() throws UnexpectedAnswerException, IOException, CqiServerError;
+	
+	public native String[] listSubcorpora(String arg0) throws UnexpectedAnswerException, IOException, CqiCqpErrorNoSuchCorpus;
+	
+	public Boolean reconnect() {
+		return true;
+	};
+	
+	public native int[] regex2Id(String arg0, String arg1) throws UnexpectedAnswerException, IOException, CqiServerError;
+	
+	public native int[] str2Id(String arg0, String[] arg1) throws IOException, UnexpectedAnswerException, CqiServerError;
+	
+	public native int[] struc2Cpos(String arg0, int arg1) throws UnexpectedAnswerException, IOException, CqiServerError;
+	
+	public native String[] struc2Str(String arg0, int[] arg1) throws UnexpectedAnswerException, IOException, CqiServerError;
+	
+	public native Boolean subCorpusHasField(String arg0, byte arg1) throws IOException, UnexpectedAnswerException, CqiServerError;
+	
+	public native Integer subCorpusSize(String arg0) throws IOException, UnexpectedAnswerException, CqiServerError;
+	
+	/**
+	 * @param args
+	 * @throws Exception
+	 */
+	public static void main(String[] args) throws Exception {
+		String pathToCQPLibDirectory = "/home/mdecorde/workspace047/org.txm.libs.cqp.linux/res/linux64/";
+		String cqpserverPathToExecutable = pathToCQPLibDirectory + "cqpserver";
+		String pathToRegistry = System.getProperty("user.home") + "TXM-0.8.3/corpora/DEMOCRATLYON5/registry";
+		String pathToInitFile = System.getProperty("user.home") + "workspace047/org.txm.libs.cqp.linux/res/cqpserver.init";
+		
+		String corpus = "DEMOCRATLYON5";
+		String subcorpusname = "SUB";
+		String subcorpusid = corpus + ":" + subcorpusname;
+		String query = "[word=\"j.*\"]";
+		String regex = "j.*";
+		String pattribute1 = corpus + ".word";
+		String pattribute2 = corpus + ".frpos";
+		String pattribute3 = corpus + ".frlemma";
+		String sattribute1 = corpus + ".text_id";
+		String sattribute2 = corpus + ".p_id";
+		String sattribute3 = corpus + ".s_id";
+		
+		String align_attr = "p_id";
+		
+		int[] cpos = { 0, 10000, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
+		// int id = 1;
+		int[] ids = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
+		String[] strings = { "je", "jamais" };
+		int[] strucpos = { 0, 1, 2, 3, 4 };
+		
+		CQPLibPreferences.getInstance().put(CQPLibPreferences.CQI_SERVER_PATH_TO_CQPLIB, pathToCQPLibDirectory);
+		
+		MemCqiServer server = new MemCqiServer(pathToRegistry, pathToInitFile, " -b 10000000 -d OFF", false);
+		if (server.start()) System.out.println("Mem Server ok");
+		System.out.println("SERVER=" + server);
+		MemCqiClient client = new MemCqiClient(server);
+		if (client.connect("anonymous", "")) System.out.println("Mem Client ok");
+		
+		NetCqiServer netServer = new NetCqiServer(cqpserverPathToExecutable, pathToRegistry, pathToInitFile, "", false);
+		if (netServer.start()) System.out.println("Net Server ok");
+		NetCqiClient netClient = new NetCqiClient("127.0.0.1", 4877);
+		if (netClient.connect("anonymous", "")) System.out.println("Net Client ok");
+		
+		ExecTimer.start();
+		
+		try {
+			System.out.println("client.alg2Cpos(sattribute, struct_id) : " + Arrays.toString(client.alg2Cpos(sattribute1, 0)));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		try {
+			System.out.println("netClient.alg2Cpos(sattribute, struct_id) : " + Arrays.toString(netClient.alg2Cpos(sattribute1, 0)));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		
+		try {
+			System.out.println("client.attributeSize(sattribute1) : " + client.attributeSize(sattribute1));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		try {
+			System.out.println("netClient.attributeSize(sattribute1) : " + netClient.attributeSize(sattribute1));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		
+		
+		try {
+			System.out.println("client.attributeSize(sattribute2) : " + client.attributeSize(sattribute2));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		try {
+			System.out.println("netClient.attributeSize(sattribute2) : " + netClient.attributeSize(sattribute2));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		
+		
+		try {
+			System.out.println("client.attributeSize(sattribute3) : " + client.attributeSize(sattribute3));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		try {
+			System.out.println("netClient.attributeSize(sattribute3) : " + netClient.attributeSize(sattribute3));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		
+		
+		try {
+			System.out.println("client.corpusAlignementAttributes(corpus) : " + Arrays.toString(client.corpusAlignementAttributes(corpus)));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		try {
+			System.out.println("netClient.corpusAlignementAttributes(corpus) : " + Arrays.toString(netClient.corpusAlignementAttributes(corpus)));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		
+		try {
+			System.out.println("client.corpusCharset(corpus) : " + client.corpusCharset(corpus));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		try {
+			System.out.println("netClient.corpusCharset(corpus) : " + netClient.corpusCharset(corpus));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		
+		
+		try {
+			System.out.println("client.corpusFullName(corpus) : " + client.corpusFullName(corpus));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		try {
+			System.out.println("netClient.corpusFullName(corpus) : " + netClient.corpusFullName(corpus));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		
+		try {
+			System.out.println("client.corpusInfo(corpus) : " + client.corpusInfo(corpus));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		try {
+			System.out.println("netClient.corpusInfo(corpus) : " + netClient.corpusInfo(corpus));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		
+		
+		try {
+			System.out.println("client.corpusPositionalAttributes(corpus) : " + Arrays.toString(client.corpusPositionalAttributes(corpus)));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		try {
+			System.out.println("netClient.corpusPositionalAttributes(corpus) : " + Arrays.toString(netClient.corpusPositionalAttributes(corpus)));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		
+		
+		try {
+			System.out.println("client.corpusProperties(corpus) : " + Arrays.toString(client.corpusProperties(corpus)));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		try {
+			System.out.println("netClient.corpusProperties(corpus) : " + Arrays.toString(netClient.corpusProperties(corpus)));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		
+		
+		try {
+			System.out.println("client.corpusStructuralAttributeHasValues(sattribute1) : " + client.corpusStructuralAttributeHasValues(sattribute1));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		try {
+			System.out.println("netClient.corpusStructuralAttributeHasValues(sattribute1) : " + netClient.corpusStructuralAttributeHasValues(sattribute1));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		
+		try {
+			System.out.println("client.corpusStructuralAttributeHasValues(sattribute2) : " + client.corpusStructuralAttributeHasValues(sattribute2));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		try {
+			System.out.println("netClient.corpusStructuralAttributeHasValues(sattribute2) : " + netClient.corpusStructuralAttributeHasValues(sattribute2));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		
+		try {
+			System.out.println("client.corpusStructuralAttributeHasValues(sattribute3) : " + client.corpusStructuralAttributeHasValues(sattribute3));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		try {
+			System.out.println("netClient.corpusStructuralAttributeHasValues(sattribute3) : " + netClient.corpusStructuralAttributeHasValues(sattribute3));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		
+		try {
+			System.out.println("client.corpusStructuralAttributes(corpus) : " + Arrays.toString(client.corpusStructuralAttributes(corpus)));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		try {
+			System.out.println("netClient.corpusStructuralAttributes(corpus) : " + Arrays.toString(netClient.corpusStructuralAttributes(corpus)));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		
+		try {
+			System.out.println("client.cpos2Alg(align_attr, cpos) : " + Arrays.toString(client.cpos2Alg(align_attr, cpos)));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		try {
+			System.out.println("netClient.cpos2Alg(align_attr, cpos) : " + Arrays.toString(netClient.cpos2Alg(align_attr, cpos)));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		
+		try {
+			System.out.println("client.cpos2Id(pattribute1, cpos) : " + Arrays.toString(client.cpos2Id(pattribute1, cpos)));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		try {
+			System.out.println("netClient.cpos2Id(pattribute1, cpos) : " + Arrays.toString(netClient.cpos2Id(pattribute1, cpos)));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		
+		try {
+			System.out.println("client.cpos2Id(pattribute2, cpos) : " + Arrays.toString(client.cpos2Id(pattribute2, cpos)));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		try {
+			System.out.println("netClient.cpos2Id(pattribute2, cpos) : " + Arrays.toString(netClient.cpos2Id(pattribute2, cpos)));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		
+		try {
+			System.out.println("client.cpos2Id(pattribute3, cpos) : " + Arrays.toString(client.cpos2Id(pattribute3, cpos)));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		try {
+			System.out.println("netClient.cpos2Id(pattribute3, cpos) : " + Arrays.toString(netClient.cpos2Id(pattribute3, cpos)));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		
+		try {
+			System.out.println("client.cpos2LBound(sattribute1, cpos) : " + Arrays.toString(client.cpos2LBound(sattribute1, cpos)));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		try {
+			System.out.println("netClient.cpos2LBound(sattribute1, cpos) : " + Arrays.toString(netClient.cpos2LBound(sattribute1, cpos)));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		
+		try {
+			System.out.println("client.cpos2LBound(sattribute2, cpos) : " + Arrays.toString(client.cpos2LBound(sattribute2, cpos)));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		try {
+			System.out.println("netClient.cpos2LBound(sattribute2, cpos) : " + Arrays.toString(netClient.cpos2LBound(sattribute2, cpos)));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		
+		try {
+			System.out.println("client.cpos2LBound(sattribute3, cpos) : " + Arrays.toString(client.cpos2LBound(sattribute3, cpos)));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		try {
+			System.out.println("netClient.cpos2LBound(sattribute3, cpos) : " + Arrays.toString(netClient.cpos2LBound(sattribute3, cpos)));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		
+		try {
+			System.out.println("client.cpos2RBound(sattribute1, cpos) : " + Arrays.toString(client.cpos2RBound(sattribute1, cpos)));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		try {
+			System.out.println("netClient.cpos2RBound(sattribute1, cpos) : " + Arrays.toString(netClient.cpos2RBound(sattribute1, cpos)));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		
+		try {
+			System.out.println("client.cpos2RBound(sattribute2, cpos) : " + Arrays.toString(client.cpos2RBound(sattribute2, cpos)));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		try {
+			System.out.println("netClient.cpos2RBound(sattribute2, cpos) : " + Arrays.toString(netClient.cpos2RBound(sattribute2, cpos)));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		
+		try {
+			System.out.println("client.cpos2RBound(sattribute3, cpos) : " + Arrays.toString(client.cpos2RBound(sattribute3, cpos)));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		try {
+			System.out.println("netClient.cpos2RBound(sattribute3, cpos) : " + Arrays.toString(netClient.cpos2RBound(sattribute3, cpos)));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		
+		try {
+			System.out.println("client.cpos2Str(pattribute1, cpos) : " + Arrays.toString(client.cpos2Str(pattribute1, cpos)));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		try {
+			System.out.println("netClient.cpos2Str(pattribute1, cpos) : " + Arrays.toString(netClient.cpos2Str(pattribute1, cpos)));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		
+		try {
+			System.out.println("client.cpos2Str(pattribute2, cpos) : " + Arrays.toString(client.cpos2Str(pattribute2, cpos)));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		try {
+			System.out.println("netClient.cpos2Str(pattribute2, cpos) : " + Arrays.toString(netClient.cpos2Str(pattribute2, cpos)));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		
+		try {
+			System.out.println("client.cpos2Str(pattribute3, cpos) : " + Arrays.toString(client.cpos2Str(pattribute3, cpos)));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		try {
+			System.out.println("netClient.cpos2Str(pattribute3, cpos) : " + Arrays.toString(netClient.cpos2Str(pattribute3, cpos)));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		
+		try {
+			System.out.println("client.cpos2Struc(sattribute1, cpos) : " + Arrays.toString(client.cpos2Struc(sattribute1, cpos)));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		try {
+			System.out.println("netClient.cpos2Struc(sattribute1, cpos) : " + Arrays.toString(netClient.cpos2Struc(sattribute1, cpos)));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		
+		try {
+			System.out.println("client.cpos2Struc(sattribute2, cpos) : " + Arrays.toString(client.cpos2Struc(sattribute2, cpos)));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		try {
+			System.out.println("netClient.cpos2Struc(sattribute2, cpos) : " + Arrays.toString(netClient.cpos2Struc(sattribute2, cpos)));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		
+		try {
+			System.out.println("client.cpos2Struc(sattribute3, cpos) : " + Arrays.toString(client.cpos2Struc(sattribute3, cpos)));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		try {
+			System.out.println("netClient.cpos2Struc(sattribute3, cpos) : " + Arrays.toString(netClient.cpos2Struc(sattribute3, cpos)));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		
+		try {
+			System.out.println("client.cqpQuery(corpus, subcorpus, query)");
+			client.cqpQuery(corpus, subcorpusname, query);
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		try {
+			System.out.println("netClient.cqpQuery(corpus, subcorpus, query)");
+			netClient.cqpQuery(corpus, subcorpusname, query);
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		
+		try {
+			System.out.println("client.dropAttribute(pattribute1)");
+			client.dropAttribute(pattribute1);
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		try {
+			System.out.println("netClient.dropAttribute(pattribute1)");
+			netClient.dropAttribute(pattribute1);
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		
+		try {
+			System.out.println("client.dropAttribute(pattribute2)");
+			client.dropAttribute(pattribute2);
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		try {
+			System.out.println("netClient.dropAttribute(pattribute2)");
+			netClient.dropAttribute(pattribute2);
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		
+		try {
+			System.out.println("client.dropAttribute(pattribute3)");
+			client.dropAttribute(pattribute3);
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		try {
+			System.out.println("netClient.dropAttribute(pattribute3)");
+			netClient.dropAttribute(pattribute3);
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		
+		try {
+			System.out.println("client.dropCorpus(corpus)");
+			client.dropCorpus(corpus);
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		try {
+			System.out.println("netClient.dropCorpus(corpus)");
+			netClient.dropCorpus(corpus);
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		
+		try {
+			System.out.println("client.dumpSubCorpus(subcorpus, CQI_CONST_FIELD_MATCH, 1, 2) : " + Arrays.toString(client.dumpSubCorpus(subcorpusid, NetCqiClient.CQI_CONST_FIELD_MATCH, 1, 10)));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		try {
+			System.out.println("netClient.dumpSubCorpus(subcorpus, CQI_CONST_FIELD_MATCH, 1, 2) : " + Arrays.toString(netClient.dumpSubCorpus(subcorpusid, NetCqiClient.CQI_CONST_FIELD_MATCH, 1, 10)));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		
+		try {
+			System.out.println("client.dumpSubCorpus(subcorpus, CQI_CONST_FIELD_MATCHEND, 1, 2) : " + Arrays.toString(client.dumpSubCorpus(subcorpusid, NetCqiClient.CQI_CONST_FIELD_MATCHEND, 1, 10)));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		try {
+			System.out.println("netClient.dumpSubCorpus(subcorpus, CQI_CONST_FIELD_MATCHEND, 1, 2) : " + Arrays.toString(netClient.dumpSubCorpus(subcorpusid, NetCqiClient.CQI_CONST_FIELD_MATCHEND, 1,
+					10)));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		
+		// try {
+		// System.out.println("client.fdist1(arg0, arg1, arg2, arg3) : "+client.fdist1(arg0, arg1, arg2, arg3));
+		// } catch(Exception e) { System.out.println("Exception : "+e);}
+		// try {
+		// System.out.println("netClient.fdist1(arg0, arg1, arg2, arg3) : "+netClient.fdist1(arg0, arg1, arg2, arg3));
+		// } catch(Exception e) { System.out.println("Exception : "+e);}
+		
+		// try {
+		// System.out.println("//client.fdist2(arg0, arg1, arg2, arg3, arg4, arg5) : "+client.fdist2(arg0, arg1, arg2, arg3, arg4, arg5));
+		// } catch(Exception e) { System.out.println("Exception : "+e);}
+		// try {
+		// System.out.println("//netClient.fdist2(arg0, arg1, arg2, arg3, arg4, arg5) : "+netClient.fdist2(arg0, arg1, arg2, arg3, arg4, arg5));
+		// } catch(Exception e) { System.out.println("Exception : "+e);}
+		
+		try {
+			System.out.println("client.getLastCqiError() : " + client.getLastCqiError());
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		try {
+			System.out.println("netClient.getLastCqiError() : " + netClient.getLastCqiError());
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		
+		try {
+			System.out.println("client.getLastCQPError() : " + client.getLastCQPError());
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		try {
+			System.out.println("netClient.getLastCQPError() : " + netClient.getLastCQPError());
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		
+		try {
+			System.out.println("client.id2Cpos(pattribute1, 0) : " + Arrays.toString(client.id2Cpos(pattribute1, 0)));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		try {
+			System.out.println("netClient.id2Cpos(pattribute1, 0) : " + Arrays.toString(netClient.id2Cpos(pattribute1, 0)));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		
+		try {
+			System.out.println("client.id2Cpos(pattribute2, 0) : " + Arrays.toString(client.id2Cpos(pattribute2, 0)));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		try {
+			System.out.println("netClient.id2Cpos(pattribute2, 0) : " + Arrays.toString(netClient.id2Cpos(pattribute2, 0)));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		
+		try {
+			System.out.println("client.id2Cpos(pattribute3, 0) : " + Arrays.toString(client.id2Cpos(pattribute3, 0)));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		try {
+			System.out.println("netClient.id2Cpos(pattribute3, 0) : " + Arrays.toString(netClient.id2Cpos(pattribute3, 0)));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		
+		try {
+			System.out.println("client.id2Cpos(pattribute1, 1) : " + Arrays.toString(client.id2Cpos(pattribute1, 1)));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		try {
+			System.out.println("netClient.id2Cpos(pattribute1, 1) : " + Arrays.toString(netClient.id2Cpos(pattribute1, 1)));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		
+		try {
+			System.out.println("client.id2Cpos(pattribute2, 1) : " + Arrays.toString(client.id2Cpos(pattribute2, 1)));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		try {
+			System.out.println("netClient.id2Cpos(pattribute2, 1) : " + Arrays.toString(netClient.id2Cpos(pattribute2, 1)));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		
+		try {
+			System.out.println("client.id2Cpos(pattribute3, 1) : " + Arrays.toString(client.id2Cpos(pattribute3, 1)));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		try {
+			System.out.println("netClient.id2Cpos(pattribute3, 1) : " + Arrays.toString(netClient.id2Cpos(pattribute3, 1)));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		
+		try {
+			System.out.println("client.id2Cpos(pattribute1, 2) : " + Arrays.toString(client.id2Cpos(pattribute1, 2)));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		try {
+			System.out.println("netClient.id2Cpos(pattribute1, 2) : " + Arrays.toString(netClient.id2Cpos(pattribute1, 2)));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		
+		try {
+			System.out.println("client.id2Cpos(pattribute2, 2) : " + Arrays.toString(client.id2Cpos(pattribute2, 2)));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		try {
+			System.out.println("netClient.id2Cpos(pattribute2, 2) : " + Arrays.toString(netClient.id2Cpos(pattribute2, 2)));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		
+		try {
+			System.out.println("client.id2Cpos(pattribute3, 2) : " + Arrays.toString(client.id2Cpos(pattribute3, 2)));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		try {
+			System.out.println("netClient.id2Cpos(pattribute3, 2) : " + Arrays.toString(netClient.id2Cpos(pattribute3, 2)));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		
+		try {
+			System.out.println("client.id2Freq(pattribute1, ids) : " + Arrays.toString(client.id2Freq(pattribute1, ids)));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		try {
+			System.out.println("netClient.id2Freq(pattribute1, ids) : " + Arrays.toString(netClient.id2Freq(pattribute1, ids)));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		
+		try {
+			System.out.println("client.id2Freq(pattribute2, ids) : " + Arrays.toString(client.id2Freq(pattribute2, ids)));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		try {
+			System.out.println("netClient.id2Freq(pattribute2, ids) : " + Arrays.toString(netClient.id2Freq(pattribute2, ids)));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		
+		try {
+			System.out.println("client.id2Freq(pattribute3, ids) : " + Arrays.toString(client.id2Freq(pattribute3, ids)));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		try {
+			System.out.println("netClient.id2Freq(pattribute3, ids) : " + Arrays.toString(netClient.id2Freq(pattribute3, ids)));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		
+		try {
+			System.out.println("client.id2Str(pattribute1, ids) : " + Arrays.toString(client.id2Str(pattribute1, ids)));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		try {
+			System.out.println("netClient.id2Str(pattribute1, ids) : " + Arrays.toString(netClient.id2Str(pattribute1, ids)));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		
+		try {
+			System.out.println("client.id2Str(pattribute2, ids) : " + Arrays.toString(client.id2Str(pattribute2, ids)));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		try {
+			System.out.println("netClient.id2Str(pattribute2, ids) : " + Arrays.toString(netClient.id2Str(pattribute2, ids)));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		
+		try {
+			System.out.println("client.id2Str(pattribute3, ids) : " + Arrays.toString(client.id2Str(pattribute3, ids)));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		try {
+			System.out.println("netClient.id2Str(pattribute3, ids) : " + Arrays.toString(netClient.id2Str(pattribute3, ids)));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		
+		try {
+			System.out.println("client.idList2Cpos(pattribute1, ids) : " + Arrays.toString(client.idList2Cpos(pattribute1, ids)));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		try {
+			System.out.println("netClient.idList2Cpos(pattribute1, ids) : " + Arrays.toString(netClient.idList2Cpos(pattribute1, ids)));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		
+		try {
+			System.out.println("client.idList2Cpos(pattribute2, ids) : " + Arrays.toString(client.idList2Cpos(pattribute2, ids)));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		try {
+			System.out.println("netClient.idList2Cpos(pattribute2, ids) : " + Arrays.toString(netClient.idList2Cpos(pattribute2, ids)));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		
+		try {
+			System.out.println("client.idList2Cpos(pattribute3, ids) : " + Arrays.toString(client.idList2Cpos(pattribute3, ids)));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		try {
+			System.out.println("netClient.idList2Cpos(pattribute3, ids) : " + Arrays.toString(netClient.idList2Cpos(pattribute3, ids)));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		
+		try {
+			System.out.println("client.lexiconSize(pattribute1) : " + client.lexiconSize(pattribute1));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		try {
+			System.out.println("netClient.lexiconSize(pattribute1) : " + netClient.lexiconSize(pattribute1));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		
+		try {
+			System.out.println("client.lexiconSize(pattribute2) : " + client.lexiconSize(pattribute2));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		try {
+			System.out.println("netClient.lexiconSize(pattribute2) : " + netClient.lexiconSize(pattribute2));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		
+		try {
+			System.out.println("client.lexiconSize(pattribute3) : " + client.lexiconSize(pattribute3));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		try {
+			System.out.println("netClient.lexiconSize(pattribute3) : " + netClient.lexiconSize(pattribute3));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		
+		try {
+			System.out.println("client.listCorpora() : " + Arrays.toString(client.listCorpora()));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		try {
+			System.out.println("netClient.listCorpora() : " + Arrays.toString(netClient.listCorpora()));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		
+		try {
+			System.out.println("client.listSubcorpora(corpus) : " + Arrays.toString(client.listSubcorpora(corpus)));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		try {
+			System.out.println("netClient.listSubcorpora(corpus) : " + Arrays.toString(netClient.listSubcorpora(corpus)));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		
+		try {
+			System.out.println("client.regex2Id(pattribute1, regex) : " + Arrays.toString(client.regex2Id(pattribute1, regex)));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		try {
+			System.out.println("netClient.regex2Id(pattribute1, regex) : " + Arrays.toString(netClient.regex2Id(pattribute1, regex)));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		
+		try {
+			System.out.println("client.regex2Id(pattribute2, regex) : " + Arrays.toString(client.regex2Id(pattribute2, regex)));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		try {
+			System.out.println("netClient.regex2Id(pattribute2, regex) : " + Arrays.toString(netClient.regex2Id(pattribute2, regex)));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		
+		try {
+			System.out.println("client.regex2Id(pattribute3, regex) : " + Arrays.toString(client.regex2Id(pattribute3, regex)));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		try {
+			System.out.println("netClient.regex2Id(pattribute3, regex) : " + Arrays.toString(netClient.regex2Id(pattribute3, regex)));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		
+		try {
+			System.out.println("client.str2Id(pattribute1, strings) : " + Arrays.toString(client.str2Id(pattribute1, strings)));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		try {
+			System.out.println("netClient.str2Id(pattribute1, strings) : " + Arrays.toString(netClient.str2Id(pattribute1, strings)));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		
+		try {
+			System.out.println("client.str2Id(pattribute2, strings) : " + Arrays.toString(client.str2Id(pattribute2, strings)));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		try {
+			System.out.println("netClient.str2Id(pattribute2, strings) : " + Arrays.toString(netClient.str2Id(pattribute2, strings)));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		
+		try {
+			System.out.println("client.str2Id(pattribute3, strings) : " + Arrays.toString(client.str2Id(pattribute3, strings)));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		try {
+			System.out.println("netClient.str2Id(pattribute3, strings) : " + Arrays.toString(netClient.str2Id(pattribute3, strings)));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		
+		try {
+			System.out.println("client.struc2Cpos(sattribute1, 0) : " + Arrays.toString(client.struc2Cpos(sattribute1, 0)));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		try {
+			System.out.println("netClient.struc2Cpos(sattribute1, 0) : " + Arrays.toString(netClient.struc2Cpos(sattribute1, 0)));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		
+		try {
+			System.out.println("client.struc2Cpos(sattribute2, 0) : " + Arrays.toString(client.struc2Cpos(sattribute2, 0)));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		try {
+			System.out.println("netClient.struc2Cpos(sattribute2, 0) : " + Arrays.toString(netClient.struc2Cpos(sattribute2, 0)));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		
+		try {
+			System.out.println("client.struc2Cpos(sattribute3, 0) : " + Arrays.toString(client.struc2Cpos(sattribute3, 0)));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		try {
+			System.out.println("netClient.struc2Cpos(sattribute3, 0) : " + Arrays.toString(netClient.struc2Cpos(sattribute3, 0)));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		
+		try {
+			System.out.println("client.struc2Cpos(sattribute1, 1) : " + Arrays.toString(client.struc2Cpos(sattribute1, 1)));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		try {
+			System.out.println("netClient.struc2Cpos(sattribute1, 1) : " + Arrays.toString(netClient.struc2Cpos(sattribute1, 1)));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		
+		try {
+			System.out.println("client.struc2Cpos(sattribute2, 1) : " + Arrays.toString(client.struc2Cpos(sattribute2, 1)));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		try {
+			System.out.println("netClient.struc2Cpos(sattribute2, 1) : " + Arrays.toString(netClient.struc2Cpos(sattribute2, 1)));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		
+		try {
+			System.out.println("client.struc2Cpos(sattribute3, 1) : " + Arrays.toString(client.struc2Cpos(sattribute3, 1)));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		try {
+			System.out.println("netClient.struc2Cpos(sattribute3, 1) : " + Arrays.toString(netClient.struc2Cpos(sattribute3, 1)));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		
+		try {
+			System.out.println("client.struc2Cpos(sattribute1, 2) : " + Arrays.toString(client.struc2Cpos(sattribute1, 2)));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		try {
+			System.out.println("netClient.struc2Cpos(sattribute1, 2) : " + Arrays.toString(netClient.struc2Cpos(sattribute1, 2)));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		
+		try {
+			System.out.println("client.struc2Cpos(sattribute2, 2) : " + Arrays.toString(client.struc2Cpos(sattribute2, 2)));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		try {
+			System.out.println("netClient.struc2Cpos(sattribute2, 2) : " + Arrays.toString(netClient.struc2Cpos(sattribute2, 2)));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		
+		try {
+			System.out.println("client.struc2Cpos(sattribute3, 2) : " + Arrays.toString(client.struc2Cpos(sattribute3, 2)));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		try {
+			System.out.println("netClient.struc2Cpos(sattribute3, 2) : " + Arrays.toString(netClient.struc2Cpos(sattribute3, 2)));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		
+		try {
+			System.out.println("client.struc2Cpos(sattribute1, 3) : " + Arrays.toString(client.struc2Cpos(sattribute1, 3)));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		try {
+			System.out.println("netClient.struc2Cpos(sattribute1, 3) : " + Arrays.toString(netClient.struc2Cpos(sattribute1, 3)));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		
+		try {
+			System.out.println("client.struc2Cpos(sattribute2, 3) : " + Arrays.toString(client.struc2Cpos(sattribute2, 3)));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		try {
+			System.out.println("netClient.struc2Cpos(sattribute2, 3) : " + Arrays.toString(netClient.struc2Cpos(sattribute2, 3)));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		
+		try {
+			System.out.println("client.struc2Cpos(sattribute3, 3) : " + Arrays.toString(client.struc2Cpos(sattribute3, 3)));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		try {
+			System.out.println("netClient.struc2Cpos(sattribute3, 3) : " + Arrays.toString(netClient.struc2Cpos(sattribute3, 3)));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		
+		try {
+			System.out.println("client.struc2Str(sattribute1, strucpos) : " + Arrays.toString(client.struc2Str(sattribute1, strucpos)));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		try {
+			System.out.println("netClient.struc2Str(sattribute1, strucpos) : " + Arrays.toString(netClient.struc2Str(sattribute1, strucpos)));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		
+		try {
+			System.out.println("client.struc2Str(sattribute2, strucpos) : " + Arrays.toString(client.struc2Str(sattribute2, strucpos)));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		try {
+			System.out.println("netClient.struc2Str(sattribute2, strucpos) : " + Arrays.toString(netClient.struc2Str(sattribute2, strucpos)));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		
+		try {
+			System.out.println("client.struc2Str(sattribute3, strucpos) : " + Arrays.toString(client.struc2Str(sattribute3, strucpos)));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		try {
+			System.out.println("netClient.struc2Str(sattribute3, strucpos) : " + Arrays.toString(netClient.struc2Str(sattribute3, strucpos)));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		
+		try {
+			System.out.println("client.subCorpusHasField(subcorpus, (byte)0) : " + client.subCorpusHasField(subcorpusid, (byte) 0));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		try {
+			System.out.println("netClient.subCorpusHasField(subcorpus, (byte)0) : " + netClient.subCorpusHasField(subcorpusid, (byte) 0));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		
+		try {
+			System.out.println("client.subCorpusSize(subcorpus) : " + client.subCorpusSize(subcorpusid));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		try {
+			System.out.println("netClient.subCorpusSize(subcorpus) : " + netClient.subCorpusSize(subcorpusid));
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		
+		try {
+			System.out.println("client.dropSubCorpus(subcorpus)");
+			client.dropSubCorpus(subcorpusid);
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		try {
+			System.out.println("netClient.dropSubCorpus(subcorpus)");
+			netClient.dropSubCorpus(subcorpusid);
+		}
+		catch (Exception e) {
+			System.out.println("Exception : " + e);
+		}
+		
+		System.out.println("TIME: " + ExecTimer.stop());
+		System.out.println("STOP MEM CLIENT " + client.disconnect());
+		System.out.println("STOP MEM SERVER " + server.stop());
+		System.out.println("STOP NET CLIENT " + netClient.disconnect());
+		System.out.println("STOP NET SERVER " + netServer.stop());
+	}
+}

Property changes on: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/MemCqiServer.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/importer/cwb/CwbEncode.java
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/importer/cwb/CwbEncode.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/importer/cwb/CwbEncode.java	(revision 3659)
@@ -0,0 +1,410 @@
+// Copyright © 2010-2020 ENS de Lyon., University of Franche-Comté
+// 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: 2016-05-30 16:02:59 +0200 (Mon, 30 May 2016) $
+// $LastChangedRevision: 3220 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.importer.cwb;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.eclipse.osgi.util.NLS;
+import org.txm.Toolbox;
+import org.txm.core.messages.TXMCoreMessages;
+import org.txm.core.preferences.TBXPreferences;
+import org.txm.libs.cqp.CQPLibPreferences;
+import org.txm.searchengine.cqp.clientExceptions.ServerNotFoundException;
+import org.txm.searchengine.cqp.core.messages.CQPSearchEngineCoreMessages;
+import org.txm.utils.ConsoleProgressBar;
+import org.txm.utils.OSDetector;
+import org.txm.utils.io.IOUtils;
+
+/**
+ * This class aims at handling a CQi server process. It is not a CQi server per
+ * se.
+ * 
+ * @author Adrien Yepdieu, mdecorde
+ */
+
+public class CwbEncode extends CwbProcess {
+	
+	/**
+	 * Instantiates a new CQi server.
+	 */
+	public CwbEncode() {
+		super("cwb-encode"); //$NON-NLS-1$
+	}
+	
+	/**
+	 * Instantiates a new cwb encode.
+	 *
+	 * @param name the name
+	 */
+	public CwbEncode(String name) {
+		super(name);
+	}
+	
+	/**
+	 * Instantiates a new CQi server using executable path set in CQPLibPreferences.
+	 *
+	 * @param pathToData the path to data
+	 * @param inputFiles the input files
+	 * @param pathToRegistry the path to the registry
+	 * @param pAttributes the positional attribute
+	 * @param sAttributes the structural attribute
+	 * @return true if successful
+	 * @throws ServerNotFoundException the server not found exception
+	 * @throws IOException
+	 * @throws InterruptedException
+	 */
+	public boolean run(String pathToData,
+			String inputFile, String pathToRegistry, String[] pAttributes,
+			String[] sAttributes) throws ServerNotFoundException, InterruptedException, IOException {
+		return run(pathToData, inputFile,
+				pathToRegistry, pAttributes, sAttributes, false);
+	}
+	
+	/**
+	 * Instantiates a new CQi server using executable path set in CQPLibPreferences.
+	 *
+	 * @param pathToData the path to data
+	 * @param inputFiles the input files
+	 * @param pathToRegistry the path to the registry
+	 * @param pAttributes the positional attribute
+	 * @param sAttributes the structural attribute
+	 * @return true if successful
+	 * @throws ServerNotFoundException the server not found exception
+	 * @throws IOException
+	 * @throws InterruptedException
+	 */
+	public boolean run(String pathToData,
+			String inputFile, String pathToRegistry, String[] pAttributes,
+			String[] sAttributes, boolean monitorOutput) throws ServerNotFoundException, InterruptedException, IOException {
+		
+		File pathToExecutable = new File(CQPLibPreferences.getInstance().getString(CQPLibPreferences.CQI_SERVER_PATH_TO_CQPLIB),
+				"cwb-encode" + (System.getProperty("os.name").toLowerCase().contains("windows") ? ".exe" : "")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
+		
+		return run(pathToExecutable.getAbsolutePath(), pathToData, inputFile,
+				pathToRegistry, pAttributes, sAttributes, false);
+	}
+	
+	/**
+	 * 
+	 * @return if the cwb-encode executable file set in preferences is available
+	 */
+	public static boolean isExecutableAvailable() {
+		return isExecutableAvailable("cwb-encode" + (System.getProperty("os.name").toLowerCase().contains("windows") ? ".exe" : "")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
+	}
+	
+	/**
+	 * * Instantiates a new CQi server.
+	 *
+	 * @param pathToExecutable the path to the executable
+	 * @param pathToData the path to data
+	 * @param inputFiles the input files
+	 * @param pathToRegistry the path to the registry
+	 * @param pAttributes the positional attribute
+	 * @param sAttributes the structural attribute
+	 * @return true if successful
+	 * @throws ServerNotFoundException the server not found exception
+	 * @throws IOException
+	 * @throws InterruptedException
+	 */
+	public boolean run(String pathToExecutable, String pathToData,
+			List<File> inputFiles, String pathToRegistry, String[] pAttributes,
+			String[] sAttributes) throws ServerNotFoundException, InterruptedException, IOException {
+		boolean ret = run(pathToExecutable, pathToData, inputFiles, pathToRegistry, pAttributes, sAttributes, false);
+		
+		return ret;
+	}
+	
+	/**
+	 * * Instantiates a new CQi server.
+	 *
+	 * @param pathToExecutable the path to the executable
+	 * @param pathToData the path to data
+	 * @param inputFile the input file
+	 * @param pathToRegistry the path to the registry
+	 * @param pAttributes the positional attribute
+	 * @param sAttributes the structural atribute
+	 * @return true, if successful
+	 * @throws ServerNotFoundException the server not found exception
+	 * @throws IOException
+	 * @throws InterruptedException
+	 */
+	public boolean run(String pathToExecutable, String pathToData,
+			String inputFile, String pathToRegistry, String[] pAttributes,
+			String[] sAttributes) throws ServerNotFoundException, InterruptedException, IOException {
+		boolean ret = run(pathToExecutable, pathToData, inputFile, pathToRegistry, pAttributes, sAttributes, false);
+		
+		return ret;
+	}
+	
+	/*
+	 * delete all files and directory of the given path
+	 */
+	/**
+	 * Delete dir.
+	 *
+	 * @param dir the dir
+	 * @return true, if successful
+	 */
+	public static boolean deleteDir(File dir) {
+		if (dir.isDirectory()) {
+			String[] children = dir.list();
+			for (int i = 0; i < children.length; i++) {
+				boolean success = deleteDir(new File(dir, children[i]));
+				if (!success) {
+					return false;
+				}
+			}
+		}
+		// The directory is now empty so delete it
+		return dir.delete();
+	}
+	
+	public boolean run(String pathToExecutable, String pathToData,
+			String inputFile, String pathToRegistry, String[] pAttributes,
+			String[] sAttributes, boolean monitorOutput)
+			throws ServerNotFoundException, InterruptedException, IOException {
+		
+		List<File> inputFiles = Arrays.asList(new File(inputFile));
+		
+		return run(pathToExecutable, pathToData, inputFiles, pathToRegistry, pAttributes, sAttributes, monitorOutput);
+	}
+	
+	/**
+	 * execute cwb-encode.
+	 *
+	 * @param pathToExecutable the path to the executable of cwb-encode
+	 * @param pathToData the path to cwb indexes
+	 * @param inputFiles the input file
+	 * @param pathToRegistry the path to registry
+	 * @param pAttributes the attributes
+	 * @param sAttributes the s attributes
+	 * @param monitorOutput the monitor output
+	 * @return true, if successful
+	 * @throws ServerNotFoundException the server not found exception
+	 * @throws IOException
+	 * @throws InterruptedException
+	 */
+	public boolean run(String pathToExecutable, String pathToData,
+			List<File> inputFiles, String pathToRegistry, String[] pAttributes,
+			String[] sAttributes, boolean monitorOutput)
+			throws ServerNotFoundException, InterruptedException, IOException {
+		File data = new File(pathToData);
+		deleteDir(data);
+		data.mkdirs();
+		
+		// fix UNC paths for mingw
+		if (pathToRegistry.startsWith("\\\\")) {
+			pathToRegistry = pathToRegistry.replace("\\\\", "//"); //$NON-NLS-1$ //$NON-NLS-2$
+		}
+		// fix UNC paths for mingw
+		if (pathToData.startsWith("\\\\")) {
+			pathToData = pathToData.replace("\\\\", "//"); //$NON-NLS-1$ //$NON-NLS-2$
+		}
+		
+		if (!new File(pathToExecutable).exists()) {
+			System.err.println(TXMCoreMessages.bind("Error: path to cwb-encode not found: {0}.", pathToExecutable));
+			return false;
+		}
+		if (!new File(pathToExecutable).canExecute()) {
+			System.err.println(TXMCoreMessages.bind("Error: path to cwb-encode not executable: {0}.", pathToExecutable));
+			return false;
+		}
+		
+		/*
+		 * if (System.getProperty("os.name").contains("Win")) { pathToExecutable
+		 * = "\""+pathToExecutable+"\""; pathToData = "\""+pathToData+"\"";
+		 * inputFile = "\""+inputFile+"\""; pathToRegistry =
+		 * "\""+pathToRegistry+"\""; }
+		 */
+		
+		// Warning !! for WINDOWS ONLY the "" value does not work with the ProcessBuilder we must set the value to "\"\""
+		String empty_value_code = Toolbox.getPreference(TBXPreferences.EMPTY_PROPERTY_VALUE_CODE);
+		if (OSDetector.isFamilyWindows()) {
+			if (empty_value_code == null) empty_value_code = "\"\"";//$NON-NLS-1$
+			empty_value_code = empty_value_code.trim();
+			if (empty_value_code.length() == 0) empty_value_code = "\"\"";//$NON-NLS-1$
+		}
+		
+		ArrayList<String> cmd = new ArrayList<>();
+		if (inputFiles != null) { // read input from file
+			cmd.add(pathToExecutable);
+			cmd.add("-d");//$NON-NLS-1$
+			cmd.add(new File(pathToData).getAbsolutePath());
+			cmd.add("-R"); //$NON-NLS-1$
+			cmd.add(new File(pathToRegistry).getAbsolutePath());
+			cmd.add("-U");//$NON-NLS-1$
+			cmd.add(empty_value_code);
+			cmd.add("-c"); //$NON-NLS-1$
+			cmd.add("utf8"); //$NON-NLS-1$
+			
+			if (debug) {
+				cmd.add("-D"); //$NON-NLS-1$
+			}
+			
+			for (File inputFile : inputFiles) { // append "-f path" parameters
+				cmd.add("-f"); //$NON-NLS-1$
+				cmd.add(inputFile.getAbsolutePath());
+			}
+		}
+		else { // read input from stdin
+			String[] c = { pathToExecutable,
+					"-d", new File(pathToData).getAbsolutePath() //$NON-NLS-1$
+					, "-R", new File(pathToRegistry).getAbsolutePath() //$NON-NLS-1$
+					, "-U", empty_value_code //$NON-NLS-1$
+					, "-c", "utf8" //$NON-NLS-1$ //$NON-NLS-2$
+					// , "-x" //$NON-NLS-1$
+			};
+			cmd.addAll(Arrays.asList(c));
+		}
+		
+		cmd.add("-xsB"); //$NON-NLS-1$
+		for (int i = 0; i < pAttributes.length; i++) {
+			cmd.add("-P"); //$NON-NLS-1$
+			// lower case pattributes
+			cmd.addAll(Arrays.asList(pAttributes[i].toLowerCase().split(" "))); //$NON-NLS-1$
+			
+		}
+		for (int i = 0; i < sAttributes.length; i++) {
+			cmd.add("-S"); //$NON-NLS-1$
+			// lower case sattributes
+			cmd.addAll(Arrays.asList(sAttributes[i].toLowerCase().split(" "))); //$NON-NLS-1$
+		}
+		// String[] tmp = new String[cmd.length];
+		boolean waitForCWBEncodeToEnd = inputFiles != null;
+		return run(cmd, monitorOutput, waitForCWBEncodeToEnd) && new File(pathToRegistry).exists();
+	}
+	
+	/**
+	 * Patch dir.
+	 *
+	 * @param directory the directory
+	 */
+	public static void patchDir(File directory) {
+		File bin = new File(directory, "bin"); //$NON-NLS-1$
+		File registry = new File(directory, "registry"); //$NON-NLS-1$
+		File corpora = new File(directory, "corpora"); //$NON-NLS-1$
+		if (!directory.exists()) {
+			System.err.println(TXMCoreMessages.bind(CQPSearchEngineCoreMessages.theDirectoryDoesNotExistsColon, directory));
+			return;
+		}
+		if (!bin.exists()) {
+			System.err.println(TXMCoreMessages.bind(CQPSearchEngineCoreMessages.theBinaryDirectoryDoesNotExistsColon, bin));
+			return;
+		}
+		if (!registry.exists()) {
+			System.err.println(TXMCoreMessages.bind(CQPSearchEngineCoreMessages.theRegistryDirectoryDoesNotExistsColon, registry));
+			return;
+		}
+		if (!corpora.exists()) {
+			System.err.println(TXMCoreMessages.bind(CQPSearchEngineCoreMessages.theCorporaDirectoryDoesNotExistsColon, corpora));
+			return;
+		}
+		
+		for (File corpus : corpora.listFiles(IOUtils.HIDDENFILE_FILTER)) {
+			if (!corpus.isDirectory()) continue;
+			
+			System.out.println(TXMCoreMessages.bind(CQPSearchEngineCoreMessages.processingCorpus, corpus.getName()));
+			File data = new File(corpus, "data"); //$NON-NLS-1$
+			
+			if (!data.exists()) {
+				System.err.println(TXMCoreMessages.bind(CQPSearchEngineCoreMessages.theDataDirectoryDoesNotExistsColon, data));
+				return;
+			}
+			
+			String datapath = data.getAbsolutePath();
+			String regpath = registry.getAbsolutePath() + "/" + corpus.getName(); //$NON-NLS-1$
+			// fix UNC paths for mingw
+			if (datapath.startsWith("\\\\")) { //$NON-NLS-1$
+				datapath = datapath.replace("\\\\", "//"); //$NON-NLS-1$ //$NON-NLS-2$
+			}
+			System.out.println(NLS.bind(CQPSearchEngineCoreMessages.fixingRegistryFileP0WithP1, regpath, datapath));
+			try {
+				PatchCwbRegistry.patch(new File(regpath), new File(datapath));
+			}
+			catch (IOException e) {
+				org.txm.utils.logger.Log.printStackTrace(e);
+			}
+		}
+	}
+	
+	/**
+	 * concatenates CQP files into one master CQP file and wraps with the 'txmcorpus' structure.
+	 * 
+	 * @param cqpFiles
+	 * @param allcqpFile
+	 * @return true if the CQP files are concatenated
+	 * @throws IOException
+	 */
+	public static boolean concat(ArrayList<File> cqpFiles, File allcqpFile) throws IOException {
+		PrintWriter output = IOUtils.getWriter(allcqpFile);
+		ConsoleProgressBar cpb = new ConsoleProgressBar(cqpFiles.size());
+		
+		output.write("<txmcorpus lang=\"fr\">\n"); //$NON-NLS-1$
+		for (File cqpFile : cqpFiles) {
+			cpb.tick();
+			output.write(IOUtils.getText(cqpFile, "UTF-8")); //$NON-NLS-1$
+			output.write("\n"); //$NON-NLS-1$
+			output.flush();
+		}
+		output.write("</txmcorpus>\n"); //$NON-NLS-1$
+		output.close();
+		return true;
+	}
+	
+	/**
+	 * The main method.
+	 *
+	 * @param args the arguments
+	 */
+	public static void main(String[] args) {
+		// CwbEncode cwbEn = new CwbEncode();
+		// String[] pAttributes = {"pos", "col", "line", "id", "facs", "dipl"};
+		// String[] sAttributes = {"p:0+n", "q:1", "s:0+n+id"};
+		/*
+		 * String[] pAttributes = {"pos", "id", "col"}; String[] sAttributes =
+		 * {"p:0+n", "s:0+n"}; try {//cwbEn.run(
+		 * "/home/ayepdieu/textometrie/trunk/toolbox/src/main/C/cwb-3.0/utils/cwb-encode"
+		 * , "/home/txm/form/data/qgraalcm", "/home/txm/form/cqp/qgraalcm.cqp",
+		 * "/home/txm/form/registry/qgraalcm",pAttributes, sAttributes);
+		 * cwbEn.run(
+		 * "/home/ayepdieu/textometrie/trunk/toolbox/src/main/C/cwb-3.0/utils/cwb-encode"
+		 * , "/home/txm/form/data/qgraalfrmod",
+		 * "/home/txm/form/cqp/qgraalfrmod.cqp",
+		 * "/home/txm/form/registry/qgraalfrmod", pAttributes, sAttributes);
+		 * System.out.println(cwbEn.getErrorStream().toString()); } catch
+		 * (Exception ex) { System.out.println(ex);
+		 * System.out.println(cwbEn.getErrorStream()); }
+		 */
+		CwbEncode.patchDir(new File("C:/Documents and Settings/H/Mes documents/TXM/cwb")); //$NON-NLS-1$
+	}
+}

Property changes on: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/importer/cwb/CwbEncode.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/importer/cwb/CwbProcess.java
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/importer/cwb/CwbProcess.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/importer/cwb/CwbProcess.java	(revision 3659)
@@ -0,0 +1,306 @@
+// Copyright © 2010-2020 ENS de Lyon., University of Franche-Comté
+// 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: 2016-05-30 16:02:59 +0200 (Mon, 30 May 2016) $
+// $LastChangedRevision: 3220 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.importer.cwb;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
+import java.util.List;
+
+import org.apache.commons.lang.StringUtils;
+import org.txm.core.messages.TXMCoreMessages;
+import org.txm.libs.cqp.CQPLibPreferences;
+import org.txm.searchengine.cqp.clientExceptions.ServerNotFoundException;
+import org.txm.searchengine.cqp.core.messages.CQPSearchEngineCoreMessages;
+import org.txm.utils.logger.Log;
+
+// TODO: Auto-generated Javadoc
+/**
+ * This class aims at handling a Cwb process. it uses a java ProcessBuilder
+ * 
+ * @author Adrien Yepdieu
+ */
+
+abstract class CwbProcess {
+
+	/** The debug. */
+	protected boolean debug = false;
+	/** The process. */
+	private Process process;
+
+	/** The name. */
+	private String name;
+
+	/**
+	 * * Instantiates a new Cwb process.
+	 *
+	 */
+	protected CwbProcess() {
+		name = "Cwb_Process"; //$NON-NLS-1$
+	}
+
+	/**
+	 * Instantiates a new cwb process.
+	 *
+	 * @param name the name
+	 */
+	protected CwbProcess(String name) {
+		this.name = name;
+	}
+
+	/**
+	 * Sets the debug.
+	 *
+	 * @param b the new debug
+	 */
+	public void setDebug(boolean b) {
+		this.debug = b;
+	}
+	
+	/**
+	 * 
+	 * @return true if the 'filename' executable file set in preferences is available 
+	 */
+	public static boolean isExecutableAvailable(String filename) {
+		File pathToExecutable = new File(CQPLibPreferences.getInstance().getString(CQPLibPreferences.CQI_SERVER_PATH_TO_CQPLIB), filename);
+
+		if (!pathToExecutable.exists()) {
+			Log.severe(TXMCoreMessages.bind("Error: \"{0}\" not found.", pathToExecutable.getAbsolutePath()));
+			return false;
+		}
+		
+		if (!pathToExecutable.canExecute()) {
+			Log.severe(TXMCoreMessages.bind("Error: \"{0}\" not executable.", pathToExecutable.getAbsolutePath()));
+			return false;
+		}
+		return true;
+	}
+
+	/**
+	 * * run the command in cmd.
+	 *
+	 * @param cmd the cmd to be execute by the process
+	 * @param monitorOutput the monitor output
+	 * @return true, if successful
+	 * @throws ServerNotFoundException the server not found exception
+	 * @throws InterruptedException 
+	 * @throws IOException 
+	 */
+	protected boolean run(List<String> cmd, boolean monitorOutput, boolean waitFor) throws ServerNotFoundException, InterruptedException, IOException {
+		
+		Log.fine(TXMCoreMessages.bind(CQPSearchEngineCoreMessages.startingProcessWithCommandColon, StringUtils.join(cmd, " "))); //$NON-NLS-1$ 
+		
+		//System.out.println(StringUtils.join(cmd, " "));
+		for (String s : cmd) {
+			//System.out.println("s="+s);
+			if (s == null) {
+				Log.severe(TXMCoreMessages.bind("ERROR null arg parameter: {0}.", cmd));
+				return false;
+			}
+		}
+		ProcessBuilder processBuilder = new ProcessBuilder(cmd);
+		processBuilder.redirectErrorStream(true);
+		this.process = processBuilder.start();
+
+		final InputStream is = process.getInputStream();
+		new Thread() {
+			@Override
+			public void run() {
+				if (debug) {
+					System.out.println(TXMCoreMessages.bind("Starting logging {0} process...", name));
+				}
+				try {
+					InputStreamReader isr = new InputStreamReader(is);
+					BufferedReader br = new BufferedReader(isr);
+					String line;
+					while ((line = br.readLine()) != null) {
+						if (debug) {
+							System.out.println(line);
+						}
+					}
+					isr.close();
+					if (debug) {
+						System.out.println(TXMCoreMessages.bind("End of {0} logging process.", name));
+					}
+				} catch (IOException e) {
+					e.printStackTrace();
+				}
+			}
+		}.start();
+
+		if (waitFor) {
+			Log.fine(TXMCoreMessages.bind("Waiting for end of process: {0}...", name));
+			endProcess();
+		}
+		
+		return true;
+	}
+	
+	public static String getOutputMessages(Process process) throws InterruptedException {
+		final InputStream is = process.getInputStream();
+		StringBuffer buffer = new StringBuffer();
+		Thread t = new Thread() {
+			@Override
+			public void run() {
+				try {
+					InputStreamReader isr = new InputStreamReader(is);
+					BufferedReader br = new BufferedReader(isr);
+					String line;
+					while ((line = br.readLine()) != null) {
+						buffer.append(line+"\n");
+					}
+					isr.close();
+				} catch (IOException e) {
+					e.printStackTrace();
+				}
+			}
+		};
+		t.start();
+		t.join();
+		
+		return buffer.toString();
+		
+	}
+	
+	public void endProcess() throws InterruptedException {
+		this.process.waitFor();
+
+		int scount = 0;
+		do {
+			Thread.sleep(10);
+			scount++;
+		} while (isRunning() && scount <= 5);
+		this.process.destroy();
+	}
+
+	public OutputStream getOutPutStream() {
+		if (process == null)  return null;
+		return process.getOutputStream();
+	}
+
+	/**
+	 * Stop the CWB process.
+	 */
+	public void stop() {
+		Log.finest(TXMCoreMessages.bind(CQPSearchEngineCoreMessages.stoppingProcessColon, name.toUpperCase()));
+		this.process.destroy();
+		Log.finest(TXMCoreMessages.bind(CQPSearchEngineCoreMessages.processStopedColon, name.toUpperCase()));
+	}
+
+	/**
+	 * Checks if the process is running.
+	 * 
+	 * @return true, if is running
+	 */
+	public boolean isRunning() {
+		try {
+			if (this.process.exitValue() == 0)
+				return true;
+			// this throws an IllegalThreadStateException if the process is
+			// running
+			// The IllegalThreadStateException has not been thrown, the process
+			// is not running.
+			// false;
+			return false;
+		} catch (IllegalThreadStateException e) {
+			// The IllegalThreadStateException has been thrown, all good.
+			return true;
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see java.lang.Object#finalize()
+	 */
+	@Override
+	protected void finalize() throws Throwable {
+		try {
+			this.stop();
+		} finally {
+			super.finalize();
+		}
+	}
+
+	/**
+	 * Wait for.
+	 *
+	 * @return the int
+	 * @throws InterruptedException the interrupted exception
+	 */
+	public int waitFor() throws InterruptedException {
+		return this.process.waitFor();
+	}
+
+	/**
+	 * Gets the error stream.
+	 *
+	 * @return the error stream
+	 */
+	public InputStream getErrorStream() {
+		return process.getErrorStream();
+	}
+
+	/**
+	 * Gets the input stream.
+	 *
+	 * @return the input stream
+	 */
+	public InputStream getInputStream() {
+		return process.getInputStream();
+	}
+
+	/**
+	 * Gets the output stream.
+	 *
+	 * @return the output stream
+	 */
+	public OutputStream getOutputStream() {
+		return process.getOutputStream();
+	}
+
+	/**
+	 * Gets the CWB binaries location.
+	 *
+	 * @return the cWB location
+	 */
+	public static String getCWBLocation()
+	{
+		String cwbLoc = CQPLibPreferences.getInstance().getString(CQPLibPreferences.CQI_SERVER_PATH_TO_CQPLIB) + File.separator;
+
+		if (!new File(cwbLoc).exists()) {
+			Log.severe(TXMCoreMessages.bind(CQPSearchEngineCoreMessages.cantFindCQPLocationColon, cwbLoc));
+			return null;
+		}
+
+		return cwbLoc;
+	}
+}
\ No newline at end of file

Property changes on: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/importer/cwb/CwbProcess.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/importer/cwb/BuildCwbEncodeArgsFromCQP.java
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/importer/cwb/BuildCwbEncodeArgsFromCQP.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/importer/cwb/BuildCwbEncodeArgsFromCQP.java	(revision 3659)
@@ -0,0 +1,220 @@
+// Copyright © 2010-2020 ENS de Lyon., University of Franche-Comté
+// 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: 2013-08-29 14:23:55 +0200 (Thu, 29 Aug 2013) $
+// $LastChangedRevision: 2519 $
+// $LastChangedBy: nilskredens $ 
+//
+package org.txm.importer.cwb;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+
+import javax.xml.stream.FactoryConfigurationError;
+import javax.xml.stream.XMLStreamException;
+
+import org.txm.core.messages.TXMCoreMessages;
+import org.txm.searchengine.cqp.core.messages.CQPSearchEngineCoreMessages;
+
+/**
+ * build the sAttributes and pAttributs List from an xmlfile pAttributes
+ * (attributes of tei:w tags) and the sAttributes (attributes + max inclusion of
+ * tags).
+ *
+ * @author mdecorde
+ */
+public class BuildCwbEncodeArgsFromCQP {
+
+	/** The stack. */
+	LinkedList<String> stack = new LinkedList<String>();
+
+	/** The tagcount. */
+	HashMap<String, Integer> tagcount = new HashMap<String, Integer>();
+
+	/** The tagmax. */
+	HashMap<String, Integer> tagmax = new HashMap<String, Integer>();
+
+	/** The tagattrs. */
+	HashMap<String, HashSet<String>> tagattrs = new HashMap<String, HashSet<String>>();
+	int nWordProps = 0;
+	
+	/**
+	 * pattern to find structure attributes
+	 */
+	public static final Pattern p = Pattern.compile("(([^= ]+)=\"([^\"]+)\")");
+	
+	/**
+	 * process !!!.
+	 *
+	 * @param cqpfile the input file in CQP format
+	 * @return true if successful
+	 * @throws XMLStreamException the xML stream exception
+	 * @throws FactoryConfigurationError the factory configuration error
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 */
+	public boolean process(File cqpfile)
+			throws XMLStreamException, FactoryConfigurationError, IOException {
+		if (cqpfile == null || !cqpfile.exists()) {
+			System.out.println(TXMCoreMessages.bind(CQPSearchEngineCoreMessages.theFileP0CannotBeFound, cqpfile));
+			return false;
+		}
+
+		BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(cqpfile), "UTF-8"));
+
+		String line = reader.readLine();
+		String localname;
+		
+		//for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next()) {
+		for(; line != null ; line = reader.readLine()) {
+
+			if (line.startsWith("</") && line.endsWith(">")) { // END_ELEMENT
+				int idx = line.indexOf(" ");
+				if (idx == -1) idx = line.indexOf(">");
+				localname = line.substring(2, idx);
+
+				if (stack.size() > 0) {
+					stack.pop();
+					int count = tagcount.get(localname);
+					count--;
+					tagcount.put(localname, count);// decrement the
+					// recursion counter of the tag
+				}
+
+			} else if (line.startsWith("<") && line.endsWith("/>")) { // EMPTY_ELEMENT
+				// ignore milestones
+			} else if (line.startsWith("<") && line.endsWith(">")) { // START_ELEMENT
+				int idx = line.indexOf(" ");
+				if (idx == -1) idx = line.indexOf(">"); // no attributes
+				localname = line.substring(1, idx);
+
+				stack.push(localname);
+
+				if (!tagattrs.containsKey(localname))// initialize
+					// HashMaps
+				{
+					tagattrs.put(localname, new HashSet<String>());
+					tagcount.put(localname, 0);
+					tagmax.put(localname, 0);
+				}
+
+				Matcher m = p.matcher(line);
+				while (m.find()) {
+					if (m.groupCount() == 3) {
+						tagattrs.get(localname).add(m.group(2));
+					}
+				}
+
+				int count = tagcount.get(localname);
+				count++;
+				tagcount.put(localname, count);// increment the
+				// recursion counter of the tag
+				int max = tagmax.get(localname);
+				if (max < count)
+					tagmax.put(localname, count);// update max
+				// recursion of the tag
+
+			} else { // WORD LINE
+				if (nWordProps == 0) {
+					//System.out.println("Line: "+line);
+					String[] split = line.split("\t");
+					nWordProps = split.length;
+					//System.out.println("nprops: "+nWordProps);
+				}
+				
+			}
+		} // end while
+		reader.close();
+		return true;
+	}
+
+	/**
+	 * Gets the p attributes.
+	 *
+	 * @return the p attributes
+	 */
+	public Collection<String> getPAttributes() {
+		ArrayList<String> props = new ArrayList<String>();
+		for( int i = 1 ; i < nWordProps ; i++) { // don't count the "word" property
+			props.add("p"+i);
+		}
+		return props;
+	}
+
+	/**
+	 * Gets the s attributes.
+	 *
+	 * @return the s attributes
+	 */
+	public Collection<String> getSAttributes() {
+		ArrayList<String> rez = new ArrayList<String>();
+
+		for (String tag : tagattrs.keySet()) {
+			String s = tag.toLowerCase();
+			s += ":"; //$NON-NLS-1$
+
+			if (tagmax.get(tag) >= 0)
+				s += "" + (tagmax.get(tag) - 1); //$NON-NLS-1$
+
+			for (String attr : tagattrs.get(tag))
+				s += "+" + attr.toLowerCase(); //$NON-NLS-1$
+			rez.add(s);
+		}
+		return rez;
+	}
+
+	/**
+	 * The main method.
+	 *
+	 * @param args the arguments
+	 */
+	public static void main(String[] args) {
+		try {
+			BuildCwbEncodeArgsFromCQP argsgetter = new BuildCwbEncodeArgsFromCQP();
+			argsgetter.process(new File(
+					"/home/mdecorde/xml/cqp/discours.cqp")); //$NON-NLS-1$
+
+			System.out.println("pAttributes : " + argsgetter.getPAttributes()); //$NON-NLS-1$
+			System.out.println("sAttributes : " + argsgetter.getSAttributes()); //$NON-NLS-1$
+		} catch (XMLStreamException e) {
+			// TODO Auto-generated catch block
+			org.txm.utils.logger.Log.printStackTrace(e);
+		} catch (FactoryConfigurationError e) {
+			// TODO Auto-generated catch block
+			org.txm.utils.logger.Log.printStackTrace(e);
+		} catch (IOException e) {
+			// TODO Auto-generated catch block
+			org.txm.utils.logger.Log.printStackTrace(e);
+		}
+	}
+}
\ No newline at end of file

Property changes on: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/importer/cwb/BuildCwbEncodeArgsFromCQP.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/importer/cwb/package.html
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/importer/cwb/package.html	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/importer/cwb/package.html	(revision 3659)
@@ -0,0 +1,5 @@
+<html>
+<body>
+	<p>CWB utils. Wraps cwb-encode and cwb-makeall</p>
+</body>
+</html>
\ No newline at end of file

Property changes on: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/importer/cwb/package.html
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/importer/cwb/CompressCQPIndexes.java
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/importer/cwb/CompressCQPIndexes.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/importer/cwb/CompressCQPIndexes.java	(revision 3659)
@@ -0,0 +1,197 @@
+// Copyright © 2010-2022 ENS de Lyon., University of Franche-Comté
+// 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: 2016-05-24 10:43:03 +0200 (Tue, 24 May 2016) $
+// $LastChangedRevision: 3216 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.importer.cwb;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+
+import org.txm.utils.OSDetector;
+
+/**
+ * The Class CompressCQPIndexes.
+ */
+public class CompressCQPIndexes {
+	
+	/**
+	 * 
+	 * @param cqpToolsDirectory directory to the CWB tools
+	 * @param registryfile the corpus registry file
+	 * @param corpusid the corpus ID in UPPERCASE
+	 * @param dataDirectory directory to the CQP corpus indexes
+	 * @param txm081fix set to true for a corpus targeting TXM 0.8.1
+	 * @return true if the corpus was compressed
+	 * 
+	 * @throws IOException
+	 * @throws InterruptedException
+	 */
+	public static boolean compressAll(File cqpToolsDirectory, File registryfile, String corpusid, File dataDirectory, boolean txm081fix)
+			throws IOException, InterruptedException {
+		//Runtime.getRuntime().
+		
+		if (!registryfile.exists()) {
+			System.out.println("No registry file found: "+registryfile);
+			return false;
+		}
+		
+		if (!dataDirectory.exists()) {
+			System.out.println("No data directory found: "+dataDirectory);
+			return false;
+		}
+		
+		File huff = new File(cqpToolsDirectory, "cwb-huffcode");
+		if (OSDetector.isFamilyWindows()) {
+			huff = new File(cqpToolsDirectory, "cwb-huffcode.exe");
+		}
+		
+		File rdxcompressor = new File(cqpToolsDirectory, "cwb-compress-rdx");
+		if (OSDetector.isFamilyWindows()) {
+			rdxcompressor = new File(cqpToolsDirectory, "cwb-compress-rdx.exe");
+		}
+		
+		if (!huff.exists()) {
+			System.out.println("No huff executable found: "+huff);
+			return false;
+		}
+		
+		if (!rdxcompressor.exists()) {
+			System.out.println("No rdxcompressor executable found: "+rdxcompressor);
+			return false;
+		}
+		
+		ArrayList<String> args = new ArrayList<>(Arrays.asList(huff.getAbsolutePath(), "-T", "-r", registryfile.getParent()));
+		
+		//		ReadRegistryFile rrf = new ReadRegistryFile(registryfile);
+		//		rrf.read();
+		//		for (String p : rrf.pAttributes) {
+		//			args.add("-P");
+		//			args.add(p);
+		//		}
+		args.add("-A");
+		args.add(corpusid);
+		
+		ProcessBuilder processBuilder = new ProcessBuilder(args);
+		processBuilder.redirectErrorStream(true);
+		Process process = processBuilder.start();
+		String messages = CwbProcess.getOutputMessages(process);
+		System.out.println(messages);
+		if (process.exitValue() != 0) {
+			System.out.println("Error while compressing with huff");
+			return false;
+		}
+		
+		ArrayList<String> args2 = new ArrayList<>(Arrays.asList(rdxcompressor.getAbsolutePath(), "-T", "-r", registryfile.getParent()));
+		
+		//		for (String p : rrf.pAttributes) {
+		//			File f = new File(dataDirectory, p+".corpus");
+		//			if (f.length() > 0) {
+		//				args2.add("-P");
+		//				args2.add(p);
+		//			}
+		//		}
+		args2.add("-A");
+		args2.add(corpusid);
+		
+		processBuilder = new ProcessBuilder(args2);
+		processBuilder.redirectErrorStream(true);
+		process = processBuilder.start();
+		messages = CwbProcess.getOutputMessages(process);
+		System.out.println(messages);
+		if (process.exitValue() != 0) {
+			System.out.println("Error while compressing rdx files");
+			return false;
+		}
+		
+		// remove .corpus files if the compression was successful
+		int s = 0;
+		int a = 0;
+		for (File f : dataDirectory.listFiles()) {
+			if (f.getName().endsWith(".corpus")) {
+				
+				
+				String path = f.getAbsolutePath();
+				path = path.substring(0, path.length() - 7)+".huf";
+				File cfile = new File(path);
+				if (cfile.exists()) {
+					s += f.length();
+					f.delete();
+					if (txm081fix) f.createNewFile();
+				} else {
+					continue;
+				}
+			}
+			if (f.getName().matches(".+(\\.hcd|\\.huf|\\.huf\\.syn)")) {
+				a += f.length();
+			}
+		}
+		
+		// remove .corpus.rdx and corpus.rev files if the compression was successful
+		for (File f : dataDirectory.listFiles()) {
+			if (f.getName().endsWith(".corpus.rdx") ||f.getName().endsWith(".corpus.rev")) {
+				
+				String path = f.getAbsolutePath();
+				path = path.substring(0, path.length() - 7)+".crc";
+				File cfile = new File(path);
+				if (cfile.exists()) {
+					s += f.length();
+					f.delete();
+					if (txm081fix) f.createNewFile();
+				} else {
+					continue;
+				}
+			}
+			if (f.getName().matches(".+(\\.crc|\\.crx)")) {
+				a += f.length();
+			}
+		}
+		
+		System.out.println("cleared: "+s);
+		System.out.println("created: "+a);
+		System.out.println("diff="+(s-a));
+		return true;
+	}
+	
+	/**
+	 * The main method.
+	 *
+	 * @param args the arguments
+	 */
+	public static void main(String[] args) {
+		try {
+			String userdir = System.getProperty("user.home");
+			File tools = new File(userdir, "SVN/txm-sf/CWB/cwb-lib/src/builds/linux-64"); //$NON-NLS-1$
+			File registry = new File(userdir, "runtime-rcpapplication.product/corpora/NOV13-P1-2022-06-15-V1/registry/nov13-p1-2022-06-15-v1"); //$NON-NLS-1$
+			File data = new File(userdir, "runtime-rcpapplication.product/corpora/NOV13-P1-2022-06-15-V1/data/NOV13-P1-2022-06-15-V1"); //$NON-NLS-1$
+			CompressCQPIndexes.compressAll(tools, registry, "NOV13-P1-2022-06-15-V1", data, true);
+			
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+	}
+}
\ No newline at end of file

Property changes on: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/importer/cwb/CompressCQPIndexes.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/importer/cwb/CwbDecode.java
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/importer/cwb/CwbDecode.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/importer/cwb/CwbDecode.java	(revision 3659)
@@ -0,0 +1,598 @@
+// Copyright © 2010-2020 ENS de Lyon., University of Franche-Comté
+// 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: 2013-05-06 17:38:43 +0200 (lun., 06 mai 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.importer.cwb;
+
+import java.util.Date;
+import java.util.List;
+import java.util.Locale;
+import java.text.DateFormat;
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.util.ArrayList;
+
+// Decode CWB indexes
+/**
+ * The Class CwbDecode.
+ */
+public class CwbDecode {
+
+	/** The binpath. */
+	String binpath = "";
+
+	/**
+	 * Instantiates a new cwb decode.
+	 *
+	 * @param binpath the binpath
+	 */
+	public CwbDecode(String binpath) {
+		this.binpath = binpath;
+	}
+
+	/** The version. */
+	String version = "0.0.0";
+
+	/** The desc. */
+	String desc = "Decode CWB indexes";
+
+	/** The debug. */
+	boolean debug = false;
+
+	/**
+	 * Debug.
+	 *
+	 * @param b the b
+	 */
+	public void debug(boolean b) {
+		debug = b;
+	};
+
+	// Lisp output mode
+
+	/** The is l. */
+	private Boolean isL = false;
+
+	/**
+	 * Sets the l.
+	 */
+	public void setL() {
+		this.isL = true;
+	}
+
+	/**
+	 * Unset l.
+	 */
+	public void unsetL() {
+		this.isL = false;
+	}
+
+	// concordance line ('horizonta'l) output mode
+
+	/** The is h. */
+	private Boolean isH = false;
+
+	/**
+	 * Sets the h.
+	 */
+	public void setH() {
+		this.isH = true;
+	}
+
+	/**
+	 * Unset h.
+	 */
+	public void unsetH() {
+		this.isH = false;
+	}
+
+	// compact output mode (suitable for encode)
+
+	/** The is c. */
+	private Boolean isC = false;
+
+	/**
+	 * Sets the c.
+	 */
+	public void setC() {
+		this.isC = true;
+	}
+
+	/**
+	 * Unset c.
+	 */
+	public void unsetC() {
+		this.isC = false;
+	}
+
+	// XML-compatible compact output (for {encode -x ...}))
+
+	/** The is cx. */
+	private Boolean isCx = false;
+
+	/**
+	 * Sets the cx.
+	 */
+	public void setCx() {
+		this.isCx = true;
+	}
+
+	/**
+	 * Unset cx.
+	 */
+	public void unsetCx() {
+		this.isCx = false;
+	}
+
+	// XML output mode
+
+	/** The is x. */
+	private Boolean isX = false;
+
+	/**
+	 * Sets the x.
+	 */
+	public void setX() {
+		this.isX = true;
+	}
+
+	/**
+	 * Unset x.
+	 */
+	public void unsetX() {
+		this.isX = false;
+	}
+
+	// show corpus position ('numbers')
+
+	/** The isn. */
+	private Boolean isn = false;
+
+	/**
+	 * Setn.
+	 */
+	public void setn() {
+		this.isn = true;
+	}
+
+	/**
+	 * Unsetn.
+	 */
+	public void unsetn() {
+		this.isn = false;
+	}
+
+	// first token to print (at corpus position {n})
+
+	/** The iss. */
+	private Boolean iss = false;
+
+	/** The s. */
+	private int s;
+
+	/**
+	 * Sets the s.
+	 *
+	 * @param arg the new s
+	 */
+	public void sets(int arg) {
+		this.iss = true;
+		this.s = arg;
+	}
+
+	/**
+	 * Unsets.
+	 */
+	public void unsets() {
+		this.iss = false;
+	}
+
+	// last token to print (at corpus position {n})
+
+	/** The ise. */
+	private Boolean ise = false;
+
+	/** The e. */
+	private int e;
+
+	/**
+	 * Sets the e.
+	 *
+	 * @param arg the new e
+	 */
+	public void sete(int arg) {
+		this.ise = true;
+		this.e = arg;
+	}
+
+	/**
+	 * Unsete.
+	 */
+	public void unsete() {
+		this.ise = false;
+	}
+
+	// set registry directory
+
+	/** The isr. */
+	private Boolean isr = false;
+
+	/** The r. */
+	private String r;
+
+	/**
+	 * Sets the r.
+	 *
+	 * @param arg the new r
+	 */
+	public void setr(String arg) {
+		this.isr = true;
+		this.r = arg;
+	}
+
+	/**
+	 * Unsetr.
+	 */
+	public void unsetr() {
+		this.isr = false;
+	}
+
+	// matchlist mode (input from stdin)
+
+	/** The isp. */
+	private Boolean isp = false;
+
+	/**
+	 * Setp.
+	 */
+	public void setp() {
+		this.isp = true;
+	}
+
+	/**
+	 * Unsetp.
+	 */
+	public void unsetp() {
+		this.isp = false;
+	}
+
+	// matchlist mode (input from {file})
+
+	/** The isf. */
+	private Boolean isf = false;
+
+	/** The f. */
+	private String f;
+
+	/**
+	 * Sets the f.
+	 *
+	 * @param arg the new f
+	 */
+	public void setf(String arg) {
+		this.isf = true;
+		this.f = arg;
+	}
+
+	/**
+	 * Unsetf.
+	 */
+	public void unsetf() {
+		this.isf = false;
+	}
+
+	// this help page
+
+	/** The ish. */
+	private Boolean ish = false;
+
+	/**
+	 * Seth.
+	 */
+	public void seth() {
+		this.ish = true;
+	}
+
+	/**
+	 * Unseth.
+	 */
+	public void unseth() {
+		this.ish = false;
+	}
+
+	// print p-attribute {att}
+
+	/** The is p. */
+	private Boolean isP = false;
+
+	/** The P. */
+	private List<String> P;
+
+	/**
+	 * Sets the p.
+	 *
+	 * @param arg the new p
+	 */
+	public void setP(List<String> arg) {
+		this.isP = true;
+		this.P = arg;
+	}
+
+	/**
+	 * Unset p.
+	 */
+	public void unsetP() {
+		this.isP = false;
+	}
+
+	// print s-attribute {att} (possibly including annotations)
+
+	/** The is s. */
+	private Boolean isS = false;
+
+	/** The S. */
+	private List<String> S;
+
+	/**
+	 * Sets the s.
+	 *
+	 * @param arg the new s
+	 */
+	public void setS(List<String> arg) {
+		this.isS = true;
+		this.S = arg;
+	}
+
+	/**
+	 * Unset s.
+	 */
+	public void unsetS() {
+		this.isS = false;
+	}
+
+	// show s-attribute annotation for each range in matchlist mode
+
+	/** The is v. */
+	private Boolean isV = false;
+
+	/** The V. */
+	private List<String> V;
+
+	/**
+	 * Sets the v.
+	 *
+	 * @param arg the new v
+	 */
+	public void setV(List<String> arg) {
+		this.isV = true;
+		this.V = arg;
+	}
+
+	/**
+	 * Unset v.
+	 */
+	public void unsetV() {
+		this.isV = false;
+	}
+
+	// print alignment attribute {att}
+
+	/** The is a. */
+	private Boolean isA = false;
+
+	/** The A. */
+	private List<String> A;
+
+	/**
+	 * Sets the a.
+	 *
+	 * @param arg the new a
+	 */
+	public void setA(List<String> arg) {
+		this.isA = true;
+		this.A = arg;
+	}
+
+	/**
+	 * Unset a.
+	 */
+	public void unsetA() {
+		this.isA = false;
+	}
+
+	// print all p-attributes and s-attributes
+
+	/** The is all. */
+	private Boolean isALL = false;
+
+	/**
+	 * Sets the all.
+	 */
+	public void setALL() {
+		this.isALL = true;
+	}
+
+	/**
+	 * Unset all.
+	 */
+	public void unsetALL() {
+		this.isALL = false;
+	}
+
+	// expand ranges to full {att} region (matchlist mode)
+
+	/** The isc. */
+	private Boolean isc = false;
+
+	/** The c. */
+	private String c;
+
+	/**
+	 * Sets the c.
+	 *
+	 * @param arg the new c
+	 */
+	public void setc(String arg) {
+		this.isc = true;
+		this.c = arg;
+	}
+
+	/**
+	 * Unsetc.
+	 */
+	public void unsetc() {
+		this.isc = false;
+	}
+
+	String[] options;
+	public void setAdditionalOptions(String[] options) {
+		this.options = options;
+	}
+
+	/**
+	 * Cwbdecode.
+	 *
+	 * @param corpus the corpus
+	 */
+	public void cwbdecode(String corpus) throws IOException
+	// arg : corpus name
+	{
+		ArrayList<String> args = new ArrayList<String>();
+		if(System.getProperty("os.name").contains("Windows")) {
+			args.add(binpath + "cwb-decode.exe");	
+		} else {
+			args.add(binpath + "cwb-decode");
+		}
+		if (isL)
+			args.add("-L");
+		if (isH)
+			args.add("-H");
+		if (isC)
+			args.add("-C");
+		if (isCx)
+			args.add("-Cx");
+		if (isX)
+			args.add("-X");
+		if (isn)
+			args.add("-n");
+		if (iss) {
+			args.add("-s");
+			args.add("" + s);
+		}
+		if (ise) {
+			args.add("-e");
+			args.add("" + e);
+		}
+		if (isr) {
+			args.add("-r");
+			args.add("" + r);
+		}
+		if (isp)
+			args.add("-p");
+		if (isf) {
+			args.add("-f");
+			args.add("" + f);
+		}
+		args.add("" + corpus);
+		if (ish)
+			args.add("-h");
+		if (isP)
+			for (int c = 0; c < P.size(); c++) {
+				args.add("-P");
+				args.add("" + P.get(c));
+			}
+		if (isS)
+			for (int c = 0; c < S.size(); c++) {
+				args.add("-S");
+				args.add("" + S.get(c));
+			}
+		if (isV)
+			for (int c = 0; c < V.size(); c++) {
+				args.add("-V");
+				args.add("" + V.get(c));
+			}
+		if (isA)
+			for (int c = 0; c < A.size(); c++) {
+				args.add("-A");
+				args.add("" + A.get(c));
+			}
+		if (isALL)
+			args.add("-ALL");
+		if (isc) {
+			args.add("-c");
+			args.add("" + c);
+		}
+
+		if (options != null) {
+			for (String opt : options) {
+				args.add(opt);
+			}
+		}
+
+		ProcessBuilder pb = new ProcessBuilder(args);
+		pb.redirectErrorStream(false);
+		Process process = null;
+		try {
+			process = pb.start();
+		} catch (IOException e) {
+			System.err.println(e);
+		}
+		InputStream is = process.getInputStream();
+		InputStreamReader isr = new InputStreamReader(is);
+		BufferedReader br = new BufferedReader(isr);
+		String line;
+		while ((line = br.readLine()) != null) {
+			System.out.println(line);
+		}
+		int e = 0;
+		try {
+			e = process.waitFor();
+		} catch (Exception err) {
+		}
+		if (e != 0) {
+			System.err.println("Process exited abnormally with code "
+					+ e
+					+ " at "
+					+ DateFormat.getDateInstance(DateFormat.FULL, Locale.UK)
+					.format(new Date()));
+
+			for (int c = 0; c < args.size(); c++)
+				System.out.print("" + args.get(c) + " ");
+			System.out.println();
+		}
+	}
+
+	/**
+	 * The main method.
+	 *
+	 * @param args the arguments
+	 */
+	public static void main(String[] args) {
+		CwbDecode tt = new CwbDecode("");
+	}
+}
\ No newline at end of file

Property changes on: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/importer/cwb/CwbDecode.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/importer/cwb/FixMilestoneDeclarations.java
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/importer/cwb/FixMilestoneDeclarations.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/importer/cwb/FixMilestoneDeclarations.java	(revision 3659)
@@ -0,0 +1,124 @@
+package org.txm.importer.cwb;
+
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileReader;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+
+import org.txm.utils.io.IOUtils;
+
+/**
+ * Remove milestone declarations and index files. Milestones are empty structures that cannot be used with CQL
+ * 
+ * @author mdecorde
+ *
+ */
+public class FixMilestoneDeclarations {
+	File registryFile;
+	File dataDirectory;
+	boolean debug = false;
+	
+	public static final String[] exts = { ".avs", ".avx", ".rng"};
+
+	public FixMilestoneDeclarations(File registryFile, File dataDirectory) {
+		this.registryFile = registryFile;
+		this.dataDirectory = dataDirectory;
+	}
+
+	
+	public boolean process() throws IOException {
+		if (!dataDirectory.exists()) return false;
+		if (!registryFile.exists()) return false;
+
+		// get structural units and their properties
+		ArrayList<String> structures = new ArrayList<String>();
+		HashMap<String, ArrayList<String>> structureAttributes = new HashMap<String, ArrayList<String>>();
+		BufferedReader reader = new BufferedReader(new FileReader(registryFile));
+		String line = reader.readLine();
+		String structure = "";
+		while (line != null) {
+
+			if (line.startsWith("STRUCTURE ")) {
+				if ( !line.contains("_")) {
+					structure = line.substring(10);
+					structures.add(structure);
+					structureAttributes.put(structure, new ArrayList<String>());
+				} else {
+					line = line.replaceAll("[ ]+# \\[annotations\\]", "");
+					structureAttributes.get(structure).add(line.substring(10));
+				}
+
+			}
+			line = reader.readLine();
+		}
+		reader.close();
+		if (debug) System.out.println("Structures: "+structures);
+
+		File[] files = dataDirectory.listFiles(IOUtils.HIDDENFILE_FILTER);
+		if (files == null) return false;
+
+		//removing empty data files
+		ArrayList<String> linesToRemove = new ArrayList<String>();
+		for (String s : structures) {
+			File f = new File(dataDirectory, s+".rng");
+
+			if (f.exists() && f.length() == 0) {
+				if (debug) System.out.println("Milestone detected : "+s);
+				f.delete();
+				linesToRemove.add(s);
+
+				if (debug) System.out.println("Removing files: "+structureAttributes.get(s));
+				for (String attribute : structureAttributes.get(s)) {
+					linesToRemove.add(attribute);
+					for (String ext : exts) {
+						new File(dataDirectory, attribute+ext).delete();
+					}
+				}
+				continue;
+			}
+
+//			if (!f.exists()) {
+//				if (debug) System.out.println("Structure "+s+" RNG file is missing: "+f);
+//				linesToRemove.add(s);
+//			}
+		}
+
+		// remove structure declarations
+		if (debug) System.out.println("Attributes to remove from registry files: "+linesToRemove);
+		reader = new BufferedReader(new FileReader(registryFile));
+		File registryFile_tmp = new File(registryFile.getAbsolutePath()+".tmp");
+		BufferedWriter writer = new BufferedWriter(new FileWriter(registryFile_tmp));
+		line = reader.readLine();
+		while (line != null) {
+			
+			if (line.startsWith("STRUCTURE ")) {
+				
+				structure = line.substring(10).replaceAll("[ ]+# \\[annotations\\]", "");
+				if (linesToRemove.contains(structure)) {
+					if (debug) System.out.println("Remove line: "+line);
+					// don't write attribute line
+				} else {
+					writer.write(line+"\n");
+				}
+			} else {
+				writer.write(line+"\n");
+			}
+			line = reader.readLine();
+		}
+		reader.close();
+		writer.close();
+
+		return (registryFile.delete() && registryFile_tmp.renameTo(registryFile));
+	}
+
+	public static void main(String args[]) throws IOException {
+		File registryFile = new File("/home/mdecorde/TXM/corpora/BAIP/registry/baip");
+		File dataDirectory = new File("/home/mdecorde/TXM/corpora/BAIP/data/BAIP");
+		FixMilestoneDeclarations fm = new FixMilestoneDeclarations(registryFile, dataDirectory);
+		System.out.println("Result: "+fm.process());
+	}
+}

Property changes on: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/importer/cwb/FixMilestoneDeclarations.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/importer/cwb/BuildAlignOut.java
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/importer/cwb/BuildAlignOut.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/importer/cwb/BuildAlignOut.java	(revision 3659)
@@ -0,0 +1,95 @@
+package org.txm.importer.cwb;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.ArrayList;
+
+import org.txm.utils.io.IOUtils;
+/**
+ * Create the CWB "align.out" file usually created with cwb-align using 2 CQP files. The alignement structure and property is not checked. Only structure order is used.
+ * 
+ * @author mdecorde
+ *
+ */
+public class BuildAlignOut {
+	
+	File cqpFile1;
+	File cqpFile2;
+	
+	public BuildAlignOut(File cqpFile1, File cqpFile2) {
+		this.cqpFile1 = cqpFile1;
+		this.cqpFile2 = cqpFile2;
+	}
+	
+	public boolean process(File alignOutFile, String su, String sup) throws IOException {
+		
+		ArrayList<Integer> positions1 = getWordPositions(cqpFile1, su, sup);
+		ArrayList<Integer> positions2 = getWordPositions(cqpFile2, su, sup);
+		
+		if (positions1.size() != positions2.size()) {
+			System.out.println("Error: the number of segment differs. "+positions1.size()+" in "+cqpFile1+" and "+positions2.size()+" in "+cqpFile2);
+			return false;
+		}
+		
+		System.out.println("Writing "+alignOutFile.getName()+" with "+positions1.size()+" positions.");
+		String encoding = "UTF-8";
+		PrintWriter writer = IOUtils.getWriter(alignOutFile, encoding);
+		
+		String c1 = cqpFile1.getName().toLowerCase();
+		c1 = c1.substring(0, c1.length()-4);
+		String c2 = cqpFile2.getName().toLowerCase();
+		c2 = c2.substring(0, c2.length()-4);
+		
+		writer.println(c1+"\t"+su+"\t"+c2+"\t"+su);
+		for (int i = 0 ; i < positions1.size() ; i = i+2) {
+			writer.println(""+positions1.get(i)+"\t"+positions1.get(i+1)+"\t"+positions2.get(i)+"\t"+positions2.get(i+1)+"\t1:1\t42");
+		}
+		writer.close();
+		
+		return true;
+	}
+
+	private static ArrayList<Integer> getWordPositions(File cqpFile, String su,
+			String sup) throws IOException {
+		
+		BufferedReader reader = IOUtils.getReader(cqpFile);
+		int position_counter = 0;
+		ArrayList<Integer> positions1 = new ArrayList<Integer>();
+		
+		String pattern = " "+sup+"=\"";
+		String line = reader.readLine();
+		while (line != null) {
+			if (line.startsWith("<"+su) && line.contains(pattern)) {
+				// align structure !
+				positions1.add(position_counter);
+			} else if (line.startsWith("</"+su+">")) {
+				// align structure !
+				positions1.add(position_counter-1);
+			}  else if (line.startsWith("<")) {
+				// structure !
+			} else if (line.length() == 0) {
+				// empty line
+			} else { // word line
+				//System.out.println("WORD: "+line);
+				position_counter++;
+			}
+			line = reader.readLine();
+		}
+		return positions1;
+	}
+	
+	public static void main(String args[]) throws IOException {
+		
+//		PatchCwbRegistry.patchAlignment(new File("/home/mdecorde/TEMP/align/registry", "c1"), "c2");
+//		PatchCwbRegistry.patchAlignment(new File("/home/mdecorde/TEMP/align/registry", "c2"), "c1");
+		
+		File cqpFile1 = new File("/home/mdecorde/TXM/corpora/SAMPLE/cqp/SAMPLE_en0.cqp");
+		File cqpFile2 = new File("/home/mdecorde/TXM/corpora/SAMPLE/cqp/SAMPLE_fr3.cqp");
+		File alignOutFile = new File("/home/mdecorde/TXM/corpora/SAMPLE/align.out");
+		
+		BuildAlignOut bao = new BuildAlignOut(cqpFile1, cqpFile2);
+		System.out.println("Result: "+bao.process(alignOutFile, "seg", "id"));
+	}
+}

Property changes on: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/importer/cwb/BuildAlignOut.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/importer/cwb/CwbMakeAll.java
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/importer/cwb/CwbMakeAll.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/importer/cwb/CwbMakeAll.java	(revision 3659)
@@ -0,0 +1,215 @@
+// Copyright © 2010-2020 ENS de Lyon., University of Franche-Comté
+// 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: 2016-05-26 17:42:36 +0200 (Thu, 26 May 2016) $
+// $LastChangedRevision: 3219 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.importer.cwb;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+
+import org.txm.libs.cqp.CQPLibPreferences;
+import org.txm.searchengine.cqp.clientExceptions.ServerNotFoundException;
+import org.txm.utils.OSDetector;
+import org.txm.utils.io.IOUtils;
+import org.txm.utils.logger.Log;
+
+// TODO: Auto-generated Javadoc
+/**
+ * This class aims at handling a Cwb Make All.
+ * 
+ * @author Adrien Yepdieu
+ */
+public class CwbMakeAll extends CwbProcess {
+
+	/**
+	 * Instantiates a new cwb make all.
+	 */
+	public CwbMakeAll() {
+		super("cwb-makeall"); //$NON-NLS-1$
+	}
+
+	/**
+	 * Instantiates a new cwb make all.
+	 *
+	 * @param name the name
+	 */
+	public CwbMakeAll(String name) {
+		super(name);
+	}
+
+	/**
+	 * * Instantiates a new Cwb Make All.
+	 *
+	 * @param pathToExecutable the path to the executable
+	 * @param corpusName the corpus name
+	 * @param pathToRegistry the path to the registry
+	 * @return true, if successful
+	 * @throws ServerNotFoundException the server not found exception
+	 * @throws IOException 
+	 * @throws InterruptedException 
+	 */
+	public boolean run(String pathToExecutable, String corpusName,
+			String pathToRegistry) throws ServerNotFoundException, InterruptedException, IOException {
+		return run(pathToExecutable, corpusName, pathToRegistry, false);
+	}
+
+	/**
+	 * * Instantiates a new Cwb Make All using executable file set in preferences
+	 *
+	 * @param corpusName the corpus name
+	 * @param pathToRegistry the path to the registry
+	 * @return true, if successful
+	 * @throws ServerNotFoundException the server not found exception
+	 * @throws IOException 
+	 * @throws InterruptedException 
+	 */
+	public boolean run(String corpusName,
+			String pathToRegistry) throws ServerNotFoundException, InterruptedException, IOException {
+		return run(corpusName, pathToRegistry, false);
+	}
+	
+	/**
+	 * * Instantiates a new Cwb Make All using executable file set in preferences
+	 *
+	 * @param corpusName the corpus name
+	 * @param pathToRegistry the path to the registry
+	 * @return true, if successful
+	 * @throws ServerNotFoundException the server not found exception
+	 * @throws IOException 
+	 * @throws InterruptedException 
+	 */
+	public boolean run(String corpusName,
+			String pathToRegistry, boolean monitorOutput) throws ServerNotFoundException, InterruptedException, IOException {
+		new File(pathToRegistry).mkdirs();
+		File pathToExecutable = new File(CQPLibPreferences.getInstance().getString(CQPLibPreferences.CQI_SERVER_PATH_TO_CQPLIB), 
+				"cwb-makeall"+(System.getProperty("os.name").toLowerCase().contains("windows")?".exe":""));
+		
+		return run(pathToExecutable.getAbsolutePath(), corpusName, pathToRegistry, monitorOutput);
+	}
+
+	
+	/**
+	 * 
+	 * @return if the cwb-makeall executable file set in preferences is available 
+	 */
+	public static boolean isExecutableAvailable() {
+		return isExecutableAvailable("cwb-makeall"+(System.getProperty("os.name").toLowerCase().contains("windows")?".exe":""));
+	}
+	
+	/**
+	 * execute cwb-makeall.
+	 *
+	 * @param pathToExecutable path to cwb-makeall executable
+	 * @param corpusName the corpus name you want to build
+	 * @param pathToRegistry path to the directory which contains the corpus registry file
+	 * @param monitorOutput show output messages or not
+	 * @return true, if successful
+	 * @throws ServerNotFoundException the server not found exception
+	 * @throws IOException 
+	 * @throws InterruptedException 
+	 */
+	public boolean run(String pathToExecutable, String corpusName, String pathToRegistry, boolean monitorOutput) throws ServerNotFoundException, InterruptedException, IOException {
+
+		// FIXME: SJ: old code that created a wrong file path
+		// need to check on a real TXM install if this code is very useless then remove it
+//		if (OSDetector.isFamilyWindows()) { //$NON-NLS-1$ //$NON-NLS-2$
+////			pathToExecutable = "\"" + pathToExecutable + "\""; //$NON-NLS-1$ //$NON-NLS-2$
+////			pathToRegistry = "\"" + pathToRegistry + "\""; //$NON-NLS-1$ //$NON-NLS-2$
+//			
+//			pathToExecutable = pathToExecutable + "/"; //$NON-NLS-1$ //$NON-NLS-2$
+//			pathToRegistry = pathToRegistry + "/"; //$NON-NLS-1$ //$NON-NLS-2$
+//
+//			
+//		}
+		
+		if (!new File(pathToExecutable).exists()) {
+			Log.severe("Error: path to cwb-makeall not found: " + pathToExecutable);
+			return false;
+		}
+		if (!new File(pathToExecutable).canExecute()) {
+			Log.severe("Error: path to cwb-makeall not executable: " + pathToExecutable);
+			return false;
+		}
+		
+		ArrayList<String> cmd = new ArrayList<String>();
+		cmd.addAll(Arrays.asList(pathToExecutable, "-r", pathToRegistry, "-V", corpusName.toUpperCase())); //$NON-NLS-1$ //$NON-NLS-2$
+		if (debug) {
+			cmd.add(1, "-D"); //$NON-NLS-1$
+		}
+		boolean ret = run(cmd, monitorOutput, true); // always wait for cwb-makeall to end
+		
+//		if (ret) {
+//			File regFile = new File(pathToRegistry);
+//			ReadRegistryFile registry = new ReadRegistryFile(regFile);
+//			registry.read();
+//			
+//			File dataDirectory = registry.getDataDirectory();
+//			
+//			for (String struct : registry.getSAttributesMap().keySet()) {
+//				for (String attr : registry.getSAttributesMap().get(struct)) {
+//					File avxFile = new File(dataDirectory, attr+".avx");
+//					File avsFile = new File(dataDirectory, attr+".avs");
+//					File rngFile = new File(dataDirectory, attr+".rng");
+//					File cpos2idFile = new File(dataDirectory, attr+".corpus.idx");
+//					File id2StrFile = new File(dataDirectory, attr+".lexicon.idx");
+//					
+//					if (avsFile.exists()) {
+//						System.out.println("Building id -> cpos: "+id2StrFile);
+//						ArrayList<String> strings = new ArrayList<String>();
+//						String dataString = IOUtils.getText(avsFile);
+//					
+//						System.out.println("Building cpos -> id: "+cpos2idFile);
+//					}
+//				}
+//			}
+//			
+//			return ret;
+//		} else {
+//			return false;
+//		}
+		return ret;
+	}
+
+	/**
+	 * The main method.
+	 *
+	 * @param args the arguments
+	 */
+	public static void main(String[] args) {
+		CwbMakeAll cwbMa = new CwbMakeAll();
+		try {
+			// cwbMa.run("/home/ayepdieu/textometrie/trunk/toolbox/src/main/C/cwb-3.0/utils/cwb-makeall",
+			// "QGRAALCM", "/home/txm/form/registry");
+			cwbMa.run("/home/ayepdieu/textometrie/trunk/toolbox/src/main/C/cwb-3.0/utils/cwb-makeall", "QGRAALFRMOD", "/home/txm/form/registry"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+			// System.out.println(cwbMa.getErrorStream().toString());
+		} catch (Exception ex) {
+			System.out.println(ex);
+			// System.out.println(cwbMa.getErrorStream());
+		}
+	}
+}

Property changes on: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/importer/cwb/CwbMakeAll.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/importer/cwb/PatchCwbRegistry.java
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/importer/cwb/PatchCwbRegistry.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/importer/cwb/PatchCwbRegistry.java	(revision 3659)
@@ -0,0 +1,343 @@
+// Copyright © 2010-2020 ENS de Lyon., University of Franche-Comté
+// 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: 2016-05-24 10:43:03 +0200 (Tue, 24 May 2016) $
+// $LastChangedRevision: 3216 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.importer.cwb;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.OutputStreamWriter;
+
+import org.txm.core.messages.TXMCoreMessages;
+import org.txm.searchengine.cqp.core.messages.CQPSearchEngineCoreMessages;
+import org.txm.utils.io.IOUtils;
+import org.txm.utils.logger.Log;
+
+/**
+ * The Class PatchCwbRegistry.
+ */
+public class PatchCwbRegistry {
+	
+	/**
+	 * Patch.
+	 *
+	 * @param registryfile the file to patch
+	 * @param datadir the directory containing the cwb index
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 */
+	public static void patch(File registryfile, File datadir)
+			throws IOException {
+		//String corpus = registryfile.getName();
+		
+		// HOME INFO
+		String datadirPath = datadir.getAbsolutePath();
+		File temp = File.createTempFile("temp", ".registry", registryfile.getParentFile()); //$NON-NLS-1$ //$NON-NLS-2$
+		
+		 // fix UNC paths for mingw
+		if (datadirPath.startsWith("\\\\")) {
+			datadirPath = datadirPath.replace("\\\\", "//");
+		}
+		
+		String encoding = IOUtils.UTF8;
+		//if (OSDetector.isFamilyWindows()) encoding = "ISO-8859-1"; //$NON-NLS-1$
+		BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(registryfile), encoding));
+		OutputStreamWriter writer = new OutputStreamWriter(new FileOutputStream(temp), encoding);
+
+		String line = reader.readLine();
+		while (line != null) {
+			//System.out.println("LINE: "+line);
+			if (line.startsWith("HOME")) //$NON-NLS-1$
+				writer.write("HOME \"" + datadirPath + "\"\n"); //$NON-NLS-1$ //$NON-NLS-2$
+			else if (line.startsWith("INFO")) //$NON-NLS-1$
+				writer.write("INFO \"" + datadirPath + "/.info\"\n"); //$NON-NLS-1$ //$NON-NLS-2$
+			else
+				writer.write(line + "\n"); //$NON-NLS-1$
+			line = reader.readLine();
+		}
+		writer.close();
+		reader.close();
+		
+		registryfile.delete();
+		
+//		System.out.println("TMP file: "+temp);
+//		System.out.println("TMP file exists?: "+temp.exists());
+//		System.out.println("REG file exists?: "+registryfile.exists());
+		if (registryfile.exists()) {
+			System.err.println(TXMCoreMessages.bind("ERROR: old registry path still exists. Result in {0}.", temp));
+		} else {
+			temp.renameTo(registryfile);
+		}
+		
+//		System.out.println("TMP file exists?: "+temp.exists());
+//		System.out.println("REG file exists?: "+registryfile.exists());
+	}
+
+	/**
+	 * Change the encoding value.
+	 *
+	 * @param registryfile the registry file to patch
+	 * @param corpusEncoding the new encoding value
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 */
+	public static void patchEncoding(File registryfile, String corpusEncoding) throws IOException {
+		String corpus = registryfile.getName();
+
+		// HOME INFO
+		File temp = File.createTempFile("temp", ".regsitry", registryfile.getParentFile()); //$NON-NLS-1$ //$NON-NLS-2$
+
+		String encoding = IOUtils.UTF8;
+		//if (OSDetector.isFamilyWindows()) encoding = "ISO-8859-1"; //$NON-NLS-1$
+		BufferedReader reader = new BufferedReader(new InputStreamReader(
+				new FileInputStream(registryfile), encoding));
+		OutputStreamWriter writer = new OutputStreamWriter(
+				new FileOutputStream(temp), encoding);
+
+		if (corpusEncoding.startsWith("ISO") || corpusEncoding.startsWith("iso")) { //$NON-NLS-1$ //$NON-NLS-2$
+			corpusEncoding = "latin" + corpusEncoding.substring(9);//remove iso-8859- //$NON-NLS-1$
+		}
+		corpusEncoding = corpusEncoding.toLowerCase();
+
+		Log.fine(TXMCoreMessages.bind(CQPSearchEngineCoreMessages.updating, corpus, corpusEncoding));
+		
+		String line = reader.readLine();
+		while (line != null) {
+			if (line.startsWith("##:: charset") || line.startsWith("charset")) { //$NON-NLS-1$ //$NON-NLS-2$
+				writer.write("charset = \"" + corpusEncoding + "\" # change if your corpus uses different charset : latin1, latin2 ... utf-8\n"); //$NON-NLS-1$ //$NON-NLS-2$
+			} else {
+				writer.write(line + "\n"); //$NON-NLS-1$
+			}
+			line = reader.readLine();
+		}
+		writer.close();
+		reader.close();
+		registryfile.delete();
+		temp.renameTo(registryfile);
+	}
+	
+	/**
+	 * Changes the language value.
+	 *
+	 * @param registryfile the registry file to patch
+	 * @param corpusLanguage the new language value
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 */
+	public static void patchLanguage(File registryfile, String corpusLanguage)throws IOException {
+		
+		String corpus = registryfile.getName();
+
+		// HOME INFO
+		File temp = File.createTempFile("temp", ".regsitry", registryfile.getParentFile()); //$NON-NLS-1$ //$NON-NLS-2$
+
+		String encoding = "UTF-8"; //$NON-NLS-1$
+		//if (OSDetector.isFamilyWindows()) encoding = "ISO-8859-1"; //$NON-NLS-1$
+		BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(registryfile), encoding));
+		OutputStreamWriter writer = new OutputStreamWriter(new FileOutputStream(temp), encoding);
+
+		corpusLanguage = corpusLanguage.toLowerCase();
+		
+		Log.fine(TXMCoreMessages.bind(CQPSearchEngineCoreMessages.updatingP0CorpusLanguageToP1, corpus, corpusLanguage));
+		
+		String line = reader.readLine();
+		while (line != null) {
+			if (line.startsWith("##:: language") || line.startsWith("language")) { //$NON-NLS-1$ //$NON-NLS-2$
+				writer.write("language = \"" + corpusLanguage + "\" # insert ISO code for language (de, en, fr, ...)\n"); //$NON-NLS-1$ //$NON-NLS-2$
+			} else {
+				writer.write(line + "\n"); //$NON-NLS-1$
+			}
+			line = reader.readLine();
+		}
+		writer.close();
+		reader.close();
+		registryfile.delete();
+		temp.renameTo(registryfile);
+	}
+
+	/**
+	 * Add the ALIGNED <corpus> line to a registry file.
+	 *
+	 * @param registryfile the registry file to patch
+	 * @param targetcorpus the aligned corpus
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 */
+	public static boolean patchAlignment(File registryfile, String targetcorpus) throws IOException {
+		
+		targetcorpus = targetcorpus.toLowerCase();
+		String corpus = registryfile.getName();
+
+		if (!new File(registryfile.getParent(), targetcorpus).exists()) {
+			Log.severe(TXMCoreMessages.bind(CQPSearchEngineCoreMessages.theTargetCorpusDoesntExist, new File(registryfile.getParent(), targetcorpus)));
+			return false;
+		}
+		if (!registryfile.exists()) {
+			Log.severe(TXMCoreMessages.bind(CQPSearchEngineCoreMessages.sourceRegistryDoesNotExistsColon, registryfile.getAbsolutePath()));
+			return false;
+		}
+		
+		boolean alignmentwritten = false;
+		// HOME INFO
+		File temp = File.createTempFile("temp", ".registry", registryfile.getParentFile()); //$NON-NLS-1$ //$NON-NLS-2$
+
+		String encoding = "UTF-8"; //$NON-NLS-1$
+		//if (OSDetector.isFamilyWindows()) encoding = "ISO-8859-1"; //$NON-NLS-1$
+		BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(registryfile), encoding));
+		OutputStreamWriter writer = new OutputStreamWriter(new FileOutputStream(temp), encoding);
+
+		Log.fine(TXMCoreMessages.bind(CQPSearchEngineCoreMessages.addingAlignmentAttributeToCorpusP0RegistryColonP1, corpus, targetcorpus));
+		
+		String line = reader.readLine();
+		while (line != null) {
+			if (line.startsWith("ALIGNED " + targetcorpus)) { //$NON-NLS-1$
+				alignmentwritten = true;
+				writer.write(line + "\n"); //$NON-NLS-1$
+			}
+			else if (line.startsWith("# Yours sincerely, the Encode tool.")) { //$NON-NLS-1$
+				if (!alignmentwritten) {
+					writer.write("ALIGNED " + targetcorpus + "\n"); //$NON-NLS-1$ //$NON-NLS-2$
+					alignmentwritten = true;
+				}
+				writer.write("# Yours sincerely, the Encode tool."); //$NON-NLS-1$
+			}
+			else {
+				writer.write(line + "\n"); //$NON-NLS-1$
+			}
+			line = reader.readLine();
+		}
+
+		writer.close();
+		reader.close();
+		return registryfile.delete() && temp.renameTo(registryfile);
+	}
+	
+	/**
+	 * Add the ALIGNED <corpus> line to a registry file.
+	 *
+	 * @param registryfile the registry file to patch
+	 * @param oldname the oldname
+	 * @param newname the newname
+	 * @return true, if successful
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 */
+	public static boolean patchAttribute(File registryfile, String oldname, String newname) throws IOException {
+		
+		boolean found = false;
+		String datapath = ""; //$NON-NLS-1$
+		
+		if (!registryfile.exists()) {
+			Log.fine(CQPSearchEngineCoreMessages.cantFindRegistryFile);
+			return false;
+		}
+
+		// HOME INFO
+		File temp = File.createTempFile("temp", ".regsitry", registryfile.getParentFile()); //$NON-NLS-1$ //$NON-NLS-2$
+
+		String encoding = IOUtils.UTF8;
+		//if (OSDetector.isFamilyWindows()) encoding = "ISO-8859-1"; //$NON-NLS-1$
+		BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(registryfile), encoding));
+		OutputStreamWriter writer = new OutputStreamWriter(new FileOutputStream(temp), encoding);
+
+		String line = reader.readLine();
+		while (line != null) {
+			if (line.startsWith("ATTRIBUTE "+oldname)) { //$NON-NLS-1$
+				writer.write("ATTRIBUTE "+newname+"\n"); //$NON-NLS-1$ //$NON-NLS-2$
+				found = true;
+			}
+			else {
+				if (line.startsWith("HOME")) { //$NON-NLS-1$
+					datapath = line.substring(5);
+				}
+				writer.write(line + "\n"); //$NON-NLS-1$
+			}
+			line = reader.readLine();
+		}
+		
+		if (found && datapath.length() > 0) {
+			System.out.println("rename "+oldname+".* files to "+newname+".*"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+			File datadir = new File(datapath);
+			if (datadir.exists()) {
+				for (File f : datadir.listFiles(IOUtils.HIDDENFILE_FILTER))
+					if (f.getName().startsWith(oldname+".")) //$NON-NLS-1$
+						f.renameTo(new File(f.getParent(), f.getName().replace(oldname+".", newname+"."))); //$NON-NLS-1$ //$NON-NLS-2$
+			}
+			else {
+				System.out.println(TXMCoreMessages.bind(CQPSearchEngineCoreMessages.dataDirectory, datadir));
+				writer.close();
+				reader.close();
+				return false;
+			}
+		}
+		else {
+			Log.severe(CQPSearchEngineCoreMessages.couldNotPatchTheRegistryFile);
+			
+			if(!found || !(datapath.length() > 0)) {
+				Log.severe(TXMCoreMessages.bind(CQPSearchEngineCoreMessages.couldNotBeFoundInRegistryFile, oldname, registryfile));
+			}
+			writer.close();
+			reader.close();
+			return false;
+		}
+		
+
+		writer.close();
+		reader.close();
+		registryfile.delete();
+		temp.renameTo(registryfile);
+		return true;
+	}
+
+	/**
+	 * The main method.
+	 *
+	 * @param args the arguments
+	 */
+	public static void main(String[] args) {
+		try {
+			/*
+		PatchCwbRegistry.patchEncoding(new File(
+									"~/TXM/corpora/tmxtest/registry/tmxen"), "utf-8"); //$NON-NLS-1$ //$NON-NLS-2$
+			PatchCwbRegistry.patchLanguage(new File(
+					"~/TXM/corpora/tmxtest/registry/tmxen"), "en"); //$NON-NLS-1$ //$NON-NLS-2$
+			PatchCwbRegistry.patchAlignment(new File(
+									"~/TXM/corpora/tmxtest/registry/tmxen"), "TMXFR"); //$NON-NLS-1$ //$NON-NLS-2$
+			*/
+			File registry = new File("/home/mdecorde/TXM/corpora/VOEUX/registry/voeux"); //$NON-NLS-1$
+			File data = new File("/home/mdecorde/TXM/corpora/VOEUX/data/VOEUX"); //$NON-NLS-1$
+			PatchCwbRegistry.patch(registry, data);
+//			PatchCwbRegistry.patchAttribute(registry, "word", "form"); //$NON-NLS-1$ //$NON-NLS-2$
+//			try {
+//				new CwbMakeAll().run("/usr/lib/TXM/cwb/bin/cwb-makeall", "lasla", registry.getAbsolutePath()); //$NON-NLS-1$ //$NON-NLS-2$
+//			} catch (Exception e) {
+//				// TODO Auto-generated catch block
+//				org.txm.utils.logger.Log.printStackTrace(e);
+//			}
+		} catch (IOException e) {
+			org.txm.utils.logger.Log.printStackTrace(e);
+		}
+	}
+}
\ No newline at end of file

Property changes on: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/importer/cwb/PatchCwbRegistry.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/importer/cwb/ReadRegistryFile.java
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/importer/cwb/ReadRegistryFile.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/importer/cwb/ReadRegistryFile.java	(revision 3659)
@@ -0,0 +1,229 @@
+package org.txm.importer.cwb;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+
+import org.txm.utils.io.IOUtils;
+import org.txm.utils.logger.Log;
+
+/**
+ * Read a registry file a retrive the declared p attributes and s attributes informations.
+ * 
+ * Call constructor then use : getPattributes and getSattributes for cwb-encode
+ * 
+ * or use getSattributesMap, getSattributeProfs and getAnatypes() to get the declared attributes
+ * 
+ * @author mdecorde
+ *
+ */
+public class ReadRegistryFile {
+	
+	File registryFile, dataDirectory;
+	
+	String id;
+	
+	ArrayList<String> pAttributes;
+	
+	ArrayList<String> sAttributes;
+	
+	HashMap<String, HashSet<String>> sattrs;
+	
+	HashMap<String, Integer> sattrsProfs;
+	
+	public ReadRegistryFile(File registryFile) {
+		this.registryFile = registryFile;
+		read();
+	}
+	
+	/*
+	 * reload the informations
+	 */
+	public void read() {
+		pAttributes = new ArrayList<>();
+		sAttributes = new ArrayList<>();
+		sattrs = new HashMap<>();
+		sattrsProfs = new HashMap<>();
+		
+		for (String line : IOUtils.getLines(registryFile, System.getProperty("file.encoding"))) {
+			line = line.trim(); // remove first tab
+			
+			if (line.startsWith("HOME ")) {
+				line = line.substring(5); // remove 'ATTRIBUTE '
+				if (line.startsWith("\"") && line.endsWith("\"")) {
+					line = line.substring(1, line.length() - 1);
+				}
+				dataDirectory = new File(line);
+			} else if (line.startsWith("ID ")) {
+				line = line.substring(3); // remove 'ATTRIBUTE '
+				id = line;
+			} else if (line.startsWith("ATTRIBUTE ")) {
+				line = line.substring(10); // remove 'ATTRIBUTE '
+				pAttributes.add(line);
+			}
+			else if (line.startsWith("STRUCTURE ")) {
+				line = line.substring(9); // remove 'STRUCTURE '
+				line = line.replaceAll("\\#.*", "");
+				line = line.trim();
+				String[] split = line.split("_", 2);
+				String sname = split[0];
+				// println split
+				if (split.length == 1) { // sattr decl
+					if (sname.matches(".+[1-9]") && sattrs.containsKey(sname.substring(0, sname.length() - 1))) { // recursive structure
+						sname = sname.substring(0, sname.length() - 1);
+						sattrsProfs.put(sname, sattrsProfs.get(sname) + 1);
+					}
+					else {
+						sattrs.put(sname, new HashSet<String>());
+						sattrsProfs.put(sname, 0);
+					}
+				}
+				else {
+					String satt = split[1];
+					if (satt.matches(".+[1-9]") && sattrs.get(sname).contains(satt.substring(0, satt.length() - 1))) {
+						// recursive attribute -> to be ignored
+					}
+					else {
+						sattrs.get(sname).add(satt);
+					}
+				}
+			}
+		}
+		
+		for (String sattr : sattrs.keySet()) {
+			String tmp = "" + sattr + ":" + sattrsProfs.get(sattr);
+			for (String attr : sattrs.get(sattr)) {
+				tmp += "+" + attr;
+			}
+			sAttributes.add(tmp);
+		}
+	}
+	
+	/**
+	 * 
+	 * @return the value of the ID field
+	 */
+	public String getID() {
+		return id;
+	}
+	
+	/**
+	 * 
+	 * @return the data directory pointed by the value of the HOME field
+	 */
+	public File getDataDirectory() {
+		return dataDirectory;
+	}
+	
+	/**
+	 * Test the CQP index files of each p-attribute and s-attribute properties
+	 * 
+	 * @param dataDirectory the directory where the binary files should be found
+	 * @return true if all CQP files are present
+	 */
+	public ArrayList<String> isCorpusBuildValid(File dataDirectory) {
+		if (pAttributes == null) {
+			read();
+		}
+		
+		ArrayList<String> errors = new ArrayList<>();
+		
+		// test p-attributes
+		String[] exts = { ".lexicon", ".corpus.cnt", ".lexicon.idx", ".lexicon.srt" };
+		for (String p : pAttributes) {
+			for (String ext : exts) {
+				File f = new File(dataDirectory, p + ext);
+				if (!f.exists()) {
+					// System.out.println("MISSING: " + f.exists() + " " + f.getAbsolutePath());
+					errors.add(f.getName());
+				}
+			}
+		}
+		
+		// test p-attributes with optional compression files
+		String[] extsCompressed = { ".corpus	.hcd	.huf	.huf.syn", ".corpus.rdx	.crc	.crx", ".corpus.rev	.crc	.crx"};
+		for (String p : pAttributes) {
+			for (String extsTabulated : extsCompressed) {
+				String[] exts2 = extsTabulated.split("\t");
+				String ext = exts2[0];
+				File f = new File(dataDirectory, p + ext);
+				if (!f.exists()) {
+					// System.out.println("MISSING: " + f.exists() + " " + f.getAbsolutePath());
+					for (int i = 1 ; i < exts2.length ; i++) {
+						f = new File(dataDirectory, p + exts2[i]);
+						if (!f.exists()) {
+							errors.add(f.getName());
+						}
+					}
+				}
+			}
+		}
+		
+		String[] sexts = { ".rng" };
+		String[] spexts = { ".avs", ".avx", ".rng" };
+		for (String s : sattrs.keySet()) {
+			for (String ext : sexts) {
+				File f = new File(dataDirectory, s + ext);
+				if (!f.exists()) {
+					// System.out.println("MISSING: " + f.exists() + " " + f.getAbsolutePath());
+					errors.add(f.getName());
+				}
+			}
+			
+			for (String sp : sattrs.get(s)) {
+				for (String ext : spexts) {
+					File f = new File(dataDirectory, s + "_" + sp + ext);
+					if (!f.exists()) {
+						// System.out.println("MISSING: " + f.exists() + " " + f.getAbsolutePath());
+						errors.add(f.getName());
+					}
+				}
+			}
+		}
+		return errors;
+	}
+	
+	/**
+	 * 
+	 * @return the cwb-encode arguments for p attributes
+	 */
+	public ArrayList<String> getPAttributes() {
+		return pAttributes;
+	}
+	
+	/**
+	 * 
+	 * @return the cwb-encode arguments for s attributes
+	 */
+	public ArrayList<String> getSAttributes() {
+		return sAttributes;
+	}
+	
+	/**
+	 * 
+	 * @return the attributes of the structures
+	 */
+	public HashMap<String, HashSet<String>> getSAttributesMap() {
+		return sattrs;
+	}
+	
+	/**
+	 * 
+	 * @return the recursive level of the structures
+	 */
+	public HashMap<String, Integer> getSAttributesProfs() {
+		return sattrsProfs;
+	}
+	
+	public static void main(String[] args) {
+		File registry = new File(System.getProperty("user.home"), "runtime-rcpapplication.product/corpora/VOEUX/registry/voeux");
+		File data = new File(System.getProperty("user.home"), "runtime-rcpapplication.product/corpora/VOEUX/data/VOEUX");
+		ReadRegistryFile reader = new ReadRegistryFile(registry);
+		System.out.println("pAttributes: " + reader.getPAttributes());
+		System.out.println("sAttributes Map: " + reader.getSAttributesMap());
+		System.out.println("sAttributes: " + reader.getSAttributes());
+		
+		System.out.println("Validation: " + reader.isCorpusBuildValid(data));
+	}
+}
Index: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/importer/cwb/BuildCwbEncodeArgsFromTEITXM.java
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/importer/cwb/BuildCwbEncodeArgsFromTEITXM.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/importer/cwb/BuildCwbEncodeArgsFromTEITXM.java	(revision 3659)
@@ -0,0 +1,206 @@
+// Copyright © 2010-2020 ENS de Lyon., University of Franche-Comté
+// 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: 2013-08-29 14:23:55 +0200 (jeu., 29 août 2013) $
+// $LastChangedRevision: 2519 $
+// $LastChangedBy: nilskredens $ 
+//
+package org.txm.importer.cwb;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.LinkedList;
+
+import javax.xml.stream.FactoryConfigurationError;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+// TODO: Auto-generated Javadoc
+/**
+ * build the sAttributes and pAttributs List from an xmlfile pAttributes
+ * (attributes of tei:w tags) and the sAttributes (attributes + max inclusion of
+ * tags).
+ *
+ * @author mdecorde
+ */
+public class BuildCwbEncodeArgsFromTEITXM {
+	
+	/** The stack. */
+	LinkedList<String> stack = new LinkedList<String>();
+	
+	/** The tagcount. */
+	HashMap<String, Integer> tagcount = new HashMap<String, Integer>();
+	
+	/** The tagmax. */
+	HashMap<String, Integer> tagmax = new HashMap<String, Integer>();
+	
+	/** The tagattrs. */
+	HashMap<String, HashSet<String>> tagattrs = new HashMap<String, HashSet<String>>();
+	
+	/** The wattrs. */
+	HashSet<String> wattrs = new HashSet<String>();
+
+	/**
+	 * process !!!.
+	 *
+	 * @param xmlfile the xmlfile
+	 * @throws XMLStreamException the xML stream exception
+	 * @throws FactoryConfigurationError the factory configuration error
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 */
+	public void process(File xmlfile) throws XMLStreamException,
+			FactoryConfigurationError, IOException {
+		URL u = xmlfile.toURI().toURL();
+		InputStream in = u.openStream();
+		XMLInputFactory factory = XMLInputFactory.newInstance();
+		XMLStreamReader parser = factory.createXMLStreamReader(in);
+
+		for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser
+				.next()) {
+			switch (event) {
+			case XMLStreamConstants.START_ELEMENT:
+				stack.push(parser.getLocalName());
+
+				if (!tagattrs.containsKey(parser.getLocalName()))// initialize
+																	// HashMaps
+				{
+					tagattrs.put(parser.getLocalName(), new HashSet<String>());
+					tagcount.put(parser.getLocalName(), 0);
+					tagmax.put(parser.getLocalName(), 0);
+				}
+
+				if (parser.getLocalName().matches("w"))//get w attrs //$NON-NLS-1$
+					for (int i = 0; i < parser.getAttributeCount(); i++) {
+						String att = parser.getAttributeLocalName(i);
+						wattrs.add(att);
+					}
+
+				if (parser.getLocalName().matches("interp"))//get w attrs //$NON-NLS-1$
+				{
+					String att = parser.getAttributeValue(null, "type"); //$NON-NLS-1$
+					wattrs.add(att.substring(1));
+				}
+				for (int i = 0; i < parser.getAttributeCount(); i++)// get tags
+																	// attrs
+				{
+					String att = parser.getAttributeLocalName(i);
+					tagattrs.get(parser.getLocalName()).add(att);
+				}
+
+				int count = tagcount.get(parser.getLocalName());
+				count++;
+				tagcount.put(parser.getLocalName(), count);// increment the
+															// recursion counter
+															// of the tag
+				int max = tagmax.get(parser.getLocalName());
+				if (max < count)
+					tagmax.put(parser.getLocalName(), count);// update max
+																// recursion of
+																// the tag
+				break;
+			case XMLStreamConstants.END_ELEMENT:
+				stack.pop();
+
+				count = tagcount.get(parser.getLocalName());
+				count--;
+				tagcount.put(parser.getLocalName(), count);// decrement the
+															// recursion counter
+															// of the tag
+				break;
+			case XMLStreamConstants.CHARACTERS:
+
+				break;
+			case XMLStreamConstants.CDATA:
+
+				break;
+			} // end switch
+		} // end while
+		tagattrs.remove("w");//we dont need to report the w tags :) //$NON-NLS-1$
+		tagmax.remove("w"); //$NON-NLS-1$
+		parser.close();
+		in.close();
+	}
+
+	/**
+	 * Gets the p attributes.
+	 *
+	 * @return the p attributes
+	 */
+	public Collection<String> getPAttributes() {
+		return wattrs;
+	}
+
+	/**
+	 * Gets the s attributes.
+	 *
+	 * @return the s attributes
+	 */
+	public Collection<String> getSAttributes() {
+		ArrayList<String> rez = new ArrayList<String>();
+
+		for (String tag : tagattrs.keySet()) {
+			String s = tag;
+			if (tagmax.get(tag) > 1)
+				s += "" + tagmax.get(tag); //$NON-NLS-1$
+			if (tagattrs.get(tag).size() > 0)
+				s += ":"; //$NON-NLS-1$
+			for (String attr : tagattrs.get(tag))
+				s += "+" + attr; //$NON-NLS-1$
+			rez.add(s);
+		}
+		return rez;
+	}
+
+	/**
+	 * The main method.
+	 *
+	 * @param args the arguments
+	 */
+	public static void main(String[] args) {
+		try {
+			BuildCwbEncodeArgsFromTEITXM argsgetter = new BuildCwbEncodeArgsFromTEITXM();
+			argsgetter.process(new File(
+					"~/xml/rgaqcj/anainline/roland-p5.xml")); //$NON-NLS-1$
+
+			System.out.println("pAttributes : " + argsgetter.getPAttributes()); //$NON-NLS-1$
+			System.out.println("sAttributes : " + argsgetter.getSAttributes()); //$NON-NLS-1$
+		} catch (XMLStreamException e) {
+			// TODO Auto-generated catch block
+			org.txm.utils.logger.Log.printStackTrace(e);
+		} catch (FactoryConfigurationError e) {
+			// TODO Auto-generated catch block
+			org.txm.utils.logger.Log.printStackTrace(e);
+		} catch (IOException e) {
+			// TODO Auto-generated catch block
+			org.txm.utils.logger.Log.printStackTrace(e);
+		}
+	}
+}
\ No newline at end of file

Property changes on: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/importer/cwb/BuildCwbEncodeArgsFromTEITXM.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/importer/cwb/BuildCwbEncodeArgs.java
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/importer/cwb/BuildCwbEncodeArgs.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/importer/cwb/BuildCwbEncodeArgs.java	(revision 3659)
@@ -0,0 +1,242 @@
+// Copyright © 2010-2020 ENS de Lyon., University of Franche-Comté
+// 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: 2013-08-29 14:23:55 +0200 (jeu., 29 août 2013) $
+// $LastChangedRevision: 2519 $
+// $LastChangedBy: nilskredens $ 
+//
+package org.txm.importer.cwb;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.LinkedList;
+
+import javax.xml.stream.FactoryConfigurationError;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+import org.txm.core.messages.TXMCoreMessages;
+import org.txm.searchengine.cqp.core.messages.CQPSearchEngineCoreMessages;
+
+// TODO: Auto-generated Javadoc
+/**
+ * build the sAttributes and pAttributs List from an xmlfile pAttributes
+ * (attributes of tei:w tags) and the sAttributes (attributes + max inclusion of
+ * tags).
+ *
+ * @author mdecorde
+ */
+public class BuildCwbEncodeArgs {
+
+	/** The stack. */
+	LinkedList<String> stack = new LinkedList<String>();
+
+	/** The tagcount. */
+	HashMap<String, Integer> tagcount = new HashMap<String, Integer>();
+
+	/** The tagmax. */
+	HashMap<String, Integer> tagmax = new HashMap<String, Integer>();
+
+	/** The tagattrs. */
+	HashMap<String, HashSet<String>> tagattrs = new HashMap<String, HashSet<String>>();
+
+	/** The wattrs. */
+	HashSet<String> wattrs = new HashSet<String>();
+
+	private String scanElem;
+
+	/**
+	 * process !!!.
+	 *
+	 * @param xmlfile the xmlfile
+	 * @param wordstag the wordstag
+	 * @return true, if successful
+	 * @throws XMLStreamException the xML stream exception
+	 * @throws FactoryConfigurationError the factory configuration error
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 */
+	public boolean process(File xmlfile, ArrayList<String> wordstag)
+			throws XMLStreamException, FactoryConfigurationError, IOException {
+		if (xmlfile == null || !xmlfile.exists()) {
+			System.out.println(TXMCoreMessages.bind(CQPSearchEngineCoreMessages.theFileP0CannotBeFound, xmlfile));
+			return false;
+		}
+		URL u = xmlfile.toURI().toURL();
+		InputStream in = u.openStream();
+		XMLInputFactory factory = XMLInputFactory.newInstance();
+		XMLStreamReader parser = factory.createXMLStreamReader(in);
+
+		gotoStartElement(parser);
+
+		for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser
+				.next()) {
+			switch (event) {
+			case XMLStreamConstants.START_ELEMENT:
+				stack.push(parser.getLocalName());
+
+				if (!tagattrs.containsKey(parser.getLocalName()))// initialize
+					// HashMaps
+				{
+					tagattrs.put(parser.getLocalName(), new HashSet<String>());
+					tagcount.put(parser.getLocalName(), 0);
+					tagmax.put(parser.getLocalName(), 0);
+				}
+
+				if (wordstag.contains(parser.getLocalName()))// get w attrs
+					for (int i = 0; i < parser.getAttributeCount(); i++) {
+						String att = parser.getAttributeLocalName(i);
+						wattrs.add(att);
+					}
+
+				for (int i = 0; i < parser.getAttributeCount(); i++)// get tags
+					// attrs
+				{
+					String att = parser.getAttributeLocalName(i);
+					tagattrs.get(parser.getLocalName()).add(att);
+				}
+
+				int count = tagcount.get(parser.getLocalName());
+				count++;
+				tagcount.put(parser.getLocalName(), count);// increment the
+				// recursion counter
+				// of the tag
+				int max = tagmax.get(parser.getLocalName());
+				if (max < count)
+					tagmax.put(parser.getLocalName(), count);// update max
+				// recursion of
+				// the tag
+				break;
+			case XMLStreamConstants.END_ELEMENT:
+				if (stack.size() > 0) {
+					stack.pop();
+					count = tagcount.get(parser.getLocalName());
+					count--;
+					tagcount.put(parser.getLocalName(), count);// decrement the
+					// recursion counter
+					// of the tag
+				}
+
+				break;
+			case XMLStreamConstants.CHARACTERS:
+
+				break;
+			case XMLStreamConstants.CDATA:
+
+				break;
+			} // end switch
+		} // end while
+		tagattrs.remove("w");//we dont need to report the w tags :) //$NON-NLS-1$
+		tagmax.remove("w"); //$NON-NLS-1$
+		parser.close();
+		in.close();
+		return true;
+	}
+
+	public void gotoStartElement(XMLStreamReader parser) throws XMLStreamException
+	{
+		if (this.scanElem == null) return;
+		for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser
+				.next()) {
+			switch (event) {
+			case XMLStreamConstants.START_ELEMENT:
+				if (parser.getLocalName() == scanElem)
+					return;
+			}
+		}
+	}
+
+	public void setElementToScan(String elem)
+	{
+		this.scanElem = elem;
+	}
+
+	/**
+	 * Gets the p attributes.
+	 *
+	 * @return the p attributes
+	 */
+	public Collection<String> getPAttributes() {
+		return wattrs;
+	}
+
+	/**
+	 * Gets the s attributes.
+	 *
+	 * @return the s attributes
+	 */
+	public Collection<String> getSAttributes() {
+		ArrayList<String> rez = new ArrayList<String>();
+
+		for (String tag : tagattrs.keySet()) {
+			String s = tag.toLowerCase();
+			s += ":"; //$NON-NLS-1$
+
+			if (tagmax.get(tag) >= 0)
+				s += "" + (tagmax.get(tag) - 1); //$NON-NLS-1$
+
+			for (String attr : tagattrs.get(tag))
+				s += "+" + attr.toLowerCase(); //$NON-NLS-1$
+					rez.add(s);
+		}
+		return rez;
+	}
+
+	/**
+	 * The main method.
+	 *
+	 * @param args the arguments
+	 */
+	public static void main(String[] args) {
+		try {
+			BuildCwbEncodeArgs argsgetter = new BuildCwbEncodeArgs();
+			ArrayList<String> wordstag = new ArrayList<String>();
+			String[] awords = { "M", "PC", "MC" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+
+			for (String s : awords) {
+				wordstag.add(s);
+			}
+			argsgetter.process(new File(
+					"~/xml/fleurs/src/fleursduMal-2.xml"), wordstag); //$NON-NLS-1$
+
+			System.out.println("pAttributes : " + argsgetter.getPAttributes()); //$NON-NLS-1$
+			System.out.println("sAttributes : " + argsgetter.getSAttributes()); //$NON-NLS-1$
+		} catch (XMLStreamException e) {
+			// TODO Auto-generated catch block
+			org.txm.utils.logger.Log.printStackTrace(e);
+		} catch (FactoryConfigurationError e) {
+			// TODO Auto-generated catch block
+			org.txm.utils.logger.Log.printStackTrace(e);
+		} catch (IOException e) {
+			// TODO Auto-generated catch block
+			org.txm.utils.logger.Log.printStackTrace(e);
+		}
+	}
+}
\ No newline at end of file

Property changes on: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/importer/cwb/BuildCwbEncodeArgs.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/importer/cwb/CwbAlign.java
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/importer/cwb/CwbAlign.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/importer/cwb/CwbAlign.java	(revision 3659)
@@ -0,0 +1,535 @@
+// Copyright © 2010-2020 ENS de Lyon., University of Franche-Comté
+// 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: 2017-01-24 18:11:42 +0100 (Tue, 24 Jan 2017) $
+// $LastChangedRevision: 3400 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.importer.cwb;
+
+import java.util.Date;
+import java.util.Locale;
+import java.text.DateFormat;
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.util.ArrayList;
+
+import org.txm.core.preferences.TXMPreferences;
+import org.txm.libs.cqp.CQPLibPreferences;
+import org.txm.utils.logger.Log;
+
+// TODO: Auto-generated Javadoc
+/**
+ * Align a corpus with an other Generated with ProcessBuilderBuilder 28/07/2010.
+ */
+public class CwbAlign {
+	
+	/** The binpath. */
+	String binpath = ""; //$NON-NLS-1$
+
+	/**
+	 * Instantiates a new cwb align using the executable path set in preferences
+	 *
+	 * @param binpath the binpath
+	 */
+	public CwbAlign() {
+		this.binpath = CQPLibPreferences.getInstance().getString(CQPLibPreferences.CQI_SERVER_PATH_TO_CQPLIB);
+	}
+	
+	
+	/**
+	 * 
+	 * @return if the cwb-makeall executable file set in preferences is available 
+	 */
+	public static boolean isExecutableAvailable() {
+		return CwbProcess.isExecutableAvailable("cwb-align"+(System.getProperty("os.name").toLowerCase().contains("windows")?".exe":""));
+	}
+	
+	/**
+	 * Instantiates a new cwb align.
+	 *
+	 * @param binpath the binpath
+	 */
+	public CwbAlign(String binpath) {
+		this.binpath = binpath;
+	}
+
+	/** The version. */
+	String version = "3.2"; //$NON-NLS-1$
+	
+	/** The desc. */
+	String desc = "Align a corpus with an other"; //$NON-NLS-1$
+	
+	/** The debug. */
+	boolean debug = false;
+
+	/**
+	 * Debug.
+	 *
+	 * @param b the b
+	 */
+	public void debug(boolean b) {
+		debug = b;
+	};
+
+	// use positional attribute [word]
+	/** The is p. */
+	private Boolean isP = false;
+	
+	/** The P. */
+	private String P;
+
+	/**
+	 * Sets the p.
+	 *
+	 * @param arg the new p
+	 */
+	public void setP(String arg) {
+		this.isP = true;
+		this.P = arg;
+	}
+
+	/**
+	 * Unset p.
+	 */
+	public void unsetP() {
+		this.isP = false;
+	}
+
+	// ordered prealignment
+	/** The is s. */
+	private Boolean isS = false;
+	
+	/** The S. */
+	private String S;
+
+	/**
+	 * Sets the s.
+	 *
+	 * @param arg the new s
+	 */
+	public void setS(String arg) {
+		this.isS = true;
+		this.S = arg;
+	}
+
+	/**
+	 * Unset s.
+	 */
+	public void unsetS() {
+		this.isS = false;
+	}
+
+	// ordered prealignment with annotations, ex : seg_id
+	/** The is v. */
+	private Boolean isV = false;
+	
+	/** The V. */
+	private String V;
+
+	/**
+	 * Sets the v.
+	 *
+	 * @param arg the new v
+	 */
+	public void setV(String arg) {
+		this.isV = true;
+		this.V = arg;
+	}
+
+	/**
+	 * Unset v.
+	 */
+	public void unsetV() {
+		this.isV = false;
+	}
+
+	// outfile file [out.align]
+	/** The iso. */
+	private Boolean iso = false;
+	
+	/** The o. */
+	private String o;
+
+	/**
+	 * Sets the o.
+	 *
+	 * @param arg the new o
+	 */
+	public void seto(String arg) {
+		this.iso = true;
+		this.o = arg;
+	}
+
+	/**
+	 * Unseto.
+	 */
+	public void unseto() {
+		this.iso = false;
+	}
+
+	// set 2:2 alignment split factor [1.2]
+	/** The iss. */
+	private Boolean iss = false;
+	
+	/** The s. */
+	private String s;
+
+	/**
+	 * Sets the s.
+	 *
+	 * @param arg the new s
+	 */
+	public void sets(String arg) {
+		this.iss = true;
+		this.s = arg;
+	}
+
+	/**
+	 * Unsets.
+	 */
+	public void unsets() {
+		this.iss = false;
+	}
+
+	// use best path search beam of width [50]
+	/** The isw. */
+	private Boolean isw = false;
+	
+	/** The w. */
+	private String w;
+
+	/**
+	 * Sets the w.
+	 *
+	 * @param arg the new w
+	 */
+	public void setw(String arg) {
+		this.isw = true;
+		this.w = arg;
+	}
+
+	/**
+	 * Unsetw.
+	 */
+	public void unsetw() {
+		this.isw = false;
+	}
+
+	// use registry directory
+	/** The isr. */
+	private Boolean isr = false;
+	
+	/** The r. */
+	private String r;
+
+	/**
+	 * Sets the r.
+	 *
+	 * @param arg the new r
+	 */
+	public void setr(String arg) {
+		this.isr = true;
+		this.r = arg;
+	}
+
+	/**
+	 * Unsetr.
+	 */
+	public void unsetr() {
+		this.isr = false;
+	}
+
+	// verbose mode
+	/** The isv. */
+	private Boolean isv = false;
+
+	/**
+	 * Setv.
+	 */
+	public void setv() {
+		this.isv = true;
+	}
+
+	/**
+	 * Unsetv.
+	 */
+	public void unsetv() {
+		this.isv = false;
+	}
+
+	// show help
+	/** The ish. */
+	private Boolean ish = false;
+
+	/**
+	 * Seth.
+	 */
+	public void seth() {
+		this.ish = true;
+	}
+
+	/**
+	 * Unseth.
+	 */
+	public void unseth() {
+		this.ish = false;
+	}
+
+	// create align file
+	/**
+	 * Cwbalign.
+	 *
+	 * @param source the source
+	 * @param target the target
+	 * @param sattrib the sattrib
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 */
+	public void cwbalign(String source, String target, String sattrib)
+			throws IOException
+	// arg : source corpus identif ier
+	// arg : target corpus identif ier
+	// arg : the aligned structure, ex : seg
+	{
+		ArrayList<String> args = new ArrayList<String>();
+		args.add(binpath + "/cwb-align"); //$NON-NLS-1$
+		if (isP) {
+			args.add("-P"); //$NON-NLS-1$
+			args.add("" + P); //$NON-NLS-1$
+		}
+		if (isS) {
+			args.add("-S"); //$NON-NLS-1$
+			args.add("" + S); //$NON-NLS-1$
+		}
+		if (isV) {
+			args.add("-V"); //$NON-NLS-1$
+			args.add("" + V);} //$NON-NLS-1$
+		if (iso) {
+			args.add("-o"); //$NON-NLS-1$
+			args.add("" + o); //$NON-NLS-1$
+		}
+		if (iss) {
+			args.add("-s"); //$NON-NLS-1$
+			args.add("" + s); //$NON-NLS-1$
+		}
+		if (isw) {
+			args.add("-w"); //$NON-NLS-1$
+			args.add("" + w); //$NON-NLS-1$
+		}
+		if (isr) {
+			args.add("-r"); //$NON-NLS-1$
+			args.add("" + r); //$NON-NLS-1$
+		}
+		if (isv)
+			args.add("-v"); //$NON-NLS-1$
+		if (ish)
+			args.add("-h"); //$NON-NLS-1$
+		args.add("" + source); //$NON-NLS-1$
+		args.add("" + target); //$NON-NLS-1$
+		args.add("" + sattrib); //$NON-NLS-1$
+
+		ProcessBuilder pb = new ProcessBuilder(args);
+		pb.redirectErrorStream(true);
+		Process process = null;
+		try {
+			process = pb.start();
+		} catch (IOException e) {
+			System.err.println(e);
+		}
+		InputStream is = process.getInputStream();
+		InputStreamReader isr = new InputStreamReader(is);
+		BufferedReader br = new BufferedReader(isr);
+		String line;
+		while ((line = br.readLine()) != null) {
+			System.out.println(line);
+		}
+		int e = 0;
+		try {
+			e = process.waitFor();
+		} catch (Exception err) {
+		}
+		if (e != 0) {
+			System.err
+					.println("Process exited abnormally with code " + e + " at " + DateFormat.getDateInstance(DateFormat.FULL, Locale.UK).format(new Date())); //$NON-NLS-1$ //$NON-NLS-2$
+			for (int c = 0; c < args.size(); c++)
+				System.out.print("" + args.get(c) + " "); //$NON-NLS-1$ //$NON-NLS-2$
+			System.out.println();
+		}
+	}
+
+	// write data file to directory
+	/** The isd. */
+	private Boolean isd = false;
+	
+	/** The d. */
+	private String d;
+
+	/**
+	 * Sets the d.
+	 *
+	 * @param arg the new d
+	 */
+	public void setd(String arg) {
+		this.isd = true;
+		this.d = arg;
+	}
+
+	/**
+	 * Unsetd.
+	 */
+	public void unsetd() {
+		this.isd = false;
+	}
+
+	// write data files to corpus data directory
+	/** The is d. */
+	private Boolean isD = false;
+
+	/**
+	 * Sets the d.
+	 */
+	public void setD() {
+		this.isD = true;
+	}
+
+	/**
+	 * Unset d.
+	 */
+	public void unsetD() {
+		this.isD = false;
+	}
+
+	// compatibility mode (creates .alg file)
+	/** The is c. */
+	private Boolean isC = false;
+
+	/**
+	 * Sets the c.
+	 */
+	public void setC() {
+		this.isC = true;
+	}
+
+	/**
+	 * Unset c.
+	 */
+	public void unsetC() {
+		this.isC = false;
+	}
+
+	// create corpus align data
+	/**
+	 * Cwbalignencode.
+	 *
+	 * @param alignmentfile the alignmentfile
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 */
+	public void cwbalignencode(String alignmentfile) throws IOException
+	// arg : the align file created by cwb-align
+	{
+		ArrayList<String> args = new ArrayList<String>();
+		args.add(new File(binpath, "cwb-align-encode").getAbsolutePath()); //$NON-NLS-1$
+		if (isd) {
+			args.add("-d"); //$NON-NLS-1$
+			args.add("" + d); //$NON-NLS-1$
+		}
+		if (isD)
+			args.add("-D"); //$NON-NLS-1$
+		if (isC)
+			args.add("-C"); //$NON-NLS-1$
+		if (isr) {
+			args.add("-r"); //$NON-NLS-1$
+			args.add("" + r); //$NON-NLS-1$
+		}
+		if (isv)
+			args.add("-v"); //$NON-NLS-1$
+		if (ish)
+			args.add("-h"); //$NON-NLS-1$
+		args.add("" + alignmentfile); //$NON-NLS-1$
+
+		ProcessBuilder pb = new ProcessBuilder(args);
+		pb.redirectErrorStream(true);
+		Process process = null;
+		try {
+			process = pb.start();
+		} catch (IOException e) {
+			System.err.println(e);
+		}
+		InputStream is = process.getInputStream();
+		InputStreamReader isr = new InputStreamReader(is);
+		BufferedReader br = new BufferedReader(isr);
+		String line;
+		while ((line = br.readLine()) != null) {
+			System.out.println(line);
+		}
+		int e = 0;
+		try {
+			e = process.waitFor();
+		} catch (Exception err) {
+		}
+		if (e != 0) {
+			System.err
+					.println("Process exited abnormally with code " + e + " at " + DateFormat.getDateInstance(DateFormat.FULL, Locale.UK).format(new Date())); //$NON-NLS-1$ //$NON-NLS-2$
+			for (int c = 0; c < args.size(); c++)
+				System.out.print("" + args.get(c) + " "); //$NON-NLS-1$ //$NON-NLS-2$
+			System.out.println();
+		}
+	}
+
+	/**
+	 * The main method.
+	 *
+	 * @param args the arguments
+	 */
+	public static void main(String[] args) {
+		// ./cwb-align -V seg_id -r ~/TXM/corpora/tmxtest/registry/
+		// tmxen tmxfr seg
+		// ./cwb-align-encode -D -r ~/TXM/corpora/tmxtest/registry/
+		// -v out.align
+		CwbAlign tt = new CwbAlign("~/TXMinstall/cwb/bin/"); //$NON-NLS-1$
+		tt.setV("seg_id"); //$NON-NLS-1$
+		tt
+				.setr(new File("~/TXM/corpora/tmxtest/registry/").getAbsolutePath()); //$NON-NLS-1$
+		try {
+			tt.cwbalign("tmxen", "tmxfr", "seg"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+		} catch (IOException e) {
+			Log.severe("Error while calling cwb-align: "+e.getLocalizedMessage());
+			return;
+		}
+
+		tt = new CwbAlign("~/TXMinstall/cwb/bin/"); //$NON-NLS-1$
+		tt.setD();
+		tt.setv();
+		tt
+				.setr(new File("~/TXM/corpora/tmxtest/registry/").getAbsolutePath()); //$NON-NLS-1$
+		try {
+			tt.cwbalignencode("out.align"); //$NON-NLS-1$
+		} catch (IOException e) {
+			Log.severe("Error while calling cwb-align: "+e.getLocalizedMessage());
+			return;
+		}
+	}
+}
\ No newline at end of file

Property changes on: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/importer/cwb/CwbAlign.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.core/build.properties
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.core/build.properties	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.core/build.properties	(revision 3659)
@@ -0,0 +1,8 @@
+#Fri Jul 06 10:25:16 CEST 2018
+output..=bin/
+bin.includes = plugin.xml,\
+               META-INF/,\
+               .,\
+               OSGI-INF/
+source..=src/
+#qualifier=svn

Property changes on: TXM/trunk/bundles/org.txm.searchengine.cqp.core/build.properties
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.core/OSGI-INF/l10n/bundle.properties
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.core/OSGI-INF/l10n/bundle.properties	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.core/OSGI-INF/l10n/bundle.properties	(revision 3659)
@@ -0,0 +1,4 @@
+#TXM OSGI messages generated by the PluginMessagesManager class
+#Fri Jun 10 16:36:03 CEST 2022
+Bundle-Name=CQP
+Bundle-Vendor=Textometrie.org

Property changes on: TXM/trunk/bundles/org.txm.searchengine.cqp.core/OSGI-INF/l10n/bundle.properties
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.core/OSGI-INF/l10n/bundle_fr.properties
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.core/OSGI-INF/l10n/bundle_fr.properties	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.core/OSGI-INF/l10n/bundle_fr.properties	(revision 3659)
@@ -0,0 +1,4 @@
+#TXM OSGI messages generated by the PluginMessagesManager class
+#Fri Jun 10 16:36:03 CEST 2022
+Bundle-Name=CQP
+Bundle-Vendor=Textometrie.org

Property changes on: TXM/trunk/bundles/org.txm.searchengine.cqp.core/OSGI-INF/l10n/bundle_fr.properties
___________________________________________________________________
Added: svn:mime-type
   + text/plain


Property changes on: TXM/trunk/bundles/org.txm.searchengine.cqp.core
___________________________________________________________________
Added: svn:ignore
   + target


Index: TXM/trunk/bundles/org.txm.referencer.core/build.properties
===================================================================
--- TXM/trunk/bundles/org.txm.referencer.core/build.properties	(revision 0)
+++ TXM/trunk/bundles/org.txm.referencer.core/build.properties	(revision 3659)
@@ -0,0 +1,8 @@
+#Fri Jul 06 10:25:15 CEST 2018
+output..=bin/
+bin.includes = META-INF/,\
+               .,\
+               plugin.xml,\
+               OSGI-INF/
+source..=src/
+#qualifier=svn

Property changes on: TXM/trunk/bundles/org.txm.referencer.core/build.properties
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.referencer.core/OSGI-INF/l10n/bundle.properties
===================================================================
--- TXM/trunk/bundles/org.txm.referencer.core/OSGI-INF/l10n/bundle.properties	(revision 0)
+++ TXM/trunk/bundles/org.txm.referencer.core/OSGI-INF/l10n/bundle.properties	(revision 3659)
@@ -0,0 +1,3 @@
+#TXM OSGI messages generated by the PluginMessagesManager class
+#Fri Jun 10 16:36:03 CEST 2022
+Bundle-Name=Referencer

Property changes on: TXM/trunk/bundles/org.txm.referencer.core/OSGI-INF/l10n/bundle.properties
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.referencer.core/plugin.xml
===================================================================
--- TXM/trunk/bundles/org.txm.referencer.core/plugin.xml	(revision 0)
+++ TXM/trunk/bundles/org.txm.referencer.core/plugin.xml	(revision 3659)
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>  
+   <extension
+         point="org.eclipse.core.runtime.preferences">
+      <initializer
+            class="org.txm.referencer.core.preferences.ReferencerPreferences">
+      </initializer>
+   </extension>
+
+</plugin>

Property changes on: TXM/trunk/bundles/org.txm.referencer.core/plugin.xml
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.referencer.core/.settings/org.eclipse.core.resources.prefs
===================================================================
--- TXM/trunk/bundles/org.txm.referencer.core/.settings/org.eclipse.core.resources.prefs	(revision 0)
+++ TXM/trunk/bundles/org.txm.referencer.core/.settings/org.eclipse.core.resources.prefs	(revision 3659)
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+encoding//src/org/txm/referencer/core/messages/messages_fr.properties=UTF-8

Property changes on: TXM/trunk/bundles/org.txm.referencer.core/.settings/org.eclipse.core.resources.prefs
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.referencer.core/.classpath
===================================================================
--- TXM/trunk/bundles/org.txm.referencer.core/.classpath	(revision 0)
+++ TXM/trunk/bundles/org.txm.referencer.core/.classpath	(revision 3659)
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="con"
+		path="org.eclipse.jdt.launching.JRE_CONTAINER" />
+	<classpathentry kind="con"
+		path="org.eclipse.pde.core.requiredPlugins">
+		<accessrules>
+			<accessrule kind="accessible" pattern="**" />
+		</accessrules>
+	</classpathentry>
+	<classpathentry kind="src" path="src" />
+	<classpathentry kind="output" path="bin" />
+</classpath>
\ No newline at end of file

Property changes on: TXM/trunk/bundles/org.txm.referencer.core/.classpath
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.referencer.core/META-INF/MANIFEST.MF
===================================================================
--- TXM/trunk/bundles/org.txm.referencer.core/META-INF/MANIFEST.MF	(revision 0)
+++ TXM/trunk/bundles/org.txm.referencer.core/META-INF/MANIFEST.MF	(revision 3659)
@@ -0,0 +1,15 @@
+Manifest-Version: 1.0
+Export-Package: org.txm.referencer.core,org.txm.referencer.core.functi
+ ons,org.txm.referencer.core.messages,org.txm.referencer.core.preferen
+ ces
+Bundle-SymbolicName: org.txm.referencer.core;singleton:=true
+Bundle-Version: 1.0.0.qualifier
+Bundle-Name: Referencer
+Require-Bundle: org.txm.statsengine.r.core;bundle-version="1.0.0";visibility:=reexport,
+ org.txm.searchengine.cqp.core;bundle-version="1.1.0";visibility:=reexport,
+ org.eclipse.jface
+Bundle-ManifestVersion: 2
+Bundle-RequiredExecutionEnvironment: JavaSE-16
+Bundle-Vendor: Textometrie.org
+Automatic-Module-Name: org.txm.referencer.core
+

Property changes on: TXM/trunk/bundles/org.txm.referencer.core/META-INF/MANIFEST.MF
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.referencer.core/.project
===================================================================
--- TXM/trunk/bundles/org.txm.referencer.core/.project	(revision 0)
+++ TXM/trunk/bundles/org.txm.referencer.core/.project	(revision 3659)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>org.txm.referencer.core</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.pde.ManifestBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.pde.SchemaBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.pde.PluginNature</nature>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+	</natures>
+</projectDescription>

Property changes on: TXM/trunk/bundles/org.txm.referencer.core/.project
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.referencer.core/src/org/txm/referencer/core/messages/messages_fr.properties
===================================================================
--- TXM/trunk/bundles/org.txm.referencer.core/src/org/txm/referencer/core/messages/messages_fr.properties	(revision 0)
+++ TXM/trunk/bundles/org.txm.referencer.core/src/org/txm/referencer/core/messages/messages_fr.properties	(revision 3659)
@@ -0,0 +1,5 @@
+#TXM messages generated by the PluginMessagesManager class
+#Fri Jun 10 16:36:03 CEST 2022
+referencerExportFailedColon=L''export des Références a échoué \: {0}.
+referencesOfP0InTheP1Corpus=Références de {0} dans le corpus {1}...
+RESULT_TYPE=Références

Property changes on: TXM/trunk/bundles/org.txm.referencer.core/src/org/txm/referencer/core/messages/messages_fr.properties
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.referencer.core/src/org/txm/referencer/core/messages/package.html
===================================================================
--- TXM/trunk/bundles/org.txm.referencer.core/src/org/txm/referencer/core/messages/package.html	(revision 0)
+++ TXM/trunk/bundles/org.txm.referencer.core/src/org/txm/referencer/core/messages/package.html	(revision 3659)
@@ -0,0 +1,4 @@
+<html>
+<body>Core message keys: contains the low level shared messages.
+</body>
+</html>

Property changes on: TXM/trunk/bundles/org.txm.referencer.core/src/org/txm/referencer/core/messages/package.html
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.referencer.core/src/org/txm/referencer/core/messages/ReferencerCoreMessages.java
===================================================================
--- TXM/trunk/bundles/org.txm.referencer.core/src/org/txm/referencer/core/messages/ReferencerCoreMessages.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.referencer.core/src/org/txm/referencer/core/messages/ReferencerCoreMessages.java	(revision 3659)
@@ -0,0 +1,30 @@
+package org.txm.referencer.core.messages;
+
+import org.eclipse.osgi.util.NLS;
+import org.txm.utils.messages.Utf8NLS;
+
+/**
+ * Referencer core messages.
+ * 
+ * @author mdecorde
+ * @author sjacquot
+ *
+ */
+public class ReferencerCoreMessages extends NLS {
+
+	
+	private static final String BUNDLE_NAME = "org.txm.referencer.core.messages.messages"; //$NON-NLS-1$
+	
+	public static String RESULT_TYPE;
+
+	public static String referencesOfP0InTheP1Corpus;
+	public static String referencerExportFailedColon; 
+	
+	static {
+		// initialize resource bundle
+		Utf8NLS.initializeMessages(BUNDLE_NAME, ReferencerCoreMessages.class);
+	}
+	
+	
+	
+}

Property changes on: TXM/trunk/bundles/org.txm.referencer.core/src/org/txm/referencer/core/messages/ReferencerCoreMessages.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.referencer.core/src/org/txm/referencer/core/messages/messages.properties
===================================================================
--- TXM/trunk/bundles/org.txm.referencer.core/src/org/txm/referencer/core/messages/messages.properties	(revision 0)
+++ TXM/trunk/bundles/org.txm.referencer.core/src/org/txm/referencer/core/messages/messages.properties	(revision 3659)
@@ -0,0 +1,5 @@
+#TXM messages generated by the PluginMessagesManager class
+#Fri Jun 10 16:36:03 CEST 2022
+referencerExportFailedColon=Referencer export failed\: {0}.
+referencesOfP0InTheP1Corpus=References of {0} in {1} corpus...
+RESULT_TYPE=Referencer

Property changes on: TXM/trunk/bundles/org.txm.referencer.core/src/org/txm/referencer/core/messages/messages.properties
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.referencer.core/src/org/txm/referencer/core/functions/Referencer.java
===================================================================
--- TXM/trunk/bundles/org.txm.referencer.core/src/org/txm/referencer/core/functions/Referencer.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.referencer.core/src/org/txm/referencer/core/functions/Referencer.java	(revision 3659)
@@ -0,0 +1,802 @@
+// Copyright © 2010-2020 ENS de Lyon., University of Franche-Comté
+// 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.
+
+//
+// This file is part of the TXM platform.
+//
+// The TXM platform is free software: you can redistribute it and/or modif y
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 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: 2016-11-29 16:47:07 +0100 (Tue, 29 Nov 2016) $
+// $LastChangedRevision: 3349 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.referencer.core.functions;
+
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStreamWriter;
+import java.io.Writer;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.txm.core.messages.TXMCoreMessages;
+import org.txm.core.preferences.TXMPreferences;
+import org.txm.core.results.Parameter;
+import org.txm.core.results.TXMParameters;
+import org.txm.core.results.TXMResult;
+import org.txm.objects.Match;
+import org.txm.referencer.core.messages.ReferencerCoreMessages;
+import org.txm.referencer.core.preferences.ReferencerPreferences;
+import org.txm.searchengine.core.IQuery;
+import org.txm.searchengine.core.Query;
+import org.txm.searchengine.core.Selection;
+import org.txm.searchengine.cqp.AbstractCqiClient;
+import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
+import org.txm.searchengine.cqp.corpus.CQPCorpus;
+import org.txm.searchengine.cqp.corpus.Property;
+import org.txm.searchengine.cqp.corpus.CorpusManager;
+import org.txm.searchengine.cqp.corpus.StructuralUnitProperty;
+import org.txm.searchengine.cqp.corpus.WordProperty;
+//import org.txm.searchengine.cqp.corpus.query.Match;
+//import org.txm.searchengine.cqp.corpus.query.CQLQuery;
+import org.txm.searchengine.cqp.serverException.CqiServerError;
+import org.txm.statsengine.r.core.RWorkspace;
+import org.txm.statsengine.r.core.exceptions.RWorkspaceException;
+import org.txm.utils.TXMProgressMonitor;
+import org.txm.utils.logger.Log;
+
+/**
+ * The Class Referencer computes the references of a query.
+ * 
+ * @author mdecorde
+ * @author sjacquot
+ */
+public class Referencer extends TXMResult {
+
+	/** The noref. */
+	protected static int noref = 1;
+
+	/** The prefix r. */
+	protected static String prefixR = "Referencer"; //$NON-NLS-1$
+
+	/** The indexes. */
+	int[] indexes;
+
+	/** The lines. */
+	List<Line> lines = new ArrayList<Line>();
+
+	/** The matches. */
+	List<? extends Match> matches;
+
+	/** The positions. */
+	int[] positions;
+
+	/** The nlines. */
+	int nlines;
+
+	/** The processed idx. */
+	HashMap<Integer, Line> processedIdx;
+
+	/** The result. */
+	Selection result;
+
+	/** The symbol. */
+	private String symbol;
+
+	/** The writer. */
+	private BufferedWriter writer;
+
+	/** The hierarchic sort. */
+	@Parameter(key = ReferencerPreferences.SORT_BY_FREQUENCIES)
+	protected boolean pHierarchicSort;
+
+	@Parameter(key = ReferencerPreferences.PATTERN)
+	protected List<StructuralUnitProperty> pPattern;
+
+	/** The prop. */
+	@Parameter(key = ReferencerPreferences.UNIT_PROPERTY)
+	protected Property pProperty;
+
+	/** The query. */
+	@Parameter(key = ReferencerPreferences.QUERY)
+	protected IQuery pQuery;
+	
+	/** The show counts boolean. */
+	@Parameter(key = ReferencerPreferences.SHOW_COUNTS)
+	protected Boolean pShowCounts;
+
+	/** The show counts boolean. */
+	@Parameter(key = ReferencerPreferences.HIERARCHIC_MODE)
+	private boolean pHierarchicMode;
+
+	/**
+	 * Creates a not computed referencer.
+	 *
+	 * @param parent the parent corpus
+	 */
+	public Referencer(CQPCorpus parent) {
+		super(parent);
+	}
+
+
+	/**
+	 * Creates a not computed referencer.
+	 * 
+	 * @param parametersNodePath
+	 */
+	public Referencer(String parametersNodePath) {
+		super(parametersNodePath);
+	}
+
+
+	/**
+	 * As r matrix.
+	 *
+	 * @return the string
+	 * @throws RWorkspaceException the r workspace exception
+	 */
+	public String asRMatrix() throws RWorkspaceException {
+
+		String keywords[] = new String[lines.size()];
+		for (int i = 0; i < lines.size(); i++)
+			keywords[i] = lines.get(i).getPropValue();
+		// System.out.println(Arrays.toString(keywords));
+
+		String symbol = prefixR + noref;
+
+		RWorkspace rw = RWorkspace.getRWorkspaceInstance();
+		rw.eval(symbol + " <- list()"); //$NON-NLS-1$
+		rw.addVectorToWorkspace("refkeywords", keywords); //$NON-NLS-1$
+		rw.eval(symbol + "$keywords <- refkeywords"); //$NON-NLS-1$
+		// rw.eval(symbol+"$query <- \""+this.query.getQueryString()+"\")");
+		rw.eval(symbol + "$refs <- list()"); //$NON-NLS-1$
+		int i = 1;
+		for (Line line : this.lines) {
+			String refs[] = line.getReferences().toArray(new String[line.getReferences().size()]);
+			// System.out.println(line.getPropValue()+": "+Arrays.toString(refs));
+			rw.addVectorToWorkspace("reflinerefs", refs); //$NON-NLS-1$
+			rw.eval(symbol + "$refs[[" + i + "]] <- reflinerefs"); //$NON-NLS-1$ //$NON-NLS-2$
+			i++;
+		}
+
+		noref++;
+		this.symbol = symbol;
+		return symbol;
+	}
+
+	@Override
+	public void clean() {
+		try {
+			if (this.writer != null) {
+				this.writer.flush();
+				this.writer.close();
+			}
+		}
+		catch (IOException e) {
+			// TODO Auto-generated catch block
+			org.txm.utils.logger.Log.printStackTrace(e);
+		}
+	}
+
+	/**
+	 * Clears all lines.
+	 */
+	public void clearAllLines() {
+		for (Line line : lines) { // we need to recompute lines references
+			line.clear();
+		}
+	}
+
+	/**
+	 * Calls in order all stages to compute the referencer.
+	 *
+	 * @return true, if successful
+	 */
+	@Override
+	protected boolean _compute(TXMProgressMonitor monitor) {
+		try {
+			if (!getQueryMatches()) {
+				return false;
+			}
+
+			if (!getQueryindexes()) {
+				return false;
+			}
+
+			if (!groupPositionsbyId()) {
+				return false;
+			}
+		}
+		catch (Exception e) {
+			Log.severe("** Error: "+e);
+			Log.printStackTrace(e);
+			return false;
+		}
+
+		return true;
+	}
+
+	/**
+	 * Gets the parent corpus.
+	 *
+	 * @return the corpus
+	 */
+	public CQPCorpus getCorpus() {
+		return (CQPCorpus) this.parent;
+	}
+
+	@Override
+	public String getDetails() {
+		return getCorpus().getName();
+	}
+
+	/**
+	 * Gets the lines.
+	 *
+	 * @return the lines
+	 * @throws Exception 
+	 */
+	public List<Line> getLines() throws Exception {
+		return getLines(0, lines.size());
+	}
+
+	/**
+	 * Gets the lines.
+	 *
+	 * @param from the from
+	 * @param to the to
+	 * @return the lines
+	 * @throws Exception 
+	 */
+	public List<Line> getLines(int from, int to) throws Exception {
+		if (from < 0) {
+			from = 0;
+		}
+		if (to > lines.size()) {
+			to = lines.size();
+		}
+
+		HashMap<Integer, Line> lineswithoutpropvalue = new HashMap<>();
+
+		AbstractCqiClient cqiClient = CorpusManager.getCorpusManager().getCqiClient();
+		// build Missing lines
+		for (int i = from; i < to; i++) { // for each position group
+			Line l = lines.get(i);
+			if (l.notcomputed) {
+				lineswithoutpropvalue.put(l.id, l);
+
+				// get all reference values of all position of the line
+				Map<Property, List<List<String>>> refValues = new HashMap<>();
+				for (Property property : pPattern) {
+					refValues.put(property, cqiClient.getData(property,
+							l.positions, Collections.nCopies(l.positions.size(), 1)));
+				}
+				// build the Reference object
+				for (int j = 0; j < l.positions.size(); j++) {
+					String propvalue = ""; //$NON-NLS-1$
+					for (Property property : pPattern) {
+						propvalue += refValues.get(property).get(j).get(0) + ", "; //$NON-NLS-1$
+					}
+
+					l.addReference(propvalue.substring(0, propvalue.length() - 2));
+				}
+				if (pHierarchicSort) {
+					l.sortRef(true);
+				}
+				else {
+					l.sortAlpha();
+				}
+				l.notcomputed = false;
+			}
+		}
+
+		// get idx String value
+		int[] idxwithoutvalues = new int[lineswithoutpropvalue.keySet().size()];
+		int count = 0;
+		for (int i : lineswithoutpropvalue.keySet()) {
+			idxwithoutvalues[count++] = i;
+		}
+
+		String[] values = pProperty.id2Str(idxwithoutvalues);
+		for (int i = 0; i < values.length; i++) {
+			int id = idxwithoutvalues[i];
+			lineswithoutpropvalue.get(id).linepropvalue = values[i];
+		}
+		return lines.subList(from, to);
+	}
+
+	/**
+	 * Gets the name.
+	 *
+	 * @return the name
+	 */
+	@Override
+	public String getName() {
+		try {
+			return getCorpus().getName() + TXMPreferences.PARENT_NAME_SEPARATOR + this.getSimpleName();
+		}
+		catch (Exception e) {
+			return this.getEmptyName();
+		}
+	}
+
+
+	@Override
+	public String getSimpleName() {
+		if (this.pQuery != null && !this.pQuery.isEmpty()) {
+			return this.pQuery.asString() + ", " + StructuralUnitProperty.asFullNameString(this.pPattern);
+		}
+		else {
+			return this.getEmptyName();
+		}
+	}
+
+
+	@Override
+	public String getComputingStartMessage() {
+		return TXMCoreMessages.bind(ReferencerCoreMessages.referencesOfP0InTheP1Corpus, this.pQuery.asString(), this.getCorpus().getName());
+	}
+
+
+	@Override
+	public String getComputingDoneMessage() {
+		if (this.lines == null || this.lines.isEmpty()) {
+			return TXMCoreMessages.common_noResults;
+		}
+		else {
+			return TXMCoreMessages.bind(TXMCoreMessages.common_P0ItemsForP1Occurrences, TXMCoreMessages.formatNumber(this.getNLines()), TXMCoreMessages.formatNumber(this.getV()));
+		}
+	}
+
+
+	/**
+	 * Gets the n lines.
+	 *
+	 * @return the n lines
+	 */
+	public int getNLines() {
+		return nlines;
+	}
+
+	/**
+	 * Gets the pattern.
+	 *
+	 * @return the pattern
+	 */
+	public List<StructuralUnitProperty> getPattern() {
+		return pPattern;
+	}
+
+	/**
+	 * Gets the property.
+	 *
+	 * @return the property
+	 */
+	public Property getProperty() {
+		return pProperty;
+	}
+
+	/**
+	 * Gets the query.
+	 *
+	 * @return the query
+	 */
+	public IQuery getQuery() {
+		return pQuery;
+	}
+
+	/**
+	 * 2nd step.
+	 *
+	 * @return the queryindexes
+	 */
+	public boolean getQueryindexes() {
+		try {
+			positions = new int[matches.size()];
+			int i = 0;
+			for (Match m : matches) {
+				positions[i++] = m.getStart();
+			}
+
+			indexes = pProperty.cpos2Id(positions);
+		}
+		catch (Exception e) {
+			// TODO Auto-generated catch block
+			org.txm.utils.logger.Log.printStackTrace(e);
+			return false;
+		}
+		return true;
+	}
+
+	/**
+	 * 1st step.
+	 *
+	 * @return the query matches
+	 * @throws Exception 
+	 */
+	public boolean getQueryMatches() throws Exception {
+		
+		result = pQuery.getSearchEngine().query(this.getCorpus(), pQuery, "TMP", false);
+		
+//		result = this.getCorpus().query(pQuery, ReferencerCoreMessages.RESULT_TYPE, false);
+		if (result.getNMatch() == 0) {
+			return false;
+		}
+		matches = result.getMatches();
+		result.drop();
+		return true;
+	}
+
+	/**
+	 * Gets the symbol.
+	 *
+	 * @return the symbol
+	 */
+	public String getSymbol() {
+		return symbol;
+	}
+
+	public int getV() {
+		if (matches == null) {
+			return 0;
+		}
+		return matches.size();
+	}
+
+	/**
+	 * 3rd stage.
+	 *
+	 * @return true, if successful
+	 */
+	public boolean groupPositionsbyId() {
+		processedIdx = new HashMap<>();
+
+		lines = new ArrayList<>();
+		// System.out.println("indexes ");
+		for (int i = 0; i < indexes.length; i++) {
+			int id = indexes[i];
+			// System.out.print(" "+id);
+			if (!processedIdx.containsKey(id)) {
+				// System.out.println("add idx "+id);
+				Line l = new Line(id);
+				processedIdx.put(id, l);
+
+				lines.add(l);
+			}
+			processedIdx.get(id).addPosition(positions[i]);
+		}
+
+		nlines = processedIdx.keySet().size();
+		return true;
+	}
+
+	public void setParameters(IQuery query, WordProperty prop, List<StructuralUnitProperty> pattern, Boolean hierarchicSort) {
+		if (query != null) this.pQuery = query;
+		if (pattern != null) this.pPattern = pattern;
+		if (prop != null) this.pProperty = prop;
+		if (hierarchicSort != null) this.pHierarchicSort = hierarchicSort;
+		this.setDirty();
+	}
+
+	@Override
+	public boolean setParameters(TXMParameters parameters) {
+		return false;
+	}
+
+	@Deprecated
+	public boolean toTxt(File outfile, String encoding) throws Exception {
+		return toTxt(outfile, encoding, "\t", ""); //$NON-NLS-1$ //$NON-NLS-2$
+	}
+
+	@Override
+	@Deprecated
+	public boolean _toTxt(File outfile, String encoding, String colseparator, String txtseparator) {
+		try {
+			// NK: writer declared as class attribute to perform a clean if the operation is interrupted
+			this.writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(outfile), encoding));
+			// if ("UTF-8".equals(encoding)) writer.write('\ufeff'); // UTF-8 BOM
+			toTxt(writer, 0, lines.size() - 1, colseparator, txtseparator);
+		}
+		catch (Exception e) {
+			Log.severe(TXMCoreMessages.bind(ReferencerCoreMessages.referencerExportFailedColon, Log.toString(e)));
+			return false;
+		}
+		return true;
+	}
+
+	@Deprecated
+	public void toTxt(Writer writer, int from, int to, String colseparator, String txtseparator)
+			throws Exception {
+		try {
+			getLines(0, Integer.MAX_VALUE);
+			writer.write(pProperty.getName() + colseparator + this.pPattern + "\n"); //$NON-NLS-1$
+			for (Line line : lines) {
+				writer.write(txtseparator + line.getPropValue().replace(txtseparator, txtseparator + txtseparator) + txtseparator + colseparator + txtseparator + line.getReferences().toString()
+						.replace(txtseparator, txtseparator + txtseparator) + txtseparator + "\n"); //$NON-NLS-1$
+				writer.flush();
+			}
+
+			writer.close();
+		}
+		catch (CqiServerError e) {
+			// TODO Auto-generated catch block
+			org.txm.utils.logger.Log.printStackTrace(e);
+		}
+	}
+
+	@Override
+	public boolean canCompute() {
+
+		if (pQuery == null || pQuery.isEmpty()) {
+			Log.fine("No query set.");
+			return false;
+		}
+		if (pPattern == null || pPattern.size() == 0) {
+			Log.fine("No reference pattern set.");
+			return false;
+		}
+		if (pProperty == null) {
+			Log.fine("No property set.");
+			return false;
+		}
+
+		return true;
+	}
+
+	@Override
+	public boolean loadParameters() throws CqiClientException {
+		
+		this.pQuery = IQuery.fromPrefString(this.getStringParameterValue(ReferencerPreferences.QUERY));//new CQLQuery(this.getStringParameterValue(ReferencerPreferences.QUERY));
+		this.pPattern = StructuralUnitProperty.stringToProperties(this.getCorpus(), this.getStringParameterValue(ReferencerPreferences.PATTERN));
+		this.pProperty = this.getCorpus().getProperty(this.getStringParameterValue(ReferencerPreferences.UNIT_PROPERTY));
+		return true;
+	}
+
+	@Override
+	public boolean saveParameters() {
+		
+		if (this.pQuery != null) {
+			this.saveParameter(ReferencerPreferences.QUERY, IQuery.toPrefString(pQuery));
+		}
+
+		if (this.pPattern != null) {
+			this.saveParameter(ReferencerPreferences.PATTERN, StructuralUnitProperty.propertiesToString(this.pPattern));
+		}
+
+		if (this.pProperty != null) {
+			this.saveParameter(ReferencerPreferences.UNIT_PROPERTY, this.pProperty.getName());
+		}
+		return true;
+	}
+
+	/**
+	 * The Class Line.
+	 */
+	public class Line {
+
+		/** The id. */
+		int id;
+
+		/** The propvalue. */
+		String linepropvalue;
+
+		/** The notcomputed. */
+		boolean notcomputed = true;
+
+		/** The positions. */
+		ArrayList<Integer> positions;
+
+		/** The references. */
+		ArrayList<String> references;
+
+		/** The references counts. */
+		HashMap<String, Integer> referencesCounts = new HashMap<>();
+
+		/**
+		 * Instantiates a new line.
+		 *
+		 * @param i the i
+		 */
+		public Line(int i) {
+			id = i;
+			positions = new ArrayList<>();
+			references = new ArrayList<>();
+		}
+
+		/**
+		 * Adds the position.
+		 *
+		 * @param i the i
+		 */
+		public void addPosition(int i) {
+			positions.add(i);
+		}
+
+		/**
+		 * Adds the reference.
+		 *
+		 * @param string the string
+		 */
+		public void addReference(String string) {
+			if (!referencesCounts.containsKey(string)) {
+				references.add(string);
+				referencesCounts.put(string, 1);
+			}
+			else {
+				referencesCounts.put(string, referencesCounts.get(string) + 1);
+			}
+		}
+
+		/**
+		 * Clear.
+		 */
+		public void clear() {
+			notcomputed = false;
+			references = new ArrayList<>();
+		}
+
+		/**
+		 * Gets the count.
+		 *
+		 * @param ref the ref
+		 * @return the count
+		 */
+		public int getCount(String ref) {
+			return referencesCounts.get(ref);
+		}
+
+		public HashMap<String, Integer> getCounts() {
+			return referencesCounts;
+		}
+
+		/**
+		 * Gets the prop value.
+		 *
+		 * @return the prop value
+		 */
+		public String getPropValue() {
+			return linepropvalue;
+		}
+
+		/**
+		 * Gets the references.
+		 *
+		 * @return the references
+		 */
+		public List<String> getReferences() {
+			return references;
+		}
+
+		/**
+		 * Sort alpha.
+		 */
+		public void sortAlpha() {
+			Collections.sort(references);
+		}
+
+		/**
+		 * Sort ref.
+		 *
+		 * @param reverse the reverse
+		 */
+		public void sortRef(final boolean reverse) {
+			Collections.sort(references, new Comparator<String>() {
+
+				@Override
+				public int compare(String arg0, String arg1) {
+					if (reverse)
+						return getCount(arg1) - getCount(arg0);
+					else
+						return getCount(arg0) - getCount(arg1);
+				}
+			});
+		}
+
+		/*
+		 * (non-Javadoc)
+		 * @see java.lang.Object#toString()
+		 */
+		@Override
+		public String toString() {
+			return linepropvalue + " : <" + id + "," + pProperty + "> : " + references.toString(); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+		}
+	}
+
+	public void setQuery(Query query) {
+		this.pQuery = query;
+	}
+
+	public void setProperty(WordProperty property) {
+		this.pProperty = property;
+	}
+
+	public void setPattern(List<StructuralUnitProperty> properties) {
+		this.pPattern = properties;
+	}
+
+
+	/**
+	 * Creates a CQL query string from the specified Referencer lines.
+	 *
+	 * @param lines
+	 * @return the query
+	 */
+	public String createQuery(List<Line> lines) {
+
+		Property prop = this.getProperty();
+		String query = "["; //$NON-NLS-1$
+
+		ArrayList<String> values = new ArrayList<>();
+		for (Line line : lines) {
+			String s = line.getPropValue();
+			values.add(s);
+		}
+		String test = ((WordProperty) prop).getCQLTest(values);
+		if (test != null) {
+			query += test;
+		}
+		
+		query += "]"; //$NON-NLS-1$
+				
+		return query;
+
+	}
+
+	@Override
+	public String getResultType() {
+		return ReferencerCoreMessages.RESULT_TYPE;
+	}
+
+	public void setShowCounts(boolean showCounts) {
+		
+		pShowCounts = showCounts;
+	}
+
+	public boolean getShowCounts() {
+		
+		return pShowCounts;
+	}
+
+
+	public boolean getHierarchicMode() {
+		
+		return pHierarchicMode;
+	}
+}

Property changes on: TXM/trunk/bundles/org.txm.referencer.core/src/org/txm/referencer/core/functions/Referencer.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.referencer.core/src/org/txm/referencer/core/package.html
===================================================================
--- TXM/trunk/bundles/org.txm.referencer.core/src/org/txm/referencer/core/package.html	(revision 0)
+++ TXM/trunk/bundles/org.txm.referencer.core/src/org/txm/referencer/core/package.html	(revision 3659)
@@ -0,0 +1,5 @@
+<html>
+<body>
+	<p>Compute an index such as those in books</p>
+</body>
+</html>
\ No newline at end of file

Property changes on: TXM/trunk/bundles/org.txm.referencer.core/src/org/txm/referencer/core/package.html
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.referencer.core/src/org/txm/referencer/core/preferences/ReferencerPreferences.java
===================================================================
--- TXM/trunk/bundles/org.txm.referencer.core/src/org/txm/referencer/core/preferences/ReferencerPreferences.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.referencer.core/src/org/txm/referencer/core/preferences/ReferencerPreferences.java	(revision 3659)
@@ -0,0 +1,43 @@
+package org.txm.referencer.core.preferences;
+
+import org.osgi.service.prefs.Preferences;
+import org.txm.core.preferences.TXMPreferences;
+
+/**
+ * Default preferences.
+ * 
+ * @author mdecorde
+ * @author sjacquot
+ *
+ */
+public class ReferencerPreferences extends TXMPreferences {
+
+	public static final String SORT_BY_FREQUENCIES = "sort_by_frequencies"; //$NON-NLS-1$
+	public static final String PATTERN = "pattern"; //$NON-NLS-1$
+	public static final String SHOW_COUNTS = "show_counts";
+	public static final String HIERARCHIC_MODE = "hierarchic_mode";
+	
+	/**
+	 * Gets the instance.
+	 * @return the instance
+	 */
+	public static TXMPreferences getInstance()	{
+		if (!TXMPreferences.instances.containsKey(ReferencerPreferences.class)) {
+			new ReferencerPreferences();
+		}
+		return TXMPreferences.instances.get(ReferencerPreferences.class);
+	}
+
+	
+	@Override
+	public void initializeDefaultPreferences() {
+		super.initializeDefaultPreferences();
+		Preferences preferences = this.getDefaultPreferencesNode();
+
+		preferences.putBoolean(SORT_BY_FREQUENCIES, false);
+
+		preferences.put(UNIT_PROPERTY, TXMPreferences.DEFAULT_UNIT_PROPERTY); //$NON-NLS-1$
+		preferences.put(PATTERN, "text_id"); //$NON-NLS-1$
+		preferences.putBoolean(SHOW_COUNTS, true); //$NON-NLS-1$
+	}
+}

Property changes on: TXM/trunk/bundles/org.txm.referencer.core/src/org/txm/referencer/core/preferences/ReferencerPreferences.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain


Property changes on: TXM/trunk/bundles/org.txm.referencer.core
___________________________________________________________________
Added: svn:ignore
   + bin

target


Index: TXM/trunk/bundles/org.txm.rcp.about.fragment/src/org/eclipse/ui/internal/about/InstallationDialog.java
===================================================================
--- TXM/trunk/bundles/org.txm.rcp.about.fragment/src/org/eclipse/ui/internal/about/InstallationDialog.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.rcp.about.fragment/src/org/eclipse/ui/internal/about/InstallationDialog.java	(revision 3659)
@@ -0,0 +1,410 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2009 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ ******************************************************************************/
+
+package org.eclipse.ui.internal.about;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtensionPoint;
+import org.eclipse.core.runtime.IProduct;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.dialogs.IDialogSettings;
+import org.eclipse.jface.dialogs.TrayDialog;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.DisposeEvent;
+import org.eclipse.swt.events.DisposeListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.FontMetrics;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.TabFolder;
+import org.eclipse.swt.widgets.TabItem;
+import org.eclipse.ui.about.IInstallationPageContainer;
+import org.eclipse.ui.about.InstallationPage;
+import org.eclipse.ui.internal.ConfigurationInfo;
+import org.eclipse.ui.internal.WorkbenchMessages;
+import org.eclipse.ui.internal.WorkbenchPlugin;
+import org.eclipse.ui.internal.registry.IWorkbenchRegistryConstants;
+import org.eclipse.ui.services.IServiceLocator;
+
+/**
+ * @since 3.5
+ * 
+ */
+public class InstallationDialog extends TrayDialog implements
+IInstallationPageContainer {
+	class ButtonManager {
+
+		private Composite composite;
+		HashMap<String, List<Button>> buttonMap = new HashMap<>(); // page id->Collection of page
+
+		// buttons
+
+		public ButtonManager(Composite composite) {
+			this.composite = composite;
+		}
+
+		public Composite getParent() {
+			return composite;
+		}
+
+		public void update(String currentPageId) {
+			
+			if (composite == null || composite.isDisposed()) {
+				return;
+			}
+			GC metricsGC = new GC(composite);
+			FontMetrics metrics = metricsGC.getFontMetrics();
+			metricsGC.dispose();
+			List<?> buttons = (List<?>) buttonMap.get(currentPageId);
+			Control[] children = composite.getChildren();
+
+			int visibleChildren = 0;
+			Button closeButton = getButton(IDialogConstants.CLOSE_ID);
+
+			for (int i = 0; i < children.length; i++) {
+				Control control = children[i];
+				if (closeButton == control)
+					closeButton.dispose();
+				else {
+					control.setVisible(false);
+					setButtonLayoutData(metrics, control, false);
+				}
+			}
+			
+			if (buttons != null) {
+				for (int i = 0; i < buttons.size(); i++) {
+					Button button = (Button) buttons.get(i);
+					button.setVisible(true);
+					setButtonLayoutData(metrics, button, true);
+					GridData data = (GridData) button.getLayoutData();
+					data.exclude = false;
+					visibleChildren++;
+				}
+			}
+
+			GridLayout compositeLayout = (GridLayout) composite.getLayout();
+			compositeLayout.numColumns = visibleChildren;
+			composite.layout(true);
+		}
+
+		protected void setButtonLayoutData(FontMetrics metrics, Control button,
+				boolean visible) {
+			GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
+			int widthHint = Dialog.convertHorizontalDLUsToPixels(metrics,
+					IDialogConstants.BUTTON_WIDTH);
+			Point minSize = button.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
+			data.widthHint = Math.max(widthHint, minSize.x);
+			data.exclude = !visible;
+			button.setLayoutData(data);
+		}
+
+		public void addPageButton(String id, Button button) {
+			List<Button> list = (List<Button>) buttonMap.get(id);
+			if (list == null) {
+				list = new ArrayList<>(1);
+				buttonMap.put(id, list);
+			}
+			list.add(button);
+		}
+
+		public void clear() {
+			buttonMap = new HashMap<>();
+		}
+	}
+
+	protected static final String ID = "ID"; //$NON-NLS-1$
+	private static final String DIALOG_SETTINGS_SECTION = "InstallationDialogSettings"; //$NON-NLS-1$
+	private final static int TAB_WIDTH_IN_DLUS = 440;
+	private final static int TAB_HEIGHT_IN_DLUS = 320;
+
+	private static String lastSelectedTabId = null;
+	private TabFolder folder;
+	IServiceLocator serviceLocator;
+	private ButtonManager buttonManager;
+	private Map<InstallationPage, String> pageToId = new HashMap<>();
+	private Dialog modalParent;
+
+	/**
+	 * @param parentShell
+	 * @param locator
+	 */
+	public InstallationDialog(Shell parentShell, IServiceLocator locator) {
+		super(parentShell);
+		serviceLocator = locator;
+
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets
+	 * .Shell)
+	 */
+	protected void configureShell(Shell newShell) {
+		super.configureShell(newShell);
+		String productName = ""; //$NON-NLS-1$
+		IProduct product = Platform.getProduct();
+		if (product != null && product.getName() != null) {
+			productName = product.getName();
+		}
+		newShell.setText(NLS.bind(WorkbenchMessages.InstallationDialog_ShellTitle, productName));
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.jface.dialogs.Dialog#isResizable()
+	 */
+	protected boolean isResizable() {
+		return true;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets
+	 * .Composite)
+	 */
+	protected Control createDialogArea(Composite parent) {
+		Composite composite = (Composite) super.createDialogArea(parent);
+
+		folder = new TabFolder(composite, SWT.NONE);
+		configureFolder();
+		createFolderItems(folder);
+
+		GridData folderData = new GridData(SWT.FILL, SWT.FILL, true, true);
+		folderData.widthHint = convertHorizontalDLUsToPixels(TAB_WIDTH_IN_DLUS);
+		folderData.heightHint = convertVerticalDLUsToPixels(TAB_HEIGHT_IN_DLUS);
+		folder.setLayoutData(folderData);
+		folder.addSelectionListener(createFolderSelectionListener());
+		folder.addDisposeListener(new DisposeListener() {
+			public void widgetDisposed(DisposeEvent e) {
+				releaseContributions();
+			}
+		});
+		return composite;
+	}
+
+	protected void createFolderItems(TabFolder folder) {
+		IConfigurationElement[] elements = ConfigurationInfo
+				.getSortedExtensions(loadElements());
+
+		// Patch !!
+		if (elements.length > 1) {
+			IConfigurationElement tmp = elements[0];
+			elements[0] = elements[1];
+			elements[1] = tmp;
+		}
+
+		for (int i = 0; i < elements.length; i++) {
+			IConfigurationElement element = elements[i];
+			TabItem item = new TabItem(folder, SWT.NONE);
+			item.setText(element.getAttribute(IWorkbenchRegistryConstants.ATT_NAME));
+			item.setData(element);
+			item.setData(ID, element.getAttribute(IWorkbenchRegistryConstants.ATT_ID));
+
+			Composite control = new Composite(folder, SWT.NONE);
+			control.setLayout(new GridLayout());
+			item.setControl(control);
+		}
+
+	}
+
+	protected Control createContents(Composite parent) {
+		Control control = super.createContents(parent);
+		boolean selected = false;
+		if (folder.getItemCount() > 0) {
+			if (lastSelectedTabId != null) {
+				TabItem[] items = folder.getItems();
+				for (int i = 0; i < items.length; i++) {
+					if (items[i].getData(ID).equals(lastSelectedTabId)) {
+						folder.setSelection(i);
+						tabSelected(items[i]);
+						selected = true;
+						break;
+					}
+				}
+			}
+			if (!selected) {
+				tabSelected(folder.getItem(0));
+			}
+		}
+		// need to reapply the dialog font now that we've created new
+		// tab items
+		Dialog.applyDialogFont(folder);
+		return control;
+	}
+
+	private SelectionAdapter createFolderSelectionListener() {
+		return new SelectionAdapter() {
+
+			public void widgetSelected(SelectionEvent e) {
+				tabSelected((TabItem) e.item);
+			}
+		};
+	}
+
+	/*
+	 * Must be called after contributions and button manager are created.
+	 */
+	private void tabSelected(TabItem item) {
+		if (item.getData() instanceof IConfigurationElement) {
+			final IConfigurationElement element = (IConfigurationElement) item.getData();
+
+			Composite pageComposite = (Composite) item.getControl();
+			try {
+				final InstallationPage page = (InstallationPage) element.createExecutableExtension(IWorkbenchRegistryConstants.ATT_CLASS);
+				page.createControl(pageComposite);
+				// new controls created since the dialog font was applied, so
+				// apply again.
+				Dialog.applyDialogFont(pageComposite);
+				page.setPageContainer(this);
+				// Must be done before creating the buttons because the control
+				// button creation methods
+				// use this map.
+				pageToId.put(page, element.getAttribute(IWorkbenchRegistryConstants.ATT_ID));
+				createButtons(page);
+				item.setData(page);
+				item.addDisposeListener(new DisposeListener() {
+
+					public void widgetDisposed(DisposeEvent e) {
+						page.dispose();
+					}
+				});
+				pageComposite.layout(true, true);
+
+			} catch (CoreException e1) {
+				Label label = new Label(pageComposite, SWT.NONE);
+				label.setText(e1.getMessage());
+				item.setData(null);
+			}
+
+		}
+		String id = (String) item.getData(ID);
+		rememberSelectedTab(id);
+		buttonManager.update(id);
+		Button button = createButton(buttonManager.getParent(), IDialogConstants.CLOSE_ID, IDialogConstants.CLOSE_LABEL, true);
+		GridData gd = (GridData) button.getLayoutData();
+		gd.horizontalAlignment = SWT.BEGINNING;
+		gd.horizontalIndent = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH) / 2;
+		// Layout the button bar's parent and all of its children.  We must
+		// cascade through all children because the buttons have changed and
+		// because tray dialog inserts an extra composite in the button bar
+		// hierarchy.
+		getButtonBar().getParent().layout(true, true);
+
+	}
+
+	protected void createButtons(InstallationPage page) {
+		page.createPageButtons(buttonManager.getParent());
+		Dialog.applyDialogFont(buttonManager.getParent());
+	}
+
+	private void rememberSelectedTab(String pageId) {
+		lastSelectedTabId = pageId;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * org.eclipse.jface.dialogs.Dialog#createButtonsForButtonBar(org.eclipse
+	 * .swt.widgets.Composite)
+	 */
+	protected void createButtonsForButtonBar(Composite parent) {
+		// The button manager will handle the correct sizing of the buttons.
+		// We do not want columns equal width because we are going to add some
+		// padding in the final column (close button).
+		GridLayout layout = (GridLayout) parent.getLayout();
+		layout.makeColumnsEqualWidth = false;
+		buttonManager = new ButtonManager(parent);
+	}
+
+	private void configureFolder() {
+	}
+
+	private IConfigurationElement[] loadElements() {
+		IExtensionPoint point = Platform.getExtensionRegistry()
+				.getExtensionPoint("org.eclipse.ui", "installationPages"); //$NON-NLS-1$ //$NON-NLS-2$
+		return point.getConfigurationElements();
+	}
+
+	protected IDialogSettings getDialogBoundsSettings() {
+		IDialogSettings settings = WorkbenchPlugin.getDefault()
+				.getDialogSettings();
+		IDialogSettings section = settings.getSection(DIALOG_SETTINGS_SECTION);
+		if (section == null) {
+			section = settings.addNewSection(DIALOG_SETTINGS_SECTION);
+		}
+		return section;
+	}
+
+	protected void releaseContributions() {
+		buttonManager.clear();
+	}
+
+	public void closeModalContainers() {
+		close();
+		if (modalParent != null)
+			modalParent.close();
+	}
+
+	protected void buttonPressed(int buttonId) {
+		if (IDialogConstants.CLOSE_ID == buttonId) {
+			okPressed();
+		}
+	}
+
+	public void registerPageButton(InstallationPage page, Button button) {
+		buttonManager.addPageButton(pageToId(page), button);
+	}
+
+	protected String pageToId(InstallationPage page) {
+		String pageId = (String) pageToId.get(page);
+		Assert.isLegal(pageId != null);
+		return pageId;
+	}
+
+	/**
+	 * Set the modal parent dialog that was used to launch this dialog. This
+	 * should be used by any launching dialog so that the {
+	 * {@link #closeModalContainers()} method can be properly implemented.
+	 * 
+	 * @param parent
+	 *            the modal parent dialog that launched this dialog, or
+	 *            <code>null</code> if there was no parent.
+	 * 
+	 *            This is an internal method and should not be used outside of
+	 *            platform UI.
+	 */
+	public void setModalParent(Dialog parent) {
+		this.modalParent = parent;
+	}
+}

Property changes on: TXM/trunk/bundles/org.txm.rcp.about.fragment/src/org/eclipse/ui/internal/about/InstallationDialog.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.rcp.about.fragment/build.properties
===================================================================
--- TXM/trunk/bundles/org.txm.rcp.about.fragment/build.properties	(revision 0)
+++ TXM/trunk/bundles/org.txm.rcp.about.fragment/build.properties	(revision 3659)
@@ -0,0 +1,5 @@
+bin.includes = META-INF/,\
+               library.jar,\
+               OSGI-INF/
+source.library.jar = src/
+jars.compile.order = library.jar

Property changes on: TXM/trunk/bundles/org.txm.rcp.about.fragment/build.properties
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.rcp.about.fragment/OSGI-INF/l10n/bundle.properties
===================================================================
--- TXM/trunk/bundles/org.txm.rcp.about.fragment/OSGI-INF/l10n/bundle.properties	(revision 0)
+++ TXM/trunk/bundles/org.txm.rcp.about.fragment/OSGI-INF/l10n/bundle.properties	(revision 3659)
@@ -0,0 +1,2 @@
+#Properties file for org.txm.rcp.about.fragment
+Bundle-Name = org.txm.rcp.about.fragment
\ No newline at end of file

Property changes on: TXM/trunk/bundles/org.txm.rcp.about.fragment/OSGI-INF/l10n/bundle.properties
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.rcp.about.fragment/library.jar
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: TXM/trunk/bundles/org.txm.rcp.about.fragment/library.jar
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: TXM/trunk/bundles/org.txm.rcp.about.fragment/.classpath
===================================================================
--- TXM/trunk/bundles/org.txm.rcp.about.fragment/.classpath	(revision 0)
+++ TXM/trunk/bundles/org.txm.rcp.about.fragment/.classpath	(revision 3659)
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="con"
+		path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6" />
+	<classpathentry kind="con"
+		path="org.eclipse.pde.core.requiredPlugins" />
+	<classpathentry kind="src" path="src" />
+	<classpathentry kind="output" path="bin" />
+</classpath>

Property changes on: TXM/trunk/bundles/org.txm.rcp.about.fragment/.classpath
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.rcp.about.fragment/META-INF/MANIFEST.MF
===================================================================
--- TXM/trunk/bundles/org.txm.rcp.about.fragment/META-INF/MANIFEST.MF	(revision 0)
+++ TXM/trunk/bundles/org.txm.rcp.about.fragment/META-INF/MANIFEST.MF	(revision 3659)
@@ -0,0 +1,13 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: org.txm.rcp.about.fragment
+Bundle-SymbolicName: org.txm.rcp.about.fragment
+Bundle-Version: 1.0.0.qualifier
+Fragment-Host: org.eclipse.ui.workbench;bundle-version="3.110.1.v20170704-1208"
+Eclipse-PatchFragment: true
+Bundle-RequiredExecutionEnvironment: JavaSE-16
+Bundle-ClassPath: library.jar,
+ .
+Export-Package: org.eclipse.ui.internal.about
+Bundle-Vendor: Textometrie.org
+Automatic-Module-Name: org.txm.rcp.about.fragment

Property changes on: TXM/trunk/bundles/org.txm.rcp.about.fragment/META-INF/MANIFEST.MF
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.rcp.about.fragment/.project
===================================================================
--- TXM/trunk/bundles/org.txm.rcp.about.fragment/.project	(revision 0)
+++ TXM/trunk/bundles/org.txm.rcp.about.fragment/.project	(revision 3659)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>org.txm.rcp.about.fragment</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.pde.ManifestBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.pde.SchemaBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.pde.PluginNature</nature>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+	</natures>
+</projectDescription>

Property changes on: TXM/trunk/bundles/org.txm.rcp.about.fragment/.project
___________________________________________________________________
Added: svn:mime-type
   + text/plain


Property changes on: TXM/trunk/bundles/org.txm.rcp.about.fragment
___________________________________________________________________
Added: svn:ignore
   + bin

target


Index: TXM/trunk/bundles/org.txm.ruby.core/build.properties
===================================================================
--- TXM/trunk/bundles/org.txm.ruby.core/build.properties	(revision 0)
+++ TXM/trunk/bundles/org.txm.ruby.core/build.properties	(revision 3659)
@@ -0,0 +1,6 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+               .,\
+               plugin.xml,\
+               lib/jruby-complete-9.2.11.1.jar

Property changes on: TXM/trunk/bundles/org.txm.ruby.core/build.properties
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.ruby.core/plugin.xml
===================================================================
--- TXM/trunk/bundles/org.txm.ruby.core/plugin.xml	(revision 0)
+++ TXM/trunk/bundles/org.txm.ruby.core/plugin.xml	(revision 3659)
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+   <extension
+         point="org.txm.core.engines.ScriptEngine">
+      <ScriptEngine
+            class="org.txm.ruby.core.RubyScriptEngine"
+            name="Ruby">
+      </ScriptEngine>
+   </extension>
+   <extension
+         point="org.eclipse.core.runtime.preferences">
+      <initializer
+            class="org.txm.ruby.core.RubyPreferences">
+      </initializer>
+   </extension>
+
+</plugin>

Property changes on: TXM/trunk/bundles/org.txm.ruby.core/plugin.xml
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.ruby.core/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- TXM/trunk/bundles/org.txm.ruby.core/.settings/org.eclipse.jdt.core.prefs	(revision 0)
+++ TXM/trunk/bundles/org.txm.ruby.core/.settings/org.eclipse.jdt.core.prefs	(revision 3659)
@@ -0,0 +1,7 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
+org.eclipse.jdt.core.compiler.compliance=1.8
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.8

Property changes on: TXM/trunk/bundles/org.txm.ruby.core/.settings/org.eclipse.jdt.core.prefs
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.ruby.core/.classpath
===================================================================
--- TXM/trunk/bundles/org.txm.ruby.core/.classpath	(revision 0)
+++ TXM/trunk/bundles/org.txm.ruby.core/.classpath	(revision 3659)
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry exported="true" kind="lib" path="lib/jruby-complete-9.2.11.1.jar"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
+	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins">
+		<accessrules>
+			<accessrule kind="accessible" pattern="**"/>
+		</accessrules>
+	</classpathentry>
+	<classpathentry kind="src" path="src"/>
+	<classpathentry kind="output" path="bin"/>
+</classpath>

Property changes on: TXM/trunk/bundles/org.txm.ruby.core/.classpath
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.ruby.core/META-INF/MANIFEST.MF
===================================================================
--- TXM/trunk/bundles/org.txm.ruby.core/META-INF/MANIFEST.MF	(revision 0)
+++ TXM/trunk/bundles/org.txm.ruby.core/META-INF/MANIFEST.MF	(revision 3659)
@@ -0,0 +1,12 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: org.txm.ruby.core
+Bundle-SymbolicName: org.txm.ruby.core;singleton:=true
+Bundle-Version: 1.0.0.qualifier
+Bundle-Vendor: textometrie.org
+Automatic-Module-Name: org.txm.ruby.core
+Bundle-RequiredExecutionEnvironment: JavaSE-16
+Require-Bundle: org.txm.core;bundle-version="0.8.3";visibility:=reexport
+Bundle-ClassPath: lib/jruby-complete-9.2.11.1.jar,
+ .
+Export-Package: org.txm.ruby.core

Property changes on: TXM/trunk/bundles/org.txm.ruby.core/META-INF/MANIFEST.MF
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.ruby.core/.project
===================================================================
--- TXM/trunk/bundles/org.txm.ruby.core/.project	(revision 0)
+++ TXM/trunk/bundles/org.txm.ruby.core/.project	(revision 3659)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>org.txm.ruby.core</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.pde.ManifestBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.pde.SchemaBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.pde.PluginNature</nature>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+	</natures>
+</projectDescription>

Property changes on: TXM/trunk/bundles/org.txm.ruby.core/.project
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.ruby.core/lib/jruby-complete-9.2.11.1.jar
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: TXM/trunk/bundles/org.txm.ruby.core/lib/jruby-complete-9.2.11.1.jar
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: TXM/trunk/bundles/org.txm.ruby.core/src/org/txm/ruby/core/RubyScriptEngine.java
===================================================================
--- TXM/trunk/bundles/org.txm.ruby.core/src/org/txm/ruby/core/RubyScriptEngine.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.ruby.core/src/org/txm/ruby/core/RubyScriptEngine.java	(revision 3659)
@@ -0,0 +1,104 @@
+package org.txm.ruby.core;
+
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+
+import javax.script.ScriptEngineManager;
+import javax.script.ScriptException;
+import javax.script.SimpleBindings;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.txm.core.engines.ScriptEngine;
+import org.txm.utils.io.IOUtils;
+import org.txm.utils.logger.Log;
+
+/**
+ * 
+ * <pre>
+ * require 'java'
+
+puts 'Hello World!' + org.txm.Toolbox.workspace.getProjects().toString()
+ * </pre>
+ * 
+ * 
+ * @author mdecorde
+ *
+ */
+public class RubyScriptEngine extends ScriptEngine {
+	
+	private javax.script.ScriptEngine engine;
+
+	public RubyScriptEngine() {
+		super("ruby", "rb");
+	}
+	
+	@Override
+	public boolean isRunning() {
+		return true;
+	}
+	
+	@Override
+	public boolean initialize() throws Exception {
+		ScriptEngineManager manager = new ScriptEngineManager();
+		engine = manager.getEngineByName("jruby");
+		return engine != null;
+	}
+	
+	@Override
+	public boolean start(IProgressMonitor monitor) throws Exception {
+		return true;
+	}
+	
+	@Override
+	public boolean stop() throws Exception {
+		engine = null;
+		return true;
+	}
+	
+	@Override
+	public IStatus executeScript(File script, HashMap<String, Object> env, List<String> stringArgs) {
+		BufferedReader r = null;
+		try {
+			SimpleBindings bindings = new SimpleBindings();
+			bindings.putAll(env);
+			r = IOUtils.getReader(script);
+			engine.eval(r, bindings);
+		}
+		catch (Exception e) {
+			Log.printStackTrace(e);
+			return Status.CANCEL_STATUS;
+		} finally {
+			if (r != null) {
+				try {
+					r.close();
+				}
+				catch (IOException e) {
+					// TODO Auto-generated catch block
+					e.printStackTrace();
+				}
+			}
+		}
+		return Status.OK_STATUS;
+	}
+	
+	@Override
+	public IStatus executeText(String str, HashMap<String, Object> env) {
+		try {
+			engine.eval(str, new SimpleBindings(env));
+		}
+		catch (ScriptException e) {
+			Log.printStackTrace(e);
+			return Status.CANCEL_STATUS;
+		}
+		return Status.OK_STATUS;
+	}
+	
+	public static void main(String args[]) {}
+}

Property changes on: TXM/trunk/bundles/org.txm.ruby.core/src/org/txm/ruby/core/RubyScriptEngine.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.ruby.core/src/org/txm/ruby/core/RubyPreferences.java
===================================================================
--- TXM/trunk/bundles/org.txm.ruby.core/src/org/txm/ruby/core/RubyPreferences.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.ruby.core/src/org/txm/ruby/core/RubyPreferences.java	(revision 3659)
@@ -0,0 +1,25 @@
+package org.txm.ruby.core;
+
+import org.osgi.service.prefs.Preferences;
+import org.txm.core.preferences.TXMPreferences;
+
+public class RubyPreferences extends TXMPreferences {
+	
+	public static final String HOME = "home";
+	public static final String EXECUTABLE_FILENAME = "exec";
+	
+	@Override
+	public void initializeDefaultPreferences() {
+		super.initializeDefaultPreferences();
+		
+		Preferences preferences = getDefaultPreferencesNode();
+		
+	}
+	
+	public static TXMPreferences getInstance() {
+		if (!TXMPreferences.instances.containsKey(RubyPreferences.class)) {
+			new RubyPreferences();
+		}
+		return TXMPreferences.instances.get(RubyPreferences.class);
+	}
+}

Property changes on: TXM/trunk/bundles/org.txm.ruby.core/src/org/txm/ruby/core/RubyPreferences.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain


Property changes on: TXM/trunk/bundles/org.txm.ruby.core
___________________________________________________________________
Added: svn:ignore
   + bin

target


Index: TXM/trunk/bundles/org.txm.searchengine.rcp/build.properties
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.rcp/build.properties	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.rcp/build.properties	(revision 3659)
@@ -0,0 +1,6 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+               .,\
+               plugin.xml,\
+               OSGI-INF/l10n/bundle.properties

Property changes on: TXM/trunk/bundles/org.txm.searchengine.rcp/build.properties
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.rcp/OSGI-INF/l10n/bundle.properties
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.rcp/OSGI-INF/l10n/bundle.properties	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.rcp/OSGI-INF/l10n/bundle.properties	(revision 3659)
@@ -0,0 +1,2 @@
+#Properties file for org.txm.searchengine.rcp
+page.name = Search engines
\ No newline at end of file

Property changes on: TXM/trunk/bundles/org.txm.searchengine.rcp/OSGI-INF/l10n/bundle.properties
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.rcp/plugin.xml
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.rcp/plugin.xml	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.rcp/plugin.xml	(revision 3659)
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+   <extension
+         point="org.eclipse.ui.preferencePages">
+      <page
+            category="org.txm.rcp.preferences.AdvancePreferencePage"
+            class="org.txm.searchengine.rcp.preferences.SearchEnginePreferencesPage"
+            id="org.txm.searchengine.rcp.preferences.SearchEnginePreferencesPage"
+            name="%page.name">
+      </page>
+   </extension>
+
+</plugin>

Property changes on: TXM/trunk/bundles/org.txm.searchengine.rcp/plugin.xml
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.rcp/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.rcp/.settings/org.eclipse.jdt.core.prefs	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.rcp/.settings/org.eclipse.jdt.core.prefs	(revision 3659)
@@ -0,0 +1,7 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
+org.eclipse.jdt.core.compiler.compliance=1.8
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.8

Property changes on: TXM/trunk/bundles/org.txm.searchengine.rcp/.settings/org.eclipse.jdt.core.prefs
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.rcp/.classpath
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.rcp/.classpath	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.rcp/.classpath	(revision 3659)
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
+	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins">
+		<accessrules>
+			<accessrule kind="accessible" pattern="**"/>
+		</accessrules>
+	</classpathentry>
+	<classpathentry kind="src" path="src"/>
+	<classpathentry kind="output" path="bin"/>
+</classpath>

Property changes on: TXM/trunk/bundles/org.txm.searchengine.rcp/.classpath
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.rcp/META-INF/MANIFEST.MF
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.rcp/META-INF/MANIFEST.MF	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.rcp/META-INF/MANIFEST.MF	(revision 3659)
@@ -0,0 +1,8 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: org.txm.searchengine.rcp
+Bundle-SymbolicName: org.txm.searchengine.rcp;singleton:=true
+Bundle-Version: 1.0.0.qualifier
+Automatic-Module-Name: org.txm.searchengine.rcp
+BBundle-RequiredExecutionEnvironment: JavaSE-10
+Require-Bundle: org.txm.rcp;bundle-version="0.8.3"

Property changes on: TXM/trunk/bundles/org.txm.searchengine.rcp/META-INF/MANIFEST.MF
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.rcp/.project
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.rcp/.project	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.rcp/.project	(revision 3659)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>org.txm.searchengine.rcp</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.pde.ManifestBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.pde.SchemaBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.pde.PluginNature</nature>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+	</natures>
+</projectDescription>

Property changes on: TXM/trunk/bundles/org.txm.searchengine.rcp/.project
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.rcp/src/org/txm/searchengine/rcp/preferences/SearchEnginePreferencesPage.java
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.rcp/src/org/txm/searchengine/rcp/preferences/SearchEnginePreferencesPage.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.rcp/src/org/txm/searchengine/rcp/preferences/SearchEnginePreferencesPage.java	(revision 3659)
@@ -0,0 +1,43 @@
+package org.txm.searchengine.rcp.preferences;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+
+import org.eclipse.jface.preference.BooleanFieldEditor;
+import org.eclipse.jface.preference.ComboFieldEditor;
+import org.eclipse.ui.IWorkbench;
+import org.txm.Toolbox;
+import org.txm.core.engines.EngineType;
+import org.txm.rcp.preferences.RCPPreferencesPage;
+import org.txm.rcp.preferences.TXMPreferenceStore;
+import org.txm.searchengine.core.SearchEngine;
+import org.txm.searchengine.core.SearchEnginePreferences;
+import org.txm.searchengine.core.SearchEnginesManager;
+
+
+public class SearchEnginePreferencesPage extends RCPPreferencesPage {
+	
+	@Override
+	public void createFieldEditors() {
+		
+		SearchEnginesManager sem = (SearchEnginesManager) Toolbox.getEngineManager(EngineType.SEARCH);
+		HashMap<String, SearchEngine> engines = sem.getEngines();
+		ArrayList<String> keys = new ArrayList<>(engines.keySet());
+		Collections.sort(keys);
+		
+		String[][] choices2 = new String[engines.keySet().size()][2];
+		for (int i = 0; i < keys.size(); i++) {
+			choices2[i][0] = choices2[i][1] = engines.get(keys.get(i)).getName();
+		}
+		addField(new ComboFieldEditor(SearchEnginePreferences.DEFAULT_SEARCH_ENGINE, "Default searchengine", choices2, getFieldEditorParent()));
+		
+		addField(new BooleanFieldEditor(SearchEnginePreferences.SHOW_SEARCH_ENGINES, "Show available search engines", getFieldEditorParent()));
+		
+	}
+	
+	@Override
+	public void init(IWorkbench workbench) {
+		this.setPreferenceStore(new TXMPreferenceStore(SearchEnginePreferences.getInstance().getPreferencesNodeQualifier()));
+	}
+}

Property changes on: TXM/trunk/bundles/org.txm.searchengine.rcp/src/org/txm/searchengine/rcp/preferences/SearchEnginePreferencesPage.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain


Property changes on: TXM/trunk/bundles/org.txm.searchengine.rcp
___________________________________________________________________
Added: svn:ignore
   + target


Index: TXM/trunk/bundles/org.txm.searchengine.core/build.properties
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.core/build.properties	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.core/build.properties	(revision 3659)
@@ -0,0 +1,8 @@
+#Fri Jul 06 10:25:16 CEST 2018
+output..=bin/
+bin.includes = META-INF/,\
+               .,\
+               plugin.xml,\
+               OSGI-INF/
+source..=src/
+#qualifier=svn

Property changes on: TXM/trunk/bundles/org.txm.searchengine.core/build.properties
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.core/OSGI-INF/l10n/bundle.properties
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.core/OSGI-INF/l10n/bundle.properties	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.core/OSGI-INF/l10n/bundle.properties	(revision 3659)
@@ -0,0 +1,5 @@
+#TXM OSGI messages generated by the PluginMessagesManager class
+#Fri Jun 10 16:36:03 CEST 2022
+Bundle-Name=Searchengine core
+EngineManager.description=Manage the search engines
+extension-point.name=Search Engine

Property changes on: TXM/trunk/bundles/org.txm.searchengine.core/OSGI-INF/l10n/bundle.properties
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.core/plugin.xml
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.core/plugin.xml	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.core/plugin.xml	(revision 3659)
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>  
+   <extension-point id="org.txm.searchengine.core.SearchEngine" name="Search Engine" schema="schema/org.txm.searchengine.exsd"/>
+   <extension
+         point="org.txm.core.engines.EnginesManager">
+      <EngineManager
+            class="org.txm.searchengine.core.SearchEnginesManager"
+            description="Manage the search engines"
+            name="org.txm.searchengine.core.SearchEngines">
+      </EngineManager>
+   </extension>
+   <extension
+         point="org.eclipse.core.runtime.preferences">
+      <initializer
+            class="org.txm.searchengine.core.SearchEnginePreferences">
+      </initializer>
+   </extension>
+
+</plugin>

Property changes on: TXM/trunk/bundles/org.txm.searchengine.core/plugin.xml
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.core/.settings/org.eclipse.core.resources.prefs
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.core/.settings/org.eclipse.core.resources.prefs	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.core/.settings/org.eclipse.core.resources.prefs	(revision 3659)
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+encoding//src/org/txm/searchengine/core/messages/messages_fr.properties=UTF-8

Property changes on: TXM/trunk/bundles/org.txm.searchengine.core/.settings/org.eclipse.core.resources.prefs
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.core/.classpath
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.core/.classpath	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.core/.classpath	(revision 3659)
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="con"
+		path="org.eclipse.jdt.launching.JRE_CONTAINER" />
+	<classpathentry kind="con"
+		path="org.eclipse.pde.core.requiredPlugins">
+		<accessrules>
+			<accessrule kind="accessible" pattern="**" />
+		</accessrules>
+	</classpathentry>
+	<classpathentry kind="src" path="src" />
+	<classpathentry kind="output" path="bin" />
+</classpath>
\ No newline at end of file

Property changes on: TXM/trunk/bundles/org.txm.searchengine.core/.classpath
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.core/META-INF/MANIFEST.MF
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.core/META-INF/MANIFEST.MF	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.core/META-INF/MANIFEST.MF	(revision 3659)
@@ -0,0 +1,14 @@
+Manifest-Version: 1.0
+Export-Package: org.txm.searchengine.core,org.txm.searchengine.core.co
+ rpus,org.txm.searchengine.core.messages
+Bundle-SymbolicName: org.txm.searchengine.core;singleton:=true
+Bundle-Version: 1.0.0.qualifier
+Bundle-Name: Searchengine core
+Require-Bundle: org.txm.core;bundle-version="0.7.0";visibility:=reexpo
+ rt
+Bundle-ActivationPolicy: lazy
+Bundle-ManifestVersion: 2
+Bundle-RequiredExecutionEnvironment: JavaSE-16
+Bundle-Vendor: Textometrie.org
+Automatic-Module-Name: org.txm.searchengine.core
+

Property changes on: TXM/trunk/bundles/org.txm.searchengine.core/META-INF/MANIFEST.MF
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.core/schema/org.txm.searchengine.exsd
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.core/schema/org.txm.searchengine.exsd	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.core/schema/org.txm.searchengine.exsd	(revision 3659)
@@ -0,0 +1,102 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.txm.searchengine.core" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+      <appinfo>
+         <meta.schema plugin="org.txm.searchengine.core" id="org.txm.searchengine.core.SearchEngine" name="Search Engine"/>
+      </appinfo>
+      <documentation>
+         [Enter description of this extension point.]
+      </documentation>
+   </annotation>
+
+   <element name="extension">
+      <annotation>
+         <appinfo>
+            <meta.element />
+         </appinfo>
+      </annotation>
+      <complexType>
+         <choice minOccurs="1" maxOccurs="unbounded">
+            <element ref="SearchEngine"/>
+         </choice>
+         <attribute name="point" type="string" use="required">
+            <annotation>
+               <documentation>
+                  
+               </documentation>
+            </annotation>
+         </attribute>
+         <attribute name="id" type="string">
+            <annotation>
+               <documentation>
+                  
+               </documentation>
+            </annotation>
+         </attribute>
+         <attribute name="name" type="string">
+            <annotation>
+               <documentation>
+                  
+               </documentation>
+               <appinfo>
+                  <meta.attribute translatable="true"/>
+               </appinfo>
+            </annotation>
+         </attribute>
+      </complexType>
+   </element>
+
+   <element name="SearchEngine">
+      <complexType>
+         <attribute name="class" type="string">
+            <annotation>
+               <documentation>
+                  
+               </documentation>
+               <appinfo>
+                  <meta.attribute kind="java" basedOn="org.txm.searchengine.core.SearchEngine:"/>
+               </appinfo>
+            </annotation>
+         </attribute>
+      </complexType>
+   </element>
+
+   <annotation>
+      <appinfo>
+         <meta.section type="since"/>
+      </appinfo>
+      <documentation>
+         [Enter the first release in which this extension point appears.]
+      </documentation>
+   </annotation>
+
+   <annotation>
+      <appinfo>
+         <meta.section type="examples"/>
+      </appinfo>
+      <documentation>
+         [Enter extension point usage example here.]
+      </documentation>
+   </annotation>
+
+   <annotation>
+      <appinfo>
+         <meta.section type="apiinfo"/>
+      </appinfo>
+      <documentation>
+         [Enter API information here.]
+      </documentation>
+   </annotation>
+
+   <annotation>
+      <appinfo>
+         <meta.section type="implementation"/>
+      </appinfo>
+      <documentation>
+         [Enter information about supplied implementation of this extension point.]
+      </documentation>
+   </annotation>
+
+
+</schema>

Property changes on: TXM/trunk/bundles/org.txm.searchengine.core/schema/org.txm.searchengine.exsd
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.core/.project
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.core/.project	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.core/.project	(revision 3659)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>org.txm.searchengine.core</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.pde.ManifestBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.pde.SchemaBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.pde.PluginNature</nature>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+	</natures>
+</projectDescription>

Property changes on: TXM/trunk/bundles/org.txm.searchengine.core/.project
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.core/src/org/txm/searchengine/core/EmptySelection.java
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.core/src/org/txm/searchengine/core/EmptySelection.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.core/src/org/txm/searchengine/core/EmptySelection.java	(revision 3659)
@@ -0,0 +1,58 @@
+package org.txm.searchengine.core;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.txm.objects.Match;
+
+public class EmptySelection extends Selection {
+	
+	private static final List<? extends Match> EMPTY = new ArrayList<Match>();
+	protected IQuery query;
+	
+	public EmptySelection(IQuery query) {
+		this.query = query;
+	}
+
+	public List<? extends Match> getMatches() {
+		return EMPTY;
+	}
+	
+	public List<? extends Match> getMatches(int from, int to) {
+		return EMPTY;
+	}
+	
+	public int getNMatch() {
+		return 0;
+	}
+	
+	public IQuery getQuery() {
+		return query;
+	}
+
+	@Override
+	public boolean isTargetUsed() {
+		return false;
+	}
+
+	@Override
+	public void drop() throws Exception {
+	}
+
+	@Override
+	public boolean delete(int iMatch) {
+		// nothing to do
+		return false;
+	}
+
+	@Override
+	public boolean delete(Match match) {
+		// nothing to do
+		return false;
+	}
+
+	@Override
+	public boolean delete(ArrayList<Match> matchesToRemove) {
+		return false;
+	}
+}

Property changes on: TXM/trunk/bundles/org.txm.searchengine.core/src/org/txm/searchengine/core/EmptySelection.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.core/src/org/txm/searchengine/core/ISearchEngine.java
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.core/src/org/txm/searchengine/core/ISearchEngine.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.core/src/org/txm/searchengine/core/ISearchEngine.java	(revision 3659)
@@ -0,0 +1,24 @@
+package org.txm.searchengine.core;
+
+import org.txm.core.engines.Engine;
+import org.txm.objects.CorpusBuild;
+
+public interface ISearchEngine extends Engine {
+	
+	public Selection query(CorpusBuild corpus, IQuery query, String name, boolean saveQuery) throws Exception;
+	
+	/**
+	 * 
+	 * @return an empty Query for the engine implementation
+	 */
+	public IQuery newQuery();
+
+	/**
+	 * 
+	 * @param corpus
+	 * @return true if the Engine can query the corpus
+	 */
+	public abstract boolean hasIndexes(CorpusBuild corpus);
+	
+	public String getDetails();
+}

Property changes on: TXM/trunk/bundles/org.txm.searchengine.core/src/org/txm/searchengine/core/ISearchEngine.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.core/src/org/txm/searchengine/core/Property.java
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.core/src/org/txm/searchengine/core/Property.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.core/src/org/txm/searchengine/core/Property.java	(revision 3659)
@@ -0,0 +1,59 @@
+// Copyright © 2010-2020 ENS de Lyon., University of Franche-Comté
+// 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: 2013-05-06 17:38:43 +0200 (lun., 06 mai 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.searchengine.core;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class Property.
+ */
+public abstract class Property {
+	
+	protected String name;
+	
+	public Property(String name) {
+		this.name = name;
+	}
+		
+	/* (non-Javadoc)
+	 * @see java.lang.Object#toString()
+	 */
+	@Override
+	public String toString() {
+		return name;
+	}
+	
+	public String getName() {
+		return name;
+	}
+	
+	public abstract SearchEngine getSearchEngine();
+
+	public abstract int[] cpos2Id(int[] positions) throws Exception;
+	
+	public abstract String[] id2Str(int[] positions) throws Exception;
+}

Property changes on: TXM/trunk/bundles/org.txm.searchengine.core/src/org/txm/searchengine/core/Property.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.core/src/org/txm/searchengine/core/Query.java
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.core/src/org/txm/searchengine/core/Query.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.core/src/org/txm/searchengine/core/Query.java	(revision 3659)
@@ -0,0 +1,266 @@
+// Copyright © 2010-2020 ENS de Lyon., University of Franche-Comté
+// 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: 2015-05-13 09:46:56 +0200 (Wed, 13 May 2015) $
+// $LastChangedRevision: 2967 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.searchengine.core;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.txm.core.preferences.TXMPreferences;
+import org.txm.utils.logger.Log;
+
+/**
+ * Implements a SearchEngine generic query with a query and a search engine.
+ * 
+ * TODO stop using CQLQuery and TIGERQuery with this class
+ */
+
+public class Query implements IQuery {
+	
+	public Query() {
+		
+	}
+	
+	/**
+	 * Converts the specified list of Query to a string.
+	 * Queries strings are separated by a tabulation.
+	 * 
+	 * @param queries
+	 * @return
+	 */
+	public static String queriesToString(List<Query> queries) {
+		if (queries == null) return "";
+		StringBuilder str = new StringBuilder();
+		for (int i = 0; i < queries.size(); i++) {
+			if (i > 0) {
+				str.append(TXMPreferences.LIST_SEPARATOR);
+			}
+			Query q = queries.get(i);
+			str.append(q.getQueryString());
+			str.append(TXMPreferences.LIST_SEPARATOR + q.getSearchEngine().getName());
+		}
+		return str.toString();
+	}
+	
+	public boolean canBeMultiLine() {
+		return false;
+	}
+			
+	/**
+	 * Converts the specified string to a list of Query.
+	 * Input string must contains queries separated by a tabulation.
+	 * 
+	 * A query is composed of a engine name + tabulation + query
+	 * 
+	 * if the String list is odd, the 
+	 * 
+	 * @param str
+	 * @return
+	 */
+	public static List<Query> stringToQueries(String str) {
+		
+		ArrayList<Query> queries = new ArrayList<>();
+		if (str == null || str.length() == 0) {
+			return queries;
+		}
+		String[] split = str.split(TXMPreferences.LIST_SEPARATOR);
+			
+			for (int i = 0; i + 1 < split.length; i = i + 2) {
+				String s = split[i];
+				String eName = split[i+1];
+				SearchEngine e = SearchEnginesManager.getSearchEngine(eName);
+				if (e == null) {
+					Log.warning("Error: unknown search engine: "+eName);
+					continue;
+				}
+				
+				Query q = e.newQuery();
+				q.setQuery(s);
+				queries.add(q);
+			}
+		return queries;
+	}
+	
+	/**
+	 * Converts the specified string to a Query.
+	 * Input string must contains queries separated by a tabulation.
+	 * 
+	 * @param str
+	 * @return
+	 */
+	public static Query stringToQuery(String str) {
+		
+		String[] split = str.split(TXMPreferences.LIST_SEPARATOR, 2);
+		String eName = "CQP";
+		if (split[1] != null) {
+			eName = split[1];
+		}
+		
+		SearchEngine e = SearchEnginesManager.getSearchEngine(eName);
+		return new Query(split[0], e);
+	}
+	
+	
+	/**
+	 * The query string.
+	 */
+	protected SearchEngine engine = null;
+	
+	/**
+	 * The query string.
+	 */
+	protected String queryString = "";
+	
+	/**
+	 * The query friendly name.
+	 */
+	protected String friendlyName = "";
+	
+	/**
+	 * Instantiates a new query.
+	 * 
+	 * @param queryString
+	 *            the query string
+	 * 
+	 *            public Query(String queryString){
+	 *            this.queryString=queryString.trim(); }
+	 */
+	public Query(String queryString, SearchEngine engine) {
+		if (queryString != null) {
+			this.queryString = queryString.trim();
+		}
+		else {
+			this.queryString = "";
+		}
+		
+		this.engine = engine;
+	}
+	
+	@Override
+	public Query setName(String name) {
+		this.friendlyName = name;
+		return this;
+	}
+	
+	@Override
+	public String getName() {
+		if (friendlyName == null || friendlyName.length() == 0) return queryString;
+		
+		return friendlyName;
+	}
+	
+	@Override
+	public boolean equals(IQuery q) {
+		return this.engine.equals(q.getSearchEngine()) && this.getQueryString().equals(q.getQueryString());
+	}
+	
+	@Override
+	public boolean equals(Object obj) {
+		
+		if (obj == null) return false;
+		
+		if (!(obj instanceof Query)) {
+			return false;
+		}
+		if (this.queryString == null) return false;
+		if (this.engine == null) return false;
+		
+		return this.queryString.equals(((Query) obj).queryString) && this.engine.equals(((Query) obj).engine);
+	}
+	
+	@Override
+	public IQuery fixQuery(String lang) {
+		return new Query(queryString, this.engine);
+	}
+	
+	
+	/**
+	 * Gets the query string.
+	 * 
+	 * @return the query string
+	 */
+	@Override
+	public final String getQueryString() {
+		return queryString;
+	}
+	
+	@Override
+	public SearchEngine getSearchEngine() {
+		return engine;
+	}
+	
+	/**
+	 * Checks whatever the query is empty (null, empty or contains only double quotes) or not.
+	 * 
+	 * @return true if empty otherwise false
+	 */
+	@Override
+	public boolean isEmpty() {
+		return queryString == null || queryString.length() == 0 || "\"\"".equals(queryString);
+	}
+	
+	@Override
+	public IQuery setQuery(String rawQuery) {
+		queryString = rawQuery;
+		return this;
+	}
+	
+	/**
+	 * Creates a readable formated string from the query.
+	 * 
+	 * @return
+	 */
+	@Override
+	public String asString() {
+		return (friendlyName != null?friendlyName:"")+"<" + this.queryString + ">"; //$NON-NLS-1$ //$NON-NLS-2$
+	}
+	
+	
+	/*
+	 * (non-Javadoc)
+	 * @see java.lang.Object#toString()
+	 */
+	@Override
+	public String toString() {
+		return queryString;
+	}
+
+	public static Object toPrettyString(List<Query> queries) {
+		
+		if (queries == null) return "";
+		StringBuilder str = new StringBuilder();
+		for (int i = 0; i < queries.size(); i++) {
+			if (i > 0) {
+				str.append(TXMPreferences.LIST_SEPARATOR);
+			}
+			Query q = queries.get(i);
+			str.append(q.getQueryString());
+			//str.append(TXMPreferences.LIST_SEPARATOR + q.getSearchEngine().getName());
+		}
+		return str.toString();
+	}
+}

Property changes on: TXM/trunk/bundles/org.txm.searchengine.core/src/org/txm/searchengine/core/Query.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.core/src/org/txm/searchengine/core/Selection.java
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.core/src/org/txm/searchengine/core/Selection.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.core/src/org/txm/searchengine/core/Selection.java	(revision 3659)
@@ -0,0 +1,27 @@
+package org.txm.searchengine.core;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.txm.objects.Match;
+
+public abstract class Selection {
+	
+	public abstract List<? extends Match> getMatches() throws Exception;
+	
+	public abstract List<? extends Match> getMatches(int from, int to) throws Exception;
+	
+	public abstract int getNMatch() throws Exception;
+	
+	public abstract IQuery getQuery();
+
+	public abstract boolean isTargetUsed() throws Exception;
+
+	public abstract void drop() throws Exception;
+	
+	public abstract boolean delete(int iMatch);
+	
+	public abstract boolean delete(Match match);
+
+	public abstract boolean delete(ArrayList<Match> matchesToRemove);
+}

Property changes on: TXM/trunk/bundles/org.txm.searchengine.core/src/org/txm/searchengine/core/Selection.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.core/src/org/txm/searchengine/core/messages/messages.properties
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.core/src/org/txm/searchengine/core/messages/messages.properties	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.core/src/org/txm/searchengine/core/messages/messages.properties	(revision 3659)
@@ -0,0 +1,19 @@
+#TXM messages generated by the PluginMessagesManager class
+#Fri Jun 10 16:36:03 CEST 2022
+deletingQueryResultP0=Deleting query result {0}…
+deletingSubcorpusP0=Deleting sub-corpus {0}…
+info_computingCorpusP0=Computing corpus {0}...
+info_computingPartXWithQueryZ=Computing the part {0} with query {1}...
+info_computingTheP0PartitionOfTheP1Corpus=Partition {0} of {1} corpus...
+info_computingTheP0SubCorpusOfP1CommaQueryP2=Sub-corpus {0} of {1} {2}...
+info_computingTheP0SubCorpusOfP1CommaStructureP2CommaPropertyP3ColonP4=Sub-corpus {0} of {1}, structure {2}, property {3}\: {4}...
+info_creatingNewPartition=Creating partition {1} of corpus {0}…
+info_creatingSubcorpusXFromCorpusYWithTheQueryZ=Creating sub-corpus {0} of corpus {1} with the query {2}…
+info_deletingPartition=Deleting partition {0}…
+info_doneP0Parts={0} parts.
+info_partCreatedInXMs=Part {0} created in {1} ms.
+info_partitionCreatedInXMs=Partition {0} created in {1} ms.
+info_searchEngineStopped=Search engine stopped.
+info_stoppingSearchEngine=Stopping the search engine…
+sizeOfSubcorpusP0P1ComputedInP2Ms=Size of subcorpus {0} ({1}) computed in {2} ms.
+subcorpusP0CreatedInP1Ms=Sub-corpus {0} created in {1} ms.

Property changes on: TXM/trunk/bundles/org.txm.searchengine.core/src/org/txm/searchengine/core/messages/messages.properties
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.core/src/org/txm/searchengine/core/messages/messages_fr.properties
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.core/src/org/txm/searchengine/core/messages/messages_fr.properties	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.core/src/org/txm/searchengine/core/messages/messages_fr.properties	(revision 3659)
@@ -0,0 +1,19 @@
+#TXM messages generated by the PluginMessagesManager class
+#Fri Jun 10 16:36:03 CEST 2022
+deletingQueryResultP0=Suppression du résultat de requête {0}…
+deletingSubcorpusP0=Suppression du sous-corpus {0}…
+info_computingCorpusP0=Calcul du corpus {0}...
+info_computingPartXWithQueryZ=Création de la partie {0} avec la requête {1}...
+info_computingTheP0PartitionOfTheP1Corpus=Partition {0} du corpus {1}...
+info_computingTheP0SubCorpusOfP1CommaQueryP2=Sous-corpus {0} de {1} {2}...
+info_computingTheP0SubCorpusOfP1CommaStructureP2CommaPropertyP3ColonP4=Sous-corpus {0} de {1}, structure {2}, propriété {3} \: {4}...
+info_creatingNewPartition=Création de la partition {1} du corpus {0}…
+info_creatingSubcorpusXFromCorpusYWithTheQueryZ=Création du sous-corpus {0} du corpus {1} avec la requête {2}…
+info_deletingPartition=Suppression de la partition {0}…
+info_doneP0Parts={0} parties.
+info_partCreatedInXMs=Partie {0} créée en {1} ms.
+info_partitionCreatedInXMs=Partition {0} créée en {1} ms.
+info_searchEngineStopped=Moteur de recherche arrêté.
+info_stoppingSearchEngine=Arrêt du moteur de recherche…
+sizeOfSubcorpusP0P1ComputedInP2Ms=Taille du sous-corpus {0} ({1}) calculée en {2} ms.
+subcorpusP0CreatedInP1Ms=Sous-corpus {0} créé en {1} ms.

Property changes on: TXM/trunk/bundles/org.txm.searchengine.core/src/org/txm/searchengine/core/messages/messages_fr.properties
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.core/src/org/txm/searchengine/core/messages/SearchEngineCoreMessages.java
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.core/src/org/txm/searchengine/core/messages/SearchEngineCoreMessages.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.core/src/org/txm/searchengine/core/messages/SearchEngineCoreMessages.java	(revision 3659)
@@ -0,0 +1,64 @@
+package org.txm.searchengine.core.messages;
+
+import org.eclipse.osgi.util.NLS;
+import org.txm.utils.messages.Utf8NLS;
+
+
+/**
+ * Search engine core messages.
+ * 
+ * @author mdecorde
+ * @author sjacquot
+ *
+ */
+public class SearchEngineCoreMessages extends NLS {
+	
+	private static final String BUNDLE_NAME = "org.txm.searchengine.core.messages.messages"; //$NON-NLS-1$
+	
+	public static String info_creatingNewPartition;
+	
+	public static String info_deletingPartition;
+	
+	public static String info_partCreatedInXMs;
+	
+	public static String info_partitionCreatedInXMs;
+	
+	public static String deletingQueryResultP0;
+	
+	public static String info_computingPartXWithQueryZ;
+	
+	public static String info_creatingSubcorpusXFromCorpusYWithTheQueryZ;
+	
+	public static String info_computingTheP0SubCorpusOfP1CommaStructureP2CommaPropertyP3ColonP4;
+	
+	public static String info_computingTheP0SubCorpusOfP1CommaQueryP2;
+	
+	public static String deletingSubcorpusP0;
+	
+	public static String sizeOfSubcorpusP0P1ComputedInP2Ms;
+	
+	public static String info_searchEngineStopped;
+	
+	public static String info_stoppingSearchEngine;
+	
+	public static String subcorpusP0CreatedInP1Ms;
+	
+	
+	
+	public static String info_computingTheP0PartitionOfTheP1Corpus;
+	
+	public static String info_computingCorpusP0;
+	
+	public static String info_doneP0Parts;
+	
+	
+	
+	
+	static {
+		// initialize resource bundle
+		Utf8NLS.initializeMessages(BUNDLE_NAME, SearchEngineCoreMessages.class);
+	}
+	
+	private SearchEngineCoreMessages() {}
+	
+}

Property changes on: TXM/trunk/bundles/org.txm.searchengine.core/src/org/txm/searchengine/core/messages/SearchEngineCoreMessages.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.core/src/org/txm/searchengine/core/SearchEnginesManager.java
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.core/src/org/txm/searchengine/core/SearchEnginesManager.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.core/src/org/txm/searchengine/core/SearchEnginesManager.java	(revision 3659)
@@ -0,0 +1,67 @@
+package org.txm.searchengine.core;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.txm.Toolbox;
+import org.txm.core.engines.EngineType;
+import org.txm.core.engines.EnginesManager;
+import org.txm.objects.CorpusBuild;
+
+/**
+ * Search engines manager.
+ * 
+ * @author mdecorde
+ *
+ */
+// FIXME: useless class, the type and priority/order should be defined in org.txm.core.engines.EnginesManager extension point
+public class SearchEnginesManager extends EnginesManager<SearchEngine> {
+	
+	private static final long serialVersionUID = 8476457980915443357L;
+	
+	/**
+	 * 
+	 * @return
+	 */
+	public static SearchEngine getCQPSearchEngine() {
+		return (SearchEngine) Toolbox.getEngineManager(EngineType.SEARCH).getEngine("CQP"); //$NON-NLS-1$
+	}
+	
+	/**
+	 * 
+	 * @return
+	 */
+	public static SearchEngine getTIGERSearchEngine() {
+		return (SearchEngine) Toolbox.getEngineManager(EngineType.SEARCH).getEngine("TIGER"); //$NON-NLS-1$
+	}
+	
+	/**
+	 * 
+	 * @return
+	 */
+	public static SearchEngine getSearchEngine(String name) {
+		return (SearchEngine) Toolbox.getEngineManager(EngineType.SEARCH).getEngine(name);
+	}
+	
+	@Override
+	public boolean fetchEngines() {
+		return this.fetchEngines(SearchEngine.EXTENSION_POINT_ID);
+	}
+	
+	@Override
+	public EngineType getEnginesType() {
+		return EngineType.SEARCH;
+	}
+	
+	public static List<SearchEngine> getAvailableEngines(CorpusBuild corpus) {
+		List<SearchEngine> availables = new ArrayList<>();
+		SearchEnginesManager em = (SearchEnginesManager) Toolbox.getEngineManager(EngineType.SEARCH);
+		for (String name : em.getEngines().keySet()) {
+			SearchEngine engine = em.getEngine(name);
+			if (engine.hasIndexes(corpus)) {
+				availables.add(engine);
+			}
+		}
+		return availables;
+	}
+}

Property changes on: TXM/trunk/bundles/org.txm.searchengine.core/src/org/txm/searchengine/core/SearchEnginesManager.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.core/src/org/txm/searchengine/core/SearchEngine.java
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.core/src/org/txm/searchengine/core/SearchEngine.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.core/src/org/txm/searchengine/core/SearchEngine.java	(revision 3659)
@@ -0,0 +1,68 @@
+package org.txm.searchengine.core;
+
+import java.util.List;
+
+import org.txm.core.engines.Engine;
+import org.txm.objects.CorpusBuild;
+import org.txm.objects.Match;
+import org.txm.utils.LogMonitor;
+
+// FIXME: useless class
+public abstract class SearchEngine implements ISearchEngine {
+
+	public static final String EXTENSION_POINT_ID = SearchEngine.class.getCanonicalName();
+
+	@Override
+	public abstract String getName();
+	
+	public boolean start() throws Exception {
+		return start(new LogMonitor("Starting "+getName()));
+	}
+	
+	public abstract Selection query(CorpusBuild corpus, IQuery query, String name, boolean saveQuery) throws Exception;
+	
+	public abstract Query newQuery();
+
+	/**
+	 * 
+	 * @param corpus
+	 * @return true if the Engine can query the corpus
+	 */
+	public abstract boolean hasIndexes(CorpusBuild corpus);
+	
+	public String getDetails() {
+		return this.getClass()+ " "+this.toString();
+	}
+	
+	public boolean equals(SearchEngine e) {
+		
+		if (e == null) return false;
+		if (this.getName() == null) return false;
+		
+		return this.getName().equals(e.getName());
+	}
+	
+	/**
+	 * 
+	 * @param match
+	 * @param property
+	 * @return the first position property value
+	 */
+	public abstract String getValueForProperty(Match match, SearchEngineProperty property);
+	
+	/**
+	 * 
+	 * @param match
+	 * @param property
+	 * @return the positions property value
+	 */
+	public abstract List<String> getValuesForProperty(Match match, SearchEngineProperty property);
+
+	/**
+	 * 
+	 * @return indicates if the SearchEngine queries need mumltiple lines to be written
+	 */
+	public boolean hasMultiLineQueries() {
+		return false;
+	}
+}

Property changes on: TXM/trunk/bundles/org.txm.searchengine.core/src/org/txm/searchengine/core/SearchEngine.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.core/src/org/txm/searchengine/core/corpus/CorpusSearchException.java
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.core/src/org/txm/searchengine/core/corpus/CorpusSearchException.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.core/src/org/txm/searchengine/core/corpus/CorpusSearchException.java	(revision 3659)
@@ -0,0 +1,17 @@
+package org.txm.searchengine.core.corpus;
+
+public class CorpusSearchException extends Exception {
+
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = 3518861723206508596L;
+
+	public CorpusSearchException(String message) {
+		super(message);
+	}
+
+	public CorpusSearchException(String message, Throwable cause) {
+		super(message, cause);
+	}
+}

Property changes on: TXM/trunk/bundles/org.txm.searchengine.core/src/org/txm/searchengine/core/corpus/CorpusSearchException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.core/src/org/txm/searchengine/core/QueryBasedTXMResult.java
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.core/src/org/txm/searchengine/core/QueryBasedTXMResult.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.core/src/org/txm/searchengine/core/QueryBasedTXMResult.java	(revision 3659)
@@ -0,0 +1,34 @@
+package org.txm.searchengine.core;
+
+import org.txm.core.results.TXMResult;
+
+/**
+ * abstract class of result built on query
+ * 
+ * @author mdecorde
+ *
+ */
+public abstract class QueryBasedTXMResult extends TXMResult {
+	
+
+	public QueryBasedTXMResult(String parametersNodePath) {
+		
+		super(parametersNodePath);
+	}
+	
+	public QueryBasedTXMResult(String parametersNodePath, TXMResult parent) {
+		
+		super(parametersNodePath, parent);
+	}
+	
+	public QueryBasedTXMResult(TXMResult parent) {
+		
+		super(parent);
+	}
+
+	/**
+	 * 
+	 * @return a query based on the result parameters
+	 */
+	public abstract IQuery getQuery();
+}

Property changes on: TXM/trunk/bundles/org.txm.searchengine.core/src/org/txm/searchengine/core/QueryBasedTXMResult.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.core/src/org/txm/searchengine/core/SearchEnginePreferences.java
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.core/src/org/txm/searchengine/core/SearchEnginePreferences.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.core/src/org/txm/searchengine/core/SearchEnginePreferences.java	(revision 3659)
@@ -0,0 +1,41 @@
+package org.txm.searchengine.core;
+
+import org.osgi.service.prefs.Preferences;
+import org.txm.core.preferences.TXMPreferences;
+
+
+public class SearchEnginePreferences extends TXMPreferences {
+	
+	/**
+	 * contains the last bundle version setting the TreeTagger models directory
+	 */
+	public static final String DEFAULT_SEARCH_ENGINE = "default_search_engine"; //$NON-NLS-1$
+	
+	/**
+	 * if set, the available search engines are shown in TXM interfaces
+	 */
+	public static final String SHOW_SEARCH_ENGINES = "show_search_engines"; //$NON-NLS-1$
+	
+	/**
+	 * Gets the instance.
+	 * 
+	 * @return the instance
+	 */
+	public static TXMPreferences getInstance() {
+		if (!TXMPreferences.instances.containsKey(SearchEnginePreferences.class)) {
+			new SearchEnginePreferences();
+		}
+		return TXMPreferences.instances.get(SearchEnginePreferences.class);
+	}
+	
+	@Override
+	public void initializeDefaultPreferences() {
+		super.initializeDefaultPreferences();
+		
+		// Default preferences if no org.txm.udpipe.core fragment is found
+		Preferences preferences = this.getDefaultPreferencesNode();
+		
+		preferences.put(DEFAULT_SEARCH_ENGINE, "CQP");
+		preferences.putBoolean(SHOW_SEARCH_ENGINES, true);
+	}
+}

Property changes on: TXM/trunk/bundles/org.txm.searchengine.core/src/org/txm/searchengine/core/SearchEnginePreferences.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.core/src/org/txm/searchengine/core/IQuery.java
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.core/src/org/txm/searchengine/core/IQuery.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.core/src/org/txm/searchengine/core/IQuery.java	(revision 3659)
@@ -0,0 +1,88 @@
+package org.txm.searchengine.core;
+
+import org.eclipse.osgi.util.NLS;
+
+/**
+ * Represent a search engine query
+ * 
+ * @author mdecorde
+ *
+ */
+public interface IQuery {
+	
+	public String getQueryString();
+	
+	public boolean isEmpty();
+	
+	/**
+	 * 
+	 * @return the Query SearchEngine that can resolve the query
+	 */
+	public SearchEngine getSearchEngine();
+	
+	/**
+	 * update the query
+	 * 
+	 * @param rawQuery
+	 * @return this
+	 */
+	public IQuery setQuery(String rawQuery);
+	
+	/**
+	 * update the query name
+	 * 
+	 * @param rawQuery
+	 * @return this
+	 */
+	public String getName();
+	
+	/**
+	 * update the query name for frienddier access
+	 * 
+	 * @param name
+	 * @return this
+	 */
+	public IQuery setName(String name);
+	
+	/**
+	 * fix the query using sugar syntax rules
+	 * 
+	 * @return this
+	 */
+	public IQuery fixQuery(String lang);
+	
+	public boolean equals(IQuery q);
+	
+	public String asString();
+	
+	public boolean canBeMultiLine();
+	
+	public static String toPrefString(IQuery query) {
+		return query.getSearchEngine().getName()+"\t"+query.getQueryString();
+	}
+	
+	public static IQuery fromPrefString(String prefString) {
+		
+		String[] split = prefString.split("\t", 2);
+		
+		String engineName = null;
+		String queryString = null;
+		
+		
+		if (split.length == 2) {
+			engineName = split[0];
+			queryString = split[1];
+		} else {
+			engineName = "CQP";
+			queryString = split[0];
+		}
+		
+		SearchEngine se = SearchEnginesManager.getSearchEngine(engineName);
+		if (se == null) {
+			throw new IllegalArgumentException(NLS.bind("No SearchEngine {0} found.", engineName));
+		}
+		IQuery query = se.newQuery();
+		query.setQuery(queryString);
+		return query;
+	}
+}

Property changes on: TXM/trunk/bundles/org.txm.searchengine.core/src/org/txm/searchengine/core/IQuery.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.core/src/org/txm/searchengine/core/SearchEngineProperty.java
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.core/src/org/txm/searchengine/core/SearchEngineProperty.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.core/src/org/txm/searchengine/core/SearchEngineProperty.java	(revision 3659)
@@ -0,0 +1,23 @@
+package org.txm.searchengine.core;
+
+/**
+ * A SearchEngine queryable property for match positions
+ * 
+ * @author mdecorde
+ *
+ */
+public interface SearchEngineProperty {
+	
+	/**
+	 * 
+	 * @return the property uniq name in the queried corpus
+	 */
+	public String getName();
+	
+	/**
+	 * 
+	 * @return the property uniq name in the queried corpus
+	 */
+	public String getFullName();
+
+}

Property changes on: TXM/trunk/bundles/org.txm.searchengine.core/src/org/txm/searchengine/core/SearchEngineProperty.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain


Property changes on: TXM/trunk/bundles/org.txm.searchengine.core
___________________________________________________________________
Added: svn:ignore
   + bin

target


Index: TXM/trunk/bundles/org.txm.searchengine.cqp.rcp/OSGI-INF/l10n/bundle_ru.properties
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.rcp/OSGI-INF/l10n/bundle_ru.properties	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.rcp/OSGI-INF/l10n/bundle_ru.properties	(revision 3659)
@@ -0,0 +1,10 @@
+#TXM OSGI messages generated by the PluginMessagesManager class
+#Wed Jul 27 14:52:25 CEST 2022
+command.label.148=ÃÂÃÂÃÂºÃÂÃÂÃÂÃÂ ÃÂ±ÃÂ¸ÃÂ±ÃÂ»ÃÂ¸ÃÂ¾ÃÂ³ÃÂÃÂ°ÃÂÃÂ¸ÃÂÃÂµÃÂÃÂºÃÂÃÂ ÃÂ·ÃÂ°ÃÂ¿ÃÂ¸ÃÂÃÂ
+command.label.36=ÃÂÃÂ¾ÃÂ±ÃÂ°ÃÂ²ÃÂ¸ÃÂÃÂ ÃÂ¿ÃÂÃÂ¾ÃÂµÃÂºÃÂ
+command.name=ÃÂÃÂ¾ÃÂ´ÃÂºÃÂ¾ÃÂÃÂ¿ÃÂÃÂ
+command.name.2=ÃÂ ÃÂ°ÃÂ·ÃÂ±ÃÂ¸ÃÂ²ÃÂºÃÂ°
+command.name.52=ÃÂÃÂ¾ÃÂÃÂ¿ÃÂÃÂ ÃÂ² ÃÂ±ÃÂ¸ÃÂ½ÃÂ°ÃÂÃÂ½ÃÂ¾ÃÂ¼ ÃÂÃÂ¾ÃÂÃÂ¼ÃÂ°ÃÂÃÂµ...
+command.name.63=ÃÂÃÂÃÂºÃÂÃÂÃÂÃÂ ÃÂ¿ÃÂ°ÃÂÃÂ¿ÃÂ¾ÃÂÃÂ ÃÂÃÂµÃÂºÃÂÃÂÃÂ°
+command.tooltip.4=ÃÂ¡ÃÂ¾ÃÂ·ÃÂ´ÃÂ°ÃÂÃÂ ÃÂ ÃÂ°ÃÂ·ÃÂ±ÃÂ¸ÃÂ²ÃÂºÃÂ
+command.tooltip.71=ÃÂ¡ÃÂ¾ÃÂÃÂÃÂ°ÃÂ½ÃÂ¸ÃÂÃÂ ÃÂºÃÂ°ÃÂº ÃÂ±ÃÂ¸ÃÂ½ÃÂ°ÃÂÃÂ½ÃÂÃÂ¹ ÃÂÃÂ°ÃÂ¹ÃÂ»

Property changes on: TXM/trunk/bundles/org.txm.searchengine.cqp.rcp/OSGI-INF/l10n/bundle_ru.properties
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.rcp/OSGI-INF/l10n/bundle_fr.properties
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.rcp/OSGI-INF/l10n/bundle_fr.properties	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.rcp/OSGI-INF/l10n/bundle_fr.properties	(revision 3659)
@@ -0,0 +1,33 @@
+#TXM OSGI messages generated by the PluginMessagesManager class
+#Wed Jul 27 14:52:25 CEST 2022
+Bundle-Name=CQP RCP
+command.label=Soustraire
+command.label.0=Ajouter
+command.label.1=Intersection
+command.label.148=Ouvrir la fiche bibliographique
+command.label.2=Soustraire
+command.label.3=Ajouter
+command.label.36=Ajouter un Projet
+command.label.4=Intersection
+command.label.5=
+command.label.6=
+command.label.65=Supprimer
+command.label.7=
+command.label.8=Partition
+command.name=Sous-corpus
+command.name.0=Soustraire
+command.name.1=Ajouter
+command.name.2=Partition
+command.name.3=Intersection
+command.name.52=Corpus en format binaire (.txm)...
+command.name.63=Ouvrir la fiche bibliographique
+command.tooltip=Soustraire
+command.tooltip.0=Soustraire
+command.tooltip.1=Soustraire
+command.tooltip.4=Construire une partition
+command.tooltip.71=Exporter en fichier binaire
+commandParameter.name=editer
+editor.name=Sous-corpus
+editor.name.0=Partition
+page.name=CQP
+page.name.0=Sous-corpus

Property changes on: TXM/trunk/bundles/org.txm.searchengine.cqp.rcp/OSGI-INF/l10n/bundle_fr.properties
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.rcp/OSGI-INF/l10n/bundle.properties
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.rcp/OSGI-INF/l10n/bundle.properties	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.rcp/OSGI-INF/l10n/bundle.properties	(revision 3659)
@@ -0,0 +1,33 @@
+#TXM OSGI messages generated by the PluginMessagesManager class
+#Wed Jul 27 14:52:25 CEST 2022
+Bundle-Name=CQP RCP
+command.label=Substract
+command.label.0=Add
+command.label.1=Intersect
+command.label.148=Open biblio
+command.label.2=Substract
+command.label.3=Add
+command.label.36=Add Project
+command.label.4=Intersect
+command.label.5=
+command.label.6=
+command.label.65=Delete
+command.label.7=
+command.label.8=Partition
+command.name=Subcorpus
+command.name.0=Substraction
+command.name.1=Union
+command.name.2=Create Partition
+command.name.3=Intersect
+command.name.52=Corpus in binary format...
+command.name.63=Open Biblio
+command.tooltip=Substract
+command.tooltip.0=Substract
+command.tooltip.1=Substract
+command.tooltip.4=Build a partition
+command.tooltip.71=Export as a binary file
+commandParameter.name=edit
+editor.name=Subcorpus
+editor.name.0=Partition
+page.name=CQP
+page.name.0=Subcorpus

Property changes on: TXM/trunk/bundles/org.txm.searchengine.cqp.rcp/OSGI-INF/l10n/bundle.properties
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.rcp/icons/functions/information.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: TXM/trunk/bundles/org.txm.searchengine.cqp.rcp/icons/functions/information.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.rcp/icons/functions/subcorpus.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: TXM/trunk/bundles/org.txm.searchengine.cqp.rcp/icons/functions/subcorpus.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.rcp/icons/functions/union.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: TXM/trunk/bundles/org.txm.searchengine.cqp.rcp/icons/functions/union.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.rcp/icons/functions/partition.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: TXM/trunk/bundles/org.txm.searchengine.cqp.rcp/icons/functions/partition.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.rcp/icons/functions/compress.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: TXM/trunk/bundles/org.txm.searchengine.cqp.rcp/icons/functions/compress.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.rcp/icons/functions/minus.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: TXM/trunk/bundles/org.txm.searchengine.cqp.rcp/icons/functions/minus.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.rcp/icons/functions/biblio.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: TXM/trunk/bundles/org.txm.searchengine.cqp.rcp/icons/functions/biblio.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.rcp/icons/functions/inter.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: TXM/trunk/bundles/org.txm.searchengine.cqp.rcp/icons/functions/inter.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.rcp/icons/functions/delete.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: TXM/trunk/bundles/org.txm.searchengine.cqp.rcp/icons/functions/delete.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.rcp/plugin.xml
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.rcp/plugin.xml	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.rcp/plugin.xml	(revision 3659)
@@ -0,0 +1,579 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>  
+   <extension
+         point="org.eclipse.ui.commands">
+         <command
+            categoryId="org.eclipse.ui.category.navigate"
+            defaultHandler="org.txm.searchengine.cqp.rcp.handlers.base.OpenBiblio"
+            id="org.txm.searchengine.cqp.rcp.handlers.base.OpenBiblio"
+            name="%command.name.63">
+      </command>
+            <command
+            defaultHandler="org.txm.searchengine.cqp.rcp.handlers.base.ExportCorpus"
+            id="org.txm.searchengine.cqp.rcp.handlers.base.ExportCorpus"
+            name="%command.name.52">
+      </command>
+      <command
+            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"
+               name="%commandParameter.name.0"
+               optional="true">
+         </commandParameter>
+      </command>
+      <command
+            defaultHandler="org.txm.searchengine.cqp.rcp.handlers.base.ComputeSubCorpus"
+            id="org.txm.searchengine.cqp.rcp.handlers.base.CreateSubCorpus"
+            name="%command.name">
+         <commandParameter
+               id="CorpusParameter"
+               name="%commandParameter.name.0"
+               optional="true">
+         </commandParameter>
+         <commandParameter
+               id="edit"
+               name="%commandParameter.name"
+               optional="true">
+         </commandParameter>
+      </command>
+      <command
+            defaultHandler="org.txm.searchengine.cqp.rcp.handlers.base.Substraction"
+            id="org.txm.searchengine.cqp.rcp.handlers.base.Substraction"
+            name="%command.name.0">
+      </command>
+      <command
+            defaultHandler="org.txm.searchengine.cqp.rcp.handlers.base.Union"
+            id="org.txm.searchengine.cqp.rcp.handlers.base.Union"
+            name="%command.name.1">
+      </command>
+      <command
+            defaultHandler="org.txm.searchengine.cqp.rcp.handlers.base.Intersection"
+            id="org.txm.searchengine.cqp.rcp.handlers.base.Intersection"
+            name="%command.name.3">
+      </command>
+      <command
+            defaultHandler="org.txm.searchengine.cqp.rcp.handlers.base.EditPartition"
+            id="org.txm.searchengine.cqp.rcp.handlers.base.EditPartition"
+            name="Edit">
+         <commandParameter
+               id="CorpusParameter"
+               name="%commandParameter.name.0"
+               optional="true">
+         </commandParameter>
+      </command>
+      <command
+            defaultHandler="org.txm.searchengine.cqp.rcp.handlers.base.EditSubCorpus"
+            id="org.txm.searchengine.cqp.rcp.handlers.base.EditSubCorpus"
+            name="Edit">
+         <commandParameter
+               id="CorpusParameter"
+               name="%commandParameter.name.0"
+               optional="true">
+         </commandParameter>
+         <commandParameter
+               id="edit"
+               name="%commandParameter.name"
+               optional="true">
+         </commandParameter>
+      </command>
+   </extension>
+   <extension
+         point="org.eclipse.ui.preferencePages">
+      <page
+            category="org.txm.searchengine.rcp.preferences.SearchEnginePreferencesPage"
+            class="org.txm.searchengine.cqp.rcp.preferences.CQPPreferencePage"
+            id="org.txm.searchengine.cqp.rcp.preferences.CQPPreferencePage"
+            name="%page.name">
+      </page>
+      <page
+            category="org.txm.rcp.preferences.UserPreferencePage"
+            class="org.txm.searchengine.cqp.rcp.preferences.SubcorpusPreferencePage"
+            id="org.txm.searchengine.cqp.rcp.preferences.SubcorpusPreferencePage"
+            name="%page.name.0">
+      </page>
+   </extension>
+   <extension
+         point="org.eclipse.ui.menus">
+            <menuContribution
+            locationURI="popup:org.txm.rcp.views.BasesView">
+         <command
+               commandId="org.txm.rcp.commands.workspace.AddProject"
+               label="%command.label.36"
+               style="push">
+            <visibleWhen
+                  checkEnabled="false">
+               <reference
+                     definitionId="OneProjectSelected">
+               </reference>
+            </visibleWhen>
+         </command>
+         <separator
+               name="org.txm.rcp.separator1">
+         </separator>
+         <command
+               commandId="org.txm.rcp.commands.base.DeleteObject"
+               icon="icons/functions/delete.png"
+               style="push"
+               tooltip="%command.tooltip.33">
+            <visibleWhen
+                  checkEnabled="false">
+               <or>
+                  <reference
+                        definitionId="OnePartitionSelected">
+                  </reference>
+                  <reference
+                        definitionId="OneSubCorpusSelected">
+                  </reference>
+                  <reference
+                        definitionId="OneBaseSelected">
+                  </reference>
+                  <reference
+                        definitionId="OneIndexSelected">
+                  </reference>
+                  <reference
+                        definitionId="OneLexiconSelected">
+                  </reference>
+                  <reference
+                        definitionId="OneConcordanceSelected">
+                  </reference>
+                  <reference
+                        definitionId="OneCASelected">
+                  </reference>
+                  <reference
+                        definitionId="OneSpecificitiesResultSelected">
+                  </reference>
+                  <reference
+                        definitionId="OneMainCorpusSelected">
+                  </reference>
+               </or>
+            </visibleWhen>
+         </command>
+         <command
+               commandId="org.txm.searchengine.cqp.rcp.handlers.base.OpenBiblio"
+               icon="icons/functions/biblio.png"
+               label="%command.label.148"
+               style="push"
+               tooltip="%command.tooltip.91">
+            <visibleWhen
+                  checkEnabled="false">
+               <or>
+                  <reference
+                        definitionId="OneBaseSelected">
+                  </reference>
+                  <reference
+                        definitionId="OneTextSelected">
+                  </reference>
+               </or>
+            </visibleWhen>
+         </command>
+      </menuContribution>
+      <menuContribution
+            locationURI="popup:org.txm.rcp.corporaview.export">
+         <command
+               commandId="org.txm.searchengine.cqp.rcp.handlers.base.ExportCorpus"
+               icon="icons/functions/compress.png"
+               label="%command.name.52"
+               style="push">
+            <visibleWhen
+                  checkEnabled="false">
+               <reference
+                     definitionId="OneMainCorpusSelected">
+               </reference>
+            </visibleWhen>
+         </command>
+            </menuContribution>
+      <menuContribution
+            locationURI="popup:org.txm.rcp.views.corpora.CorporaView?after=org.txm.rcp.corporaview.corpus.manage">
+         <command
+               commandId="org.txm.searchengine.cqp.rcp.handlers.base.EditSubCorpus"
+               icon="platform:/plugin/org.txm.rcp/icons/functions/pencil.png"
+               style="push">
+            <visibleWhen
+                  checkEnabled="false">
+               <and>
+                  <reference
+                        definitionId="OneSubCorpusSelected">
+                  </reference>
+                  <reference
+                        definitionId="ExpertEnabled">
+                  </reference>
+               </and>
+            </visibleWhen>
+         </command>
+         <command
+               commandId="org.txm.searchengine.cqp.rcp.handlers.base.EditPartition"
+               icon="platform:/plugin/org.txm.rcp/icons/functions/pencil.png"
+               style="push">
+            <visibleWhen
+                  checkEnabled="false">
+               <and>
+                  <reference
+                        definitionId="OnePartitionSelected">
+                  </reference>
+                  <reference
+                        definitionId="ExpertEnabled">
+                  </reference>
+               </and>
+            </visibleWhen>
+         </command>
+         <command
+               commandId="org.txm.searchengine.cqp.rcp.handlers.base.CreateSubCorpus"
+               icon="icons/functions/subcorpus.png"
+               style="push">
+            <visibleWhen
+                  checkEnabled="false">
+               <reference
+                     definitionId="OneCorpusSelected">
+               </reference>
+            </visibleWhen>
+         </command>
+         <command
+               commandId="org.txm.searchengine.cqp.rcp.handlers.base.ComputePartition"
+               icon="icons/functions/partition.png"
+               style="push">
+            <visibleWhen
+                  checkEnabled="false">
+               <or>
+                  <reference
+                        definitionId="OneCorpusSelected">
+                  </reference>
+               </or>
+            </visibleWhen>
+         </command>
+         <command
+               commandId="org.txm.searchengine.cqp.rcp.handlers.base.Substraction"
+               icon="icons/functions/minus.png"
+               label="%command.label"
+               style="push"
+               tooltip="%command.tooltip">
+            <visibleWhen
+                  checkEnabled="false">
+               <reference
+                     definitionId="OneSubCorpusSelected">
+               </reference>
+            </visibleWhen>
+         </command>
+         <command
+               commandId="org.txm.searchengine.cqp.rcp.handlers.base.Union"
+               icon="icons/functions/union.png"
+               label="%command.label.0"
+               style="push">
+            <visibleWhen
+                  checkEnabled="false">
+               <reference
+                     definitionId="OneSubCorpusSelected">
+               </reference>
+            </visibleWhen>
+         </command>
+         <command
+               commandId="org.txm.searchengine.cqp.rcp.handlers.base.Intersection"
+               icon="icons/functions/inter.png"
+               label="%command.label.1"
+               style="push">
+            <visibleWhen
+                  checkEnabled="false">
+               <reference
+                     definitionId="OneSubCorpusSelected">
+               </reference>
+            </visibleWhen>
+         </command>
+      </menuContribution>
+      <menuContribution
+            locationURI="menu:menu.file.export.corpus">
+         <command
+               commandId="org.txm.searchengine.cqp.rcp.handlers.base.ExportCorpus"
+               icon="icons/functions/compress.png"
+               label="%command.name.52"
+               style="push">
+            <visibleWhen
+                  checkEnabled="false">
+               <reference
+                     definitionId="OneMainCorpusSelected">
+               </reference>
+            </visibleWhen>
+         </command>
+      </menuContribution>
+      <menuContribution
+            locationURI="menu:menu.corpus?after=menu.corpus.build">
+         <command
+               commandId="org.txm.searchengine.cqp.rcp.handlers.base.EditSubCorpus"
+               icon="platform:/plugin/org.txm.rcp/icons/functions/pencil.png"
+               style="push">
+            <visibleWhen
+                  checkEnabled="false">
+               <and>
+                  <reference
+                        definitionId="OneSubCorpusSelected">
+                  </reference>
+                  <reference
+                        definitionId="ExpertEnabled">
+                  </reference>
+               </and>
+            </visibleWhen>
+         </command>
+         <command
+               commandId="org.txm.searchengine.cqp.rcp.handlers.base.EditPartition"
+               icon="platform:/plugin/org.txm.rcp/icons/functions/pencil.png"
+               style="push">
+            <visibleWhen
+                  checkEnabled="false">
+               <and>
+                  <reference
+                        definitionId="OnePartitionSelected">
+                  </reference>
+                  <reference
+                        definitionId="ExpertEnabled">
+                  </reference>
+               </and>
+            </visibleWhen>
+         </command>
+         <command
+               commandId="org.txm.searchengine.cqp.rcp.handlers.base.CreateSubCorpus"
+               icon="icons/functions/subcorpus.png"
+               style="push">
+            <visibleWhen
+                  checkEnabled="false">
+               <reference
+                     definitionId="OneCorpusSelected">
+               </reference>
+            </visibleWhen>
+         </command>
+         <command
+               commandId="org.txm.searchengine.cqp.rcp.handlers.base.ComputePartition"
+               icon="icons/functions/partition.png"
+               style="push">
+            <visibleWhen
+                  checkEnabled="false">
+               <reference
+                     definitionId="OneCorpusSelected">
+               </reference>
+            </visibleWhen>
+         </command>
+         <command
+               commandId="org.txm.searchengine.cqp.rcp.handlers.base.Substraction"
+               icon="icons/functions/minus.png"
+               label="%command.label.2"
+               style="push"
+               tooltip="%command.tooltip.0">
+            <visibleWhen
+                  checkEnabled="false">
+               <reference
+                     definitionId="OneSubCorpusSelected">
+               </reference>
+            </visibleWhen>
+         </command>
+         <command
+               commandId="org.txm.searchengine.cqp.rcp.handlers.base.Union"
+               icon="icons/functions/union.png"
+               label="%command.label.3"
+               style="push">
+            <visibleWhen
+                  checkEnabled="false">
+               <reference
+                     definitionId="OneSubCorpusSelected">
+               </reference>
+            </visibleWhen>
+         </command>
+         <command
+               commandId="org.txm.searchengine.cqp.rcp.handlers.base.Intersection"
+               icon="icons/functions/inter.png"
+               label="%command.label.4"
+               style="push">
+            <visibleWhen
+                  checkEnabled="false">
+               <reference
+                     definitionId="OneSubCorpusSelected">
+               </reference>
+            </visibleWhen>
+         </command>
+      </menuContribution>
+      <menuContribution
+            allPopups="true"
+            locationURI="toolbar:org.txm.rcp.toolbarfile">
+            <command
+                  commandId="org.txm.searchengine.cqp.rcp.handlers.base.ExportCorpus"
+                  icon="icons/functions/compress.png"
+                  label="%command.name.52"
+                  style="push">
+               <visibleWhen
+                     checkEnabled="false">
+                  <reference
+                        definitionId="OneMainCorpusSelected">
+                  </reference>
+               </visibleWhen>
+            </command>
+      </menuContribution>
+      <menuContribution
+            locationURI="toolbar:org.txm.rcp.toolbarcorpus?after=org.txm.rcp.toolbarcorpus.corpus">
+         <command
+               commandId="org.txm.searchengine.cqp.rcp.handlers.base.EditSubCorpus"
+               icon="platform:/plugin/org.txm.rcp/icons/functions/pencil.png"
+               style="push">
+            <visibleWhen
+                  checkEnabled="false">
+               <and>
+                  <reference
+                        definitionId="OneSubCorpusSelected">
+                  </reference>
+                  <reference
+                        definitionId="ExpertEnabled">
+                  </reference>
+               </and>
+            </visibleWhen>
+         </command>
+         <command
+               commandId="org.txm.searchengine.cqp.rcp.handlers.base.EditPartition"
+               icon="platform:/plugin/org.txm.rcp/icons/functions/pencil.png"
+               style="push">
+            <visibleWhen
+                  checkEnabled="false">
+               <and>
+                  <reference
+                        definitionId="OnePartitionSelected">
+                  </reference>
+                  <reference
+                        definitionId="ExpertEnabled">
+                  </reference>
+               </and>
+            </visibleWhen>
+         </command>
+         <command
+               commandId="org.txm.searchengine.cqp.rcp.handlers.base.CreateSubCorpus"
+               icon="icons/functions/subcorpus.png"
+               style="push">
+            <visibleWhen
+                  checkEnabled="false">
+               <reference
+                     definitionId="OneCorpusSelected">
+               </reference>
+            </visibleWhen>
+         </command>
+                        <command
+                  commandId="org.txm.searchengine.cqp.rcp.handlers.base.ComputePartition"
+                  icon="icons/functions/partition.png"
+                  style="push">
+               <visibleWhen
+                     checkEnabled="false">
+                  <reference
+                        definitionId="OneCorpusSelected">
+                  </reference>
+               </visibleWhen>
+            </command>
+                        <command
+                              commandId="org.txm.searchengine.cqp.rcp.handlers.base.Substraction"
+                              icon="icons/functions/minus.png"
+                              style="push"
+                              tooltip="%command.tooltip.1">
+                           <visibleWhen
+                                 checkEnabled="false">
+                              <reference
+                                    definitionId="OneSubCorpusSelected">
+                              </reference>
+                           </visibleWhen>
+                        </command>
+                        <command
+                              commandId="org.txm.searchengine.cqp.rcp.handlers.base.Union"
+                              icon="icons/functions/union.png"
+                              style="push">
+                           <visibleWhen
+                                 checkEnabled="false">
+                              <reference
+                                    definitionId="OneSubCorpusSelected">
+                              </reference>
+                           </visibleWhen>
+                        </command>
+                        <command
+                              commandId="org.txm.searchengine.cqp.rcp.handlers.base.Intersection"
+                              icon="icons/functions/inter.png"
+                              style="push">
+                           <visibleWhen
+                                 checkEnabled="false">
+                              <reference
+                                    definitionId="OneSubCorpusSelected">
+                              </reference>
+                           </visibleWhen>
+                        </command>
+      </menuContribution>
+   </extension>
+   <extension
+         point="org.eclipse.core.runtime.adapters">
+      <factory
+            adaptableType="org.txm.searchengine.cqp.corpus.CQPCorpus"
+            class="org.txm.searchengine.cqp.rcp.adapters.CorpusAdapterFactory">
+         <adapter
+               type="org.eclipse.ui.model.IWorkbenchAdapter">
+         </adapter>
+      </factory>
+   </extension>
+   <extension
+         point="org.eclipse.core.expressions.definitions">
+      <definition
+            id="OneMainCorpusSelected">
+         <with
+               variable="corporaSelection">
+            <iterate
+                  ifEmpty="false"
+                  operator="and">
+               <instanceof
+                     value="org.txm.searchengine.cqp.corpus.MainCorpus">
+               </instanceof>
+            </iterate>
+            <count
+                  value="1">
+            </count>
+         </with>
+      </definition>
+      <definition
+            id="OneSubCorpusSelected">
+         <with
+               variable="corporaSelection">
+            <iterate
+                  operator="and">
+               <instanceof
+                     value="org.txm.searchengine.cqp.corpus.Subcorpus">
+               </instanceof>
+            </iterate>
+            <count
+                  value="1">
+            </count>
+         </with>
+      </definition>
+      <definition
+            id="OneCorpusSelected">
+         <with
+               variable="corporaSelection">
+            <iterate
+                  ifEmpty="false"
+                  operator="and">
+               <instanceof
+                     value="org.txm.searchengine.cqp.corpus.CQPCorpus">
+               </instanceof>
+            </iterate>
+            <count
+                  value="1">
+            </count>
+         </with>
+      </definition>
+   </extension>
+   <extension
+         point="org.eclipse.ui.editors">
+      <editor
+            class="org.txm.searchengine.cqp.rcp.editor.SubcorpusEditor"
+            default="false"
+            icon="icons/functions/subcorpus.png"
+            id="org.txm.searchengine.cqp.rcp.editor.SubcorpusEditor"
+            name="%editor.name">
+      </editor>
+      <editor
+            class="org.txm.searchengine.cqp.rcp.editor.PartitionEditor"
+            default="false"
+            icon="icons/functions/partition.png"
+            id="org.txm.searchengine.cqp.rcp.editor.PartitionEditor"
+            name="%editor.name.0">
+      </editor>
+   </extension>
+
+</plugin>

Property changes on: TXM/trunk/bundles/org.txm.searchengine.cqp.rcp/plugin.xml
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.rcp/.settings/org.eclipse.core.resources.prefs
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.rcp/.settings/org.eclipse.core.resources.prefs	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.rcp/.settings/org.eclipse.core.resources.prefs	(revision 3659)
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+encoding//src/org/txm/searchengine/cqp/rcp/messages/messages_fr.properties=UTF-8

Property changes on: TXM/trunk/bundles/org.txm.searchengine.cqp.rcp/.settings/org.eclipse.core.resources.prefs
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.rcp/.classpath
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.rcp/.classpath	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.rcp/.classpath	(revision 3659)
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="con"
+		path="org.eclipse.jdt.launching.JRE_CONTAINER" />
+	<classpathentry kind="con"
+		path="org.eclipse.pde.core.requiredPlugins">
+		<accessrules>
+			<accessrule kind="accessible" pattern="**" />
+		</accessrules>
+	</classpathentry>
+	<classpathentry kind="src" path="src" />
+	<classpathentry kind="output" path="bin" />
+</classpath>
\ No newline at end of file

Property changes on: TXM/trunk/bundles/org.txm.searchengine.cqp.rcp/.classpath
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.rcp/META-INF/MANIFEST.MF
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.rcp/META-INF/MANIFEST.MF	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.rcp/META-INF/MANIFEST.MF	(revision 3659)
@@ -0,0 +1,18 @@
+Manifest-Version: 1.0
+Export-Package: org.txm.searchengine.cqp.rcp.adapters,
+ org.txm.searchengine.cqp.rcp.dialogs,
+ org.txm.searchengine.cqp.rcp.editor,
+ org.txm.searchengine.cqp.rcp.handlers.base,
+ org.txm.searchengine.cqp.rcp.messages,
+ org.txm.searchengine.cqp.rcp.preferences
+Bundle-SymbolicName: org.txm.searchengine.cqp.rcp;singleton:=true
+Bundle-Version: 1.0.0.qualifier
+Bundle-Name: %Bundle-Name
+Require-Bundle: org.txm.rcp;bundle-version="0.8.3";visibility:=reexport,
+ org.txm.searchengine.cqp.core;bundle-version="1.1.0";visibility:=reexport,
+ org.txm.searchengine.rcp;bundle-version="1.0.0";visibility:=reexport
+Bundle-ManifestVersion: 2
+Bundle-RequiredExecutionEnvironment: JavaSE-16
+Bundle-Vendor: Textometrie.org
+Automatic-Module-Name: org.txm.searchengine.cqp.rcp
+

Property changes on: TXM/trunk/bundles/org.txm.searchengine.cqp.rcp/META-INF/MANIFEST.MF
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.rcp/.project
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.rcp/.project	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.rcp/.project	(revision 3659)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>org.txm.searchengine.cqp.rcp</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.pde.ManifestBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.pde.SchemaBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.pde.PluginNature</nature>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+	</natures>
+</projectDescription>

Property changes on: TXM/trunk/bundles/org.txm.searchengine.cqp.rcp/.project
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.rcp/src/org/txm/searchengine/cqp/rcp/handlers/base/ExportCorpus.java
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.rcp/src/org/txm/searchengine/cqp/rcp/handlers/base/ExportCorpus.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.rcp/src/org/txm/searchengine/cqp/rcp/handlers/base/ExportCorpus.java	(revision 3659)
@@ -0,0 +1,148 @@
+// Copyright © 2010-2020 ENS de Lyon., University of Franche-Comté
+// 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.io.File;
+import java.util.HashSet;
+
+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.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.window.Window;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.FileDialog;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.handlers.HandlerUtil;
+import org.txm.Toolbox;
+import org.txm.rcp.messages.TXMUIMessages;
+import org.txm.rcp.swt.dialog.LastOpened;
+import org.txm.rcp.utils.JobHandler;
+import org.txm.searchengine.cqp.corpus.MainCorpus;
+import org.txm.searchengine.cqp.rcp.dialogs.ExportCorpusDialog;
+import org.txm.utils.logger.Log;
+
+/**
+ * Export a corpus to the .txm binary format (Zip)
+ */
+public class ExportCorpus extends AbstractHandler {
+	
+	public final static String ID = "org.txm.rcp.commands.base.ExportCorpus"; //$NON-NLS-1$
+	
+	/** The selection. */
+	private IStructuredSelection selection;
+	
+	/** The lastopenedfile. */
+	private static String lastopenedfile;
+	
+	/*
+	 * (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);
+		
+		Shell shell = HandlerUtil.getActiveWorkbenchWindowChecked(event)
+				.getShell();
+		
+		if (!(selection.getFirstElement() instanceof MainCorpus))
+			return null;
+		
+		final MainCorpus corpus = (MainCorpus) selection.getFirstElement();
+		
+		try {
+			corpus.compute(false);
+		}
+		catch (InterruptedException e) {
+			Log.printStackTrace(e);
+			return null;
+		}
+		
+		if (corpus.isModified()) {
+			boolean ret = MessageDialog.openConfirm(shell, "Export - " + corpus.getName() + " annotations not saved",
+					"Do you wish to export without the current annotations?\n\n(to include the current annotations in the exported corpus, you need to save them before calling the \"Export\" command)");
+			if (!ret) return null;
+		}
+		
+		ExportCorpusDialog dialog2 = new ExportCorpusDialog(shell, corpus);
+		
+		if (dialog2.open() == Window.OK) {
+			
+			final File outfile = dialog2.getZipFile();
+			final String version = dialog2.getCorpusVersion();
+			final String rename = dialog2.getRename();
+			final HashSet<String> ignored = dialog2.getIgnoreNames();
+			
+			if (outfile.exists()) {
+				boolean ret = MessageDialog.openConfirm(shell, "Export - " + corpus.getName() + " warning",
+						TXMUIMessages.bind(TXMUIMessages.theP0FileAlreadyExistsWouldYouLikeToReplaceIt, outfile.getAbsoluteFile()));
+				if (!ret) {
+					Log.info(TXMUIMessages.abort);
+					return null;
+				}
+			}
+			
+			Log.info(NLS.bind(TXMUIMessages.exportingP0, corpus.getName()));
+			JobHandler jobhandler = new JobHandler(NLS.bind(TXMUIMessages.exportingP0, corpus.getName())) {
+				
+				@Override
+				protected IStatus run(IProgressMonitor monitor) {
+					this.runInit(monitor);
+					try {
+						monitor.beginTask(NLS.bind(TXMUIMessages.exportingP0ThisMayTakeAWhile, corpus.getName()), 100);
+						
+						if (!corpus.export(outfile, this, ignored, version, rename)) {
+							System.out.println(NLS.bind(TXMUIMessages.failedToExportCorpusP0, corpus.getName()));
+						}
+						
+						System.out.println(TXMUIMessages.bind(TXMUIMessages.doneTheCreatedBinaryFileIsP0, outfile.getAbsolutePath()));
+						monitor.worked(100);
+					}
+					catch (ThreadDeath td) {
+						return Status.CANCEL_STATUS;
+					}
+					finally {
+						monitor.done();
+					}
+					return Status.OK_STATUS;
+				}
+			};
+			jobhandler.startJob();
+		}
+		
+		return null;
+	}
+}

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

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.rcp/src/org/txm/searchengine/cqp/rcp/handlers/base/package.html
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.rcp/src/org/txm/searchengine/cqp/rcp/handlers/base/package.html	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.rcp/src/org/txm/searchengine/cqp/rcp/handlers/base/package.html	(revision 3659)
@@ -0,0 +1,5 @@
+<html>
+<body>
+	<p>Commands which deals with the CWB corpora view</p>
+</body>
+</html>
\ No newline at end of file

Property changes on: TXM/trunk/bundles/org.txm.searchengine.cqp.rcp/src/org/txm/searchengine/cqp/rcp/handlers/base/package.html
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.rcp/src/org/txm/searchengine/cqp/rcp/handlers/base/Complementary.java
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.rcp/src/org/txm/searchengine/cqp/rcp/handlers/base/Complementary.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.rcp/src/org/txm/searchengine/cqp/rcp/handlers/base/Complementary.java	(revision 3659)
@@ -0,0 +1,194 @@
+// Copyright © 2010-2020 ENS de Lyon., University of Franche-Comté
+// 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.Arrays;
+import java.util.List;
+
+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.handlers.HandlerUtil;
+import org.txm.rcp.JobsTimer;
+import org.txm.rcp.messages.TXMUIMessages;
+import org.txm.rcp.swt.dialog.TextDialog;
+import org.txm.rcp.utils.JobHandler;
+import org.txm.rcp.views.corpora.CorporaView;
+import org.txm.searchengine.cqp.AbstractCqiClient;
+import org.txm.searchengine.cqp.CQPSearchEngine;
+import org.txm.searchengine.cqp.core.messages.CQPSearchEngineCoreMessages;
+import org.txm.searchengine.cqp.corpus.CQPCorpus;
+import org.txm.searchengine.cqp.corpus.Subcorpus;
+import org.txm.searchengine.cqp.rcp.dialogs.SetOperationsDialog;
+import org.txm.utils.logger.Log;
+
+// TODO: Auto-generated Javadoc
+/**
+ * Command which creates a subcorpus from a Corpus @ author mdecorde.
+ */
+public class Complementary extends AbstractHandler {
+	
+	/** 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);
+		if (selection == null) {
+			System.out.println(TXMUIMessages.noSelectionForColon + HandlerUtil.getActiveWorkbenchWindow(event).getActivePage().getActiveEditor());
+			return null;
+		}
+		List list = selection.toList();
+		if (list.size() == 0) {
+			Log.info("No corpus selected");
+			return null;
+		}
+		else if (list.size() != 1) {
+			Log.info("Complementary need a selection of 1 corpus");
+			return null;
+		}
+		Object firstElement = list.get(0);
+		// Object secondElement = list.get(1);
+		
+		if (!(firstElement instanceof CQPCorpus)) {
+			System.out.println(TXMUIMessages.selectionIsNotACorpusColon + firstElement);
+			return null;
+		}
+		
+		// if (!(secondElement instanceof CQPCorpus)) {
+		// System.out.println(TXMUIMessages.selectionIsNotACorpusColon+secondElement);
+		// return null;
+		// }
+		
+		final CQPCorpus corpus = (CQPCorpus) firstElement;
+		try {
+			corpus.compute(false);
+		}
+		catch (InterruptedException e2) {
+			// TODO Auto-generated catch block
+			e2.printStackTrace();
+			return null;
+		}
+		// final CQPCorpus corpus2 = (CQPCorpus) secondElement;
+		// corpus2.compute(false);
+		
+		Shell shell = HandlerUtil.getActiveWorkbenchWindowChecked(event).getShell();
+		final SetOperationsDialog d = new SetOperationsDialog(shell, "COMPL", corpus);
+		int code = d.open();
+		if (code == Window.OK) {
+			JobHandler jobhandler = new JobHandler(NLS.bind(TXMUIMessages.creatingASubcorpusOnP0, corpus.getName())) {
+				
+				@Override
+				protected IStatus run(IProgressMonitor monitor) {
+					this.runInit(monitor);
+					JobsTimer.start();
+					try {
+						monitor.beginTask(TXMUIMessages.creatingASubcorpusInTheSearchEngine, 100);
+						Subcorpus subcorpus = null;
+						String name = d.getName();
+						if (name.length() == 0) {
+							name = d.getDefaultName();
+						}
+						
+						AbstractCqiClient cqi = CQPSearchEngine.getCqiClient();
+						
+						String cqpid = "S" + Subcorpus.getNextSubcorpusCounter();
+						CQPCorpus[] order = d.getCorpusOrder();
+						order[1].compute(false);
+						String query = cqpid + "=join " + order[0].getQualifiedCqpId() + " " + order[1].getQualifiedCqpId() + ";";
+						System.out.println("QUERY=" + query);
+						cqi.query(query);
+						
+						if (cqi.subCorpusSize(order[0].getMainCorpus() + ":" + cqpid) == 0) {
+							Log.info("The created subcorpus was empty. Aborting.");
+							return Status.CANCEL_STATUS;
+						}
+						
+						subcorpus = corpus.getCorpusParent().createSubcorpus(name, cqpid);
+						
+						if (subcorpus == null) {
+							monitor.done();
+							Log.warning(TXMUIMessages.errorColonSubcorpusWasNotCreated);
+							return Status.CANCEL_STATUS;
+						}
+						
+						System.out.println(NLS.bind(TXMUIMessages.doneColonP0Created, subcorpus.getName()));
+						monitor.worked(50);
+						
+						monitor.subTask(TXMUIMessages.refreshingCorpora);
+						final Subcorpus subcorpus2 = subcorpus;
+						syncExec(new Runnable() {
+							
+							@Override
+							public void run() {
+								CorporaView.refresh();
+								CorporaView.expand(subcorpus2.getParent());
+							}
+						});
+						
+						monitor.worked(100);
+					}
+					catch (ThreadDeath td) {
+						return Status.CANCEL_STATUS;
+					}
+					catch (Exception e) {
+						org.txm.utils.logger.Log.printStackTrace(e);
+						Log.severe(e.toString());
+						
+						try {
+							System.out.println(NLS.bind(CQPSearchEngineCoreMessages.lastCQPErrorColon, CQPSearchEngine.getCqiClient().getLastCQPError()));
+						}
+						catch (Exception e1) {
+							System.out.println(TXMUIMessages.failedToGetLastCQPErrorColon + e1);
+							org.txm.utils.logger.Log.printStackTrace(e1);
+						}
+					}
+					finally {
+						monitor.done();
+						JobsTimer.stopAndPrint();
+					}
+					return Status.OK_STATUS;
+				}
+			};
+			jobhandler.startJob();
+		}
+		return null;
+	}
+}

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

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.rcp/src/org/txm/searchengine/cqp/rcp/handlers/base/EditPartition.java
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.rcp/src/org/txm/searchengine/cqp/rcp/handlers/base/EditPartition.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.rcp/src/org/txm/searchengine/cqp/rcp/handlers/base/EditPartition.java	(revision 3659)
@@ -0,0 +1,84 @@
+// Copyright © 2010-2020 ENS de Lyon., University of Franche-Comté
+// 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.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.ui.handlers.HandlerUtil;
+import org.txm.rcp.editors.TXMEditor;
+import org.txm.rcp.handlers.BaseAbstractHandler;
+import org.txm.rcp.messages.TXMUIMessages;
+import org.txm.searchengine.cqp.corpus.Partition;
+import org.txm.searchengine.cqp.rcp.editor.PartitionEditor;
+
+/**
+ * Command that creates a Partition from a Corpus.
+ * 
+ * @author mdecorde
+ * @author sjacquot
+ */
+public class EditPartition extends BaseAbstractHandler {
+		
+	/*
+	 * (non-Javadoc)
+	 * @see
+	 * org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands
+	 * .ExecutionEvent)
+	 */
+	@Override
+	public Object execute(ExecutionEvent event) throws ExecutionException {
+		
+		if (!this.checkCorpusEngine()) {
+			return false;
+		}
+
+		IStructuredSelection selection = (IStructuredSelection) HandlerUtil.getCurrentSelection(event);
+		if (selection == null) {
+			System.out.println(TXMUIMessages.noSelectionForColon + HandlerUtil.getActiveWorkbenchWindow(event).getActivePage().getActiveEditor());
+			return null;
+		}
+		
+		if (selection.getFirstElement() instanceof Partition) {
+			return edit((Partition) selection.getFirstElement());
+		} else {
+			return null;
+		}
+	}
+	
+	/**
+	 * 
+	 * @param event
+	 * @return
+	 * @throws ExecutionException
+	 */
+	public static Object edit(Partition part) throws ExecutionException {
+		
+		return TXMEditor.openEditor(part, PartitionEditor.class.getName());
+	}
+}

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

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.rcp/src/org/txm/searchengine/cqp/rcp/handlers/base/Substraction.java
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.rcp/src/org/txm/searchengine/cqp/rcp/handlers/base/Substraction.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.rcp/src/org/txm/searchengine/cqp/rcp/handlers/base/Substraction.java	(revision 3659)
@@ -0,0 +1,198 @@
+// Copyright © 2010-2020 ENS de Lyon., University of Franche-Comté
+// 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.Arrays;
+import java.util.List;
+
+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.handlers.HandlerUtil;
+import org.txm.rcp.JobsTimer;
+import org.txm.rcp.messages.TXMUIMessages;
+import org.txm.rcp.swt.dialog.TextDialog;
+import org.txm.rcp.utils.JobHandler;
+import org.txm.rcp.views.corpora.CorporaView;
+import org.txm.searchengine.cqp.AbstractCqiClient;
+import org.txm.searchengine.cqp.CQPSearchEngine;
+import org.txm.searchengine.cqp.core.messages.CQPSearchEngineCoreMessages;
+import org.txm.searchengine.cqp.corpus.CQPCorpus;
+import org.txm.searchengine.cqp.corpus.Subcorpus;
+import org.txm.searchengine.cqp.rcp.dialogs.SetOperationsDialog;
+import org.txm.utils.logger.Log;
+
+// TODO: Auto-generated Javadoc
+/**
+ * Command which creates a subcorpus from a Corpus @ author mdecorde.
+ */
+public class Substraction extends AbstractHandler {
+	
+	/** 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);
+		if (selection == null) {
+			System.out.println(TXMUIMessages.noSelectionForColon + HandlerUtil.getActiveWorkbenchWindow(event).getActivePage().getActiveEditor());
+			return null;
+		}
+		List list = selection.toList();
+		if (list.size() == 0) {
+			Log.info("No corpus selected");
+			return null;
+		}
+		else if (list.size() != 1) {
+			Log.info("Substraction need a selection of 1 corpus");
+			return null;
+		}
+		Object firstElement = list.get(0);
+		// Object secondElement = list.get(1);
+		
+		if (!(firstElement instanceof CQPCorpus)) {
+			System.out.println(TXMUIMessages.selectionIsNotACorpusColon + firstElement);
+			return null;
+		}
+		
+		// if (!(secondElement instanceof CQPCorpus)) {
+		// System.out.println(TXMUIMessages.selectionIsNotACorpusColon+secondElement);
+		// return null;
+		// }
+		
+		final CQPCorpus corpus = (CQPCorpus) firstElement;
+		try {
+			corpus.compute(false);
+		}
+		catch (InterruptedException e2) {
+			// TODO Auto-generated catch block
+			e2.printStackTrace();
+			return null;
+		}
+		// final CQPCorpus corpus2 = (CQPCorpus) secondElement;
+		// corpus2.compute(false);
+		
+		Shell shell = HandlerUtil.getActiveWorkbenchWindowChecked(event).getShell();
+		final SetOperationsDialog d = new SetOperationsDialog(shell, "MINUS", corpus);
+		int code = d.open();
+		if (code == Window.OK) {
+			JobHandler jobhandler = new JobHandler(NLS.bind(TXMUIMessages.creatingASubcorpusOnP0, corpus.getName())) {
+				
+				@Override
+				protected IStatus run(IProgressMonitor monitor) {
+					this.runInit(monitor);
+					JobsTimer.start();
+					try {
+						monitor.beginTask(TXMUIMessages.creatingASubcorpusInTheSearchEngine, 100);
+						Subcorpus subcorpus = null;
+						String name = d.getName();
+						if (name.length() == 0) {
+							name = d.getDefaultName();
+						}
+						
+						AbstractCqiClient cqi = CQPSearchEngine.getCqiClient();
+						
+						String cqpid = "S" + Subcorpus.getNextSubcorpusCounter();
+						CQPCorpus[] order = d.getCorpusOrder();
+						order[1].compute(false);
+						String query = cqpid + "=difference " + order[0].getQualifiedCqpId() + " " + order[1].getQualifiedCqpId() + ";";
+						System.out.println("QUERY=" + query);
+						cqi.query(query);
+						
+						if (cqi.subCorpusSize(order[0].getMainCorpus() + ":" + cqpid) == 0) {
+							Log.info("The created subcorpus was empty. Aborting.");
+							return Status.CANCEL_STATUS;
+						}
+						subcorpus = corpus.getCorpusParent().createSubcorpus(name, cqpid);
+						
+						if (subcorpus == null) {
+							monitor.done();
+							Log.warning(TXMUIMessages.errorColonSubcorpusWasNotCreated);
+							return Status.CANCEL_STATUS;
+						}
+						
+						if (subcorpus.getSize() == 0) {
+							Log.warning("The created subcorpus was empty");
+							return Status.CANCEL_STATUS;
+						}
+						
+						System.out.println(NLS.bind(TXMUIMessages.doneColonP0Created, subcorpus.getName()));
+						monitor.worked(50);
+						
+						monitor.subTask(TXMUIMessages.refreshingCorpora);
+						final Subcorpus subcorpus2 = subcorpus;
+						syncExec(new Runnable() {
+							
+							@Override
+							public void run() {
+								CorporaView.refresh();
+								CorporaView.expand(subcorpus2.getParent());
+							}
+						});
+						
+						monitor.worked(100);
+					}
+					catch (ThreadDeath td) {
+						return Status.CANCEL_STATUS;
+					}
+					catch (Exception e) {
+						org.txm.utils.logger.Log.printStackTrace(e);
+						Log.severe(e.toString());
+						
+						try {
+							System.out.println(NLS.bind(CQPSearchEngineCoreMessages.lastCQPErrorColon, CQPSearchEngine.getCqiClient().getLastCQPError()));
+						}
+						catch (Exception e1) {
+							System.out.println(TXMUIMessages.failedToGetLastCQPErrorColon + e1);
+							org.txm.utils.logger.Log.printStackTrace(e1);
+						}
+					}
+					finally {
+						monitor.done();
+						JobsTimer.stopAndPrint();
+					}
+					return Status.OK_STATUS;
+				}
+			};
+			jobhandler.startJob();
+		}
+		return null;
+	}
+}

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

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.rcp/src/org/txm/searchengine/cqp/rcp/handlers/base/ComputeSubCorpus.java
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.rcp/src/org/txm/searchengine/cqp/rcp/handlers/base/ComputeSubCorpus.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.rcp/src/org/txm/searchengine/cqp/rcp/handlers/base/ComputeSubCorpus.java	(revision 3659)
@@ -0,0 +1,245 @@
+// Copyright © 2010-2020 ENS de Lyon., University of Franche-Comté
+// 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.lang.reflect.InvocationTargetException;
+
+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.handlers.HandlerUtil;
+import org.txm.rcp.JobsTimer;
+import org.txm.rcp.actions.CreateSubcorpusDialog;
+import org.txm.rcp.editors.TXMEditor;
+import org.txm.rcp.handlers.BaseAbstractHandler;
+import org.txm.rcp.messages.TXMUIMessages;
+import org.txm.rcp.swt.dialog.ComputeProgressMonitorDialog;
+import org.txm.rcp.utils.JobHandler;
+import org.txm.rcp.views.corpora.CorporaView;
+import org.txm.searchengine.cqp.CQPSearchEngine;
+import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
+import org.txm.searchengine.cqp.core.messages.CQPSearchEngineCoreMessages;
+import org.txm.searchengine.cqp.core.preferences.SubcorpusPreferences;
+import org.txm.searchengine.cqp.corpus.CQPCorpus;
+import org.txm.searchengine.cqp.corpus.Subcorpus;
+import org.txm.searchengine.cqp.corpus.query.CQLQuery;
+import org.txm.searchengine.cqp.rcp.editor.SubcorpusEditor;
+import org.txm.utils.logger.Log;
+
+/**
+ * Command which creates a subcorpus from a Corpus
+ * 
+ * @author mdecorde
+ * @author sjacquot
+ * 
+ */
+public class ComputeSubCorpus extends BaseAbstractHandler {
+	
+	
+	/*
+	 * (non-Javadoc)
+	 * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
+	 */
+	@Override
+	public Object execute(ExecutionEvent event) throws ExecutionException {
+		
+		if (!this.checkCorpusEngine()) {
+			return false;
+		}
+		
+		// FIXME: SJ: tests of MD for using a TXMEditor rather than a dialog box to manage sub-corpus creation and edition
+		if (SubcorpusPreferences.getInstance().getBoolean(SubcorpusPreferences.EDITORMODE)) {
+			return execute_editor(event);
+		}
+		// original code that uses a dialog box
+		else {
+			
+			// since some widgets fields need some values of parents branch,
+			// ensure the parents branch is ready
+			// show modal blocking cancelable progression dialog
+			try {
+				
+				Object selection = this.getCorporaViewSelectedObject(event);
+				
+				if (selection instanceof CQPCorpus) {
+					CQPCorpus corpus = (CQPCorpus) selection;
+					if (!corpus.hasBeenComputedOnce()) {
+						
+						ComputeProgressMonitorDialog dialog = new ComputeProgressMonitorDialog(HandlerUtil.getActiveWorkbenchWindowChecked(event).getShell(), corpus);
+						dialog.runComputingProcess(true);
+						
+					}
+				}
+				
+			}
+			// Canceling or error
+			catch (InterruptedException | InvocationTargetException e) {
+				CorporaView.refresh();
+				return null;
+			}
+			
+			
+			return execute_dialog(event);
+		}
+	}
+	
+	
+	public Object execute_editor(ExecutionEvent event) throws ExecutionException {
+		
+		IStructuredSelection selection = (IStructuredSelection) HandlerUtil.getCurrentSelection(event);
+		if (selection == null) {
+			System.out.println(TXMUIMessages.noSelectionForColon + HandlerUtil.getActiveWorkbenchWindow(event).getActivePage().getActiveEditor());
+			return null;
+		}
+		
+		String edit = event.getParameter("edit"); //$NON-NLS-1$
+		
+		Object firstElement = selection.getFirstElement();
+		Subcorpus sub = null;
+		if (firstElement instanceof CQPCorpus) {
+			if (firstElement instanceof Subcorpus && "true".equals(edit)) {
+				sub = (Subcorpus) firstElement;
+			}
+			else {
+				sub = new Subcorpus((CQPCorpus) firstElement);
+			}
+		}
+		return TXMEditor.openEditor(sub, SubcorpusEditor.class.getName());
+	}
+	
+	/*
+	 * (non-Javadoc)
+	 * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
+	 */
+	public Object execute_dialog(ExecutionEvent event) throws ExecutionException {
+		
+		IStructuredSelection selection = (IStructuredSelection) HandlerUtil.getCurrentSelection(event);
+		if (selection == null) {
+			System.out.println(TXMUIMessages.noSelectionForColon + HandlerUtil.getActiveWorkbenchWindow(event).getActivePage().getActiveEditor());
+			return null;
+		}
+		Object firstElement = selection.getFirstElement();
+		
+		if (!(firstElement instanceof CQPCorpus)) {
+			System.out.println(TXMUIMessages.selectionIsNotACorpusColon + firstElement);
+			return null;
+		}
+		
+		final CQPCorpus corpus = (CQPCorpus) firstElement;
+		Shell shell = HandlerUtil.getActiveWorkbenchWindowChecked(event).getShell();
+		final CreateSubcorpusDialog d = new CreateSubcorpusDialog(shell, corpus);
+		int code = d.open();
+		if (code == Window.OK) {
+			JobHandler jobhandler = new JobHandler(NLS.bind(TXMUIMessages.creatingASubcorpusOnP0, corpus.getName())) {
+				
+				@Override
+				protected IStatus run(IProgressMonitor monitor) {
+					this.runInit(monitor);
+					JobsTimer.start();
+					try {
+						monitor.beginTask(TXMUIMessages.creatingASubcorpusInTheSearchEngine, 100);
+						final Subcorpus subcorpus;
+						
+						if (d.isAdvancedSelected() || d.isAssistedSelected()) {
+							CQLQuery q = new CQLQuery(d.getQuery());
+							
+							// System.out.println(NLS.bind(TXMUIMessages.computeSubCorpusOnP0QueryColonP1, corpus.getName(), q.getQueryString()));
+							
+							subcorpus = corpus.createSubcorpus(q, d.getName());
+						}
+						else {
+							// System.out.println(NLS.bind(TXMUIMessages.computeSubCorpusOnP0StructsColonP1AmpPropsP2ColonP3,
+							// new Object[] { corpus.getName(), d.getStructuralUnit(),
+							// d.getStructuralUnitProperty(), d.getValues() }));
+							
+							// Escape regex char of prop values
+							// List<String> values = d.getValues();
+							// for(int i = 0 ; i < values.size() ; i++)
+							// values.set(i, Query.addBackSlash(values.get(i)));
+							
+							subcorpus = corpus.createSubcorpus(
+									d.getStructuralUnit(), d.getStructuralUnitProperty(),
+									d.getValues(), d.getName());
+						}
+						
+						if (subcorpus == null) {
+							monitor.done();
+							Log.warning(TXMUIMessages.errorColonSubcorpusWasNotCreated);
+							return Status.CANCEL_STATUS;
+						}
+						
+						// System.out.println(NLS.bind(TXMUIMessages.doneColonP0Created, subcorpus.getName()));
+						monitor.worked(50);
+						
+						monitor.subTask(TXMUIMessages.refreshingCorpora);
+						syncExec(new Runnable() {
+							
+							@Override
+							public void run() {
+								CorporaView.refresh();
+								// System.out.println("expand");
+								CorporaView.expand(subcorpus.getParent());
+							}
+						});
+						
+						monitor.worked(100);
+					}
+					catch (ThreadDeath td) {
+						return Status.CANCEL_STATUS;
+					}
+					catch (CqiClientException e) {
+						org.txm.utils.logger.Log.printStackTrace(e);
+						Log.severe(e.toString());
+						
+						try {
+							System.out.println(NLS.bind(CQPSearchEngineCoreMessages.lastCQPErrorColon, CQPSearchEngine.getCqiClient().getLastCQPError()));
+						}
+						catch (Exception e1) {
+							System.out.println(TXMUIMessages.failedToGetLastCQPErrorColon + e1);
+							org.txm.utils.logger.Log.printStackTrace(e1);
+						}
+					}
+					finally {
+						monitor.done();
+						JobsTimer.stopAndPrint();
+					}
+					return Status.OK_STATUS;
+				}
+			};
+			jobhandler.startJob();
+		}
+		return null;
+	}
+	
+}

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

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.rcp/src/org/txm/searchengine/cqp/rcp/handlers/base/OpenBiblio.java
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.rcp/src/org/txm/searchengine/cqp/rcp/handlers/base/OpenBiblio.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.rcp/src/org/txm/searchengine/cqp/rcp/handlers/base/OpenBiblio.java	(revision 3659)
@@ -0,0 +1,142 @@
+// Copyright © 2010-2020 ENS de Lyon., University of Franche-Comté
+// 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.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.handlers.HandlerUtil;
+import org.txm.objects.Text;
+import org.txm.rcp.commands.OpenBrowser;
+import org.txm.rcp.editors.TXMBrowserEditor;
+import org.txm.rcp.messages.TXMUIMessages;
+import org.txm.rcp.swt.dialog.ComboDialog;
+import org.txm.searchengine.cqp.corpus.CQPCorpus;
+
+/**
+ * Open a text edition from: a main corpus : the first text of the maincorpus a
+ * sub-corpus : the first text of the subcorpus a partition : the user must
+ * choose one of the text used in the partition
+ * 
+ * note: unplugged for now
+ * 
+ * @author mdecorde.
+ */
+public class OpenBiblio extends AbstractHandler {
+	
+	/** The Constant ID. */
+	public final static String ID = "org.txm.rcp.commands.base.OpenBiblio"; //$NON-NLS-1$
+	
+	/** The lastopenedfile. */
+	public static String lastopenedfile;
+	
+	/** The textids. */
+	private ArrayList<String> textids;
+	
+	/*
+	 * (non-Javadoc)
+	 * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
+	 */
+	@Override
+	public Object execute(ExecutionEvent event) throws ExecutionException {
+		
+		IStructuredSelection selection = (IStructuredSelection) HandlerUtil.getCurrentSelection(event);
+		
+		Shell shell = HandlerUtil.getActiveWorkbenchWindowChecked(event).getShell();
+		
+		if (selection.getFirstElement() instanceof CQPCorpus) {
+			CQPCorpus corpus = (CQPCorpus) selection.getFirstElement();
+			
+			textids = new ArrayList<>(corpus.getProject().getTextsID());
+			if (textids.size() == 0) {
+				System.out.println(NLS.bind(TXMUIMessages.noTextInCorpusColonP0, corpus.getName()));
+				return null;
+			}
+			
+			ComboDialog dialog = new ComboDialog(shell, TXMUIMessages.selectTextId, textids, textids.get(0));
+			if (dialog.open() == Window.OK) {
+				String textid = dialog.getSelectedValue();
+				openBiblio(corpus, textid);
+			}
+		}
+		else if (selection.getFirstElement() instanceof Text) {
+			Text text = (Text) selection.getFirstElement();
+			openBiblio(text);
+		}
+		return null;
+	}
+	
+	/**
+	 * Open biblio.
+	 *
+	 * @param base the base
+	 * @param textid the textid
+	 * @return the object
+	 */
+	public Object openBiblio(CQPCorpus corpus, String textid) {
+		
+		Text text = corpus.getProject().getText(textid);
+		if (text == null) {
+			System.out.println(NLS.bind(TXMUIMessages.couldNotFindTextP0InCorpusP1, textid, corpus.getName()));
+			return null;
+		}
+		
+		return openBiblio(text);
+	}
+	
+	/**
+	 * Open biblio.
+	 *
+	 * @param text the text
+	 * @return the object
+	 */
+	public Object openBiblio(Text text) {
+		
+		if (text == null) {
+			return null;
+		}
+		if (text.getBiblioPath() == null) {
+			System.out.println(NLS.bind(TXMUIMessages.textP0HasNoBibliographicRecord, text.getName()));
+			return null;
+		}
+		String url = text.getBiblioPath().toString();
+		if (url.trim().length() == 0) {
+			System.out.println(NLS.bind(TXMUIMessages.textP0HasNoBibliographicRecord, text.getName()));
+			return null;
+		}
+		// attachedBrowserEditor.setCorpus(text.getCorpus());
+		return OpenBrowser.openEdition(url);
+	}
+	
+}

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

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.rcp/src/org/txm/searchengine/cqp/rcp/handlers/base/ComputeIntersection.java
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.rcp/src/org/txm/searchengine/cqp/rcp/handlers/base/ComputeIntersection.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.rcp/src/org/txm/searchengine/cqp/rcp/handlers/base/ComputeIntersection.java	(revision 3659)
@@ -0,0 +1,115 @@
+package org.txm.searchengine.cqp.rcp.handlers.base;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.commands.IHandlerListener;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.ui.handlers.HandlerUtil;
+import org.txm.Toolbox;
+import org.txm.rcp.handlers.BaseAbstractHandler;
+import org.txm.searchengine.cqp.AbstractCqiClient;
+import org.txm.searchengine.cqp.CQPSearchEngine;
+import org.txm.searchengine.cqp.corpus.CQPCorpus;
+import org.txm.searchengine.cqp.corpus.CqpObject;
+import org.txm.searchengine.cqp.corpus.MainCorpus;
+import org.txm.searchengine.cqp.corpus.Subcorpus;
+import org.txm.searchengine.cqp.rcp.messages.CQPUIMessages;
+import org.txm.utils.logger.Log;
+
+public class ComputeIntersection extends BaseAbstractHandler {
+	
+	@Override
+	public void addHandlerListener(IHandlerListener handlerListener) {
+		super.addHandlerListener(handlerListener);
+	}
+	
+	@Override
+	public void dispose() {
+		super.dispose();
+	}
+	
+	
+	@Override
+	public Object execute(ExecutionEvent event) throws ExecutionException {
+		
+		ISelection isel = this.getCorporaViewSelection(event);
+		if (!(isel instanceof IStructuredSelection)) return null;
+		IStructuredSelection selection = (IStructuredSelection) isel;
+		List list = selection.toList();
+		ArrayList<Subcorpus> subcorpora = new ArrayList<>();
+		for (Object o : list)
+			if (o instanceof Subcorpus) subcorpora.add((Subcorpus) o);
+		
+		if (subcorpora.size() != 2) {
+			System.out.println(CQPUIMessages.ErrorSelectionSize2 + subcorpora.size());
+			return null;
+		}
+		
+		HashSet<MainCorpus> set = new HashSet<>();
+		for (Subcorpus s : subcorpora) {
+			set.add(s.getMainCorpus());
+			try {
+				s.compute(false);
+			}
+			catch (InterruptedException e) {
+				Log.printStackTrace(e);
+				return null;
+			}
+		}
+		if (set.size() > 1) {
+			Log.warning(CQPUIMessages.bind(CQPUIMessages.ErrorSelectedSubcorpusHaveDifferentMainCorpusP0, set));
+			return null;
+		}
+		
+		MainCorpus ancestor = subcorpora.get(0).getMainCorpus();
+		String id1 = subcorpora.get(0).getQualifiedCqpId();
+		String id2 = subcorpora.get(1).getQualifiedCqpId();
+		String cqpid = CqpObject.subcorpusNamePrefix + CQPCorpus.getNextSubcorpusCounter();
+		String command = "inter"; //$NON-NLS-1$
+		AbstractCqiClient CQI = CQPSearchEngine.getCqiClient();
+		
+		// TODO: finish the command
+		
+		// String query = cqpid+"="+command+" "+id1+" "+id2+";";
+		// try {
+		// CQI.query(query)
+		// } catch (Exception e) {
+		// println "Error: "+CQI.getLastError()+". Please restart TXM."
+		// return;
+		// }
+		//
+		// Subcorpus subcorpus = new Subcorpus(cqpid, name, ancestor, new Query("$command $id1 $id2;"));
+		//
+		// println "$subcorpus stored in $ancestor"
+		//
+		// monitor.syncExec(new Runnable() {
+		// public void run() {
+		// CorporaView.refresh();
+		// CorporaView.expand(subcorpus.getParent());
+		// }
+		// });
+		
+		return null;
+	}
+	
+	@Override
+	public boolean isEnabled() {
+		return super.isEnabled();
+	}
+	
+	@Override
+	public boolean isHandled() {
+		return super.isHandled();
+	}
+	
+	@Override
+	public void removeHandlerListener(IHandlerListener handlerListener) {
+		super.removeHandlerListener(handlerListener);
+	}
+}

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

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.rcp/src/org/txm/searchengine/cqp/rcp/handlers/base/ComputePartition.java
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.rcp/src/org/txm/searchengine/cqp/rcp/handlers/base/ComputePartition.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.rcp/src/org/txm/searchengine/cqp/rcp/handlers/base/ComputePartition.java	(revision 3659)
@@ -0,0 +1,241 @@
+// Copyright © 2010-2020 ENS de Lyon., University of Franche-Comté
+// 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.lang.reflect.InvocationTargetException;
+import java.util.ArrayList;
+
+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.core.runtime.SubMonitor;
+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.handlers.HandlerUtil;
+import org.txm.rcp.JobsTimer;
+import org.txm.rcp.actions.CreatePartitionDialog;
+import org.txm.rcp.editors.TXMEditor;
+import org.txm.rcp.handlers.BaseAbstractHandler;
+import org.txm.rcp.messages.TXMUIMessages;
+import org.txm.rcp.swt.dialog.ComputeProgressMonitorDialog;
+import org.txm.rcp.utils.JobHandler;
+import org.txm.rcp.views.corpora.CorporaView;
+import org.txm.searchengine.cqp.core.preferences.PartitionPreferences;
+import org.txm.searchengine.cqp.corpus.CQPCorpus;
+import org.txm.searchengine.cqp.corpus.Part;
+import org.txm.searchengine.cqp.corpus.Partition;
+import org.txm.searchengine.cqp.rcp.editor.PartitionEditor;
+import org.txm.searchengine.cqp.rcp.messages.CQPUIMessages;
+import org.txm.utils.logger.Log;
+
+/**
+ * Command that creates a Partition from a Corpus.
+ * 
+ * @author mdecorde
+ * @author sjacquot
+ */
+public class ComputePartition extends BaseAbstractHandler {
+	
+	
+	/**
+	 * Partition.
+	 */
+	protected Partition partition;
+	
+	
+	/*
+	 * (non-Javadoc)
+	 * @see
+	 * org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands
+	 * .ExecutionEvent)
+	 */
+	@Override
+	public Object execute(ExecutionEvent event) throws ExecutionException {
+		
+		if (!this.checkCorpusEngine()) {
+			return false;
+		}
+		
+		// FIXME: SJ: tests of MD for using a TXMEditor rather than a dialog box to manage partitions creation and edition
+		if (PartitionPreferences.getInstance().getBoolean(PartitionPreferences.EDITOR_MODE)) {
+			return execute_editor(event);
+		}
+		// original code that uses a dialog box
+		else {
+			// since some widgets fields need some values of parents branch,
+			// ensure the parents branch is ready
+			// show modal blocking cancelable progression dialog
+			try {
+				
+				Object selection = this.getCorporaViewSelectedObject(event);
+				
+				if (selection instanceof CQPCorpus) {
+					CQPCorpus corpus = (CQPCorpus) selection;
+					if (!corpus.hasBeenComputedOnce()) {
+						
+						ComputeProgressMonitorDialog dialog = new ComputeProgressMonitorDialog(HandlerUtil.getActiveWorkbenchWindowChecked(event).getShell(), corpus);
+						dialog.runComputingProcess(true);
+						
+					}
+				}
+				
+			}
+			// Canceling or error
+			catch (InterruptedException | InvocationTargetException e) {
+				CorporaView.refresh();
+				return null;
+			}
+			
+			return execute_dialog(event);
+		}
+	}
+	
+	/**
+	 * 
+	 * @param event
+	 * @return
+	 * @throws ExecutionException
+	 */
+	public Object execute_editor(ExecutionEvent event) throws ExecutionException {
+		IStructuredSelection selection = (IStructuredSelection) HandlerUtil.getCurrentSelection(event);
+		if (selection == null) {
+			System.out.println(TXMUIMessages.noSelectionForColon + HandlerUtil.getActiveWorkbenchWindow(event).getActivePage().getActiveEditor());
+			return null;
+		}
+		Object firstElement = selection.getFirstElement();
+		Partition part = null;
+		if (firstElement instanceof CQPCorpus) {
+			part = new Partition((CQPCorpus) firstElement);
+			part.setParameters("", new ArrayList<String>(), new ArrayList<String>()); //$NON-NLS-1$
+		}
+		else if (firstElement instanceof Partition) {
+			part = (Partition) firstElement;
+		}
+		return TXMEditor.openEditor(part, PartitionEditor.class.getName());
+	}
+	
+	/**
+	 * 
+	 * @param event
+	 * @return
+	 * @throws ExecutionException
+	 */
+	public Object execute_dialog(ExecutionEvent event) throws ExecutionException {
+		IStructuredSelection 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) {
+						
+						// convert the monitor into sub-monitor
+						SubMonitor subMonitor = SubMonitor.convert(monitor, NLS.bind(TXMUIMessages.creatingANewPartitionWithP0, corpus.getName()), 100);
+						
+						this.runInit(subMonitor);
+						
+						try {
+							JobsTimer.start();
+							
+							partition = d.getPartition();
+							if (partition == null) {
+								subMonitor.done();
+								Log.warning(TXMUIMessages.errorColonThePartitionWasNotCreated);
+								return Status.CANCEL_STATUS;
+							}
+							
+							// compute the partition and children parts
+							partition.compute(subMonitor.split(10));
+							
+							// 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(CQPUIMessages.ErrorAllPartsAreEmpty, partition.getPartsCount()));
+								return Status.CANCEL_STATUS;
+							}
+							else if (emptyParts.size() != 0) {
+								Log.warning(NLS.bind(CQPUIMessages.WarningSomePartsAreEmptyP0, emptyParts));
+							}
+							
+							subMonitor.subTask(TXMUIMessages.refreshingCorpora);
+							
+							syncExec(new Runnable() {
+								
+								@Override
+								public void run() {
+									CorporaView.refresh();
+									CorporaView.expand(partition.getParent());
+								}
+							});
+							
+						}
+						// for user direct canceling
+						catch (ThreadDeath | InterruptedException e) {
+							partition.delete();
+							return Status.CANCEL_STATUS;
+						}
+						catch (Exception e) {
+							partition.delete();
+							Log.printStackTrace(e);
+							return Status.CANCEL_STATUS;
+						}
+						finally {
+							subMonitor.done();
+							JobsTimer.stopAndPrint();
+						}
+						return Status.OK_STATUS;
+					}
+				};
+				jobhandler.startJob();
+				
+			}
+			catch (Exception e) {
+				Log.severe(NLS.bind(TXMUIMessages.errorWhileCreatingAPartitionColonP0, e));
+			}
+		}
+		return null;
+	}
+}

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

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.rcp/src/org/txm/searchengine/cqp/rcp/handlers/base/Intersection.java
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.rcp/src/org/txm/searchengine/cqp/rcp/handlers/base/Intersection.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.rcp/src/org/txm/searchengine/cqp/rcp/handlers/base/Intersection.java	(revision 3659)
@@ -0,0 +1,194 @@
+// Copyright © 2010-2020 ENS de Lyon., University of Franche-Comté
+// 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.Arrays;
+import java.util.List;
+
+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.handlers.HandlerUtil;
+import org.txm.rcp.JobsTimer;
+import org.txm.rcp.messages.TXMUIMessages;
+import org.txm.rcp.swt.dialog.TextDialog;
+import org.txm.rcp.utils.JobHandler;
+import org.txm.rcp.views.corpora.CorporaView;
+import org.txm.searchengine.cqp.AbstractCqiClient;
+import org.txm.searchengine.cqp.CQPSearchEngine;
+import org.txm.searchengine.cqp.core.messages.CQPSearchEngineCoreMessages;
+import org.txm.searchengine.cqp.corpus.CQPCorpus;
+import org.txm.searchengine.cqp.corpus.Subcorpus;
+import org.txm.searchengine.cqp.rcp.dialogs.SetOperationsDialog;
+import org.txm.utils.logger.Log;
+
+// TODO: Auto-generated Javadoc
+/**
+ * Command which creates a subcorpus from a Corpus @ author mdecorde.
+ */
+public class Intersection extends AbstractHandler {
+	
+	/** 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);
+		if (selection == null) {
+			System.out.println(TXMUIMessages.noSelectionForColon + HandlerUtil.getActiveWorkbenchWindow(event).getActivePage().getActiveEditor());
+			return null;
+		}
+		List list = selection.toList();
+		if (list.size() == 0) {
+			Log.info("No corpus selected");
+			return null;
+		}
+		else if (list.size() != 1) {
+			Log.info("Intersection need a selection of 1 corpus");
+			return null;
+		}
+		Object firstElement = list.get(0);
+		// Object secondElement = list.get(1);
+		
+		if (!(firstElement instanceof CQPCorpus)) {
+			System.out.println(TXMUIMessages.selectionIsNotACorpusColon + firstElement);
+			return null;
+		}
+		
+		// if (!(secondElement instanceof CQPCorpus)) {
+		// System.out.println(TXMUIMessages.selectionIsNotACorpusColon+secondElement);
+		// return null;
+		// }
+		
+		final CQPCorpus corpus = (CQPCorpus) firstElement;
+		try {
+			corpus.compute(false);
+		}
+		catch (InterruptedException e2) {
+			// TODO Auto-generated catch block
+			e2.printStackTrace();
+			return null;
+		}
+		// final CQPCorpus corpus2 = (CQPCorpus) secondElement;
+		// corpus2.compute(false);
+		
+		Shell shell = HandlerUtil.getActiveWorkbenchWindowChecked(event).getShell();
+		final SetOperationsDialog d = new SetOperationsDialog(shell, "INTER", corpus);
+		int code = d.open();
+		if (code == Window.OK) {
+			JobHandler jobhandler = new JobHandler(NLS.bind(TXMUIMessages.creatingASubcorpusOnP0, corpus.getName())) {
+				
+				@Override
+				protected IStatus run(IProgressMonitor monitor) {
+					this.runInit(monitor);
+					JobsTimer.start();
+					try {
+						monitor.beginTask(TXMUIMessages.creatingASubcorpusInTheSearchEngine, 100);
+						Subcorpus subcorpus = null;
+						String name = d.getName();
+						if (name.length() == 0) {
+							name = d.getDefaultName();
+						}
+						
+						AbstractCqiClient cqi = CQPSearchEngine.getCqiClient();
+						
+						String cqpid = "S" + Subcorpus.getNextSubcorpusCounter();
+						CQPCorpus[] order = d.getCorpusOrder();
+						order[1].compute(false);
+						String query = cqpid + "=intersect " + order[0].getQualifiedCqpId() + " " + order[1].getQualifiedCqpId() + ";";
+						System.out.println("QUERY=" + query);
+						cqi.query(query);
+						
+						System.out.println("END QUERY=" + order[0].getMainCorpus() + ":" + cqpid);
+						if (cqi.subCorpusSize(order[0].getMainCorpus() + ":" + cqpid) == 0) {
+							Log.info("The created subcorpus was empty. Aborting.");
+							return Status.CANCEL_STATUS;
+						}
+						subcorpus = corpus.getCorpusParent().createSubcorpus(name, cqpid);
+						
+						if (subcorpus == null) {
+							monitor.done();
+							Log.warning(TXMUIMessages.errorColonSubcorpusWasNotCreated);
+							return Status.CANCEL_STATUS;
+						}
+						
+						System.out.println(NLS.bind(TXMUIMessages.doneColonP0Created, subcorpus.getName()));
+						monitor.worked(50);
+						
+						monitor.subTask(TXMUIMessages.refreshingCorpora);
+						final Subcorpus subcorpus2 = subcorpus;
+						syncExec(new Runnable() {
+							
+							@Override
+							public void run() {
+								CorporaView.refresh();
+								CorporaView.expand(subcorpus2.getParent());
+							}
+						});
+						
+						monitor.worked(100);
+					}
+					catch (ThreadDeath td) {
+						return Status.CANCEL_STATUS;
+					}
+					catch (Exception e) {
+						org.txm.utils.logger.Log.printStackTrace(e);
+						Log.severe(e.toString());
+						
+						try {
+							System.out.println(NLS.bind(CQPSearchEngineCoreMessages.lastCQPErrorColon, CQPSearchEngine.getCqiClient().getLastCQPError()));
+						}
+						catch (Exception e1) {
+							System.out.println(TXMUIMessages.failedToGetLastCQPErrorColon + e1);
+							org.txm.utils.logger.Log.printStackTrace(e1);
+						}
+					}
+					finally {
+						monitor.done();
+						JobsTimer.stopAndPrint();
+					}
+					return Status.OK_STATUS;
+				}
+			};
+			jobhandler.startJob();
+		}
+		return null;
+	}
+}

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

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.rcp/src/org/txm/searchengine/cqp/rcp/handlers/base/Union.java
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.rcp/src/org/txm/searchengine/cqp/rcp/handlers/base/Union.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.rcp/src/org/txm/searchengine/cqp/rcp/handlers/base/Union.java	(revision 3659)
@@ -0,0 +1,194 @@
+// Copyright © 2010-2020 ENS de Lyon., University of Franche-Comté
+// 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.Arrays;
+import java.util.List;
+
+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.handlers.HandlerUtil;
+import org.txm.rcp.JobsTimer;
+import org.txm.rcp.messages.TXMUIMessages;
+import org.txm.rcp.swt.dialog.TextDialog;
+import org.txm.rcp.utils.JobHandler;
+import org.txm.rcp.views.corpora.CorporaView;
+import org.txm.searchengine.cqp.AbstractCqiClient;
+import org.txm.searchengine.cqp.CQPSearchEngine;
+import org.txm.searchengine.cqp.core.messages.CQPSearchEngineCoreMessages;
+import org.txm.searchengine.cqp.corpus.CQPCorpus;
+import org.txm.searchengine.cqp.corpus.Subcorpus;
+import org.txm.searchengine.cqp.rcp.dialogs.SetOperationsDialog;
+import org.txm.utils.logger.Log;
+
+// TODO: Auto-generated Javadoc
+/**
+ * Command which creates a subcorpus from a Corpus @ author mdecorde.
+ */
+public class Union extends AbstractHandler {
+	
+	/** 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);
+		if (selection == null) {
+			System.out.println(TXMUIMessages.noSelectionForColon + HandlerUtil.getActiveWorkbenchWindow(event).getActivePage().getActiveEditor());
+			return null;
+		}
+		List list = selection.toList();
+		if (list.size() == 0) {
+			Log.info("No corpus selected");
+			return null;
+		}
+		else if (list.size() != 1) {
+			Log.info("Union need a selection of 1 corpus");
+			return null;
+		}
+		Object firstElement = list.get(0);
+		// Object secondElement = list.get(1);
+		
+		if (!(firstElement instanceof CQPCorpus)) {
+			System.out.println(TXMUIMessages.selectionIsNotACorpusColon + firstElement);
+			return null;
+		}
+		
+		// if (!(secondElement instanceof CQPCorpus)) {
+		// System.out.println(TXMUIMessages.selectionIsNotACorpusColon+secondElement);
+		// return null;
+		// }
+		
+		final CQPCorpus corpus = (CQPCorpus) firstElement;
+		try {
+			corpus.compute(false);
+		}
+		catch (InterruptedException e2) {
+			// TODO Auto-generated catch block
+			e2.printStackTrace();
+			return null;
+		}
+		// final CQPCorpus corpus2 = (CQPCorpus) secondElement;
+		// corpus2.compute(false);
+		
+		Shell shell = HandlerUtil.getActiveWorkbenchWindowChecked(event).getShell();
+		final SetOperationsDialog d = new SetOperationsDialog(shell, "UNION", corpus);
+		int code = d.open();
+		if (code == Window.OK) {
+			JobHandler jobhandler = new JobHandler(NLS.bind(TXMUIMessages.creatingASubcorpusOnP0, corpus.getName())) {
+				
+				@Override
+				protected IStatus run(IProgressMonitor monitor) {
+					this.runInit(monitor);
+					JobsTimer.start();
+					try {
+						monitor.beginTask(TXMUIMessages.creatingASubcorpusInTheSearchEngine, 100);
+						Subcorpus subcorpus = null;
+						String name = d.getName();
+						if (name.length() == 0) {
+							name = d.getDefaultName();
+						}
+						
+						AbstractCqiClient cqi = CQPSearchEngine.getCqiClient();
+						
+						String cqpid = "S" + Subcorpus.getNextSubcorpusCounter();
+						CQPCorpus[] order = d.getCorpusOrder();
+						order[1].compute(false);
+						String query = cqpid + "=join " + order[0].getQualifiedCqpId() + " " + order[1].getQualifiedCqpId() + ";";
+						System.out.println("QUERY=" + query);
+						cqi.query(query);
+						
+						if (cqi.subCorpusSize(order[0].getMainCorpus() + ":" + cqpid) == 0) {
+							Log.info("The created subcorpus was empty. Aborting.");
+							return Status.CANCEL_STATUS;
+						}
+						
+						subcorpus = corpus.getCorpusParent().createSubcorpus(name, cqpid);
+						
+						if (subcorpus == null) {
+							monitor.done();
+							Log.warning(TXMUIMessages.errorColonSubcorpusWasNotCreated);
+							return Status.CANCEL_STATUS;
+						}
+						
+						System.out.println(NLS.bind(TXMUIMessages.doneColonP0Created, subcorpus.getName()));
+						monitor.worked(50);
+						
+						monitor.subTask(TXMUIMessages.refreshingCorpora);
+						final Subcorpus subcorpus2 = subcorpus;
+						syncExec(new Runnable() {
+							
+							@Override
+							public void run() {
+								CorporaView.refresh();
+								CorporaView.expand(subcorpus2.getParent());
+							}
+						});
+						
+						monitor.worked(100);
+					}
+					catch (ThreadDeath td) {
+						return Status.CANCEL_STATUS;
+					}
+					catch (Exception e) {
+						org.txm.utils.logger.Log.printStackTrace(e);
+						Log.severe(e.toString());
+						
+						try {
+							System.out.println(NLS.bind(CQPSearchEngineCoreMessages.lastCQPErrorColon, CQPSearchEngine.getCqiClient().getLastCQPError()));
+						}
+						catch (Exception e1) {
+							System.out.println(TXMUIMessages.failedToGetLastCQPErrorColon + e1);
+							org.txm.utils.logger.Log.printStackTrace(e1);
+						}
+					}
+					finally {
+						monitor.done();
+						JobsTimer.stopAndPrint();
+					}
+					return Status.OK_STATUS;
+				}
+			};
+			jobhandler.startJob();
+		}
+		return null;
+	}
+}

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

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.rcp/src/org/txm/searchengine/cqp/rcp/handlers/base/EditSubCorpus.java
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.rcp/src/org/txm/searchengine/cqp/rcp/handlers/base/EditSubCorpus.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.rcp/src/org/txm/searchengine/cqp/rcp/handlers/base/EditSubCorpus.java	(revision 3659)
@@ -0,0 +1,77 @@
+// Copyright © 2010-2020 ENS de Lyon., University of Franche-Comté
+// 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.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.ui.handlers.HandlerUtil;
+import org.txm.rcp.editors.TXMEditor;
+import org.txm.rcp.handlers.BaseAbstractHandler;
+import org.txm.rcp.messages.TXMUIMessages;
+import org.txm.searchengine.cqp.corpus.Subcorpus;
+import org.txm.searchengine.cqp.rcp.editor.SubcorpusEditor;
+
+/**
+ * Command which creates a subcorpus from a Corpus
+ * 
+ * @author mdecorde
+ * @author sjacquot
+ * 
+ */
+public class EditSubCorpus extends BaseAbstractHandler {
+	
+	/*
+	 * (non-Javadoc)
+	 * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
+	 */
+	@Override
+	public Object execute(ExecutionEvent event) throws ExecutionException {
+		
+		if (!this.checkCorpusEngine()) {
+			return false;
+		}
+		
+		IStructuredSelection selection = (IStructuredSelection) HandlerUtil.getCurrentSelection(event);
+		if (selection == null) {
+			System.out.println(TXMUIMessages.noSelectionForColon + HandlerUtil.getActiveWorkbenchWindow(event).getActivePage().getActiveEditor());
+			return null;
+		}
+		
+		if (selection.getFirstElement() instanceof Subcorpus) {
+			return edit((Subcorpus) selection.getFirstElement());
+		} else {
+			return null;
+		}
+	}
+	
+	public static Object edit(Subcorpus sub) throws ExecutionException {
+		
+		return TXMEditor.openEditor(sub, SubcorpusEditor.class.getName());
+	}	
+}

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

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.rcp/src/org/txm/searchengine/cqp/rcp/preferences/CQPPreferencePage.java
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.rcp/src/org/txm/searchengine/cqp/rcp/preferences/CQPPreferencePage.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.rcp/src/org/txm/searchengine/cqp/rcp/preferences/CQPPreferencePage.java	(revision 3659)
@@ -0,0 +1,217 @@
+// Copyright © 2010-2020 ENS de Lyon., University of Franche-Comté
+// 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.preferences;
+
+
+import org.eclipse.jface.preference.BooleanFieldEditor;
+import org.eclipse.jface.preference.DirectoryFieldEditor;
+import org.eclipse.jface.preference.FieldEditor;
+import org.eclipse.jface.preference.FileFieldEditor;
+import org.eclipse.jface.preference.IntegerFieldEditor;
+import org.eclipse.jface.preference.StringFieldEditor;
+import org.eclipse.jface.util.PropertyChangeEvent;
+import org.eclipse.ui.IWorkbench;
+import org.osgi.service.prefs.Preferences;
+import org.txm.libs.cqp.CQPLibPreferences;
+import org.txm.rcp.Application;
+import org.txm.rcp.preferences.TXMPreferencePage;
+import org.txm.rcp.preferences.TXMPreferenceStore;
+import org.txm.searchengine.cqp.rcp.messages.CQPUIMessages;
+
+/**
+ * CQP search engine preferences page.
+ *  
+ * @author mdecorde
+ * @author sjacquot
+ *
+ */
+public class CQPPreferencePage extends TXMPreferencePage {
+
+	/** CQL fix query strategy: tokenize string or not */
+	private BooleanFieldEditor cql_fix_query_tokenize;
+	
+	/** The cqi_server_is_remote. */
+	private BooleanFieldEditor cqi_use_network;
+
+	/** The cqi_server_is_remote. */
+	private BooleanFieldEditor cqi_server_is_remote;
+
+	/** The cqi_server_host. */
+	private StringFieldEditor cqi_server_host;
+
+	/** The cqi_server_path_to_executable. */
+	private StringFieldEditor cqi_server_path_to_executable;
+	private StringFieldEditor cqi_server_path_to_cqplib;
+
+//	/** The cqi_server_path_to_registry. */
+//	private StringFieldEditor cqi_server_path_to_registry;
+
+	/** The cqi_server_path_to_init_file. */
+	private StringFieldEditor cqi_server_path_to_init_file;
+
+	/** The cqi_server_additional_options. */
+	private StringFieldEditor cqi_server_additional_options;
+
+	/** The cqi_server_path_to_registry. */
+	private StringFieldEditor cqi_server_port;
+
+	/** The cqi_server_path_to_init_file. */
+	private StringFieldEditor cqi_server_user;
+
+	/** The cqi_server_additional_options. */
+	private StringFieldEditor cqi_server_password;
+
+	/**
+	 * Instantiates a new cQP preference page.
+	 */
+	public CQPPreferencePage() {
+		super();
+	}
+
+	/**
+	 * Creates the field editors. Field editors are abstractions of the common
+	 * GUI blocks needed to manipulate various types of preferences. Each field
+	 * editor knows how to save and restore itself.
+	 */
+	@Override
+	public void createFieldEditors() {
+
+		cqi_use_network = new BooleanFieldEditor(CQPLibPreferences.CQI_NETWORK_MODE, CQPUIMessages.useNetworkProtocol, BooleanFieldEditor.DEFAULT, getFieldEditorParent());
+		cqi_server_path_to_cqplib = new DirectoryFieldEditor(CQPLibPreferences.CQI_SERVER_PATH_TO_CQPLIB, CQPUIMessages.cQPlibPath, getFieldEditorParent());
+		cqi_server_is_remote = new BooleanFieldEditor(CQPLibPreferences.CQI_SERVER_IS_REMOTE, CQPUIMessages.ampRemoteCWBServerAddressColon, BooleanFieldEditor.DEFAULT, getFieldEditorParent());
+		cqi_server_host = new StringFieldEditor(CQPLibPreferences.CQI_SERVER_HOST, CQPUIMessages.cWBServerColonAmphostColon, getFieldEditorParent());
+		cqi_server_port = new IntegerFieldEditor(CQPLibPreferences.CQI_SERVER_PORT, CQPUIMessages.cWBServerColonAmpportColon, getFieldEditorParent());
+		cqi_server_user = new StringFieldEditor(CQPLibPreferences.CQI_SERVER_LOGIN, CQPUIMessages.cWBServerColonAmploginColon, getFieldEditorParent());
+
+		cqi_server_password = new StringFieldEditor(CQPLibPreferences.CQI_SERVER_PASSWORD, CQPUIMessages.cWBServerColonAmppasswordColon, getFieldEditorParent());
+
+		cqi_server_path_to_executable = new FileFieldEditor(CQPLibPreferences.CQI_SERVER_PATH_TO_EXECUTABLE, CQPUIMessages.pathToCWBServerBinary, getFieldEditorParent());
+
+//		cqi_server_path_to_registry = new DirectoryFieldEditor(CQI_SERVER_PATH_TO_REGISTRY, CQPUIMessages.CQPPreferencePage_16, getFieldEditorParent());
+		
+		cqi_server_path_to_init_file = new FileFieldEditor(CQPLibPreferences.CQI_SERVER_PATH_TO_INIT_FILE, CQPUIMessages.pathToCWBServerInitializationFile, getFieldEditorParent());
+		cqi_server_additional_options = new StringFieldEditor(CQPLibPreferences.CQI_SERVER_ADDITIONAL_OPTIONS, CQPUIMessages.additionalAmpoptionsForTheCWBServerColon, getFieldEditorParent());
+		
+		cql_fix_query_tokenize = new BooleanFieldEditor(CQPLibPreferences.QUERY_FIX_TOKENIZE, "When fixing CQL, tokenize the value", BooleanFieldEditor.DEFAULT, getFieldEditorParent());
+
+		addField(cqi_use_network);
+		addField(cqi_server_path_to_cqplib);
+		addField(cqi_server_is_remote);
+		addField(cqi_server_host);
+		addField(cqi_server_port);
+		addField(cqi_server_user);
+		addField(cqi_server_password);
+		addField(cqi_server_path_to_executable);
+//		addField(cqi_server_path_to_registry);
+		addField(cqi_server_path_to_init_file);
+		addField(cqi_server_additional_options);
+		addField(cql_fix_query_tokenize);
+
+		Preferences preferences = org.eclipse.core.runtime.preferences.InstanceScope.INSTANCE.getNode(Application.PLUGIN_ID);
+		boolean useNetwork = preferences.getBoolean(CQPLibPreferences.CQI_NETWORK_MODE, false);
+		boolean serverIsRemote = preferences.getBoolean(CQPLibPreferences.CQI_SERVER_IS_REMOTE, false);
+		updateFieldsState(useNetwork, serverIsRemote);
+	}
+
+	public void updateFieldsState(boolean useNetwork, boolean serverIsRemote) {
+
+		//System.out.println("update field state : "+useNetwork+" "+serverIsRemote);
+
+		if (useNetwork) {
+			if (serverIsRemote) {
+				(cqi_server_path_to_cqplib).setEnabled(false, getFieldEditorParent());
+				(cqi_server_is_remote).setEnabled(true, getFieldEditorParent());
+				(cqi_server_host).setEnabled(true, getFieldEditorParent());
+				(cqi_server_port).setEnabled(true, getFieldEditorParent());
+				(cqi_server_user).setEnabled(true, getFieldEditorParent());
+				(cqi_server_password).setEnabled(true, getFieldEditorParent());
+				(cqi_server_path_to_executable).setEnabled(false, getFieldEditorParent());
+//				(cqi_server_path_to_registry).setEnabled(false, getFieldEditorParent());
+				(cqi_server_path_to_init_file).setEnabled(false, getFieldEditorParent());
+				(cqi_server_additional_options).setEnabled(true, getFieldEditorParent());
+			} else {
+				//cqi_server_host.loadDefault();
+				(cqi_server_path_to_cqplib).setEnabled(false, getFieldEditorParent());
+				(cqi_server_is_remote).setEnabled(true, getFieldEditorParent());
+				(cqi_server_host).setEnabled(false, getFieldEditorParent());
+				(cqi_server_port).setEnabled(true, getFieldEditorParent());
+				(cqi_server_user).setEnabled(true, getFieldEditorParent());
+				(cqi_server_password).setEnabled(true, getFieldEditorParent());
+				(cqi_server_path_to_executable).setEnabled(true, getFieldEditorParent());
+//				(cqi_server_path_to_registry).setEnabled(true, getFieldEditorParent());
+				(cqi_server_path_to_init_file).setEnabled(true, getFieldEditorParent());
+				(cqi_server_additional_options).setEnabled(true, getFieldEditorParent());
+			}
+		} else {
+			(cqi_server_path_to_cqplib).setEnabled(true, getFieldEditorParent());
+			(cqi_server_is_remote).setEnabled(false, getFieldEditorParent());
+			(cqi_server_host).setEnabled(false, getFieldEditorParent());
+			(cqi_server_port).setEnabled(false, getFieldEditorParent());
+			(cqi_server_user).setEnabled(false, getFieldEditorParent());
+			(cqi_server_password).setEnabled(false, getFieldEditorParent());
+			(cqi_server_path_to_executable).setEnabled(false, getFieldEditorParent());
+//			(cqi_server_path_to_registry).setEnabled(true, getFieldEditorParent());
+			(cqi_server_path_to_init_file).setEnabled(true, getFieldEditorParent());
+			(cqi_server_additional_options).setEnabled(true, getFieldEditorParent());
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
+	 */
+	@Override
+	public void init(IWorkbench workbench) {
+		this.setPreferenceStore(new TXMPreferenceStore(new CQPLibPreferences().getPreferencesNodeQualifier()));
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.jface.preference.FieldEditorPreferencePage#propertyChange(org.eclipse.jface.util.PropertyChangeEvent)
+	 */
+	@Override
+	public void propertyChange(PropertyChangeEvent event) {
+		boolean useNetwork = false;
+		boolean serverIsRemote = false;
+		boolean update = false;
+		if (((FieldEditor) event.getSource()).getPreferenceName().equals(
+				CQPLibPreferences.CQI_SERVER_IS_REMOTE)) {
+			useNetwork = cqi_use_network.getBooleanValue();
+			serverIsRemote = (Boolean) event.getNewValue();
+			update = true;
+		} else if (((FieldEditor) event.getSource()).getPreferenceName().equals(
+				CQPLibPreferences.CQI_NETWORK_MODE)) {
+			useNetwork = (Boolean) event.getNewValue();
+			serverIsRemote = cqi_server_is_remote.getBooleanValue();
+			update = true;
+		}
+		if (update)
+			updateFieldsState(useNetwork, serverIsRemote);
+	}
+}
\ No newline at end of file

Property changes on: TXM/trunk/bundles/org.txm.searchengine.cqp.rcp/src/org/txm/searchengine/cqp/rcp/preferences/CQPPreferencePage.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.rcp/src/org/txm/searchengine/cqp/rcp/preferences/SubcorpusPreferencePage.java
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.rcp/src/org/txm/searchengine/cqp/rcp/preferences/SubcorpusPreferencePage.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.rcp/src/org/txm/searchengine/cqp/rcp/preferences/SubcorpusPreferencePage.java	(revision 3659)
@@ -0,0 +1,93 @@
+// Copyright © 2010-2020 ENS de Lyon., University of Franche-Comté
+// 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.preferences;
+
+
+import org.eclipse.jface.preference.BooleanFieldEditor;
+import org.eclipse.jface.preference.DirectoryFieldEditor;
+import org.eclipse.jface.preference.FieldEditor;
+import org.eclipse.jface.preference.FileFieldEditor;
+import org.eclipse.jface.preference.IntegerFieldEditor;
+import org.eclipse.jface.preference.StringFieldEditor;
+import org.eclipse.jface.util.PropertyChangeEvent;
+import org.eclipse.ui.IWorkbench;
+import org.osgi.service.prefs.Preferences;
+import org.txm.libs.cqp.CQPLibPreferences;
+import org.txm.rcp.Application;
+import org.txm.rcp.preferences.TXMPreferencePage;
+import org.txm.rcp.preferences.TXMPreferenceStore;
+import org.txm.searchengine.cqp.core.preferences.SubcorpusPreferences;
+import org.txm.searchengine.cqp.rcp.messages.CQPUIMessages;
+
+/**
+ * CQP search engine preferences page.
+ * 
+ * @author mdecorde
+ * @author sjacquot
+ *
+ */
+public class SubcorpusPreferencePage extends TXMPreferencePage {
+	
+	/** The cqi_server_is_remote. */
+	private BooleanFieldEditor editor_mode;
+	
+	/** The cqi_server_is_remote. */
+	private BooleanFieldEditor optimized_mode;
+	
+	/**
+	 * Instantiates a new cQP preference page.
+	 */
+	public SubcorpusPreferencePage() {
+		super();
+	}
+	
+	/**
+	 * Creates the field editors. Field editors are abstractions of the common
+	 * GUI blocks needed to manipulate various types of preferences. Each field
+	 * editor knows how to save and restore itself.
+	 */
+	@Override
+	public void createFieldEditors() {
+		
+		// editor_mode = new BooleanFieldEditor(SubcorpusPreferences.EDITORMODE, "Create subcorpus using the editor mode", BooleanFieldEditor.DEFAULT, getFieldEditorParent());
+		// addField(editor_mode);
+		
+		optimized_mode = new BooleanFieldEditor(SubcorpusPreferences.OPTIMIZED_MODE, "Create structured subcorpus using optimized queries", BooleanFieldEditor.DEFAULT, getFieldEditorParent());
+		addField(optimized_mode);
+	}
+	
+	/*
+	 * (non-Javadoc)
+	 * @see
+	 * org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
+	 */
+	@Override
+	public void init(IWorkbench workbench) {
+		this.setPreferenceStore(new TXMPreferenceStore(new SubcorpusPreferences().getPreferencesNodeQualifier()));
+	}
+}

Property changes on: TXM/trunk/bundles/org.txm.searchengine.cqp.rcp/src/org/txm/searchengine/cqp/rcp/preferences/SubcorpusPreferencePage.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.rcp/src/org/txm/searchengine/cqp/rcp/preferences/PartitionPreferencePage.java
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.rcp/src/org/txm/searchengine/cqp/rcp/preferences/PartitionPreferencePage.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.rcp/src/org/txm/searchengine/cqp/rcp/preferences/PartitionPreferencePage.java	(revision 3659)
@@ -0,0 +1,88 @@
+// Copyright © 2010-2020 ENS de Lyon., University of Franche-Comté
+// 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.preferences;
+
+
+import org.eclipse.jface.preference.BooleanFieldEditor;
+import org.eclipse.jface.preference.DirectoryFieldEditor;
+import org.eclipse.jface.preference.FieldEditor;
+import org.eclipse.jface.preference.FileFieldEditor;
+import org.eclipse.jface.preference.IntegerFieldEditor;
+import org.eclipse.jface.preference.StringFieldEditor;
+import org.eclipse.jface.util.PropertyChangeEvent;
+import org.eclipse.ui.IWorkbench;
+import org.osgi.service.prefs.Preferences;
+import org.txm.libs.cqp.CQPLibPreferences;
+import org.txm.rcp.Application;
+import org.txm.rcp.preferences.TXMPreferencePage;
+import org.txm.rcp.preferences.TXMPreferenceStore;
+import org.txm.searchengine.cqp.core.preferences.PartitionPreferences;
+import org.txm.searchengine.cqp.rcp.messages.CQPUIMessages;
+
+/**
+ * CQP search engine preferences page.
+ *  
+ * @author mdecorde
+ * @author sjacquot
+ *
+ */
+public class PartitionPreferencePage extends TXMPreferencePage {
+
+	/** The cqi_server_is_remote. */
+	private BooleanFieldEditor editor_mode;
+
+	/**
+	 * Instantiates a new cQP preference page.
+	 */
+	public PartitionPreferencePage() {
+		super();
+	}
+
+	/**
+	 * Creates the field editors. Field editors are abstractions of the common
+	 * GUI blocks needed to manipulate various types of preferences. Each field
+	 * editor knows how to save and restore itself.
+	 */
+	@Override
+	public void createFieldEditors() {
+
+		editor_mode = new BooleanFieldEditor(PartitionPreferences.EDITOR_MODE, "Create partitions using the editor mode", BooleanFieldEditor.DEFAULT, getFieldEditorParent());
+		addField(editor_mode);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
+	 */
+	@Override
+	public void init(IWorkbench workbench) {
+		this.setPreferenceStore(new TXMPreferenceStore(new PartitionPreferences().getPreferencesNodeQualifier()));
+	}
+}
\ No newline at end of file

Property changes on: TXM/trunk/bundles/org.txm.searchengine.cqp.rcp/src/org/txm/searchengine/cqp/rcp/preferences/PartitionPreferencePage.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.rcp/src/org/txm/searchengine/cqp/rcp/dialogs/ExportCorpusDialog.java
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.rcp/src/org/txm/searchengine/cqp/rcp/dialogs/ExportCorpusDialog.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.rcp/src/org/txm/searchengine/cqp/rcp/dialogs/ExportCorpusDialog.java	(revision 3659)
@@ -0,0 +1,359 @@
+package org.txm.searchengine.cqp.rcp.dialogs;
+
+
+import java.io.File;
+import java.io.FileFilter;
+import java.util.Arrays;
+import java.util.Calendar;
+import java.util.Comparator;
+import java.util.HashSet;
+import java.util.LinkedHashMap;
+import java.util.List;
+
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.layout.GridDataFactory;
+import org.eclipse.jface.viewers.ArrayContentProvider;
+import org.eclipse.jface.viewers.CellLabelProvider;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.TableViewerColumn;
+import org.eclipse.jface.viewers.ViewerCell;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.FileDialog;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.TableItem;
+import org.eclipse.swt.widgets.Text;
+import org.txm.Toolbox;
+import org.txm.core.preferences.TXMPreferences;
+import org.txm.objects.Project;
+import org.txm.searchengine.cqp.corpus.CQPCorpus;
+import org.txm.searchengine.cqp.rcp.messages.CQPUIMessages;
+
+/**
+ * Allow to select the file to create and select elements to include in the binary
+ * 
+ *
+ */
+public class ExportCorpusDialog extends Dialog {
+	
+	/**
+	 * list of the default files to include in the corpus binary
+	 */
+	private List<String> defaultFiles = Arrays.asList("HTML", "txm", "data", "registry", "analec", "temporary_annotations", "xsl", "css", ".settings", ".project", "doc"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$ //$NON-NLS-10$ //$NON-NLS-11$
+	
+	private File zipFile;
+	
+	private LinkedHashMap<File, Boolean> selectedFiles;
+	
+	private CQPCorpus corpus;
+	
+	private TableViewer treeViewer;
+	
+	private TableViewerColumn nameColumn;
+	
+	private Text textField;
+	
+	private Combo versionField;
+	
+	private Button selectButton;
+	
+	private String version;
+
+	private Text renameField;
+
+	private String rename;
+	
+	public final static String ID = ExportCorpusDialog.class.getName();
+	
+	/**
+	 * 
+	 * @param parentShell
+	 * @param title
+	 * @param question
+	 * @param text
+	 */
+	public ExportCorpusDialog(Shell parentShell, CQPCorpus corpus) {
+		super(parentShell);
+		this.corpus = corpus;
+	}
+	
+	@Override
+	protected void configureShell(Shell newShell) {
+		super.configureShell(newShell);
+		newShell.setText(NLS.bind(CQPUIMessages.ExportingP0, corpus.getProject().getName().toUpperCase()));
+		newShell.setMinimumSize(400, 300);
+	}
+	
+	@Override
+	protected Control createDialogArea(Composite parent) {
+		Composite comp = (Composite) super.createDialogArea(parent);
+		
+		GridLayout layout = (GridLayout) comp.getLayout();
+		layout.numColumns = 3;
+		
+		Label l = new Label(comp, SWT.LEFT);
+		l.setText(CQPUIMessages.OutputFile);
+		l.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, false));
+		
+		textField = new Text(comp, SWT.SINGLE | SWT.BORDER);
+		textField.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false));
+		String previousPath = TXMPreferences.getString("path", ExportCorpusDialog.class.getName()); //$NON-NLS-1$
+		if (previousPath == null || previousPath.length() == 0) {
+			previousPath = System.getProperty("user.home"); // //$NON-NLS-1$
+		}
+		textField.setText(previousPath + "/" + corpus.getProject().getName().toUpperCase() + "-" + Toolbox.dateformat.format(Calendar.getInstance().getTime()) + ".txm"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+		
+		selectButton = new Button(comp, SWT.PUSH);
+		selectButton.setText("..."); //$NON-NLS-1$
+		selectButton.addSelectionListener(new SelectionListener() {
+			
+			@Override
+			public void widgetSelected(SelectionEvent e) {
+				FileDialog dialog = new FileDialog(selectButton.getShell(), SWT.SAVE);
+				
+				String[] exts = { "*.txm", "*.zip" }; //$NON-NLS-1$ //$NON-NLS-2$
+				dialog.setFilterExtensions(exts);
+				String path = textField.getText();
+				if (path != null && path.length() > 0) {
+					File p = new File(path);
+					if (p.isDirectory()) {
+						dialog.setFilterPath(textField.getText());
+					}
+					else {
+						dialog.setFilterPath(p.getParent());
+						dialog.setFileName(p.getName());
+					}
+				}
+				//
+				
+				path = dialog.open();
+				if (path != null) {
+					textField.setText(path);
+					File dir = new File(path).getParentFile();
+					getButton(IDialogConstants.OK_ID).setEnabled(dir.exists());
+					TXMPreferences.put(ExportCorpusDialog.class.getName(), "path", dir.getAbsolutePath()); //$NON-NLS-1$
+				}
+			}
+			
+			@Override
+			public void widgetDefaultSelected(SelectionEvent e) {}
+		});
+		
+		new Label(comp, SWT.NONE).setText(CQPUIMessages.CorpusIndentifier);
+		renameField = new Text(comp, SWT.BORDER);
+		GridData gdata2 = GridDataFactory.fillDefaults().create();
+		gdata2.widthHint = 50;
+		gdata2.horizontalSpan = 2;
+		renameField.setLayoutData(gdata2);
+		renameField.setText(corpus.getProject().getName());
+		renameField.setToolTipText(CQPUIMessages.ChangeThisIdentifierToRenameTheCorpus);
+		
+		new Label(comp, SWT.NONE).setText(CQPUIMessages.CorpusVersion);
+		versionField = new Combo(comp, SWT.SINGLE | SWT.READ_ONLY);
+		versionField.setItems("0.8.0", "0.7.9"); //$NON-NLS-1$ //$NON-NLS-2$
+		versionField.select(0);
+		GridData gdata = GridDataFactory.fillDefaults().create();
+		gdata.widthHint = 50;
+		gdata.horizontalSpan = 2;
+		versionField.setLayoutData(gdata);
+		
+		// File selection section
+		selectedFiles = new LinkedHashMap<>();
+		Project project = corpus.getProject();
+		File directory = project.getProjectDirectory();
+		if (directory.exists()) {
+			
+			File[] files = directory.listFiles(new FileFilter() {
+				
+				@Override
+				public boolean accept(File f) {
+					return !f.getName().startsWith(".") && !f.isHidden() && f.isDirectory() && !defaultFiles.contains(f.getName()); //$NON-NLS-1$
+				}
+			});
+			Arrays.sort(files, new Comparator<File>() {
+				
+				@Override
+				public int compare(File arg0, File arg1) {
+					if (arg0.isDirectory() && arg1.isDirectory()) {
+						return arg0.getName().compareTo(arg1.getName());
+					}
+					else if (arg0.isFile() && arg1.isFile()) {
+						return arg0.getName().compareTo(arg1.getName());
+					}
+					else {
+						if (arg0.isDirectory()) {
+							return -1;
+						}
+						else {
+							return 1;
+						}
+					}
+				}
+			});
+			for (File f : files) {
+				if (!f.isHidden() && f.isDirectory()) {
+					
+					if (defaultFiles.contains(f.getName())) {
+						selectedFiles.put(f, true);
+					}
+					else {
+						selectedFiles.put(f, false);
+					}
+				}
+			}
+			
+			if (files.length > 0) {
+				treeViewer = new TableViewer(comp, SWT.CHECK | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
+				treeViewer.getTable().setToolTipText(CQPUIMessages.DirectoriesNotManagedByTXM);
+				treeViewer.setContentProvider(new ArrayContentProvider());
+				
+				treeViewer.getTable().addListener(SWT.Selection, event -> {
+					
+					if (event.detail == SWT.CHECK) {
+						TableItem item = (TableItem) event.item;
+						selectedFiles.put((File) event.item.getData(), item.getChecked());
+					}
+				});
+				
+				treeViewer.getTable().setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true, 3, 1));
+				treeViewer.getTable().setHeaderVisible(true);
+				treeViewer.getTable().setLinesVisible(true);
+				
+				nameColumn = new TableViewerColumn(treeViewer, SWT.NONE);
+				nameColumn.getColumn().setText(CQPUIMessages.AddExtraFiles);
+				nameColumn.getColumn().pack();
+				nameColumn.setLabelProvider(new CellLabelProvider() {
+					
+					@Override
+					public void update(ViewerCell cell) {
+						Object element = cell.getElement();
+						
+						if (element instanceof File) {
+							File f = (File) element;
+							cell.setText(f.getName());
+						}
+						else {
+							cell.setText("" + element.getClass()); //$NON-NLS-1$
+						}
+					}
+				});
+				
+				treeViewer.setInput(files);
+				for (int i = 0; i < files.length; i++) {
+					treeViewer.getTable().getItem(i).setChecked(selectedFiles.get(files[i]));
+				}
+				
+				Button selectAllButton = new Button(comp, SWT.PUSH);
+				selectAllButton.setText(CQPUIMessages.SelectAll);
+				selectAllButton.addSelectionListener(new SelectionListener() {
+					
+					@Override
+					public void widgetSelected(SelectionEvent e) {
+						massSelect(true);
+					}
+					
+					@Override
+					public void widgetDefaultSelected(SelectionEvent e) {}
+				});
+				
+				Button clearAllButton = new Button(comp, SWT.PUSH);
+				clearAllButton.setText(CQPUIMessages.ClearSelection);
+				clearAllButton.addSelectionListener(new SelectionListener() {
+					
+					@Override
+					public void widgetSelected(SelectionEvent e) {
+						massSelect(false);
+					}
+					
+					@Override
+					public void widgetDefaultSelected(SelectionEvent e) {}
+				});
+			}
+		}
+		
+		return comp;
+	}
+	
+	protected void massSelect(boolean b) {
+		for (int i = 0; i < treeViewer.getTable().getItems().length; i++) {
+			treeViewer.getTable().getItem(i).setChecked(b);
+		}
+		for (File f : selectedFiles.keySet()) {
+			selectedFiles.put(f, b);
+		}
+	}
+	
+	@Override
+	protected boolean isResizable() {
+		return true;
+	}
+	
+	@Override
+	protected void buttonPressed(int buttonId) {
+		if (buttonId == Dialog.OK) {
+			zipFile = new File(textField.getText());
+			version = versionField.getText();
+			rename = renameField.getText();
+			
+			if (renameField.getText().length() > 0) {
+				String zipname = zipFile.getName();
+				String oldname = corpus.getProject().getName();
+				zipname = zipname.replace(oldname, rename);
+				zipFile = new File(zipFile.getParentFile(), zipname);
+			}
+			
+		}
+		super.buttonPressed(buttonId);
+	}
+	
+	/**
+	 * 
+	 * @return the ZIP file to create
+	 */
+	public File getZipFile() {
+		return zipFile;
+	}
+	
+	/**
+	 * 
+	 * @return The corpus version to produce
+	 */
+	public String getCorpusVersion() {
+		return version;
+	}
+	
+	/**
+	 * 
+	 * @return The corpus version to produce
+	 */
+	public String getRename() {
+		return rename;
+	}
+	
+	/**
+	 * @return The corpus version to produce
+	 */
+	public LinkedHashMap<File, Boolean> getFileSelection() {
+		return selectedFiles;
+	}
+	
+	public HashSet<String> getIgnoreNames() {
+		HashSet<String> ignore = new HashSet<>();
+		for (File f : selectedFiles.keySet()) {
+			if (!selectedFiles.get(f)) {
+				ignore.add(f.getName());
+			}
+		}
+		return ignore;
+	}
+}

Property changes on: TXM/trunk/bundles/org.txm.searchengine.cqp.rcp/src/org/txm/searchengine/cqp/rcp/dialogs/ExportCorpusDialog.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.rcp/src/org/txm/searchengine/cqp/rcp/dialogs/SetOperationsDialog.java
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.rcp/src/org/txm/searchengine/cqp/rcp/dialogs/SetOperationsDialog.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.rcp/src/org/txm/searchengine/cqp/rcp/dialogs/SetOperationsDialog.java	(revision 3659)
@@ -0,0 +1,241 @@
+package org.txm.searchengine.cqp.rcp.dialogs;
+
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.viewers.CellLabelProvider;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.TreeNode;
+import org.eclipse.jface.viewers.TreeNodeContentProvider;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.jface.viewers.TreeViewerColumn;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerCell;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Spinner;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.swt.widgets.ToolBar;
+import org.txm.core.results.TXMResult;
+import org.txm.rcp.editors.TXMEditor;
+import org.txm.rcp.swt.GLComposite;
+import org.txm.rcp.swt.provider.SimpleLabelProvider;
+import org.txm.searchengine.cqp.corpus.CQPCorpus;
+import org.txm.searchengine.cqp.corpus.Subcorpus;
+import org.txm.searchengine.cqp.rcp.messages.CQPUIMessages;
+
+/**
+ * 
+ * 
+ *
+ */
+public class SetOperationsDialog extends Dialog {
+	
+	private Text textField;
+	String operation;
+	CQPCorpus corpus[] = new CQPCorpus[2];
+	String name;
+//	private Label corpus1Label;
+//	private Label corpus2Label;
+	private String previousDefaultName;
+private TreeViewer treeViewer;
+//	private Label questionLabel;
+private TreeViewerColumn nameColumn;
+	
+	public static HashMap<String, String> operations = new HashMap<String, String>();
+	static {
+		operations.put("UNION", "''{0}'' subcorpus union with..."); //$NON-NLS-1$ //$NON-NLS-2$
+		operations.put("INTER", "''{0}'' subcorpus intersection with..."); //$NON-NLS-1$ //$NON-NLS-2$
+		operations.put("MINUS", "''{0}'' subcorpus minus"); //$NON-NLS-1$ //$NON-NLS-2$
+		operations.put("COMPL", "''{0}'' subcorpus complement..."); //$NON-NLS-1$ //$NON-NLS-2$
+	}
+	
+	public static HashMap<String, String> symbols = new HashMap<String, String>();
+	static {
+		symbols.put("UNION", "{0} ∪ {1}"); //$NON-NLS-1$ //$NON-NLS-2$
+		symbols.put("INTER", "{0} ∩ {1}"); //$NON-NLS-1$ //$NON-NLS-2$
+		symbols.put("MINUS", "{0} - {1}"); //$NON-NLS-1$ //$NON-NLS-2$
+		symbols.put("COMPL", "-{0}"); //$NON-NLS-1$ //$NON-NLS-2$
+	}
+	
+	/**
+	 * 
+	 * @param parentShell
+	 * @param title
+	 * @param question
+	 * @param text
+	 */
+	public SetOperationsDialog(Shell parentShell, String operation, CQPCorpus corpus1) {
+		super(parentShell);
+		this.operation = operation;
+		this.corpus[0] = corpus1;
+		if (this.operation.equals("COMPL")) { //$NON-NLS-1$
+			this.corpus[1] = corpus1.getCorpusParent();
+		}
+	}
+
+	@Override
+	protected void configureShell(Shell newShell) {
+		super.configureShell(newShell);
+		newShell.setText(NLS.bind(operations.get(operation), corpus[0].getName()));
+		newShell.setMinimumSize(400, 200);
+	}
+
+	@Override
+	protected Control createDialogArea(Composite parent) {
+		Composite comp = (Composite) super.createDialogArea(parent);
+
+		GridLayout layout = (GridLayout) comp.getLayout();
+		layout.numColumns = 2;
+		
+		Label l = new Label(comp, SWT.LEFT);
+		l.setText(CQPUIMessages.Name);
+		l.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, false));
+		
+		textField = new Text(comp, SWT.SINGLE|SWT.BORDER);
+		textField.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false));
+
+		treeViewer = new TreeViewer (comp, SWT.SINGLE | SWT.BORDER);
+		if (this.operation.equals("COMPL")) { //$NON-NLS-1$
+			treeViewer.getTree().setEnabled(false);
+		}
+		treeViewer.setContentProvider(new ITreeContentProvider() {
+
+			@Override
+			public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { }
+
+			@Override
+			public void dispose() { }
+
+			@Override
+			public boolean hasChildren(Object element) {
+				if (element instanceof CQPCorpus) {
+					return ((CQPCorpus)element).getSubcorpora().size() > 0;
+				}
+				return false;
+			}
+
+			@Override
+			public Object getParent(Object element) {
+				if (element instanceof CQPCorpus) {
+					return ((CQPCorpus)element).getParent();
+				}
+				return null;
+			}
+
+			@SuppressWarnings("rawtypes")
+			@Override
+			public Object[] getElements(Object inputElement) {
+				if (inputElement == null) return new Object[0];
+				
+				if (inputElement instanceof CQPCorpus) {
+					List<Subcorpus> c = ((CQPCorpus)inputElement).getSubcorpora();
+					ArrayList<Subcorpus> corpora = new ArrayList<Subcorpus>(c);
+					corpora.remove(corpus[0]);
+					return corpora.toArray();
+				}
+				return null;
+			}
+
+			@Override
+			public Object[] getChildren(Object element) {
+				if (element instanceof CQPCorpus) {
+					return ((CQPCorpus)element).getSubcorpora().toArray();
+				} 
+				return new Object[0];
+			}
+		});
+
+		treeViewer.getTree().setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true, 2 , 1));
+		treeViewer.getTree().setHeaderVisible(true);
+		treeViewer.getTree().setLinesVisible(true);
+		treeViewer.addSelectionChangedListener(new ISelectionChangedListener() {
+			
+			@Override
+			public void selectionChanged(SelectionChangedEvent event) {
+				IStructuredSelection sel = event.getStructuredSelection();
+				Object o = sel.getFirstElement();
+				corpus[1] = (CQPCorpus) o;
+				initializeWidgets();
+			}
+		});
+
+		nameColumn = new TreeViewerColumn(treeViewer, SWT.NONE);
+		nameColumn.getColumn().setText(CQPUIMessages.AvailablesSubcorpus);
+		nameColumn.getColumn().setWidth(150);
+		nameColumn.setLabelProvider(new CellLabelProvider() {
+			@Override
+			public void update(ViewerCell cell) {
+				Object element = cell.getElement();
+
+				if (element instanceof CQPCorpus) {
+					cell.setText(((CQPCorpus)element).getName());
+				} else {
+					cell.setText(""); //$NON-NLS-1$
+				}
+			}
+		});
+		
+		treeViewer.setInput(corpus[0].getMainCorpus());
+		initializeWidgets();
+		
+		return comp;
+	}
+	
+	@Override
+	protected boolean isResizable() {
+	    return true;
+	}
+	
+	public void initializeWidgets() {
+//		corpus1Label.setText(corpus[0].getName());
+//		corpus2Label.setText(corpus[1].getName());
+//		questionLabel.setText(NLS.bind(symbols.get(operation), corpus[0], corpus[1]));
+		//textField.getShell().setText(NLS.bind(symbols.get(operation), corpus[0], corpus[1]));
+		String current = textField.getText();
+		if (current.length() == 0 || current.equals(previousDefaultName)) {
+			textField.setText(getDefaultName());
+		}
+	}
+
+	public String getDefaultName() {
+		String s = CQPUIMessages.SelectASubcorpusInTheList;
+		if (corpus[1] != null) {
+			s = corpus[1].getSimpleName();
+		}
+		previousDefaultName = NLS.bind(symbols.get(operation), corpus[0].getSimpleName(), s);
+		return previousDefaultName;
+	}
+
+	@Override
+	protected void buttonPressed(int buttonId) {
+		if (buttonId == Dialog.OK) {
+			name = textField.getText();
+		}
+		super.buttonPressed(buttonId);
+	}
+
+	public String getName() {
+		return name;
+	}
+
+	public CQPCorpus[] getCorpusOrder() {
+		return corpus;
+	}
+}

Property changes on: TXM/trunk/bundles/org.txm.searchengine.cqp.rcp/src/org/txm/searchengine/cqp/rcp/dialogs/SetOperationsDialog.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.rcp/src/org/txm/searchengine/cqp/rcp/adapters/CorpusAdapterFactory.java
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.rcp/src/org/txm/searchengine/cqp/rcp/adapters/CorpusAdapterFactory.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.rcp/src/org/txm/searchengine/cqp/rcp/adapters/CorpusAdapterFactory.java	(revision 3659)
@@ -0,0 +1,101 @@
+// Copyright © 2010-2020 ENS de Lyon., University of Franche-Comté
+package org.txm.searchengine.cqp.rcp.adapters;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.model.IWorkbenchAdapter;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.txm.core.preferences.TBXPreferences;
+import org.txm.core.results.TXMResult;
+import org.txm.rcp.Application;
+import org.txm.rcp.IImageKeys;
+import org.txm.rcp.adapters.TXMResultAdapter;
+import org.txm.rcp.adapters.TXMResultAdapterFactory;
+import org.txm.searchengine.cqp.corpus.CQPCorpus;
+import org.txm.searchengine.cqp.corpus.Partition;
+
+
+/**
+ * A factory for creating Adapter objects.
+ * 
+ * @author mdecorde
+ * @author sjacquot
+ */
+public class CorpusAdapterFactory extends TXMResultAdapterFactory {
+	
+	
+	
+	@Override
+	public Object getAdapter(Object adaptableObject, Class adapterType) {
+		if (adapterType == IWorkbenchAdapter.class && adaptableObject instanceof CQPCorpus) {
+			return new TXMResultAdapter() {
+				
+				@Override
+				public Object[] getChildren(Object corpus) {
+					
+					// List<TXMResult> allChildren = ((CQPCorpus) corpus).getChildren();
+					List<TXMResult> allChildren = ((TXMResult) corpus).getChildren(!TBXPreferences.getInstance().getBoolean(TBXPreferences.SHOW_ALL_RESULT_NODES));
+					
+					
+					ArrayList<Partition> partitions = new ArrayList<>();
+					ArrayList<CQPCorpus> subcorporas = new ArrayList<>();
+					ArrayList<TXMResult> resultsChildren = new ArrayList<>();
+					ArrayList<Object> hiddentResultsChildren = new ArrayList<>();
+					ArrayList<Object> children = new ArrayList<>();
+					
+					// FIXME: remove Text and SavedQuery from the corpora view
+					// + sort and group the partitions and subcorpus
+					for (int i = 0; i < allChildren.size(); i++) {
+						Object element = allChildren.get(i);
+						// partitions
+						if (element instanceof Partition) {
+							partitions.add((Partition) element);
+						}
+						// corpus
+						else if (element instanceof CQPCorpus) {
+							subcorporas.add((CQPCorpus) element);
+						}
+						// results
+						else if (((TXMResult) element).isVisible()) {
+							resultsChildren.add((TXMResult) element);
+						}
+						// hidden results
+						else if (TBXPreferences.getInstance().getBoolean(TBXPreferences.SHOW_ALL_RESULT_NODES)) {
+							hiddentResultsChildren.add(element);
+						}
+						
+					}
+					
+					Collections.sort(partitions);
+					Collections.sort(subcorporas);
+					
+					children.addAll(partitions);
+					children.addAll(subcorporas);
+					children.addAll(resultsChildren);
+					children.addAll(hiddentResultsChildren);
+					
+					return children.toArray();
+				}
+				
+				@Override
+				public ImageDescriptor getImageDescriptor(Object object) {
+					// if (object instanceof MainCorpus
+					// && !((MainCorpus) object).hasBeenComputed()) { // not working because of actual management of the CorpusManager (all Corpus are loaded and there is not 'not ready state')
+					// return AbstractUIPlugin.imageDescriptorFromPlugin(Application.PLUGIN_ID, IImageKeys.CORPUS_BROKEN);
+					// }
+					// else {
+					return AbstractUIPlugin.imageDescriptorFromPlugin(Application.PLUGIN_ID, IImageKeys.CORPUS);
+					// }
+				}
+			};
+		}
+		return null;
+	}
+	
+	
+	
+	
+}

Property changes on: TXM/trunk/bundles/org.txm.searchengine.cqp.rcp/src/org/txm/searchengine/cqp/rcp/adapters/CorpusAdapterFactory.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.rcp/src/org/txm/searchengine/cqp/rcp/editor/PartitionEditor.java
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.rcp/src/org/txm/searchengine/cqp/rcp/editor/PartitionEditor.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.rcp/src/org/txm/searchengine/cqp/rcp/editor/PartitionEditor.java	(revision 3659)
@@ -0,0 +1,300 @@
+package org.txm.searchengine.cqp.rcp.editor;
+
+import org.apache.commons.lang.StringUtils;
+import org.eclipse.jface.layout.GridDataFactory;
+import org.eclipse.jface.viewers.CellLabelProvider;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.TableViewerColumn;
+import org.eclipse.jface.viewers.ViewerCell;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.events.KeyListener;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+import org.txm.core.preferences.TXMPreferences;
+import org.txm.core.results.Parameter;
+import org.txm.rcp.editors.TXMEditor;
+import org.txm.rcp.editors.listeners.ComputeKeyListener;
+import org.txm.rcp.swt.widget.AssistedQueryWidget;
+import org.txm.rcp.views.corpora.CorporaView;
+import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
+import org.txm.searchengine.cqp.corpus.Part;
+import org.txm.searchengine.cqp.corpus.Partition;
+import org.txm.utils.logger.Log;
+
+public class PartitionEditor extends TXMEditor<Partition> {
+
+	TableViewer partsViewer;
+	TableViewerColumn nameColumn;
+	TableViewerColumn queryColumn;
+	TableViewerColumn sizeColumn;
+	private Label miniInfoLabel;
+	
+	@Parameter(key=TXMPreferences.USER_NAME)
+	private Text nameWidget;
+	
+	private Text partNameWidget;
+	private AssistedQueryWidget queryWidget;
+	
+	@Override
+	public void _createPartControl() throws Exception {
+		
+		getResult().compute(false); // ensure Parts are ready
+		
+		ComputeKeyListener computeKeyListener = new ComputeKeyListener(this);
+		
+		getMainParametersComposite().getLayout().numColumns = 7;
+		
+		Label l = new Label(getMainParametersComposite(), SWT.NONE);
+		l.setText("Name");
+		l.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
+		
+		nameWidget = new Text(getMainParametersComposite(), SWT.BORDER);
+		nameWidget.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
+		nameWidget.addModifyListener(new ModifyListener() {
+			
+			@Override
+			public void modifyText(ModifyEvent e) {
+				getResult().setUserName(nameWidget.getText());
+				getResult().saveParameter(TXMPreferences.USER_NAME, nameWidget.getText());
+				
+				CorporaView.refreshObject(getResult());
+			}
+		});
+		
+		l = new Label(getMainParametersComposite(), SWT.SEPARATOR | SWT.VERTICAL);
+		l.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
+		
+		miniInfoLabel = new Label(getMainParametersComposite(), SWT.NONE);
+		miniInfoLabel.setText("Add a part");
+		miniInfoLabel.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
+		
+		partNameWidget = new Text(getMainParametersComposite(), SWT.BORDER);
+		partNameWidget.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
+		
+		// [ (v)]
+		// queryWidget = new QueryWidget(queryArea, SWT.DROP_DOWN);
+		queryWidget = new AssistedQueryWidget(getMainParametersComposite(), SWT.DROP_DOWN, getResult().getCorpus());
+		queryWidget.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
+		queryWidget.addKeyListener(new ComputeKeyListener(this) {
+			@Override
+			public void keyPressed(KeyEvent e) {
+				if (e.keyCode == SWT.CR || e.keyCode == SWT.KEYPAD_CR) {
+					try {
+						if (queryWidget.getQueryString().length() > 0 && onPlusButtonPressed(null, queryWidget.getQueryString())) {
+							super.keyPressed(e); // recompute only if the query has been added
+							queryWidget.clearQuery();
+						} else {
+							queryWidget.setText(queryWidget.getQueryString());
+						}
+					} catch (Exception e1) {
+						// TODO Auto-generated catch block
+						e1.printStackTrace();
+					}
+				}
+			}
+		});
+		queryWidget.getQueryWidget().addModifyListener(computeKeyListener);
+		
+		Button addNewQueryButton = new Button(getMainParametersComposite(), SWT.PUSH);
+		addNewQueryButton.setText("+");
+		addNewQueryButton.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false, false));
+		addNewQueryButton.addSelectionListener(new SelectionListener() {
+			
+			@Override
+			public void widgetSelected(SelectionEvent e) {
+				try {
+					if (queryWidget.getQueryString().length() > 0 && onPlusButtonPressed(null, queryWidget.getQueryString())) {
+						compute(true);
+						queryWidget.clearQuery();
+					} else {
+						queryWidget.setText(queryWidget.getQueryString());
+					}
+				} catch (Exception e1) {
+					// TODO Auto-generated catch block
+					e1.printStackTrace();
+				}
+			}
+			
+			@Override
+			public void widgetDefaultSelected(SelectionEvent e) { }
+		});
+		
+		partsViewer = new TableViewer(this.getResultArea());
+		partsViewer.getTable().setLayoutData(GridDataFactory.fillDefaults().align(GridData.FILL, GridData.FILL).grab(true, true).create());
+		partsViewer.getTable().setHeaderVisible(true);
+		partsViewer.getTable().setLinesVisible(true);
+		
+		partsViewer.getTable().addKeyListener(new KeyListener() {
+			
+			@Override
+			public void keyReleased(KeyEvent e) {
+				if (e.keyCode == SWT.DEL) {
+					ISelection isel = partsViewer.getSelection();
+					IStructuredSelection sel = (IStructuredSelection)isel;
+					Object o = sel.getFirstElement();
+					if (o != null && o instanceof Part) {
+						Part p = (Part)o;
+						p.delete();
+						partsViewer.setInput(getResult());
+						try {
+							updateEditorFromResult(false);
+						} catch (Exception e1) {
+							// TODO Auto-generated catch block
+							e1.printStackTrace();
+						}
+					}
+				}
+			}
+			
+			@Override
+			public void keyPressed(KeyEvent e) {}
+		});
+		
+		partsViewer.setContentProvider(new ITreeContentProvider() {
+			
+			@Override
+			public Object[] getElements(Object inputElement) {
+				if (inputElement instanceof Partition) {
+					return ((Partition)inputElement).getParts().toArray();
+				}
+								
+				return new Object[0];
+			}
+			
+			@Override
+			public Object[] getChildren(Object parentElement) {
+				return new Object[0];
+			}
+			
+			@Override
+			public Object getParent(Object element) {
+				return getResult();
+			}
+			
+			@Override
+			public boolean hasChildren(Object element) {
+				return false;
+			}
+		});
+		
+		nameColumn = new TableViewerColumn(partsViewer, SWT.NONE);
+		nameColumn.getColumn().setText("Name");
+		nameColumn.getColumn().pack();
+		nameColumn.setLabelProvider(new CellLabelProvider() {
+			
+			@Override
+			public void update(ViewerCell cell) {
+				Object element = cell.getElement();
+				
+				if (element instanceof Part) {
+					Part part = (Part)element;
+					cell.setText(part.getName());
+				} else {
+					cell.setText("not part");
+				}
+			}
+		});
+		
+		queryColumn = new TableViewerColumn(partsViewer, SWT.NONE);
+		queryColumn.getColumn().setText("Query");
+		queryColumn.getColumn().pack();
+		queryColumn.setLabelProvider(new CellLabelProvider() {
+			
+			@Override
+			public void update(ViewerCell cell) {
+				Object element = cell.getElement();
+				
+				if (element instanceof Part) {
+					Part part = (Part)element;
+					cell.setText(part.getQuery().toString());
+				} else {
+					cell.setText("not part");
+				}
+			}
+		});
+		
+		sizeColumn = new TableViewerColumn(partsViewer, SWT.NONE);
+		sizeColumn.getColumn().setText("Size");
+		sizeColumn.getColumn().pack();
+		sizeColumn.setLabelProvider(new CellLabelProvider() {
+			
+			@Override
+			public void update(ViewerCell cell) {
+				Object element = cell.getElement();
+				
+				if (element instanceof Part) {
+					Part part = (Part)element;
+					try {
+						cell.setText(""+part.getSize());
+					} catch (CqiClientException e) {
+						Log.printStackTrace(e);
+					}
+				} else {
+					cell.setText("not part");
+				}
+			}
+		});
+		
+		partsViewer.setInput(getResult());
+	}
+
+	/**
+	 * 
+	 * @param event
+	 * @param query
+	 * @return
+	 * @throws Exception 
+	 */
+	public boolean onPlusButtonPressed(Event event, String query) throws Exception {
+		System.out.println("Add part: "+query);
+		String pName = partNameWidget.getText().trim();
+		if (pName.length() == 0) {
+			Log.warning("no part name set.");
+			return false;
+		}
+		if (query.length() == 0) {
+			Log.warning("no part query set.");
+			return false;
+		}
+		if (getResult().getPartForName(pName) != null) {
+			Log.warning(NLS.bind("A part with the '{0}' name already exists.", pName));
+			return false;
+		}
+		
+		Part p = new Part(getResult(), pName, queryWidget.getQueryString());
+		if (p.compute()) { // the part is OK, update the partition parameters
+			getResult().getQueriesParameter().add(query);
+			getResult().getPartNamesParameter().add(pName);
+			compute(false);
+			
+			updateEditorFromResult(false);
+		} else {
+			Log.warning("Can't compute the part with query: "+query);
+			p.delete();
+		}
+		
+		return false;
+	}
+	
+	@Override
+	public void updateResultFromEditor() {
+		// nothing to do
+	}
+
+	@Override
+	public void updateEditorFromResult(boolean update) throws Exception {
+		partsViewer.setInput(getResult());
+	}
+}

Property changes on: TXM/trunk/bundles/org.txm.searchengine.cqp.rcp/src/org/txm/searchengine/cqp/rcp/editor/PartitionEditor.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.rcp/src/org/txm/searchengine/cqp/rcp/editor/SubcorpusEditor.java
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.rcp/src/org/txm/searchengine/cqp/rcp/editor/SubcorpusEditor.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.rcp/src/org/txm/searchengine/cqp/rcp/editor/SubcorpusEditor.java	(revision 3659)
@@ -0,0 +1,248 @@
+package org.txm.searchengine.cqp.rcp.editor;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.commons.lang.StringUtils;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.swt.widgets.ToolItem;
+import org.eclipse.ui.IPartListener;
+import org.eclipse.ui.IWorkbenchPart;
+import org.txm.core.preferences.TXMPreferences;
+import org.txm.core.results.Parameter;
+import org.txm.core.results.TXMResult;
+import org.txm.rcp.IImageKeys;
+import org.txm.rcp.editors.TXMEditor;
+import org.txm.rcp.editors.listeners.ComputeKeyListener;
+import org.txm.rcp.messages.TXMUIMessages;
+import org.txm.rcp.swt.widget.AssistedChoiceQueryWidget;
+import org.txm.rcp.swt.widget.ComplexSubcorpusPanel;
+import org.txm.rcp.swt.widget.structures.SimpleSubcorpusPanel;
+import org.txm.rcp.views.corpora.CorporaView;
+import org.txm.searchengine.cqp.corpus.Subcorpus;
+import org.txm.searchengine.cqp.corpus.query.Match;
+
+public class SubcorpusEditor extends TXMEditor<Subcorpus> {
+
+	protected static final String ASSISTANTS_GROUPNAME = "Assistants";
+	private Label nameLabel;
+	@Parameter(key = TXMPreferences.USER_NAME)
+
+	private Text nameText;
+
+	private Label queryLabel;
+
+	@Parameter(key = TXMPreferences.QUERY)
+	private AssistedChoiceQueryWidget queryWidget;
+
+	Label matchesInfo;
+	Text matchStartsEndsInfo;
+	private Group modeGroups;
+	private ToolItem refreshQueryButton;
+
+	@Override
+	public void _createPartControl() throws Exception {
+
+		getSite().getPage().addPartListener(new IPartListener() {
+
+			@Override
+			public void partOpened(IWorkbenchPart part) { }
+
+			@Override
+			public void partDeactivated(IWorkbenchPart part) { }
+
+			@Override
+			public void partClosed(IWorkbenchPart part) {
+				TXMResult r = getResult();
+				if (!r.hasBeenComputedOnce()) {
+					r.delete();
+					CorporaView.refresh();
+				}
+			}
+
+			@Override
+			public void partBroughtToTop(IWorkbenchPart part) { }
+
+			@Override
+			public void partActivated(IWorkbenchPart part) { }
+		});
+
+		// Modified computing listeners to manage multi lines query widgets
+				ComputeKeyListener computeKeyListener = new ComputeKeyListener(this) {
+
+					@Override
+					public void keyPressed(KeyEvent e) {
+
+						if (queryWidget.getQuery() == null) return;
+						if (!queryWidget.getQuery().getSearchEngine().hasMultiLineQueries()) super.keyPressed(e);
+					}
+				};
+		
+		getMainParametersComposite().getLayout().numColumns = 4;
+
+		nameLabel = new Label(getMainParametersComposite(), SWT.NONE);
+		nameLabel.setText(TXMUIMessages.name);
+		nameLabel.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
+
+		nameText = new Text(this.getMainParametersComposite(), SWT.BORDER);
+		GridData gdata = new GridData(SWT.FILL, SWT.CENTER, true, false);
+		nameText.setLayoutData(gdata);
+		gdata.widthHint = 150;
+		nameText.addModifyListener(computeKeyListener);
+
+		queryLabel = new Label(getMainParametersComposite(), SWT.NONE);
+		queryLabel.setText(TXMUIMessages.ampQuery);
+		queryLabel.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
+
+		queryWidget = new AssistedChoiceQueryWidget(this.getMainParametersComposite(), SWT.BORDER|SWT.DROP_DOWN | SWT.MULTI | SWT.WRAP | SWT.V_SCROLL, getResult());
+		queryWidget.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, true, true));
+		queryWidget.addKeyListener(computeKeyListener);
+		queryWidget.getQueryWidget().addModifyListener(computeKeyListener);
+
+		ArrayList<String> modes = new ArrayList<String>();
+		final ArrayList<SelectionListener> listeners = new ArrayList<SelectionListener>();
+
+		// MODE TABS
+		SelectionListener openCloseSelectionListener = new SelectionListener() {
+			@Override
+			public void widgetSelected(SelectionEvent e) {
+
+				boolean v = getTopToolbar().isVisible(ASSISTANTS_GROUPNAME);
+				if (!v) { // not visible remove all composites
+					if (modeGroups.getChildren().length > 0) {
+						Control c = modeGroups.getChildren()[0];
+						if (c instanceof SimpleSubcorpusPanel) {
+							SimpleSubcorpusPanel ssp = (SimpleSubcorpusPanel)c;
+							String q = ssp.getQueryString();
+							if (q.length() > 0) {
+								queryWidget.setText(q);
+							}
+						} else if (c instanceof ComplexSubcorpusPanel) {
+							ComplexSubcorpusPanel ssp = (ComplexSubcorpusPanel)c;
+							GridData gdata = new GridData(GridData.FILL, GridData.FILL, true, true);
+							ssp.setLayoutData(gdata);
+							gdata.heightHint = 600;
+							String q = ssp.getQueryString();
+							if (q.length() > 0) {
+								queryWidget.setText(q);
+							}
+						}
+						for (Control c2 : modeGroups.getChildren()) c2.dispose();
+					}
+				} else { 
+					
+					for (Control c : modeGroups.getChildren()) c.dispose();
+					
+					if (modeGroups.getChildren().length  == 0) {
+						listeners.get(0).widgetSelected(e);
+					}
+				}
+			}
+
+			@Override
+			public void widgetDefaultSelected(SelectionEvent e) {	}
+		};
+
+		modes.add("Simple");
+		modes.add("Assisted");
+
+		listeners.add(new SelectionListener() { // create alistener to instantiate a new AnnotationArea
+
+			@Override
+			public void widgetSelected(SelectionEvent e) {
+				try {
+					for (Control c : modeGroups.getChildren()) c.dispose();
+
+					getTopToolbar().setVisible(ASSISTANTS_GROUPNAME, true);
+
+					SimpleSubcorpusPanel panel = new SimpleSubcorpusPanel(modeGroups, SWT.BORDER, null, getResult().getCorpusParent());
+					panel.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true));
+
+					modeGroups.layout(true);
+					getResultArea().getParent().layout(true);
+
+				} catch (Exception e1) {
+					// TODO Auto-generated catch block
+					e1.printStackTrace();
+				}
+			}
+
+			@Override
+			public void widgetDefaultSelected(SelectionEvent e) {}
+		});
+		listeners.add(new SelectionListener() { // create alistener to instantiate a new AnnotationArea
+
+			@Override
+			public void widgetSelected(SelectionEvent e) {
+				try {
+					for (Control c : modeGroups.getChildren()) c.dispose();
+
+					getTopToolbar().setVisible(ASSISTANTS_GROUPNAME, true);
+
+					ComplexSubcorpusPanel panel = new ComplexSubcorpusPanel(modeGroups, SWT.BORDER, getResult().getCorpusParent());
+					panel.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true));
+
+					modeGroups.layout(true);
+					getResultArea().getParent().layout(true);
+
+				} catch (Exception e1) {
+					// TODO Auto-generated catch block
+					e1.printStackTrace();
+				}
+			}
+
+			@Override
+			public void widgetDefaultSelected(SelectionEvent e) {}
+		});
+		modeGroups = this.getTopToolbar().installAlternativesGroup(ASSISTANTS_GROUPNAME, ASSISTANTS_GROUPNAME, IImageKeys.ACTION_ASSISTQUERY, null, false, openCloseSelectionListener, modes, listeners);
+		modeGroups.setLayout(new GridLayout(1, true));
+
+		// RESULT AREA
+
+		matchesInfo = new Label(this.getResultArea(), SWT.NONE);
+		matchesInfo.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, true, false));
+
+		matchStartsEndsInfo = new Text(this.getResultArea(), SWT.BORDER | SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
+		matchStartsEndsInfo.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, true, true));
+	}
+
+	protected void refreshQuery() {
+		System.out.println("Refresh query...");
+	}
+
+	@Override
+	public void updateResultFromEditor() {
+		// nothing to do
+	}
+
+	@Override
+	public void updateEditorFromResult(boolean update) throws Exception {
+
+		List<? extends org.txm.objects.Match> matches = getResult().getMatches();
+		if (matches == null || matches.size() == 0) {
+
+			if (getResult().hasBeenComputedOnce()) {
+				matchesInfo.setText(NLS.bind("{0} match and {1} token", 0, 0));
+			} else {
+				matchesInfo.setText("(not computed yes)");
+			}
+			matchStartsEndsInfo.setText("");
+		} else {
+			matchesInfo.setText(NLS.bind("{0} match(s) for {1} tokens", this.getResult().getNMatch(), this.getResult().getSize()));
+			matchStartsEndsInfo.setText(StringUtils.join(getResult().getMatches(), "\n"));
+		}
+		matchesInfo.redraw();
+		matchStartsEndsInfo.redraw();
+		matchStartsEndsInfo.getParent().layout(true);
+	}
+}

Property changes on: TXM/trunk/bundles/org.txm.searchengine.cqp.rcp/src/org/txm/searchengine/cqp/rcp/editor/SubcorpusEditor.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.rcp/src/org/txm/searchengine/cqp/rcp/messages/messages.properties
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.rcp/src/org/txm/searchengine/cqp/rcp/messages/messages.properties	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.rcp/src/org/txm/searchengine/cqp/rcp/messages/messages.properties	(revision 3659)
@@ -0,0 +1,34 @@
+#TXM messages generated by the PluginMessagesManager class
+#Wed Jul 27 14:52:25 CEST 2022
+AddExtraFiles=Add extra files
+additionalAmpoptionsForTheCWBServerColon=Additional &options for the CQP server\: 
+ampRemoteCWBServerAddressColon=&Remote CWB server address\:
+AvailablesSubcorpus=Available Subcorpora
+ChangeThisIdentifierToRenameTheCorpus=Use this field to change the corpus identifier
+ClearSelection=Clear selection
+CorpusIndentifier=Corpus identifier
+CorpusVersion=Corpus version
+cQPlibPath=CQPlib path
+creatingANewPartitionWithP0=Creating a new partition on {0}
+cWBServerColonAmphostColon=Remote CQP server\: &host\:
+cWBServerColonAmploginColon=Remote CQP server\: &login\:
+cWBServerColonAmppasswordColon=Remote CQP server\: &password\:
+cWBServerColonAmpportColon=Remote CQP server\: network &port\:
+DirectoriesNotManagedByTXM=Directories not managed by TXM
+ErrorAllPartsAreEmpty=** Error\: all parts are empty.
+errorColonThePartitionCreatedHasNoPart=** Error\: the partition created is empty.
+errorColonThePartitionWasNotCreated=** Error\: the partition has not been created.
+ErrorSelectedSubcorpusHaveDifferentMainCorpusP0=** Error\: selected subcorpora have a different main corpus\: 
+ErrorSelectionSize2=** Error\: selection size \!\= 2 \: 
+errorWhileCreatingAPartitionColonP0=** Error while creating a partition\: {0}
+ExportingP0=Exporting {0}...
+Name=Name
+noSelectionForColon=No selection for 
+OutputFile=Output file
+pathToCWBServerBinary=Path to the CQP server executable file
+pathToCWBServerInitializationFile=Path to the CQP server configuration file
+refreshingCorpora=Updating Corpus view
+SelectAll=Select All
+SelectASubcorpusInTheList=[select a subcorpus from the list]
+useNetworkProtocol=Use the network protocol
+WarningSomePartsAreEmptyP0=** Warning\: some parts are empty\: {0}

Property changes on: TXM/trunk/bundles/org.txm.searchengine.cqp.rcp/src/org/txm/searchengine/cqp/rcp/messages/messages.properties
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.rcp/src/org/txm/searchengine/cqp/rcp/messages/CQPUIMessages.java
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.rcp/src/org/txm/searchengine/cqp/rcp/messages/CQPUIMessages.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.rcp/src/org/txm/searchengine/cqp/rcp/messages/CQPUIMessages.java	(revision 3659)
@@ -0,0 +1,76 @@
+package org.txm.searchengine.cqp.rcp.messages;
+
+import org.eclipse.osgi.util.NLS;
+import org.txm.utils.messages.Utf8NLS;
+
+/**
+ * CQP UI messages.
+ * 
+ * @author mdecorde
+ * @author sjacquot
+ *
+ */
+public class CQPUIMessages extends NLS {
+	
+	private static final String BUNDLE_NAME = "org.txm.searchengine.cqp.rcp.messages.messages"; //$NON-NLS-1$
+	
+	public static String cQPlibPath;
+
+	public static String creatingANewPartitionWithP0; 
+	public static String useNetworkProtocol; 
+	public static String ampRemoteCWBServerAddressColon; 
+	public static String cWBServerColonAmphostColon; 
+	public static String cWBServerColonAmpportColon; 
+	public static String cWBServerColonAmploginColon; 
+	public static String cWBServerColonAmppasswordColon; 
+	public static String pathToCWBServerBinary; 
+	public static String pathToCWBServerInitializationFile; 
+	public static String additionalAmpoptionsForTheCWBServerColon;
+
+	public static String AddExtraFiles;
+
+	public static String AvailablesSubcorpus;
+
+	public static String ChangeThisIdentifierToRenameTheCorpus;
+
+	public static String ClearSelection;
+
+	public static String CorpusIndentifier;
+
+	public static String CorpusVersion;
+
+	public static String DirectoriesNotManagedByTXM;
+
+	public static String ErrorAllPartsAreEmpty;
+
+	public static String ErrorSelectedSubcorpusHaveDifferentMainCorpusP0;
+
+	public static String ErrorSelectionSize2;
+
+	public static String errorColonThePartitionCreatedHasNoPart;
+
+	public static String errorColonThePartitionWasNotCreated;
+
+	public static String errorWhileCreatingAPartitionColonP0;
+
+	public static String ExportingP0;
+
+	public static String Name;
+
+	public static String noSelectionForColon;
+
+	public static String OutputFile;
+
+	public static String refreshingCorpora;
+
+	public static String SelectAll;
+
+	public static String SelectASubcorpusInTheList;
+
+	public static String WarningSomePartsAreEmptyP0; 
+	
+	static {
+		// initialize resource bundle
+		Utf8NLS.initializeMessages(BUNDLE_NAME, CQPUIMessages.class);
+	}
+}

Property changes on: TXM/trunk/bundles/org.txm.searchengine.cqp.rcp/src/org/txm/searchengine/cqp/rcp/messages/CQPUIMessages.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.rcp/src/org/txm/searchengine/cqp/rcp/messages/messages_fr.properties
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.rcp/src/org/txm/searchengine/cqp/rcp/messages/messages_fr.properties	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.rcp/src/org/txm/searchengine/cqp/rcp/messages/messages_fr.properties	(revision 3659)
@@ -0,0 +1,34 @@
+#TXM messages generated by the PluginMessagesManager class
+#Wed Jul 27 14:52:25 CEST 2022
+AddExtraFiles=Ajouter des fichiers supplémentaires
+additionalAmpoptionsForTheCWBServerColon=&Options additionnelles pour le serveur CQP \: 
+ampRemoteCWBServerAddressColon=Adresse du &serveur CWB distant \:
+AvailablesSubcorpus=Sous-corpus disponibles
+ChangeThisIdentifierToRenameTheCorpus=Utilisez ce champ pour modifier l'identifiant du corpus
+ClearSelection=Effacer la sélection
+CorpusIndentifier=Identifiant du corpus
+CorpusVersion=Version du corpus
+cQPlibPath=Chemin vers CQPlib
+creatingANewPartitionWithP0=Création d''une nouvelle partition sur {0}
+cWBServerColonAmphostColon=Serveur CQP distant \: nom de machine
+cWBServerColonAmploginColon=Serveur CQP distant \: identifiant
+cWBServerColonAmppasswordColon=Serveur CQP distant \: &mot de passe
+cWBServerColonAmpportColon=Serveur CQP distant \: &port réseau
+DirectoriesNotManagedByTXM=Dossiers non gérés par TXM
+ErrorAllPartsAreEmpty=** Erreur \: toutes les parties sont vides.
+errorColonThePartitionCreatedHasNoPart=** Erreur \: la partition créée est vide.
+errorColonThePartitionWasNotCreated=** Erreur \: la partition n'a pas été créée.
+ErrorSelectedSubcorpusHaveDifferentMainCorpusP0=** Erreur \: les sous-corpus sélectionnés ont un corpus principal différent \: 
+ErrorSelectionSize2=** Erreur \: taille de la sélection \!\= 2 \: 
+errorWhileCreatingAPartitionColonP0=** Erreur lors de la création d''une partition \: {0}
+ExportingP0=Exportation de {0}...
+Name=Nom
+noSelectionForColon=Aucune sélection pour 
+OutputFile=Fichier de sortie
+pathToCWBServerBinary=Chemin vers le fichier exécutable du serveur CQP
+pathToCWBServerInitializationFile=Chemin vers le fichier de configuration du serveur CQP
+refreshingCorpora=Mise à jour de la vue du corpus
+SelectAll=Sélectionner tout
+SelectASubcorpusInTheList=[sélectionnez un sous-corpus dans la liste].
+useNetworkProtocol=Utiliser le protocole réseau
+WarningSomePartsAreEmptyP0=** Attention \: certaines parties sont vides \: {0}

Property changes on: TXM/trunk/bundles/org.txm.searchengine.cqp.rcp/src/org/txm/searchengine/cqp/rcp/messages/messages_fr.properties
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.searchengine.cqp.rcp/build.properties
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.rcp/build.properties	(revision 0)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.rcp/build.properties	(revision 3659)
@@ -0,0 +1,10 @@
+#Fri Jul 06 10:25:16 CEST 2018
+bin.includes = META-INF/,\
+               .,\
+               plugin.xml,\
+               icons/,\
+               OSGI-INF/,\
+               OSGI-INF/l10n/bundle.properties
+output..=bin/
+source..=src/
+#qualifier=svn

Property changes on: TXM/trunk/bundles/org.txm.searchengine.cqp.rcp/build.properties
___________________________________________________________________
Added: svn:mime-type
   + text/plain


Property changes on: TXM/trunk/bundles/org.txm.searchengine.cqp.rcp
___________________________________________________________________
Added: svn:ignore
   + bin

target


