Révision 3369

TXM/trunk/org.txm.specificities.rcp/src/org/txm/specificities/rcp/editors/SpecificitiesEditor.java (revision 3369)
383 383
	public void updateResultFromEditor() {
384 384
		// nothing to do
385 385
	}
386

  
387

  
388

  
389
	public TableViewer getTableViewer() {
390
		
391
		return viewer;
392
	}
386 393
	
387 394
	
388 395
	
TXM/trunk/org.txm.specificities.rcp/src/org/txm/specificities/rcp/handlers/CopyLines.java (revision 3369)
1
// Copyright © 2010-2020 ENS de Lyon., University of Franche-Comté
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.specificities.rcp.handlers;
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.TableViewer;
34
import org.eclipse.ui.IWorkbenchPart;
35
import org.eclipse.ui.handlers.HandlerUtil;
36
import org.txm.specificities.rcp.editors.SpecificitiesEditor;
37
import org.txm.rcp.editors.TableKeyListener;
38

  
39
/**
40
 * Allow the user to copy lines in a SpecificitiesEditor table.
41
 * @author mdecorde
42
 */
43
public class CopyLines extends AbstractHandler {
44

  
45
	/* (non-Javadoc)
46
	 * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
47
	 */
48
	@Override
49
	public Object execute(ExecutionEvent event) throws ExecutionException {
50
		// Shell shell = HandlerUtil.getActiveWorkbenchWindowChecked(event).getShell();
51
		// ISelection selection = HandlerUtil.getActiveWorkbenchWindow(event).getActivePage().getSelection();
52

  
53
		IWorkbenchPart editor = HandlerUtil.getActiveWorkbenchWindow(event).getActivePage().getActivePart();
54
		
55
		if (editor instanceof SpecificitiesEditor) {
56
			SpecificitiesEditor ceditor = (SpecificitiesEditor) editor;
57
			copyLines(ceditor);
58
		}
59

  
60
		return null;
61
	}
62

  
63
	public static void copyLines(SpecificitiesEditor editor) {
64
		TableViewer viewer = editor.getTableViewer();
65
				
66
		TableKeyListener.copyLinesToClipboard(new TableViewer[] {viewer});
67
	}
68
}
0 69

  
TXM/trunk/org.txm.specificities.rcp/plugin.xml (revision 3369)
34 34
            name="%command.name.0"
35 35
            returnTypeId="org.txm.specificities.core.functions.SpecificitiesSelection">
36 36
      </command>
37
      <command
38
            defaultHandler="org.txm.specificities.rcp.handlers.CopyLines"
39
            id="org.txm.specificities.rcp.handlers.CopyLines"
40
            name="Copy">
41
      </command>
37 42
   </extension>
38 43
   <extension
39 44
         point="org.eclipse.ui.menus">
......
120 125
               icon="icons/functions/specificities_selection.png"
121 126
               style="push">
122 127
         </command>
128
         <command
129
               commandId="org.txm.specificities.rcp.handlers.CopyLines"
130
               icon="platform:/plugin/org.eclipse.ui/icons/full/etool16/copy_edit.png"
131
               label="Copy"
132
               style="push">
133
         </command>
123 134
      </menuContribution>
124 135
   </extension>
125 136
   <extension
TXM/trunk/org.txm.lexicaltable.rcp/plugin.xml (revision 3369)
129 129
      </menuContribution>
130 130
            <menuContribution
131 131
            locationURI="popup:org.txm.lexicaltable.rcp.editors.LexicalTableEditor">
132
               <command
133
                     commandId="org.txm.lexicaltable.rcp.handlers.CopyLines"
134
                     icon="platform:/plugin/org.eclipse.ui/icons/full/etool16/copy_edit.png"
135
                     label="Copy"
136
                     style="push">
137
               </command>
132 138
         <command
133 139
               commandId="org.txm.lexicaltable.rcp.handlers.DeleteLines"
134 140
               style="push">
......
180 186
            id="org.txm.lexicaltable.rcp.handlers.ImportTable"
181 187
            name="%command.name.40">
182 188
      </command>
189
      <command
190
            defaultHandler="org.txm.lexicaltable.rcp.handlers.CopyLines"
191
            id="org.txm.lexicaltable.rcp.handlers.CopyLines"
192
            name="Copy">
193
      </command>
183 194
   </extension>
184 195
   <extension
185 196
         point="org.eclipse.ui.editors">
TXM/trunk/org.txm.lexicaltable.rcp/src/org/txm/lexicaltable/rcp/handlers/CopyLines.java (revision 3369)
1
// Copyright © 2010-2020 ENS de Lyon., University of Franche-Comté
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.lexicaltable.rcp.handlers;
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.TableViewer;
34
import org.eclipse.ui.IWorkbenchPart;
35
import org.eclipse.ui.handlers.HandlerUtil;
36
import org.txm.lexicaltable.rcp.editors.LexicalTableEditor;
37
import org.txm.rcp.editors.TableKeyListener;
38

  
39
/**
40
 * Allow the user to copy lines in a LexicalTableEditor table.
41
 * @author mdecorde
42
 */
43
public class CopyLines extends AbstractHandler {
44

  
45
	/* (non-Javadoc)
46
	 * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
47
	 */
48
	@Override
49
	public Object execute(ExecutionEvent event) throws ExecutionException {
50
		// Shell shell = HandlerUtil.getActiveWorkbenchWindowChecked(event).getShell();
51
		// ISelection selection =  HandlerUtil.getActiveWorkbenchWindow(event).getActivePage().getSelection();
52

  
53
		IWorkbenchPart editor = HandlerUtil.getActiveWorkbenchWindow(event).getActivePage().getActivePart();
54
		if (editor instanceof LexicalTableEditor) {
55
			LexicalTableEditor ceditor = (LexicalTableEditor) editor;
56
			copyLines(ceditor);
57
		}
58

  
59
		return null;
60
	}
61

  
62

  
63
	public static void copyLines(LexicalTableEditor editor) {
64
		
65
		TableViewer viewer = editor.getlineTableViewer();
66
		TableKeyListener.copyLinesToClipboard(new TableViewer[] {viewer});
67
	}
68
}
0 69

  
TXM/trunk/org.txm.referencer.rcp/src/org/txm/referencer/rcp/handlers/CopyLines.java (revision 3369)
54 54
		
55 55
		if (editor instanceof ReferencerEditor) {
56 56
			ReferencerEditor ceditor = (ReferencerEditor) editor;
57
			deleteConcordanceLines(ceditor);
57
			copyLines(ceditor);
58 58
		}
59 59

  
60 60
		return null;
61 61
	}
62 62

  
63
	public static void deleteConcordanceLines(ReferencerEditor editor) {
63
	public static void copyLines(ReferencerEditor editor) {
64 64
		TableViewer viewer = editor.getTableViewer();
65 65
				
66 66
		TableKeyListener.copyLinesToClipboard(new TableViewer[] {viewer});
TXM/trunk/org.txm.index.rcp/src/org/txm/index/rcp/editors/PartitionIndexEditor.java (revision 3369)
565 565
	public IQuery getQuery() {
566 566
		return queryWidget.getQuery();
567 567
	}
568

  
569

  
570

  
571

  
572
	public TableViewer getTableViewer() {
573
		
574
		return viewer;
575
	}
568 576
}
TXM/trunk/org.txm.index.rcp/src/org/txm/index/rcp/handlers/CopyLines.java (revision 3369)
34 34
import org.eclipse.ui.IWorkbenchPart;
35 35
import org.eclipse.ui.handlers.HandlerUtil;
36 36
import org.txm.index.rcp.editors.IndexEditor;
37
import org.txm.index.rcp.editors.PartitionIndexEditor;
38
import org.txm.rcp.editors.TXMEditor;
37 39
import org.txm.rcp.editors.TableKeyListener;
38 40

  
39 41
/**
......
53 55

  
54 56
		IWorkbenchPart editor = HandlerUtil.getActiveWorkbenchWindow(event).getActivePage().getActivePart();
55 57
		
56
		if (editor instanceof IndexEditor) {
57
			IndexEditor ceditor = (IndexEditor) editor;
58
			deleteConcordanceLines(ceditor);
58
		if (editor instanceof TXMEditor<?>) {
59
			TXMEditor ceditor = (TXMEditor) editor;
60
			copyLines(ceditor);
59 61
		}
60 62

  
61 63
		return null;
62 64
	}
63 65

  
64

  
65
	public static void deleteConcordanceLines(IndexEditor editor) {
66
		TableViewer viewer = editor.getTableViewer();
66
	public static void copyLines(TXMEditor<?> editor) {
67
		
68
		TableViewer viewer = null;
69
		
70
		if (editor instanceof IndexEditor) {
71
			 viewer = ((IndexEditor)editor).getTableViewer();
72
		} else if (editor instanceof PartitionIndexEditor) {
73
			viewer = ((PartitionIndexEditor)editor).getTableViewer();
74
		} else {
75
			return;
76
		}
67 77
				
68 78
		TableKeyListener.copyLinesToClipboard(new TableViewer[] {viewer});
69 79
	}
TXM/trunk/org.txm.index.rcp/plugin.xml (revision 3369)
177 177
                        style="push">
178 178
                  </command>
179 179
               </menuContribution>
180
               <menuContribution
181
                     locationURI="popup:org.txm.index.rcp.editors.PartitionIndexEditor">
182
                  <command
183
                        commandId="org.txm.index.rcp.handlers.CopyLines"
184
                        icon="platform:/plugin/org.eclipse.ui/icons/full/etool16/copy_edit.png"
185
                        label="Copy"
186
                        style="push">
187
                  </command>
188
               </menuContribution>
180 189
      
181 190
   </extension>
182 191
   <extension
TXM/trunk/org.txm.concordance.rcp/src/org/txm/concordance/rcp/handlers/CopyLines.java (revision 3369)
54 54
				.getActivePage().getActivePart();
55 55
		if (editor instanceof ConcordanceEditor) {
56 56
			ConcordanceEditor ceditor = (ConcordanceEditor) editor;
57
			deleteConcordanceLines(ceditor);
57
			copyLines(ceditor);
58 58
		}
59 59

  
60 60
		return null;
61 61
	}
62 62

  
63 63

  
64
	public static void deleteConcordanceLines(ConcordanceEditor editor) {
64
	public static void copyLines(ConcordanceEditor editor) {
65 65
		TableViewer viewer = editor.getLineTableViewer();
66 66
		TableViewer viewer2 = editor.getReferenceTableViewer();
67 67
		
TXM/trunk/org.txm.internalview.rcp/src/org/txm/internalview/rcp/handlers/CopyLines.java (revision 3369)
54 54
		
55 55
		if (editor instanceof InternalViewEditor) {
56 56
			InternalViewEditor ceditor = (InternalViewEditor) editor;
57
			deleteConcordanceLines(ceditor);
57
			copyLines(ceditor);
58 58
		}
59 59

  
60 60
		return null;
61 61
	}
62 62

  
63
	public static void deleteConcordanceLines(InternalViewEditor editor) {
63
	public static void copyLines(InternalViewEditor editor) {
64 64
		TableViewer viewer = editor.getTableViewer();
65 65
				
66 66
		TableKeyListener.copyLinesToClipboard(new TableViewer[] {viewer});
TXM/trunk/org.txm.cooccurrence.rcp/src/org/txm/cooccurrence/rcp/handlers/CopyLines.java (revision 3369)
54 54
		
55 55
		if (editor instanceof CooccurrencesEditor) {
56 56
			CooccurrencesEditor ceditor = (CooccurrencesEditor) editor;
57
			deleteConcordanceLines(ceditor);
57
			copyLines(ceditor);
58 58
		}
59 59

  
60 60
		return null;
61 61
	}
62 62

  
63
	public static void deleteConcordanceLines(CooccurrencesEditor editor) {
63
	public static void copyLines(CooccurrencesEditor editor) {
64 64
		TableViewer viewer = editor.getTableViewer();
65 65
				
66 66
		TableKeyListener.copyLinesToClipboard(new TableViewer[] {viewer});

Formats disponibles : Unified diff