performed javacscript:fix and worked on documentation
[taxeditor.git] / taxeditor-bulkeditor / src / main / java / eu / etaxonomy / taxeditor / bulkeditor / handler / SetMergeCandidateHandler.java
index d739d0b28a9d861a7640617925333b9d50b03108..f85f358eda33b637b93f28bddee16cf246ec879c 100644 (file)
@@ -1,57 +1,60 @@
-// $Id$\r
-/**\r
-* Copyright (C) 2007 EDIT\r
-* European Distributed Institute of Taxonomy \r
-* http://www.e-taxonomy.eu\r
-* \r
-* The contents of this file are subject to the Mozilla Public License Version 1.1\r
-* See LICENSE.TXT at the top of this package for the full license terms.\r
-*/\r
-package eu.etaxonomy.taxeditor.bulkeditor.handler;\r
-\r
-import java.util.Iterator;\r
-\r
-import org.eclipse.core.commands.AbstractHandler;\r
-import org.eclipse.core.commands.ExecutionEvent;\r
-import org.eclipse.core.commands.ExecutionException;\r
-import org.eclipse.jface.text.TextSelection;\r
-import org.eclipse.ui.handlers.HandlerUtil;\r
-\r
-import eu.etaxonomy.taxeditor.annotatedlineeditor.LineAnnotation;\r
-import eu.etaxonomy.taxeditor.annotatedlineeditor.LineAnnotationModel;\r
-import eu.etaxonomy.taxeditor.bulkeditor.BulkEditor;\r
-import eu.etaxonomy.taxeditor.bulkeditor.IBulkEditorConstants;\r
-import eu.etaxonomy.taxeditor.model.LineSelection;\r
-\r
-/**\r
- * @author p.ciardelli\r
- * @created 25.06.2009\r
- * @version 1.0\r
- */\r
-public class SetMergeCandidateHandler extends AbstractHandler {\r
-\r
-       /* (non-Javadoc)\r
-        * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)\r
-        */\r
-       public Object execute(ExecutionEvent event) throws ExecutionException {\r
-                               \r
-               if (HandlerUtil.getCurrentSelection(event) instanceof TextSelection \r
-                               && HandlerUtil.getActiveEditor(event) instanceof BulkEditor) {\r
-                       TextSelection selection = (TextSelection) HandlerUtil.getCurrentSelection(event);\r
-                       BulkEditor editor = (BulkEditor) HandlerUtil.getActiveEditor(event);\r
-                       \r
-                       LineAnnotationModel model = (LineAnnotationModel) editor.getDocumentProvider().getAnnotationModel(editor.getEditorInput());\r
-                       if (model != null) {\r
-                               Iterator iter = model.getAnnotationIterator(selection.getOffset(), selection.getLength(), true, true);\r
-                               while (iter.hasNext()) {\r
-                                       Object next = iter.next();\r
-                                       if (next instanceof LineAnnotation) {\r
-                                               model.changeAnnotationType(\r
-                                                               (LineAnnotation) next, IBulkEditorConstants.TYPE_MERGE_CANDIDATE);\r
-                                       }\r
-                               }\r
-                       }\r
-               }       \r
-               return null;\r
-       }\r
-}
\ No newline at end of file
+// $Id$
+/**
+* Copyright (C) 2007 EDIT
+* European Distributed Institute of Taxonomy 
+* http://www.e-taxonomy.eu
+* 
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+package eu.etaxonomy.taxeditor.bulkeditor.handler;
+
+import java.util.Iterator;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.jface.text.TextSelection;
+import org.eclipse.ui.handlers.HandlerUtil;
+
+import eu.etaxonomy.taxeditor.annotatedlineeditor.LineAnnotation;
+import eu.etaxonomy.taxeditor.annotatedlineeditor.LineAnnotationModel;
+import eu.etaxonomy.taxeditor.bulkeditor.BulkEditor;
+import eu.etaxonomy.taxeditor.bulkeditor.IBulkEditorConstants;
+import eu.etaxonomy.taxeditor.model.LineSelection;
+
+/**
+ * <p>SetMergeCandidateHandler class.</p>
+ *
+ * @author p.ciardelli
+ * @created 25.06.2009
+ * @version 1.0
+ */
+public class SetMergeCandidateHandler extends AbstractHandler {
+
+       /* (non-Javadoc)
+        * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
+        */
+       /** {@inheritDoc} */
+       public Object execute(ExecutionEvent event) throws ExecutionException {
+                               
+               if (HandlerUtil.getCurrentSelection(event) instanceof TextSelection 
+                               && HandlerUtil.getActiveEditor(event) instanceof BulkEditor) {
+                       TextSelection selection = (TextSelection) HandlerUtil.getCurrentSelection(event);
+                       BulkEditor editor = (BulkEditor) HandlerUtil.getActiveEditor(event);
+                       
+                       LineAnnotationModel model = (LineAnnotationModel) editor.getDocumentProvider().getAnnotationModel(editor.getEditorInput());
+                       if (model != null) {
+                               Iterator iter = model.getAnnotationIterator(selection.getOffset(), selection.getLength(), true, true);
+                               while (iter.hasNext()) {
+                                       Object next = iter.next();
+                                       if (next instanceof LineAnnotation) {
+                                               model.changeAnnotationType(
+                                                               (LineAnnotation) next, IBulkEditorConstants.TYPE_MERGE_CANDIDATE);
+                                       }
+                               }
+                       }
+               }       
+               return null;
+       }
+}