Index: TXM/trunk/bundles/org.txm.rcp/src/main/java/org/txm/rcp/swt/widget/structures/AdvancedPartitionPanel.java
===================================================================
--- TXM/trunk/bundles/org.txm.rcp/src/main/java/org/txm/rcp/swt/widget/structures/AdvancedPartitionPanel.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.rcp/src/main/java/org/txm/rcp/swt/widget/structures/AdvancedPartitionPanel.java	(revision 3979)
@@ -0,0 +1,259 @@
+package org.txm.rcp.swt.widget.structures;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Properties;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.ScrolledComposite;
+import org.eclipse.swt.events.ControlAdapter;
+import org.eclipse.swt.events.ControlEvent;
+import org.eclipse.swt.graphics.Rectangle;
+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.Event;
+import org.eclipse.swt.widgets.FileDialog;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Text;
+import org.txm.core.messages.TXMCoreMessages;
+import org.txm.rcp.messages.TXMUIMessages;
+import org.txm.rcp.swt.widget.QueryWidget;
+import org.txm.searchengine.cqp.CQPSearchEngine;
+import org.txm.searchengine.cqp.corpus.CQPCorpus;
+import org.txm.searchengine.cqp.corpus.Partition;
+import org.txm.utils.io.IOUtils;
+import org.txm.utils.logger.Log;
+
+public class AdvancedPartitionPanel extends Composite {
+
+	// for the "advanced" tab
+	/** The queries. */
+	private List<QueryWidget> queries = new ArrayList<>();
+
+	/** The part names. */
+	private List<Text> partNames = new ArrayList<>();
+
+	/** The queries string. */
+	List<String> queriesString = new ArrayList<>();
+
+	private CQPCorpus corpus;
+
+	private ScrolledComposite scrollComposite;
+
+	private Composite compositeForAdvanced;
+
+	public AdvancedPartitionPanel(Composite parent, int style, CQPCorpus corpus) {
+		super(parent, style);
+
+		this.setLayout(new GridLayout(2, false));
+		this.corpus = corpus;
+
+		scrollComposite = new ScrolledComposite(this, SWT.V_SCROLL);
+		scrollComposite.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true, 2, 1));
+
+		Button importButton = new Button(this, SWT.NONE);
+		importButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_CENTER, GridData.FILL, false, false));
+		importButton.setText("+ from properties file..."); //$NON-NLS-1$
+		importButton.addListener(SWT.Selection, new Listener() {
+			@Override
+			public void handleEvent(Event event) {
+				FileDialog d = new FileDialog(event.display.getActiveShell());
+				d.setFilterExtensions(new String[] {"*.properties"});
+				d.setText("Select a .properties file containing CQL queries");
+				String path = d.open();
+				if (path != null) {
+					Properties props = new Properties();
+					try {
+						props.load(IOUtils.getReader(new File(path)));
+						for (Object key : props.keySet()) {
+							String value = props.getProperty(key.toString());
+							QueryWidget qw = addQueryField(key.toString().substring(0, Math.min(20, key.toString().length())), value);
+						}
+					} catch (Exception e) {
+						// TODO Auto-generated catch block
+						e.printStackTrace();
+					}
+				}
+
+			}
+		});
+
+		compositeForAdvanced = new Composite(scrollComposite, SWT.NONE);
+		GridLayout layoutForAdvanced = new GridLayout(4, false);
+		compositeForAdvanced.setLayout(layoutForAdvanced);
+
+		scrollComposite.setContent(compositeForAdvanced);
+		scrollComposite.setExpandVertical(true);
+		scrollComposite.setExpandHorizontal(true);
+		scrollComposite.addControlListener(new ControlAdapter() {
+
+			@Override
+			public void controlResized(ControlEvent e) {
+
+				Rectangle r = scrollComposite.getClientArea();
+				scrollComposite.setMinSize(compositeForAdvanced.computeSize(r.width, SWT.DEFAULT));
+			}
+		});
+
+		createAdvancedQueryField();
+	}
+
+	/**
+	 * Creates the advanced query field.
+	 *
+	 */
+	private void createAdvancedQueryField() {
+
+		addQueryField();
+		Rectangle r = scrollComposite.getClientArea();
+		scrollComposite.setMinSize(compositeForAdvanced.computeSize(r.width, SWT.DEFAULT));
+	}
+
+	/**
+	 * Adds the query field.
+	 *
+	 */
+	private QueryWidget addQueryField() {
+
+		return addQueryField(null, null);
+	}
+
+	/**
+	 * Adds the query field.
+	 *
+	 * @param name the query name
+	 * @param value the query
+	 */
+	private QueryWidget addQueryField(String name, String value) {
+
+		final Text advancedPartLabel = new Text(compositeForAdvanced, SWT.BORDER);
+		advancedPartLabel.setText(TXMUIMessages.part + (partNames.size() + 1));
+		advancedPartLabel.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false));
+		if (name != null && name.length() > 0) {
+			advancedPartLabel.setText(name);
+		}
+		partNames.add(advancedPartLabel);
+
+		final QueryWidget queryText;
+		queryText = new QueryWidget(compositeForAdvanced, SWT.DROP_DOWN, corpus.getProject(), CQPSearchEngine.getEngine());
+		queryText.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false));
+		GridData gridData = new GridData(GridData.FILL, GridData.FILL, true, false);
+		// gridData.widthHint = convertHeightInCharsToPixels(20);
+		queryText.setLayoutData(gridData);
+		queries.add(queryText);
+		if (value != null) {
+			queryText.setText(value);
+		}
+		
+		Button plusButton = new Button(compositeForAdvanced, SWT.NONE);
+		plusButton.setText("+"); //$NON-NLS-1$
+		plusButton.addListener(SWT.Selection, new Listener() {
+
+			@Override
+			public void handleEvent(Event event) {
+				addQueryField();
+			}
+		});
+		
+		final Button minusButton = new Button(compositeForAdvanced, SWT.NONE);
+		minusButton.setText("-"); //$NON-NLS-1$
+		minusButton.addListener(SWT.Selection, new Listener() {
+
+			@Override
+			public void handleEvent(Event event) {
+				if (queries.size() <= 1) return;
+				queries.remove(queryText);
+				partNames.remove(advancedPartLabel);
+				advancedPartLabel.dispose();
+				queryText.dispose();
+				minusButton.dispose();
+				plusButton.dispose();
+				compositeForAdvanced.layout(true);
+			}
+		});
+		Rectangle r = scrollComposite.getClientArea();
+		scrollComposite.setMinSize(compositeForAdvanced.computeSize(r.width, SWT.DEFAULT));
+		scrollComposite.update();
+		scrollComposite.layout();
+		compositeForAdvanced.update();
+		compositeForAdvanced.layout();
+
+		return queryText;
+	}
+
+	/**
+	 * Gets the advance part names.
+	 *
+	 * @return the advance part names
+	 */
+	private List<String> getAdvancePartNames() {
+
+		ArrayList<String> values = new ArrayList<>();
+		int count = 0;
+		for (Text t : partNames) {
+			String name = t.getText().trim();
+			if (name.length() == 0) {
+				name = TXMUIMessages.part + count++;
+			}
+			values.add(name);
+		}
+		return values;
+	}
+
+	/**
+	 * Gets the queries.
+	 *
+	 * @return the queries
+	 */
+	public List<String> getQueries() {
+
+		return queriesString;
+	}
+
+	/**
+	 * Return true if no query is currently given in the "advanced" tab (ie if
+	 * all Text field opened are empty).
+	 *
+	 * @return true, if successful
+	 */
+	public boolean isQueriesSet() {
+
+		for (QueryWidget query : queries) {
+			if (query.getText().length() == 0) {
+				return true;
+			}
+		}
+		return false;
+	}
+
+	public Partition createPartition(String name) {
+
+		queriesString.clear();
+		for (QueryWidget query : queries) {
+			queriesString.add(query.getQueryString());
+			//query.memorize();
+		}
+
+		Partition partition = null;
+
+		try {
+			// auto-naming if needed
+			if (name.isEmpty()) {
+				name = "partition" + (this.corpus.getPartitions().size() + 1); //$NON-NLS-1$
+				Log.info(TXMCoreMessages.bind(TXMUIMessages.noPartitionNameWasSpecifiedTheNameIsP0, name));
+			}
+
+			partition = new Partition(this.corpus);
+			partition.setParameters(name, this.getQueries(), this.getAdvancePartNames());
+		}
+		catch (Exception e) {
+			org.txm.utils.logger.Log.printStackTrace(e);
+			return null;
+		}
+
+		return partition;
+	}
+}
\ No newline at end of file

Property changes on: TXM/trunk/bundles/org.txm.rcp/src/main/java/org/txm/rcp/swt/widget/structures/AdvancedPartitionPanel.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.rcp/src/main/java/org/txm/rcp/swt/widget/structures/SimplePartitionPanel.java
===================================================================
--- TXM/trunk/bundles/org.txm.rcp/src/main/java/org/txm/rcp/swt/widget/structures/SimplePartitionPanel.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.rcp/src/main/java/org/txm/rcp/swt/widget/structures/SimplePartitionPanel.java	(revision 3979)
@@ -0,0 +1,265 @@
+package org.txm.rcp.swt.widget.structures;
+
+import java.util.ArrayList;
+import java.util.List;
+
+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.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.txm.core.messages.TXMCoreMessages;
+import org.txm.rcp.messages.TXMUIMessages;
+import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
+import org.txm.searchengine.cqp.corpus.CQPCorpus;
+import org.txm.searchengine.cqp.corpus.Partition;
+import org.txm.searchengine.cqp.corpus.StructuralUnit;
+import org.txm.searchengine.cqp.corpus.StructuralUnitProperty;
+import org.txm.utils.logger.Log;
+
+public class SimplePartitionPanel extends Composite {
+
+	// For the "simple" tab
+	/** The selected structural unit. */
+	private StructuralUnit selectedStructuralUnit;
+
+	/** The selected structural unit property. */
+	private StructuralUnitProperty selectedStructuralUnitProperty;
+
+	/** The structural units combo. */
+	private Combo structuralUnitsCombo;
+
+	/** The structural units final. */
+	private List<StructuralUnit> structuralUnitsFinal;
+
+	/** The property combo. */
+	private Combo propertyCombo;
+
+	private CQPCorpus corpus;
+
+	public SimplePartitionPanel(Composite parent, int style, CQPCorpus corpus) {
+		super(parent, style);
+		
+		this.corpus = corpus;
+
+		GridLayout layout = new GridLayout(2, false);
+		this.setLayout(layout);
+
+		// StructuralUnit
+		// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+		Label structureLabel = new Label(this, SWT.NONE);
+		structureLabel.setText(TXMUIMessages.ampStructureColon);
+		structureLabel.setLayoutData(new GridData(GridData.END, GridData.CENTER, false, false));
+
+		structuralUnitsCombo = new Combo(this, SWT.READ_ONLY);
+		structuralUnitsCombo.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false));
+
+		List<StructuralUnit> structuralUnits = null;
+		try {
+			structuralUnits = corpus.getOrderedStructuralUnits();
+		}
+		catch (CqiClientException e) {
+			Log.severe(TXMCoreMessages.bind(TXMCoreMessages.error_errorP0, Log.toString(e)));
+		}
+		structuralUnitsFinal = new ArrayList<>();
+		for (StructuralUnit unit : structuralUnits) {
+			if (unit.getName().equals("txmcorpus")) continue; // ignore txmcorpus structure //$NON-NLS-1$
+
+			if (unit.getOrderedProperties() != null && unit.getOrderedProperties().size() != 0) {
+				/*
+				 * if ((unit.getName().equals("text") &&
+				 * unit.getProperties().size() > 3)) //$NON-NLS-1$ {
+				 * structuralUnitsCombo.add(unit.getName());
+				 * structuralUnitsFinal.add(unit); } else
+				 * if (!unit.getName().equals("text")) //$NON-NLS-1$ {
+				 */
+				structuralUnitsCombo.add(unit.getName());
+				structuralUnitsFinal.add(unit);
+				// }
+			}
+		}
+
+		if (structuralUnitsCombo.getItemCount() == 0) {
+
+		}
+		else {
+			structuralUnitsCombo.select(0);
+			String[] items = structuralUnitsCombo.getItems();
+			for (int i = 0; i < items.length; i++) {
+				if (items[i].equals("text")) { //$NON-NLS-1$
+					structuralUnitsCombo.select(i);
+					break;
+				}
+			}
+			selectedStructuralUnit = structuralUnitsFinal.get(0);
+		}
+		// combo.setSize (200, 200);
+
+		// StructuralUnitProperty
+		// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+		Label propertyLabel = new Label(this, SWT.NONE);
+		propertyLabel.setText(TXMUIMessages.ampPropertyColon);
+		propertyLabel.setLayoutData(new GridData(GridData.END, GridData.CENTER, false, false));
+
+		propertyCombo = new Combo(this, SWT.READ_ONLY);
+		propertyCombo.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false));
+
+		// combo.setSize (200, 200);
+		structuralUnitsCombo.addSelectionListener(new SelectionListener() {
+
+			@Override
+			public void widgetDefaultSelected(SelectionEvent e) {}
+
+			@Override
+			public void widgetSelected(SelectionEvent event) {
+
+				reloadProperties();
+			}
+		});
+
+		for (StructuralUnitProperty property : structuralUnitsFinal.get(0).getOrderedProperties()) {
+			if (!(structuralUnitsFinal.get(0).getName().equals("text") &&  //$NON-NLS-1$
+					(property.getName().equals("project") || property.getName().equals("base")))) //$NON-NLS-1$ //$NON-NLS-2$
+				propertyCombo.add(property.getName());
+		}
+		propertyCombo.select(0);
+		selectedStructuralUnitProperty = selectedStructuralUnit.getOrderedProperties().get(0);
+
+		propertyCombo.addSelectionListener(new SelectionListener() {
+
+			@Override
+			public void widgetDefaultSelected(SelectionEvent e) {}
+
+			@Override
+			public void widgetSelected(SelectionEvent event) {
+
+				selectedStructuralUnitProperty = selectedStructuralUnit.getOrderedProperties().get(propertyCombo.getSelectionIndex());
+			}
+		});
+
+		reloadProperties();
+	}
+
+	/**
+	 * Reload values.
+	 */
+	protected void reloadValues() {
+
+		List<StructuralUnitProperty> properties = null;
+		selectedStructuralUnit = structuralUnitsFinal.get(structuralUnitsCombo.getSelectionIndex());
+
+		properties = selectedStructuralUnit.getOrderedProperties();
+		propertyCombo.removeAll();
+		for (StructuralUnitProperty property : properties) {
+			/*
+			 * if (!(selectedStructuralUnit.getName().equals("text") &&
+			 * //$NON-NLS-1$ (property.getName().equals("id") || //$NON-NLS-1$
+			 * property.getName().equals("base") || //$NON-NLS-1$
+			 * property.getName().equals("project")))) //$NON-NLS-1$
+			 */
+			if (selectedStructuralUnit.getName().equals("text") && //$NON-NLS-1$
+					(property.getName().equals("project") || property.getName().equals("base"))) continue; // ignore technical properties //$NON-NLS-1$ //$NON-NLS-2$
+			propertyCombo.add(property.getName());
+		}
+		if (propertyCombo.getItemCount() > 0) {
+			propertyCombo.select(0);
+			String[] items = propertyCombo.getItems();
+			for (int i = 0; i < items.length; i++) {
+				if (items[i].equals("id")) { //$NON-NLS-1$
+					propertyCombo.select(i);
+					break;
+				}
+			}
+			selectedStructuralUnitProperty = selectedStructuralUnit
+					.getOrderedProperties().get(0);
+			// this.getButton(IDialogConstants.OK_ID).setEnabled(true);
+		}
+	}
+
+	/**
+	 * Reload properties.
+	 */
+	protected void reloadProperties() {
+
+		selectedStructuralUnit = structuralUnitsFinal.get(structuralUnitsCombo.getSelectionIndex());
+		List<StructuralUnitProperty> properties = null;
+		selectedStructuralUnit = structuralUnitsFinal.get(structuralUnitsCombo.getSelectionIndex());
+
+		properties = selectedStructuralUnit.getOrderedProperties();
+		propertyCombo.removeAll();
+		for (StructuralUnitProperty property : properties) {
+			/*
+			 * if (!(selectedStructuralUnit.getName().equals("text") &&
+			 * //$NON-NLS-1$ (property.getName().equals("id") || //$NON-NLS-1$
+			 * property.getName().equals("base") || //$NON-NLS-1$
+			 * property.getName().equals("project")))) //$NON-NLS-1$
+			 */
+			if (selectedStructuralUnit.getName().equals("text") && //$NON-NLS-1$
+					(property.getName().equals("project") || property.getName().equals("base"))) continue; // ignore technical properties //$NON-NLS-1$ //$NON-NLS-2$
+			propertyCombo.add(property.getName());
+		}
+		if (propertyCombo.getItemCount() > 0) {
+			propertyCombo.select(0);
+			String[] items = propertyCombo.getItems();
+			for (int i = 0; i < items.length; i++) {
+				if (items[i].equals("id")) { //$NON-NLS-1$
+					propertyCombo.select(i);
+					break;
+				}
+			}
+			selectedStructuralUnitProperty = selectedStructuralUnit
+					.getOrderedProperties().get(0);
+			// this.getButton(IDialogConstants.OK_ID).setEnabled(true);
+		}
+	}
+	
+	/**
+	 * Gets the structural unit.
+	 *
+	 * @return the structural unit
+	 */
+	public StructuralUnit getStructuralUnit() {
+		
+		return selectedStructuralUnit;
+	}
+	
+	/**
+	 * Gets the structural unit property.
+	 *
+	 * @return the structural unit property
+	 */
+	public StructuralUnitProperty getStructuralUnitProperty() {
+		
+		return selectedStructuralUnitProperty;
+	}
+
+	public Partition createPartition(String name) {
+
+		Partition partition = null;
+
+		// Simple mode
+
+		StructuralUnit structuralUnit = this.structuralUnitsFinal.get(this.structuralUnitsCombo.getSelectionIndex());
+		StructuralUnitProperty property = structuralUnit.getProperty(this.propertyCombo.getText());
+		try {
+			// auto-naming if needed
+			if (name.isEmpty()) {
+				name = property.asFullNameString();
+			}
+
+			partition = new Partition(corpus);
+			partition.setParameters(name, property, null);
+		}
+		catch (Exception e) {
+			org.txm.utils.logger.Log.printStackTrace(e);
+			return null;
+		}
+		
+		return partition;
+	}
+}
\ No newline at end of file

Property changes on: TXM/trunk/bundles/org.txm.rcp/src/main/java/org/txm/rcp/swt/widget/structures/SimplePartitionPanel.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.rcp/src/main/java/org/txm/rcp/swt/widget/structures/AdvancedSubcorpusPanel.java
===================================================================
--- TXM/trunk/bundles/org.txm.rcp/src/main/java/org/txm/rcp/swt/widget/structures/AdvancedSubcorpusPanel.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.rcp/src/main/java/org/txm/rcp/swt/widget/structures/AdvancedSubcorpusPanel.java	(revision 3979)
@@ -0,0 +1,117 @@
+// 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.rcp.swt.widget.structures;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.txm.rcp.messages.TXMUIMessages;
+import org.txm.rcp.swt.widget.QueryWidget;
+import org.txm.searchengine.cqp.CQPSearchEngine;
+import org.txm.searchengine.cqp.corpus.CQPCorpus;
+
+/**
+ * The Class AdvancedSubcorpusPanel : a query.
+ */
+public class AdvancedSubcorpusPanel extends Composite {
+	
+	/** The corpus. */
+	CQPCorpus corpus;
+	
+	/** The query. */
+	String query;
+	
+	/** The query field. */
+	QueryWidget queryField;
+
+	/**
+	 * Instantiates a new complex subcorpus panel.
+	 *
+	 * @param parent the parent
+	 * @param style the style
+	 * @param corpus the corpus
+	 */
+	public AdvancedSubcorpusPanel(Composite parent, int style, CQPCorpus corpus) {
+		
+		super(parent, style);
+		
+		this.setLayout(new GridLayout(2, false));
+		this.corpus = corpus;
+				
+		Label l = new Label(this, SWT.NONE);
+		l.setText(TXMUIMessages.query);
+		
+		queryField = new QueryWidget(this, SWT.BORDER, corpus.getProject(), CQPSearchEngine.getEngine());
+		queryField.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false));
+		
+	}
+	
+	public void updateQueryField() {
+		
+		queryField.update();
+	}
+	
+	/**
+	 * Update display.
+	 */
+	public void updateDisplay() {
+		this.layout();
+	}
+	
+	/**
+	 * Gets the query string.
+	 *
+	 * @return the generated query string
+	 */
+	public String getQueryString() {
+		
+		String q = queryField.getQuery().getQueryString();
+		
+		return q;
+	}
+	
+	/**
+	 * 
+	 * @return the raw query without the context filter
+	 */
+	public String getQueryFieldValue() {
+		
+		String query = this.queryField.getText();
+		if (query == null || query.length() == 0) {
+			query = getQueryString();
+		}
+		return query;
+	}
+	
+	public String getGeneratedName() {
+		
+		return null;
+	}
+}

Property changes on: TXM/trunk/bundles/org.txm.rcp/src/main/java/org/txm/rcp/swt/widget/structures/AdvancedSubcorpusPanel.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.rcp/src/main/java/org/txm/rcp/swt/widget/structures/CrossedPartitionPanel.java
===================================================================
--- TXM/trunk/bundles/org.txm.rcp/src/main/java/org/txm/rcp/swt/widget/structures/CrossedPartitionPanel.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.rcp/src/main/java/org/txm/rcp/swt/widget/structures/CrossedPartitionPanel.java	(revision 3979)
@@ -0,0 +1,396 @@
+package org.txm.rcp.swt.widget.structures;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.UUID;
+
+import org.eclipse.jface.viewers.LabelProvider;
+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.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+import org.txm.core.messages.TXMCoreMessages;
+import org.txm.rcp.messages.TXMUIMessages;
+import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
+import org.txm.searchengine.cqp.corpus.CQPCorpus;
+import org.txm.searchengine.cqp.corpus.Partition;
+import org.txm.searchengine.cqp.corpus.StructuralUnit;
+import org.txm.searchengine.cqp.corpus.StructuralUnitProperty;
+import org.txm.searchengine.cqp.corpus.Subcorpus;
+import org.txm.utils.logger.Log;
+
+public class CrossedPartitionPanel extends Composite {
+
+	/** The selected structural unit property. */
+	private List<StructuralUnitProperty> selectedStructuralUnitProperties = new ArrayList<>();
+
+	/** The structural units final. */
+	private List<StructuralUnit> structuralUnitsFinal;
+	
+	private Text separatorText;
+
+	/** The property combo. */
+	private SuperListViewer propertyCombo;
+
+	private CQPCorpus corpus;
+
+	private Text expandText;
+
+	public CrossedPartitionPanel(Composite parent, int style, CQPCorpus corpus) {
+		super(parent, style);
+
+		this.corpus = corpus;
+
+		GridLayout layout = new GridLayout(2, false);
+		this.setLayout(layout);
+
+		// StructuralUnit
+		// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+		List<StructuralUnit> structuralUnits = null;
+		try {
+			structuralUnits = corpus.getOrderedStructuralUnits();
+		}
+		catch (CqiClientException e) {
+			Log.severe(TXMCoreMessages.bind(TXMCoreMessages.error_errorP0, Log.toString(e)));
+		}
+		structuralUnitsFinal = new ArrayList<>();
+		for (StructuralUnit unit : structuralUnits) {
+			if (unit.getName().equals("txmcorpus")) continue; // ignore txmcorpus structure //$NON-NLS-1$
+
+			if (unit.getOrderedProperties() != null && unit.getOrderedProperties().size() != 0) {
+				/*
+				 * if ((unit.getName().equals("text") &&
+				 * unit.getProperties().size() > 3)) //$NON-NLS-1$ {
+				 * structuralUnitsCombo.add(unit.getName());
+				 * structuralUnitsFinal.add(unit); } else
+				 * if (!unit.getName().equals("text")) //$NON-NLS-1$ {
+				 */
+				structuralUnitsFinal.add(unit);
+				// }
+			}
+		}
+
+		// StructuralUnitProperty
+		// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+		Label propertyLabel = new Label(this, SWT.NONE);
+		propertyLabel.setText(TXMUIMessages.Structures);
+		propertyLabel.setLayoutData(new GridData(GridData.END, GridData.CENTER, false, false));
+		propertyLabel.setToolTipText("Select at least two properties");
+		
+		propertyCombo = new SuperListViewer(this, SWT.MULTI);
+		propertyCombo.setLabelProvider(new LabelProvider() {
+			@Override
+			public String getText(Object element) {
+				if (element instanceof StructuralUnitProperty) {
+					return ""+((StructuralUnitProperty)element).getFullName(); //$NON-NLS-1$
+				} else {
+					return ""+element; //$NON-NLS-1$
+				}
+			}
+		});
+		propertyCombo.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true));
+
+		ArrayList<StructuralUnitProperty> all = new ArrayList<>();
+		for (StructuralUnit su : structuralUnitsFinal) {
+			for (StructuralUnitProperty property : su.getOrderedProperties()) {
+				if (!(su.getName().equals("text") &&  //$NON-NLS-1$
+						(property.getName().equals("project") || property.getName().equals("base")))) //$NON-NLS-1$ //$NON-NLS-2$
+					all.add(property);
+			}
+		}
+
+		propertyCombo.getList().addSelectionListener(new SelectionListener() {
+
+			@Override
+			public void widgetDefaultSelected(SelectionEvent e) {}
+
+			@Override
+			public void widgetSelected(SelectionEvent event) {
+				selectedStructuralUnitProperties = propertyCombo.getSelection().toList();
+			}
+		});
+		
+		propertyCombo.setInput(all);
+		propertyCombo.setToolTipText("Select at least two properties");
+		
+		Label separatorLabel = new Label(this, SWT.NONE);
+		separatorLabel.setText("Values separator");
+		separatorLabel.setLayoutData(new GridData(GridData.END, GridData.CENTER, false, false));
+		separatorLabel.setToolTipText("The separator is inserted between the values of the part names.\nWarning: spaces are not trimmed.");
+		
+		separatorText = new Text(this, SWT.BORDER);
+		separatorText.setText("x");
+		separatorText.setToolTipText("The separator is inserted between the values of the part names.\nWarning: spaces are not trimmed.");
+		
+		Label expandLabel = new Label(this, SWT.NONE);
+		expandLabel.setText("Expand structure");
+		expandLabel.setLayoutData(new GridData(GridData.END, GridData.CENTER, false, false));
+		expandLabel.setToolTipText("Define the limit structure. If not set, the last selected structure is used");
+		
+		expandText = new Text(this, SWT.BORDER);
+		expandText.setText("");
+		expandText.setToolTipText("Define the limit structure. If not set, the last selected structure is used");
+	}
+
+	/**
+	 * Gets the structural unit property.
+	 *
+	 * @return the structural unit property
+	 */
+	public List<StructuralUnitProperty> getStructuralUnitProperties() {
+
+		return selectedStructuralUnitProperties;
+	}
+
+	public Partition createPartition(String name) {
+		
+		if (selectedStructuralUnitProperties.size() < 2) {
+			return null;
+		}
+
+		String partNamePrefix = "";
+		ArrayList<String> structuralUnits = new ArrayList<>();
+		ArrayList<String> structuralUnitProperties = new ArrayList<>();
+		for (StructuralUnitProperty sup : selectedStructuralUnitProperties) {
+			structuralUnits.add(sup.getStructuralUnit().getName());
+			structuralUnitProperties.add(sup.getName());
+		}
+		ArrayList<String> structuralUnitToIgnore = new ArrayList<>();
+		String separator = separatorText.getText();
+		String expandTarget = expandText.getText();
+		
+		PartitionQueriesGenerator pqg = new PartitionQueriesGenerator();
+		Partition partition;
+		try {
+			partition = pqg.createPartition(corpus, false,
+					name, partNamePrefix, separator,
+					structuralUnits, structuralUnitProperties,
+					structuralUnitToIgnore, expandTarget);
+			
+			return partition;
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+		return null;
+		
+	}
+	
+	/**
+	 * Create a list of queries and part names regarding the structural units, structural units properties, structural units to ignore user defined lists and expand target value specified.
+	 * @author s
+	 *
+	 */
+	public class PartitionQueriesGenerator	{
+
+		public boolean DEBUG = false;					// si DEBUG, alors les requêtes sont affichées mais la partition n'est pas créée
+
+		public String PARTITION_NAME = "";				// Nom de la partition (optionnel)
+		public List<String> STRUCTURAL_UNITS = new ArrayList<>();				// Liste des unités structurelles sur lesquelles effectuer la partition, ex: ['text', 'div1']
+		public List<String> STRUCTURAL_UNITS_PROPERTIES = new ArrayList<>();	// Propriétés des unités structurelles sur lesquelles effectuer la partition, ex : ['id', 'name']
+		public List<String> STRUCTURAL_UNITS_TO_IGNORE = new ArrayList<>();	// Structure à ignorer, ex. CQL : !speaker (optionnel)
+		public String PART_NAMES_PREFIX = "";			// Prefix pour les noms de partie (optionnel)
+		public String EXPAND_TARGET = "";			// Expand to target, englobe les empans jusqu'à la balise parente spécifiée.
+		public String VALUES_SEPARATOR = "x";	
+		// NOTE : Le expand entre en conflit avec les sections à ignorer.
+		// Si la target est à un niveau supérieur aux balises à ignorer, il les remet dans liste de résultats CWB et elles ne sont donc pas ignorées
+
+		public List<String> queries = new ArrayList<>();
+		public List<String> partNames = new ArrayList<>();
+
+		/**
+		 * Init the generator and process.
+		 * @throws CqiClientException 
+		 * @throws InterruptedException 
+		 */
+		public Partition createPartition(CQPCorpus corpus, boolean debug,
+				String partitionName, String partNamePrefix, String separator,
+				List<String> structuralUnits, List<String> structuralUnitProperties,
+				List<String> structuralUnitToIgnore, String expandTarget) throws CqiClientException, InterruptedException 	{
+
+			PARTITION_NAME = partitionName;
+			STRUCTURAL_UNITS = structuralUnits;
+			STRUCTURAL_UNITS_PROPERTIES = structuralUnitProperties;
+			STRUCTURAL_UNITS_TO_IGNORE = structuralUnitToIgnore;
+			PART_NAMES_PREFIX = partNamePrefix;
+			EXPAND_TARGET = expandTarget;
+			VALUES_SEPARATOR = separator;
+			DEBUG = debug;
+
+			if (DEBUG) {
+				System.out.println("Arguments: ");
+				System.out.println("PARTITION_NAME = $PARTITION_NAME");
+				System.out.println("STRUCTURAL_UNITS = $STRUCTURAL_UNITS");
+				System.out.println("STRUCTURAL_UNITS_PROPERTIES = $STRUCTURAL_UNITS_PROPERTIES");
+				System.out.println("STRUCTURAL_UNITS_TO_IGNORE = $STRUCTURAL_UNITS_TO_IGNORE");
+				System.out.println("PART_NAMES_PREFIX = $PART_NAMES_PREFIX");
+				System.out.println("EXPAND_TARGET = $EXPAND_TARGET");
+				System.out.println("DEBUG = $DEBUG");
+			}
+
+			if (STRUCTURAL_UNITS.size() > 0 && STRUCTURAL_UNITS.size() == STRUCTURAL_UNITS_PROPERTIES.size())	{
+
+				if (DEBUG) System.out.println("Creating the queries on corpus " + corpus + "\""); ;
+				if (DEBUG) System.out.println("PARTITION_NAME: "+ PARTITION_NAME);
+
+				//Corpus corpus = CorpusManager.getCorpusManager().getCorpus(corpusName);
+
+				// Recursing through the corpus and subcorpus
+				process(corpus, 0, "", "", VALUES_SEPARATOR);
+
+				// Displaying the queries
+				if (DEBUG) {
+					System.out.println("Queries processed: ");
+					for (int i = 0 ; i < queries.size() ; i++) {
+						System.out.println(partNames.get(i) + " = " + queries.get(i));
+					}
+				}
+
+				// Finalizing the queries
+				finalizeQueries();
+
+				// Displaying the queries
+				if (DEBUG) {
+					System.out.println("Queries finalized: ");
+					for (int i = 0 ; i < queries.size() ; i++) {
+						System.out.println(partNames.get(i) + " = " + queries.get(i));
+					}
+				}
+
+				if (DEBUG) System.out.println("Queries created.");
+
+				// Creating the partition
+				if (!DEBUG  && queries.size() == partNames.size()) {
+					Partition partition = new Partition(corpus);
+					partition.setParameters(PARTITION_NAME, queries, partNames);
+					partition.compute();
+					return partition;
+				}
+			} else {
+				System.out.println("Error: Structural units count or structural units properties count error.");
+				return null;
+			}
+			return null;
+		}
+
+		/**
+		 * Recurse through structural units and structural units properties of corpus and create the queries and the part names.
+		 * @param corpus the corpus or subcorpus
+		 * @param index the index for recursion
+		 * @param tmpQuery the temporary query for creating subcorpus part
+		 * @param tmpPartName the temporary part name of the subcorpus part
+		 * @throws CqiClientException 
+		 */
+		protected void process(CQPCorpus corpus, int index, String tmpQuery, String tmpPartName, String propertySeparator) throws CqiClientException	{
+			// End of array
+			if (index >= STRUCTURAL_UNITS.size()) {
+
+				queries.add(tmpQuery);
+				partNames.add(PART_NAMES_PREFIX + tmpPartName);
+
+				return;
+			}
+
+			StructuralUnit su = corpus.getStructuralUnit(STRUCTURAL_UNITS.get(index));
+			StructuralUnitProperty sup = su.getProperty(STRUCTURAL_UNITS_PROPERTIES.get(index));
+
+			if (DEBUG) {
+				if (index == 0)	{
+					System.out.println("Pocessing Structural Unit Property " + sup.getFullName() + " on mother corpus " + corpus.getID());
+				} else {
+					System.out.println("Pocessing Structural Unit Property " + sup.getFullName() + " on subcorpus part " + tmpPartName);
+				}
+			}
+
+
+			// Creating the queries parts for each structural units properties values
+			// for (supValue in sup.getOrderedValues()) { // TODO : signaler bug Matthieu, on ne devrait pas être obligé de repasser le sous-corpus à la méthode car sup a déjà été créée depuis le sous-corpus ? getValues() bugge aussi
+			for (String supValue : sup.getOrderedValues(corpus)) {
+
+				if (DEBUG) System.out.println("Value " + supValue);
+
+				// Getting the subcorpus linked to the structural unit property value
+				Subcorpus tmpSubcorpus = corpus.createSubcorpusWithQueryString(su, sup, supValue, "tmp" + UUID.randomUUID());
+
+				// Partition conditions and part name separators
+				String and = "";
+				String underscore = "";
+				if (tmpQuery != "")	{
+					underscore = propertySeparator;
+					and = " & ";
+				}
+
+				process(tmpSubcorpus, index + 1, (tmpQuery + and + "_." + sup.getFullName() + "=\"" + supValue + "\""), tmpPartName + underscore + supValue, propertySeparator);
+
+				// Deleting the temporary subcorpus
+				// TODO : bug : cette méthode ne supprime pas le corpus sans doute car il faut que le sous-corpus ne contienne pas d'autres sous-corpus ? le delete() en revanche fonctionne.
+				//			corpus.dropSubcorpus(tmpSubcorpus);
+				tmpSubcorpus.delete();
+			}
+		}
+
+
+		/**
+		 * 	Autoname the partition.
+		 * @param partitionName
+		 */
+		protected void autoNamePartition(String partitionName) {
+
+			// Structural units names and properties
+			for (int i = 0; i < STRUCTURAL_UNITS.size(); i++) {
+				partitionName +=  STRUCTURAL_UNITS.get(i) + '_' + STRUCTURAL_UNITS_PROPERTIES.get(i) + VALUES_SEPARATOR;
+			}
+
+			// Structural units to ignore
+			for (int i = 0; i < STRUCTURAL_UNITS_TO_IGNORE.size(); i++) {
+				partitionName +=  "NOT_" + STRUCTURAL_UNITS_TO_IGNORE.get(i) + '.';
+			}
+
+			// Removing last 'x' in partition name
+			PARTITION_NAME = partitionName.substring(0, partitionName.length() - 3);
+		}
+
+		/**
+		 * Finalize the queries.
+		 */
+		protected void finalizeQueries() {
+
+			String expandTo = "";
+			// Expanding to user defined target
+			if (EXPAND_TARGET != null && EXPAND_TARGET.length() > 0) {
+				expandTo = " expand to " + EXPAND_TARGET;
+			}
+			// Expanding to last child structural unit in user defined hierarchy
+			else if(STRUCTURAL_UNITS_TO_IGNORE.size() == 0)	 {
+				expandTo = " expand to " + STRUCTURAL_UNITS.get(STRUCTURAL_UNITS.size() - 1);
+			}
+
+			// Autonaming the partition
+			if (PARTITION_NAME != null && PARTITION_NAME.length() == 0) {
+				autoNamePartition(PARTITION_NAME);
+				// Finalizing partition name
+				if (EXPAND_TARGET != null && EXPAND_TARGET.length() > 0)
+					PARTITION_NAME += expandTo.replace(" expand to", ".EXPAND TO").replace(" ", "_");
+			}
+
+			// Finalizing queries
+			for (int j = 0; j < queries.size(); j++) {
+
+				String queryEnd = "";
+
+				// Removing some sections
+				for (String sectionToIgnore : STRUCTURAL_UNITS_TO_IGNORE) {
+					queryEnd += " & !" + sectionToIgnore;
+				}
+
+				queryEnd += ']' + expandTo;
+				queries.set(j, '[' +  queries.get(j) + queryEnd);
+			}
+		}
+	}
+}
\ No newline at end of file

Property changes on: TXM/trunk/bundles/org.txm.rcp/src/main/java/org/txm/rcp/swt/widget/structures/CrossedPartitionPanel.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.rcp/src/main/java/org/txm/rcp/swt/widget/structures/ContextsSubcorpusPanel.java
===================================================================
--- TXM/trunk/bundles/org.txm.rcp/src/main/java/org/txm/rcp/swt/widget/structures/ContextsSubcorpusPanel.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.rcp/src/main/java/org/txm/rcp/swt/widget/structures/ContextsSubcorpusPanel.java	(revision 3979)
@@ -0,0 +1,209 @@
+// 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.rcp.swt.widget.structures;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.LinkedHashSet;
+import java.util.List;
+
+import org.apache.commons.lang.StringUtils;
+import org.eclipse.jface.viewers.ArrayContentProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.ListViewer;
+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.Group;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Spinner;
+import org.eclipse.swt.widgets.Text;
+import org.txm.core.messages.TXMCoreMessages;
+import org.txm.rcp.messages.TXMUIMessages;
+import org.txm.rcp.swt.widget.QueryWidget;
+import org.txm.rcp.swt.widget.parameters.QueryField;
+import org.txm.searchengine.cqp.CQPSearchEngine;
+import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
+import org.txm.searchengine.cqp.corpus.CQPCorpus;
+import org.txm.searchengine.cqp.corpus.StructuralUnit;
+import org.txm.searchengine.cqp.corpus.StructuralUnitProperty;
+
+/**
+ * The Class ComplexSubcorpusPanel.
+ */
+public class ContextsSubcorpusPanel extends Composite {
+	
+	/** The corpus. */
+	CQPCorpus corpus;
+	
+	/** The query. */
+	String query;
+	
+	/** The structuralunits. */
+	List<String> structuralunits;
+		
+	/** The query field. */
+	QueryWidget queryField;
+	
+	Combo structuralUnitCombo;
+
+	private Spinner wordContextSize;
+		
+	/**
+	 * Instantiates a new complex subcorpus panel.
+	 *
+	 * @param parent the parent
+	 * @param style the style
+	 * @param corpus the corpus
+	 */
+	public ContextsSubcorpusPanel(Composite parent, int style, CQPCorpus corpus) {
+		
+		super(parent, style);
+		
+		this.setLayout(new GridLayout(2, false));
+		this.corpus = corpus;
+		
+		try {
+			ArrayList<StructuralUnit> tmp = new ArrayList<>(corpus.getOrderedStructuralUnits());
+			this.structuralunits = new ArrayList<String>();
+			for (StructuralUnit su : tmp) {
+				if (!(su.getName().equals("txmcorpus"))) { //$NON-NLS-1$
+					this.structuralunits.add(su.getName());
+				}
+			}
+		}
+		catch (CqiClientException e) {
+			org.txm.utils.logger.Log.printStackTrace(e);
+		}
+				
+		Label firstStep = new Label(this, SWT.NONE);
+		firstStep.setText("1- set pivot");
+		firstStep = new Label(this, SWT.SEPARATOR | SWT.HORIZONTAL);
+		firstStep.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false, 2, 1));
+		
+		Label l = new Label(this, SWT.NONE);
+		l.setText(TXMUIMessages.query);
+		
+		queryField = new QueryWidget(this, SWT.BORDER, corpus.getProject(), CQPSearchEngine.getEngine());
+		queryField.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false));
+		
+		Label secondStep = new Label(this, SWT.NONE);
+		secondStep.setText("2- set context");
+		secondStep = new Label(this, SWT.SEPARATOR | SWT.HORIZONTAL);
+		secondStep.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false, 2, 1));
+		
+		l = new Label(this, SWT.NONE);
+		l.setText("Limit");
+		
+		structuralUnitCombo = new Combo(this, SWT.SINGLE|SWT.READ_ONLY);
+		structuralUnitCombo.setItems(structuralunits.toArray(new String[structuralunits.size()]));
+		structuralUnitCombo.add("<w>", 0);
+		
+		structuralUnitCombo.setText("text");
+		
+		l = new Label(this, SWT.NONE);
+		l.setText(TXMUIMessages.contextSize);
+		
+		wordContextSize = new Spinner(this, SWT.NONE);
+		wordContextSize.setMinimum(1);
+	}
+	
+	public void updateQueryField() {
+		
+		queryField.update();
+	}
+	
+	/**
+	 * Update display.
+	 */
+	public void updateDisplay() {
+		this.layout();
+	}
+	
+	/**
+	 * Gets the query string.
+	 *
+	 * @return the generated query string
+	 */
+	public String getQueryString() {
+		
+		String q = queryField.getQuery().fixQuery(corpus.getLang()).getQueryString();
+		if (!q.contains(" expand to ") && 
+				(wordContextSize.getSelection() > 1 || !("<w>".equals(structuralUnitCombo.getText())))) {
+			q += " expand to";
+			
+			if (wordContextSize.getSelection() > 1) {
+				q += " " + wordContextSize.getSelection();
+			}
+			
+			if (!("<w>".equals(structuralUnitCombo.getText()))) {
+				q += " " +structuralUnitCombo.getText();
+			}
+		}
+		
+		return q;
+	}
+	
+	/**
+	 * 
+	 * @return the raw query without the context filter
+	 */
+	public String getQueryFieldValue() {
+		
+		String query = this.queryField.getText();
+		if (query == null || query.length() == 0) {
+			query = getQueryString();
+		}
+		return query;
+	}
+	
+	public String getGeneratedName() {
+		
+		String s = queryField.getQueryString()+">";
+		if ("<w>".equals(structuralUnitCombo.getText())) {
+			
+			if (wordContextSize.getSelection() > 1) {
+				return "<"+wordContextSize.getSelection() +"w "+s;
+			} else {
+				return "<w "+s;
+			}
+		} else {
+			if (wordContextSize.getSelection() > 1) {
+				return "<"+wordContextSize.getSelection()+ structuralUnitCombo.getText()+" "+s;
+			} else {
+				return "<"+structuralUnitCombo.getText()+" "+s;
+			}
+		}
+		
+	}
+}

Property changes on: TXM/trunk/bundles/org.txm.rcp/src/main/java/org/txm/rcp/swt/widget/structures/ContextsSubcorpusPanel.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

