Revision c4a7540a
Added by Patrick Plitzner about 7 years ago
eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/AlignmentEditorPasteHandler.java | ||
---|---|---|
1 | 1 |
package eu.etaxonomy.taxeditor.molecular.handler; |
2 | 2 |
|
3 | 3 |
|
4 |
import info.bioinfweb.libralign.alignmentarea.AlignmentArea; |
|
5 |
import info.bioinfweb.libralign.alignmentarea.order.SequenceOrder; |
|
6 |
import info.bioinfweb.libralign.alignmentarea.selection.SelectionModel; |
|
7 |
import info.bioinfweb.libralign.model.AlignmentModel; |
|
8 |
import info.bioinfweb.libralign.model.utils.AlignmentModelUtils; |
|
9 |
|
|
10 | 4 |
import java.util.ArrayList; |
11 | 5 |
import java.util.List; |
12 | 6 |
import java.util.Map; |
... | ... | |
19 | 13 |
import org.eclipse.ui.handlers.HandlerUtil; |
20 | 14 |
import org.eclipse.ui.menus.UIElement; |
21 | 15 |
|
16 |
import eu.etaxonomy.taxeditor.molecular.Messages; |
|
22 | 17 |
import eu.etaxonomy.taxeditor.molecular.editor.AlignmentEditor; |
18 |
import info.bioinfweb.libralign.alignmentarea.AlignmentArea; |
|
19 |
import info.bioinfweb.libralign.alignmentarea.order.SequenceOrder; |
|
20 |
import info.bioinfweb.libralign.alignmentarea.selection.SelectionModel; |
|
21 |
import info.bioinfweb.libralign.model.AlignmentModel; |
|
22 |
import info.bioinfweb.libralign.model.utils.AlignmentModelUtils; |
|
23 | 23 |
|
24 | 24 |
|
25 | 25 |
|
... | ... | |
53 | 53 |
while (scanner.hasNext()) { |
54 | 54 |
lines.add(scanner.nextLine()); |
55 | 55 |
} |
56 |
if (lines.get(lines.size() - 1).equals("")) { |
|
56 |
if (lines.get(lines.size() - 1).equals("")) { //$NON-NLS-1$
|
|
57 | 57 |
lines.remove(lines.size() - 1); |
58 | 58 |
} |
59 | 59 |
} |
... | ... | |
69 | 69 |
} |
70 | 70 |
else { |
71 | 71 |
MessageDialog dialog = new MessageDialog(HandlerUtil.getActiveWorkbenchWindow(event).getShell(), //TODO Can the window be null? |
72 |
"Pasting multiple lines", null, |
|
73 |
"The text to be pasted contains mutlitple lines (" + lines.size() + |
|
74 |
") although the current cursor height is one. What do you want to do?", |
|
72 |
Messages.AlignmentEditorPasteHandler_PASTING_LINES, null, |
|
73 |
String.format(Messages.AlignmentEditorPasteHandler_PASTING_LINES_QUESTION, lines.size()), |
|
75 | 74 |
MessageDialog.QUESTION, |
76 |
new String[]{"Ingnore line breaks and paste as one sequence",
|
|
77 |
"Only paste the first line from the clipboard", "Cancel"},
|
|
75 |
new String[]{Messages.AlignmentEditorPasteHandler_PASTING_LINES_IGNORE,
|
|
76 |
Messages.AlignmentEditorPasteHandler_PASTING_LINES_FIRST_LINE, Messages.AlignmentEditorPasteHandler_CANCEL},
|
|
78 | 77 |
0); |
79 | 78 |
//TODO Does the dialog have to be disposed in some way? |
80 | 79 |
|
... | ... | |
97 | 96 |
} |
98 | 97 |
else { |
99 | 98 |
MessageDialog.openError(HandlerUtil.getActiveWorkbenchWindow(event).getShell(), //TODO Can the window be null? |
100 |
"Unable to paste multiple lines", |
|
101 |
"The current cursor height (" + selection.getCursorHeight() + |
|
102 |
") does not match the number of lines to be pasted (" + lines.size() + ")." + |
|
103 |
System.getProperty("line.separator") + System.getProperty("line.separator") + |
|
104 |
"You can either change the cursor height accordingly or set the cursor height to one " |
|
105 |
+ "allowing you to paste all lines from the clipboad into one sequence."); |
|
99 |
Messages.AlignmentEditorPasteHandler_PASTE_FAILURE, |
|
100 |
String.format(Messages.AlignmentEditorPasteHandler_PASTE_FAILURE_MESSAGE, selection.getCursorHeight(), lines.size(), System.getProperty("line.separator"))); //$NON-NLS-1$ |
|
106 | 101 |
} |
107 | 102 |
} |
108 | 103 |
} |
Also available in: Unified diff
ref #4611 i18n for molecular plugin