added a readme file
[taxeditor.git] / taxeditor-editor / src / main / java / eu / etaxonomy / taxeditor / editor / view / descriptive / DescriptiveViewPart.java
index 84e7ac6de2d6482fb19b19f1b6f5a56b875338d3..c5232c2afb836e55a4d9d9afc3dca53bf94b4068 100644 (file)
@@ -194,39 +194,44 @@ public class DescriptiveViewPart extends AbstractCdmEditorViewPart implements IP
        public boolean postOperation(CdmBase objectAffectedByOperation) {
                boolean result = super.postOperation(objectAffectedByOperation);
                
-               if(objectAffectedByOperation != null){
-                       
-                       if(objectAffectedByOperation instanceof DescriptionElementBase){
-                               DescriptionElementBase descriptionElement = (DescriptionElementBase) objectAffectedByOperation;
-                               FeatureNodeContainer container = getFeatureNodeContainerForDescriptionElement(descriptionElement);
-                               viewer.expandToLevel(container, 1);
-                       }
-                       
-                       StructuredSelection selection = new StructuredSelection(objectAffectedByOperation);
-                       viewer.setSelection(selection, true);
-               }
+//             if(objectAffectedByOperation != null){
+//                     
+//                     if(objectAffectedByOperation instanceof DescriptionElementBase){
+//                             DescriptionElementBase descriptionElement = (DescriptionElementBase) objectAffectedByOperation;
+//                             FeatureNodeContainer featureNodeContainerBranch = featureNodeContainerCache.get(descriptionElement.getInDescription());
+//                             FeatureNodeContainer featureNodeContainer = featureNodeContainerBranch.processDescriptionElement(descriptionElement);
+////                           viewer.refresh(featureNodeContainer, true);
+//                             viewer.expandToLevel(featureNodeContainer, 1);
+//                     }
+//                     
+//                     StructuredSelection selection = new StructuredSelection(objectAffectedByOperation);
+//                     viewer.setSelection(selection, true);
+//             }else{
+////                   viewer.refresh();
+//             }
 
                return result;
        }
-       
-       /**
-        * 
-        * @param descriptionElement
-        * @return
-        */
-       private FeatureNodeContainer getFeatureNodeContainerForDescriptionElement(
-                       DescriptionElementBase descriptionElement) {
-               FeatureNodeContainer featureNodeContainerBranch = featureNodeContainerCache.get(descriptionElement.getInDescription());         
-               FeatureNodeContainer featureNodeContainer = featureNodeContainerBranch.getFeatureNodeContainerForDescriptionElement(descriptionElement);
-               return featureNodeContainer;
-       }
 
        /** {@inheritDoc} */
        @Override
        public void changed(Object object) {
-//             viewer.refresh(true);
-//             viewer.update(object, null);
-               viewer.refresh(object, true);
+               if(object instanceof DescriptionElementBase){
+                       DescriptionElementBase descriptionElement = (DescriptionElementBase) object;
+                       FeatureNodeContainer featureNodeContainerBranch = featureNodeContainerCache.get(descriptionElement.getInDescription());
+                       FeatureNodeContainer featureNodeContainer = featureNodeContainerBranch.processDescriptionElement(descriptionElement);
+                       viewer.refresh(featureNodeContainer, true);
+                       viewer.expandToLevel(featureNodeContainer, 1);
+                       
+               }else{
+                       viewer.refresh(true);
+               }
+               
+               if(object != null){
+                       StructuredSelection selection = new StructuredSelection(object);
+                       viewer.setSelection(selection, true);
+               }
+
                super.changed(object);
        }