From c7d9465d85cf7fb0d8d2b7a3d8589d9a83cab334 Mon Sep 17 00:00:00 2001
From: Artem Zatsarynnyi <azatsarynnyy@codenvy.com>
Date: Thu, 13 Apr 2017 14:41:42 +0300
Subject: [PATCH] Restore active part in each part stack

Signed-off-by: Artem Zatsarynnyi <azatsarynnyy@codenvy.com>
---
 .../perspectives/general/AbstractPerspective.java      | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/workspace/perspectives/general/AbstractPerspective.java b/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/workspace/perspectives/general/AbstractPerspective.java
index 146d01c9069..a27a4514055 100644
--- a/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/workspace/perspectives/general/AbstractPerspective.java
+++ b/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/workspace/perspectives/general/AbstractPerspective.java
@@ -360,6 +360,7 @@ public void loadState(@NotNull JsonObject state) {
             }
         }
 
+        // restore perspective's active part
         if (state.hasKey("ACTIVE_PART")) {
             String activePart = state.getString("ACTIVE_PART");
             Provider<PartPresenter> provider = dynaProvider.getProvider(activePart);
@@ -387,6 +388,15 @@ private void restorePartController(PartStack partStack, WorkBenchPartController
             }
         }
 
+        // restore part stack's active part
+        if (partStackJSON.hasKey("ACTIVE_PART")) {
+            String activePart = partStackJSON.getString("ACTIVE_PART");
+            Provider<PartPresenter> provider = dynaProvider.getProvider(activePart);
+            if (provider != null) {
+                partStack.setActivePart(provider.get());
+            }
+        }
+
         //hide part stack if it has no parts
         if (partStack.getParts().isEmpty()) {
             controller.setHidden(true);