Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/link/ReferencerToConc.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/link/ReferencerToConc.java	(revision 0)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/link/ReferencerToConc.java	(revision 379)
@@ -0,0 +1,140 @@
+// Copyright © 2010-2013 ENS de Lyon.
+// Copyright © 2007-2010 ENS de Lyon, CNRS, INRP, University of
+// Lyon 2, University of Franche-Comté, University of Nice
+// Sophia Antipolis, University of Paris 3.
+// 
+// The TXM platform is free software: you can redistribute it
+// and/or modify it under the terms of the GNU General Public
+// License as published by the Free Software Foundation,
+// either version 2 of the License, or (at your option) any
+// later version.
+// 
+// The TXM platform is distributed in the hope that it will be
+// useful, but WITHOUT ANY WARRANTY; without even the implied
+// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+// PURPOSE. See the GNU General Public License for more
+// details.
+// 
+// You should have received a copy of the GNU General
+// Public License along with the TXM platform. If not, see
+// http://www.gnu.org/licenses.
+// 
+// 
+// 
+// $LastChangedDate:$
+// $LastChangedRevision:$
+// $LastChangedBy:$ 
+//
+package org.txm.rcp.commands.link;
+
+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.osgi.util.NLS;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.handlers.HandlerUtil;
+import org.txm.concordance.rcp.editors.ConcordanceEditor;
+import org.txm.concordance.rcp.editors.ConcordanceEditorInput;
+import org.txm.functions.ReferencePattern;
+import org.txm.functions.referencer.Referencer;
+import org.txm.functions.referencer.Referencer.Line;
+import org.txm.rcp.Messages;
+import org.txm.rcp.editors.referencer.ReferencerEditor;
+import org.txm.searchengine.cqp.corpus.Corpus;
+import org.txm.searchengine.cqp.corpus.Property;
+import org.txm.searchengine.cqp.corpus.query.Query;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class ReferencerToConc.
+ */
+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(selection);
+		if (query.length() == 0)
+			return null;
+		Corpus corpus = refeditor.getCorpus();
+		ConcordanceEditorInput editorInput = new ConcordanceEditorInput(
+				corpus, null);
+
+		IWorkbenchPage page = refeditor.getEditorSite().getWorkbenchWindow()
+		.getActivePage();
+		try {
+			ConcordanceEditor conceditor = (ConcordanceEditor) page
+			.openEditor(editorInput,
+					"ConcordanceEditor"); //$NON-NLS-1$
+			conceditor.setQuery(query);
+			ReferencePattern rp = new ReferencePattern();
+			for(Property p : refeditor.getReferencer().getPattern())
+				rp.addProperty(p);
+			conceditor.setRefViewPattern(rp);
+			conceditor.compute();
+		} catch (PartInitException e) {
+			System.err.println(NLS.bind(Messages.GetConcordances_4, e));
+		}
+
+		return null;
+	}
+
+	/**
+	 * Gets the query.
+	 *
+	 * @param selection the selection
+	 * @return the query
+	 */
+	private static String getQuery(IStructuredSelection selection) {
+		String query = ""; //$NON-NLS-1$
+
+		Line fline = (Line) selection.getFirstElement();
+		Referencer ref = fline.getReferencer();
+		int nbToken = 1;
+
+		List<Line> lines = selection.toList();
+
+		Property prop = ref.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 = Query.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: tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/link/ReferencerToConc.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

