performed javacscript:fix and worked on documentation
[taxeditor.git] / taxeditor-editor / src / main / java / eu / etaxonomy / taxeditor / editor / view / descriptive / handler / AddDescriptionHandler.java
index 1ab22c0b4518541bde91c47dbc56a9f2342dedac..3358712360d168659d985c5d05deb7fd9732eae4 100644 (file)
@@ -1,66 +1,69 @@
-// $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.editor.view.descriptive.handler;\r
-import org.apache.log4j.Logger;\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.core.commands.common.NotDefinedException;\r
-import org.eclipse.ui.IEditorInput;\r
-import org.eclipse.ui.IEditorPart;\r
-import org.eclipse.ui.IWorkbenchPart;\r
-import org.eclipse.ui.forms.editor.FormEditor;\r
-import org.eclipse.ui.handlers.HandlerUtil;\r
-\r
-import eu.etaxonomy.cdm.model.taxon.Taxon;\r
-import eu.etaxonomy.taxeditor.editor.EditorUtil;\r
-import eu.etaxonomy.taxeditor.editor.TaxonEditorInput;\r
-import eu.etaxonomy.taxeditor.operations.AbstractPostOperation;\r
-import eu.etaxonomy.taxeditor.operations.CreateTaxonDescriptionOperation;\r
-import eu.etaxonomy.taxeditor.operations.IPostOperationEnabled;\r
-\r
-/**\r
- * @author p.ciardelli\r
- * @created 11.08.2009\r
- * @version 1.0\r
- */\r
-public class AddDescriptionHandler extends AbstractHandler {\r
-       private static final Logger logger = Logger\r
-                       .getLogger(CreateDescriptionElementHandler.class);\r
-\r
-       /* (non-Javadoc)\r
-        * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)\r
-        */\r
-       public Object execute(ExecutionEvent event) throws ExecutionException {\r
-               IWorkbenchPart part = HandlerUtil.getActivePart(event);\r
-               IPostOperationEnabled postOperationEnabled = (part instanceof IPostOperationEnabled) ? (IPostOperationEnabled) part : null;\r
-               \r
-               \r
-               IEditorPart editor = HandlerUtil.getActiveEditor(event);\r
-               if (editor instanceof FormEditor) {\r
-                       editor = ((FormEditor) editor).getActiveEditor();\r
-               }\r
-               IEditorInput input = editor.getEditorInput();\r
-               if (input instanceof TaxonEditorInput) {\r
-                       Taxon taxon = ((TaxonEditorInput) input).getTaxon();    \r
-                       AbstractPostOperation operation;\r
-                       try {\r
-                               // TODO use undo context specific to editor\r
-                               operation = new CreateTaxonDescriptionOperation(event.getCommand().getName(), \r
-                                               EditorUtil.getUndoContext(), taxon, postOperationEnabled);\r
-                               EditorUtil.executeOperation(operation);\r
-                       } catch (NotDefinedException e) {\r
-                               logger.warn("Command name not set");\r
-                       }\r
-               } \r
-               return null;\r
-       }\r
-\r
-}\r
+// $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.editor.view.descriptive.handler;
+import org.apache.log4j.Logger;
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.commands.common.NotDefinedException;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.forms.editor.FormEditor;
+import org.eclipse.ui.handlers.HandlerUtil;
+
+import eu.etaxonomy.cdm.model.taxon.Taxon;
+import eu.etaxonomy.taxeditor.editor.EditorUtil;
+import eu.etaxonomy.taxeditor.editor.TaxonEditorInput;
+import eu.etaxonomy.taxeditor.operations.AbstractPostOperation;
+import eu.etaxonomy.taxeditor.operations.CreateTaxonDescriptionOperation;
+import eu.etaxonomy.taxeditor.operations.IPostOperationEnabled;
+
+/**
+ * <p>AddDescriptionHandler class.</p>
+ *
+ * @author p.ciardelli
+ * @created 11.08.2009
+ * @version 1.0
+ */
+public class AddDescriptionHandler extends AbstractHandler {
+       private static final Logger logger = Logger
+                       .getLogger(CreateDescriptionElementHandler.class);
+
+       /* (non-Javadoc)
+        * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
+        */
+       /** {@inheritDoc} */
+       public Object execute(ExecutionEvent event) throws ExecutionException {
+               IWorkbenchPart part = HandlerUtil.getActivePart(event);
+               IPostOperationEnabled postOperationEnabled = (part instanceof IPostOperationEnabled) ? (IPostOperationEnabled) part : null;
+               
+               
+               IEditorPart editor = HandlerUtil.getActiveEditor(event);
+               if (editor instanceof FormEditor) {
+                       editor = ((FormEditor) editor).getActiveEditor();
+               }
+               IEditorInput input = editor.getEditorInput();
+               if (input instanceof TaxonEditorInput) {
+                       Taxon taxon = ((TaxonEditorInput) input).getTaxon();    
+                       AbstractPostOperation operation;
+                       try {
+                               // TODO use undo context specific to editor
+                               operation = new CreateTaxonDescriptionOperation(event.getCommand().getName(), 
+                                               EditorUtil.getUndoContext(), taxon, postOperationEnabled);
+                               EditorUtil.executeOperation(operation);
+                       } catch (NotDefinedException e) {
+                               logger.warn("Command name not set");
+                       }
+               } 
+               return null;
+       }
+
+}