1
|
package eu.etaxonomy.taxeditor.molecular.handler;
|
2
|
|
3
|
import org.eclipse.core.commands.AbstractHandler;
|
4
|
import org.eclipse.core.commands.ExecutionEvent;
|
5
|
import org.eclipse.core.commands.ExecutionException;
|
6
|
import org.eclipse.swt.dnd.Clipboard;
|
7
|
import org.eclipse.swt.dnd.TextTransfer;
|
8
|
import org.eclipse.swt.dnd.Transfer;
|
9
|
import org.eclipse.swt.widgets.Display;
|
10
|
import org.eclipse.ui.IEditorPart;
|
11
|
import org.eclipse.ui.handlers.HandlerUtil;
|
12
|
|
13
|
import eu.etaxonomy.taxeditor.molecular.editor.AlignmentEditor;
|
14
|
|
15
|
public class AlignmentEditorCopyHandler extends AbstractHandler {
|
16
|
|
17
|
@Override
|
18
|
public Object execute(ExecutionEvent event) throws ExecutionException {
|
19
|
Clipboard clipboard = new Clipboard(Display.getCurrent());
|
20
|
TextTransfer textTransfer = TextTransfer.getInstance();
|
21
|
Transfer[] transfers = new Transfer[]{textTransfer};
|
22
|
|
23
|
String selectedSequenceString = "Blabla";
|
24
|
IEditorPart activeEditor = HandlerUtil.getActiveEditor(event);
|
25
|
if(activeEditor instanceof AlignmentEditor){
|
26
|
AlignmentEditor alignmentEditor = (AlignmentEditor)activeEditor;
|
27
|
//TODO get selected sequence string
|
28
|
}
|
29
|
Object[] data = new Object[]{selectedSequenceString};
|
30
|
clipboard.setContents(data, transfers);
|
31
|
return null;
|
32
|
}
|
33
|
|
34
|
}
|