Révision 272

tmp/org.txm.rcp/src/main/java/org/txm/rcpapplication/commands/function/ComputeLexicon.java (revision 272)
1
// Copyright © 2010-2013 ENS de Lyon.
2
// Copyright © 2007-2010 ENS de Lyon, CNRS, INRP, University of
3
// Lyon 2, University of Franche-Comté, University of Nice
4
// Sophia Antipolis, University of Paris 3.
5
// 
6
// The TXM platform is free software: you can redistribute it
7
// and/or modify it under the terms of the GNU General Public
8
// License as published by the Free Software Foundation,
9
// either version 2 of the License, or (at your option) any
10
// later version.
11
// 
12
// The TXM platform is distributed in the hope that it will be
13
// useful, but WITHOUT ANY WARRANTY; without even the implied
14
// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15
// PURPOSE. See the GNU General Public License for more
16
// details.
17
// 
18
// You should have received a copy of the GNU General
19
// Public License along with the TXM platform. If not, see
20
// http://www.gnu.org/licenses.
21
// 
22
// 
23
// 
24
// $LastChangedDate:$
25
// $LastChangedRevision:$
26
// $LastChangedBy:$ 
27
//
28
package org.txm.rcpapplication.commands.function;
29

  
30
import org.eclipse.core.commands.AbstractHandler;
31
import org.eclipse.core.commands.ExecutionEvent;
32
import org.eclipse.core.commands.ExecutionException;
33
import org.eclipse.jface.viewers.IStructuredSelection;
34
import org.eclipse.ui.IWorkbenchPage;
35
import org.eclipse.ui.handlers.HandlerUtil;
36
import org.txm.Toolbox;
37
import org.txm.index.rcp.editors.IndexEditorInput;
38
import org.txm.rcpapplication.TXMWindows;
39
import org.txm.rcpapplication.editors.dictionnary.DictionnaryEditor;
40
import org.txm.searchengine.cqp.corpus.Corpus;
41

  
42
// TODO: Auto-generated Javadoc
43
/**
44
 * Compute a Lexicon used it to create a Index (object) then open it in the
45
 * DictionnaryEditor @ author mdecorde.
46
 */
47
public class ComputeLexicon extends AbstractHandler {
48

  
49
	/* (non-Javadoc)
50
	 * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
51
	 */
52
	@Override
53
	public Object execute(ExecutionEvent event) throws ExecutionException {
54
		if (!Toolbox.isSearchEngineInitialized()) return false;
55
		
56
		//window = HandlerUtil.getActiveWorkbenchWindow(event);
57
		IStructuredSelection selection = (IStructuredSelection) HandlerUtil.getCurrentSelection(event);
58

  
59
		assert (selection.getFirstElement() instanceof Corpus);
60

  
61
		final Corpus corpus = (Corpus) selection.getFirstElement();
62
		
63
		openEditor(corpus);
64
		
65
		return null;
66
	}
67
	
68
	public static boolean openEditor(Corpus corpus) {
69
		if (!Toolbox.isSearchEngineInitialized()) return false;
70
		
71
		IWorkbenchPage page = TXMWindows.getActiveWindow().getActivePage();
72
		IndexEditorInput editorInput = new IndexEditorInput(corpus);
73
		DictionnaryEditor voceditor;
74
		try {
75
			voceditor = (DictionnaryEditor) page.openEditor(editorInput,
76
							"org.txm.rcpapplication.editors.dictionnary.DictionnaryEditor"); //$NON-NLS-1$
77
			voceditor.compute();
78
			// voceditor.initializeFields();
79
			 return true;
80
		} catch (Exception e) {
81
			// TODO Auto-generated catch block
82
			org.txm.rcpapplication.utils.Logger.printStackTrace(e);
83
		} 
84
		 return false;
85
	}
86

  
87
}
tmp/org.txm.rcp/src/main/java/org/txm/rcpapplication/commands/function/ExportResult.java (revision 272)
50 50
import org.txm.functions.referencer.Referencer;
51 51
import org.txm.index.core.functions.Index;
52 52
import org.txm.lexicaltable.core.statsengine.data.LexicalTable;
53
import org.txm.lexicon.core.corpusengine.cqp.Lexicon;
53 54
import org.txm.progression.core.functions.Progression;
54 55
import org.txm.rcpapplication.JobsTimer;
55 56
import org.txm.rcpapplication.Messages;
......
59 60
import org.txm.rcpapplication.preferences.ExportPreferencePage;
60 61
import org.txm.rcpapplication.swt.dialog.LastOpened;
61 62
import org.txm.rcpapplication.utils.JobHandler;
62
import org.txm.searchengine.cqp.corpus.Lexicon;
63 63
import org.txm.specificities.core.functions.SpecificitesResult;
64 64
// TODO: Auto-generated Javadoc
65 65
/**
tmp/org.txm.rcp/src/main/java/org/txm/rcpapplication/commands/function/ComputeDiagnostic.java (revision 272)
50 50
import org.txm.rcpapplication.editors.TXMWebBrowserEditor;
51 51
import org.txm.rcpapplication.preferences.DiagnosticPreferencePage;
52 52
import org.txm.rcpapplication.utils.JobHandler;
53
import org.txm.rcpapplication.views.corpora.CorporaView;
54 53
import org.txm.searchengine.cqp.AbstractCqiClient;
55 54
import org.txm.searchengine.cqp.NetCqiClient;
56 55
import org.txm.searchengine.cqp.corpus.Corpus;
tmp/org.txm.rcp/src/main/java/org/txm/rcpapplication/commands/function/ExportSVG.java (revision 272)
40 40
import org.txm.Toolbox;
41 41
import org.txm.rcpapplication.Messages;
42 42
import org.txm.rcpapplication.swt.dialog.LastOpened;
43
import org.txm.utils.FileCopy;
43
import org.txm.utils.io.FileCopy;
44 44

  
45 45
/**
46 46
 * save the SVG file selected @ author mdecorde.

Formats disponibles : Unified diff