Search in sources :

Example 16 with PartPresenter

use of org.eclipse.che.ide.api.parts.PartPresenter in project che by eclipse.

the class AbstractPerspective method loadState.

@Override
public void loadState(@NotNull JsonObject state) {
    if (state.hasKey("PART_STACKS")) {
        JsonObject part_stacks = state.getObject("PART_STACKS");
        for (String partStackType : part_stacks.keys()) {
            JsonObject partStack = part_stacks.getObject(partStackType);
            switch(PartStackType.valueOf(partStackType)) {
                case INFORMATION:
                    restorePartController(partStacks.get(INFORMATION), belowPartController, partStack);
                    break;
                case NAVIGATION:
                    restorePartController(partStacks.get(NAVIGATION), leftPartController, partStack);
                    break;
                case TOOLING:
                    restorePartController(partStacks.get(TOOLING), rightPartController, partStack);
                    break;
            }
        }
    }
    if (state.hasKey("ACTIVE_PART")) {
        String activePart = state.getString("ACTIVE_PART");
        Provider<PartPresenter> provider = dynaProvider.getProvider(activePart);
        if (provider != null) {
            setActivePart(provider.get());
        }
    }
}
Also used : JsonObject(elemental.json.JsonObject) PartPresenter(org.eclipse.che.ide.api.parts.PartPresenter)

Aggregations

PartPresenter (org.eclipse.che.ide.api.parts.PartPresenter)16 EditorPartPresenter (org.eclipse.che.ide.api.editor.EditorPartPresenter)9 JsonObject (elemental.json.JsonObject)6 JsonArray (elemental.json.JsonArray)4 PropertyListener (org.eclipse.che.ide.api.parts.PropertyListener)4 EditorPartStack (org.eclipse.che.ide.api.parts.EditorPartStack)3 FileType (org.eclipse.che.ide.api.filetypes.FileType)2 EditorTab (org.eclipse.che.ide.api.parts.EditorTab)2 Path (org.eclipse.che.ide.resource.Path)2 Test (org.junit.Test)2 ArrayList (java.util.ArrayList)1 List (java.util.List)1 OperationException (org.eclipse.che.api.promises.client.OperationException)1 HasDataObject (org.eclipse.che.ide.api.data.HasDataObject)1 AbstractEditorPresenter (org.eclipse.che.ide.api.editor.AbstractEditorPresenter)1 AsyncEditorProvider (org.eclipse.che.ide.api.editor.AsyncEditorProvider)1 EditorOpenedEvent (org.eclipse.che.ide.api.editor.EditorOpenedEvent)1 EditorProvider (org.eclipse.che.ide.api.editor.EditorProvider)1 EditorWithErrors (org.eclipse.che.ide.api.editor.EditorWithErrors)1 EditorState (org.eclipse.che.ide.api.editor.EditorWithErrors.EditorState)1