DND-triggered operations now executed after drag end.
[taxeditor.git] / eclipseprojects / eu.etaxonomy.taxeditor / src / eu / etaxonomy / taxeditor / editor / name / NameComposite.java
index 8b3f51433183859d4bd110a8209da735b2985b44..61d3954db1545520d6878001e92e5aeab5405e59 100644 (file)
@@ -17,7 +17,6 @@ import org.eclipse.core.commands.operations.IUndoContext;
 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
@@ -165,8 +164,6 @@ public abstract class NameComposite extends GroupedComposite {
                \r
                setDraggableControl(nameViewer.getRulerControl());\r
                \r
-//             setData(taxonBase);\r
-\r
                createParser();\r
                createEmptyViewerPrompt(EMPTY_NAME_PROMPT);\r
                setFocus();\r
@@ -246,11 +243,7 @@ public abstract class NameComposite extends GroupedComposite {
                                ((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
@@ -272,15 +265,10 @@ public abstract class NameComposite extends GroupedComposite {
                                \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
@@ -329,55 +317,50 @@ public abstract class NameComposite extends GroupedComposite {
 \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
@@ -413,7 +396,6 @@ public abstract class NameComposite extends GroupedComposite {
        }\r
        \r
        public void setIcon(Image icon) {\r
-//             super.setIcon(icon);\r
                if (nameViewer != null) {\r
                        nameViewer.setIcon(icon);\r
                }\r