root / tmp / org.txm.links.rcp / src / ComputeIndexFromLines.java @ 671
Historique | Voir | Annoter | Télécharger (2,56 ko)
| 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 |
|
| 29 |
|
| 30 |
import org.eclipse.jface.action.Action; |
| 31 |
import org.eclipse.jface.viewers.IStructuredSelection; |
| 32 |
import org.eclipse.jface.viewers.TableViewer; |
| 33 |
import org.eclipse.ui.IWorkbenchWindow; |
| 34 |
import org.eclipse.ui.actions.ActionFactory.IWorkbenchAction; |
| 35 |
import org.txm.concordance.rcp.editors.ConcordanceEditor; |
| 36 |
import org.txm.rcp.RCPMessages; |
| 37 |
import org.txm.rcp.commands.link.ConcordanceToIndex; |
| 38 |
|
| 39 |
// TODO: Auto-generated Javadoc
|
| 40 |
/**
|
| 41 |
* use the line selection to compute an index.
|
| 42 |
*/
|
| 43 |
public class ComputeIndexFromLines extends Action implements IWorkbenchAction { |
| 44 |
|
| 45 |
/** The Constant ID. */
|
| 46 |
private static final String ID = "org.txm.rcp.editors.concordances.computecoocfromconclines"; //$NON-NLS-1$ |
| 47 |
|
| 48 |
/** The window. */
|
| 49 |
private IWorkbenchWindow window;
|
| 50 |
|
| 51 |
/** The concordance editor. */
|
| 52 |
private ConcordanceEditor concordanceEditor;
|
| 53 |
|
| 54 |
/**
|
| 55 |
* Instantiates a new compute index from lines.
|
| 56 |
*
|
| 57 |
* @param window the window
|
| 58 |
* @param concordanceEditor the concordance editor
|
| 59 |
*/
|
| 60 |
public ComputeIndexFromLines(IWorkbenchWindow window,
|
| 61 |
ConcordanceEditor concordanceEditor) {
|
| 62 |
this.window = window;
|
| 63 |
this.concordanceEditor = concordanceEditor;
|
| 64 |
setId(ID); |
| 65 |
setText(RCPMessages.ComputeIndexFromLines_0); |
| 66 |
setToolTipText(RCPMessages.ComputeIndexFromLines_0); |
| 67 |
} |
| 68 |
|
| 69 |
/* (non-Javadoc)
|
| 70 |
* @see org.eclipse.ui.actions.ActionFactory.IWorkbenchAction#dispose()
|
| 71 |
*/
|
| 72 |
@Override
|
| 73 |
public void dispose() { |
| 74 |
} |
| 75 |
|
| 76 |
/* (non-Javadoc)
|
| 77 |
* @see org.eclipse.jface.action.Action#run()
|
| 78 |
*/
|
| 79 |
@Override
|
| 80 |
public void run() { |
| 81 |
TableViewer table = concordanceEditor.getLineTableViewer(); |
| 82 |
ConcordanceToIndex.link(concordanceEditor, |
| 83 |
(IStructuredSelection) table.getSelection()); |
| 84 |
} |
| 85 |
} |