Révision 3368

TXM/trunk/org.txm.cooccurrence.rcp/plugin.xml (revision 3368)
10 10
            name="%command.name"
11 11
            returnTypeId="org.txm.cooccurrence.core.functions.Cooccurrence">
12 12
      </command>
13
      <command
14
            defaultHandler="org.txm.cooccurrence.rcp.handlers.CopyLines"
15
            id="org.txm.cooccurrence.rcp.handlers.CopyLines"
16
            name="Copy">
17
      </command>
13 18
   </extension>
14 19
   <extension
15 20
         point="org.eclipse.ui.preferencePages">
......
128 133
               tooltip="%command.name.4">
129 134
         </command>
130 135
      </menuContribution>
136
      <menuContribution
137
            locationURI="popup:org.txm.cooccurrence.rcp.editors.CooccurrencesEditor">
138
         <command
139
               commandId="org.txm.cooccurrence.rcp.handlers.CopyLines"
140
               icon="platform:/plugin/org.eclipse.ui/icons/full/etool16/copy_edit.png"
141
               label="Copy"
142
               style="push">
143
         </command>
144
      </menuContribution>
131 145
   </extension>
132 146
   <extension
133 147
         point="org.eclipse.ui.editors">
TXM/trunk/org.txm.cooccurrence.rcp/src/org/txm/cooccurrence/rcp/handlers/CopyLines.java (revision 3368)
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.cooccurrence.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.cooccurrence.rcp.editors.CooccurrencesEditor;
37
import org.txm.rcp.editors.TableKeyListener;
38

  
39
/**
40
 * Allow the user to copy lines in a CooccurrencesEditor 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 CooccurrencesEditor) {
56
			CooccurrencesEditor ceditor = (CooccurrencesEditor) editor;
57
			deleteConcordanceLines(ceditor);
58
		}
59

  
60
		return null;
61
	}
62

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

  
TXM/trunk/org.txm.cooccurrence.rcp/src/org/txm/cooccurrence/rcp/editors/CooccurrencesEditor.java (revision 3368)
664 664
		TXMParameters parameters = getWidgetsParameters();
665 665
		cooc.setParameters(parameters);
666 666
	}
667

  
668
	public TableViewer getTableViewer() {
669
		
670
		return viewer;
671
	}
667 672
}
TXM/trunk/org.txm.index.rcp/src/org/txm/index/rcp/handlers/CopyLines.java (revision 3368)
37 37
import org.txm.rcp.editors.TableKeyListener;
38 38

  
39 39
/**
40
 * Allow the user to delete lines in a Concordance table.
40
 * Allow the user to copy lines in a IndexEditor table.
41 41
 * @author mdecorde
42 42
 * @author sjacquot
43 43
 */
TXM/trunk/org.txm.index.rcp/plugin.xml (revision 3368)
137 137
                        label="%command.name.2"
138 138
                        style="push">
139 139
                  </command>
140
                  <command
141
                        commandId="org.txm.index.rcp.handlers.CopyLines"
142
                        icon="platform:/plugin/org.eclipse.ui/icons/full/etool16/copy_edit.png"
143
                        label="Copy"
144
                        style="push">
145
                  </command>
140 146
               </menuContribution>
141 147
               <menuContribution
142 148
                     locationURI="popup:org.txm.internalview.rcp.editors.InternalViewEditor">
TXM/trunk/org.txm.concordance.rcp/src/org/txm/concordance/rcp/handlers/CopyLines.java (revision 3368)
31 31
import org.eclipse.core.commands.ExecutionEvent;
32 32
import org.eclipse.core.commands.ExecutionException;
33 33
import org.eclipse.jface.viewers.TableViewer;
34
import org.eclipse.swt.widgets.Shell;
35 34
import org.eclipse.ui.IWorkbenchPart;
36 35
import org.eclipse.ui.handlers.HandlerUtil;
37 36
import org.txm.concordance.rcp.editors.ConcordanceEditor;
38 37
import org.txm.rcp.editors.TableKeyListener;
39 38

  
40 39
/**
41
 * Allow the user to delete lines in a Concordance table.
40
 * Allow the user to copy lines in a ConcordanceEditor table.
42 41
 * @author mdecorde
43
 * @author sjacquot
44 42
 */
45 43
public class CopyLines extends AbstractHandler {
46 44

  
......
49 47
	 */
50 48
	@Override
51 49
	public Object execute(ExecutionEvent event) throws ExecutionException {
52
		Shell shell = HandlerUtil.getActiveWorkbenchWindowChecked(event).getShell();
53
		// ISelection selection =
54
		// HandlerUtil.getActiveWorkbenchWindow(event).getActivePage().getSelection();
50
		// Shell shell = HandlerUtil.getActiveWorkbenchWindowChecked(event).getShell();
51
		// ISelection selection =  HandlerUtil.getActiveWorkbenchWindow(event).getActivePage().getSelection();
55 52

  
56 53
		IWorkbenchPart editor = HandlerUtil.getActiveWorkbenchWindow(event)
57 54
				.getActivePage().getActivePart();
TXM/trunk/org.txm.referencer.rcp/src/org/txm/referencer/rcp/handlers/CopyLines.java (revision 3368)
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.referencer.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.referencer.rcp.editors.ReferencerEditor;
37
import org.txm.rcp.editors.TableKeyListener;
38

  
39
/**
40
 * Allow the user to copy lines in a ReferencerEditor 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 ReferencerEditor) {
56
			ReferencerEditor ceditor = (ReferencerEditor) editor;
57
			deleteConcordanceLines(ceditor);
58
		}
59

  
60
		return null;
61
	}
62

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

  
TXM/trunk/org.txm.referencer.rcp/src/org/txm/referencer/rcp/editors/ReferencerEditor.java (revision 3368)
483 483
	public void updateResultFromEditor() {
484 484
		// nothing to do
485 485
	}
486

  
487
	public TableViewer getTableViewer() {
488
		
489
		return viewer;
490
	}
486 491
}
TXM/trunk/org.txm.referencer.rcp/plugin.xml (revision 3368)
57 57
                     </visibleWhen>
58 58
                  </command>
59 59
               </menuContribution>
60
               <menuContribution
61
                     locationURI="popup:org.txm.referencer.rcp.editors.ReferencerEditor">
62
                  <command
63
                        commandId="org.txm.referencer.rcp.handlers.CopyLines"
64
                        icon="platform:/plugin/org.eclipse.ui/icons/full/etool16/copy_edit.png"
65
                        label="Copy"
66
                        style="push">
67
                  </command>
68
               </menuContribution>
60 69
   </extension>
61 70
   <extension
62 71
         point="org.eclipse.ui.commands">
......
68 77
                  name="%command.name.44"
69 78
                  returnTypeId="org.txm.referencer.core.functions.Referencer">
70 79
      </command>
80
            <command
81
                  defaultHandler="org.txm.referencer.rcp.handlers.CopyLines"
82
                  id="org.txm.referencer.rcp.handlers.CopyLines"
83
                  name="Copy">
84
            </command>
71 85
   </extension>
72 86
   <extension
73 87
         point="org.eclipse.core.expressions.definitions">
TXM/trunk/org.txm.internalview.rcp/plugin.xml (revision 3368)
9 9
            name="%command.name"
10 10
            returnTypeId="org.txm.internalview.core.functions.InternalView">
11 11
      </command>
12
      <command
13
            defaultHandler="org.txm.internalview.rcp.handlers.CopyLines"
14
            id="org.txm.internalview.rcp.handlers.CopyLines"
15
            name="Copy">
16
      </command>
12 17
   </extension>   <extension
13 18
         point="org.eclipse.ui.menus">
14 19
      <menuContribution
......
55 60
            </visibleWhen>
56 61
         </command>
57 62
      </menuContribution>
63
      <menuContribution
64
            locationURI="popup:org.txm.internalview.rcp.editors.InternalViewEditor">
65
         <command
66
               commandId="org.txm.internalview.rcp.handlers.CopyLines"
67
               icon="platform:/plugin/org.eclipse.ui/icons/full/etool16/copy_edit.png"
68
               label="Copy"
69
               style="push">
70
         </command>
71
      </menuContribution>
58 72
      
59 73
   </extension>   <extension
60 74
         point="org.eclipse.ui.editors">
TXM/trunk/org.txm.internalview.rcp/src/org/txm/internalview/rcp/editors/InternalViewEditor.java (revision 3368)
393 393
			e.printStackTrace();
394 394
		}
395 395
	}
396

  
397
	public TableViewer getTableViewer() {
398
		
399
		return viewer;
400
	}
396 401
}
TXM/trunk/org.txm.internalview.rcp/src/org/txm/internalview/rcp/handlers/CopyLines.java (revision 3368)
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.internalview.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.internalview.rcp.editors.InternalViewEditor;
37
import org.txm.rcp.editors.TableKeyListener;
38

  
39
/**
40
 * Allow the user to copy lines in a InternalViewEditor 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 InternalViewEditor) {
56
			InternalViewEditor ceditor = (InternalViewEditor) editor;
57
			deleteConcordanceLines(ceditor);
58
		}
59

  
60
		return null;
61
	}
62

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

  

Formats disponibles : Unified diff