Salome HOME
Fix of document popup menu refreshing after document import, delete and version....
[tools/siman.git] / Workspace / Siman / src / org / splat / simer / VersionDocumentAction.java
index 90fe6d9ccdb7fd71f72be758c2e1720f9ef0299c..5c41b269c4e91e2b1ad41ddc5657573e76a8f276 100644 (file)
@@ -79,7 +79,7 @@ public class VersionDocumentAction extends BaseUploadDocumentAction {
                                setupDefaultUses(_deftype);
                        }
                        // Add additional documents used by the current version
-                       for (Relation usesRel: doc.getRelations(UsesRelation.class)) {
+                       for (Relation usesRel : doc.getRelations(UsesRelation.class)) {
                                Document used = (Document) usesRel.getTo();
                                if (!_defuses.contains(used)) {
                                        _defuses.add(used);
@@ -93,19 +93,20 @@ public class VersionDocumentAction extends BaseUploadDocumentAction {
                        _usedby.addAll(tag.getRelations(UsedByRelation.class));
 
                        // Initialize applicable states list
-                       if(tag.value().getProgressState() == ProgressState.EXTERN) {
+                       if (tag.value().getProgressState() == ProgressState.EXTERN) {
                                _documentStates.add(ProgressState.EXTERN);
                        } else {
-                       _documentStates.add(ProgressState.inWORK);
-                       if (_deftype != null) {
-                               // Check if the validation cycle of the document type can has a review state
-                               ValidationCycle cycle = getStudyService().getValidationCycleOf(
-                                               _mystudy.getMystudy(), _deftype);
-                               if ((cycle != null) && cycle.enables(ValidationStep.REVIEW)) {
-                                       _documentStates.add(ProgressState.inDRAFT);
+                               _documentStates.add(ProgressState.inWORK);
+                               if (_deftype != null) {
+                                       // Check if the validation cycle of the document type can has a review state
+                                       ValidationCycle cycle = getStudyService()
+                                                       .getValidationCycleOf(_mystudy.getMystudy(),
+                                                                       _deftype);
+                                       if ((cycle != null) && cycle.enables(ValidationStep.REVIEW)) {
+                                               _documentStates.add(ProgressState.inDRAFT);
+                                       }
                                }
                        }
-                       }
                } else {
                        if (!(Constants.NONE.equals(getToolProperty()))) {
                                initializationFullScreenContext(Constants.STUDY_MENU,
@@ -203,8 +204,7 @@ public class VersionDocumentAction extends BaseUploadDocumentAction {
                                                _state, aDate, listDocuses, _docusedby);
 
                                // Update of the open study
-                               _mystudy.setSelection(_mystudy.getSelection()); // Rebuilds the presentation
-                               // TODO: Look is an optimization is possible (for example by updating the presentation of versioned document)
+                               refreshStudy();
 
                                res = SUCCESS;
                        } catch (FileNotFoundException error) {