import org.eclipse.core.commands.operations.IUndoableOperation;\r
import org.eclipse.core.runtime.Assert;\r
import org.eclipse.jface.action.Action;\r
-import org.eclipse.jface.action.MenuManager;\r
import org.eclipse.swt.SWT;\r
import org.eclipse.swt.custom.StyledText;\r
import org.eclipse.swt.events.FocusAdapter;\r
\r
setDraggableControl(nameViewer.getRulerControl());\r
\r
-// setData(taxonBase);\r
-\r
createParser();\r
createEmptyViewerPrompt(EMPTY_NAME_PROMPT);\r
setFocus();\r
((NameViewer) getTextViewer()).setCursorToEOL();\r
\r
TaxonNameBase name = taxonBase.getName();\r
- if (name != null) {\r
- \r
-// boolean hasProblem = name.getHasProblem();\r
-// ((NameViewer) getTextViewer()).setShowError(name);\r
- \r
+ if (name != null) { \r
calculateErrors();\r
}\r
}\r
\r
// Let others know the parser is active\r
isParsing = true;\r
- \r
- // Get the name from the composite's data field\r
-// TaxonBase taxonBase = (TaxonBase) getData();\r
-// NonViralName nonViralName = (NonViralName) taxonBase.getName();\r
- \r
+ \r
// Parse the name and paint the text field w any errors\r
if (getName() != null) {\r
CdmParserController.parseFullReference((NonViralName) getName(), text);\r
-// ((NameViewer) getTextViewer()).setShowError(nonViralName);\r
}\r
\r
// Any entry of text means the taxon has been changed\r
\r
@Override\r
public void handleSplitText(String text) {\r
-\r
+ \r
// Create a synonym in a new homotypic group using text as name\r
IUndoContext undoContext = EditorController.getUndoContext(taxon);\r
-// IUndoableOperation operation = new CreateSynonymInNewGroupOperation\r
- setOperation(new CreateSynonymInNewGroupOperation\r
- ("new heterotypic synonym", undoContext, taxon, text)); //$NON-NLS-1$\r
- \r
-// GlobalController.executeOperation(operation);\r
+ IUndoableOperation operation = new CreateSynonymInNewGroupOperation\r
+ ("new heterotypic synonym", undoContext, taxon, text); //$NON-NLS-1$\r
+// setOperation(new CreateSynonymInNewGroupOperation\r
\r
+ GlobalController.executeOperation(operation);\r
// getTextViewer().removeLineBreakListener(this);\r
}\r
\r
});\r
\r
- styledText.addKeyListener(new KeyAdapter(){\r
-\r
- @Override\r
- public void keyReleased(KeyEvent e) {\r
- if (operation != null) {\r
- GlobalController.executeOperation(operation);\r
- operation = null;\r
- }\r
- }\r
- \r
- });\r
- \r
-\r
- // Following collides with \r
- // NameViewer line 100: ruler.getControl().moveAbove(getTextWidget());\r
- \r
-// styledText.addFocusListener(new FocusAdapter() {\r
-// public void focusGained(FocusEvent e) {\r
-// setFocus();\r
+// styledText.addKeyListener(new KeyAdapter(){\r
+//\r
+// @Override\r
+// public void keyReleased(KeyEvent e) {\r
+// if (operation != null) {\r
+// GlobalController.executeOperation(operation);\r
+// operation = null;\r
+// }\r
// }\r
+// \r
// });\r
\r
+ styledText.addFocusListener(new FocusAdapter() {\r
+ public void focusGained(FocusEvent e) {\r
+ setFocus();\r
+ }\r
+ });\r
+ \r
// createLineWrapSupport(nameViewer);\r
\r
\r
return nameViewer;\r
}\r
\r
- IUndoableOperation operation;\r
+// IUndoableOperation operation;\r
\r
private Label nonEditableInfo;\r
\r
- protected void setOperation(IUndoableOperation operation) {\r
- this.operation = operation;\r
- }\r
+// protected void setOperation(IUndoableOperation operation) {\r
+// this.operation = operation;\r
+// }\r
\r
public void setText(String text) {\r
Assert.isNotNull(getTextViewer(), \r
}\r
\r
public void setIcon(Image icon) {\r
-// super.setIcon(icon);\r
if (nameViewer != null) {\r
nameViewer.setIcon(icon);\r
}\r