public void close(GuiControl gui)
        {
            EditorGui                      EditorGui                      = "EditorGui";
            GuiCanvas                      Canvas                         = "Canvas";
            GuiEditorGui                   GuiEditorGui                   = "GuiEditorGui";
            EWTreeWindow                   EWTreeWindow                   = "EWTreeWindow";
            TerrainPainter                 TerrainPainter                 = "TerrainPainter";
            GuiWindowCollapseCtrl          TerrainPainterPreview          = "TerrainPainterPreview";
            EWInspectorWindow              EWInspectorWindow              = "EWInspectorWindow";
            MaterialEditorPreviewWindow    MaterialEditorPreviewWindow    = "MaterialEditorPreviewWindow";
            MaterialEditorPropertiesWindow MaterialEditorPropertiesWindow = "MaterialEditorPropertiesWindow";
            DatablockEditorTreeWindow      DatablockEditorTreeWindow      = "DatablockEditorTreeWindow";
            DatablockEditorInspectorWindow DatablockEditorInspectorWindow = "DatablockEditorInspectorWindow";

            DecalEditorGui.DecalEditorWindow              DecalEditorWindow            = "DecalEditorWindow";
            DecalEditorGui.DecalPreviewWindow             DecalPreviewWindow           = "DecalPreviewWindow";
            ForestEditorGui.ForestEditorPalleteWindow     ForestEditorPalleteWindow    = "ForestEditorPalleteWindow";
            ForestEditorGui.ForestEditorPropertiesWindow  ForestEditorPropertiesWindow = "ForestEditorPropertiesWindow";
            MeshRoadEditorGui.MeshRoadEditorTreeWindow    MeshRoadEditorTreeWindow     = "MeshRoadEditorTreeWindow";
            MeshRoadEditorGui.MeshRoadEditorOptionsWindow MeshRoadEditorOptionsWindow  = "MeshRoadEditorOptionsWindow";
            GuiWindowCollapseCtrl MissionAreaEditorTerrainWindow    = "MissionAreaEditorTerrainWindow";
            GuiWindowCollapseCtrl MissionAreaEditorPropertiesWindow = "MissionAreaEditorPropertiesWindow";

            ParticleEditor.gui.ParticleEditor.PE_Window PE_Window                = "PE_Window";
            RiverEditorGui.RiverEditorTreeWindow        RiverEditorTreeWindow    = "RiverEditorTreeWindow";
            RiverEditorGui.RiverEditorOptionsWindow     RiverEditorOptionsWindow = "RiverEditorOptionsWindow";
            RoadEditorGui.RoadEditorTreeWindow          RoadEditorTreeWindow     = "RoadEditorTreeWindow";
            RoadEditorGui.RoadEditorOptionsWindow       RoadEditorOptionsWindow  = "RoadEditorOptionsWindow";
            ShapeEdAdvancedWindow ShapeEdAdvancedWindow = "ShapeEdAdvancedWindow";
            ShapeEdSelectWindow   ShapeEdSelectWindow   = "ShapeEdSelectWindow";
            ShapeEdPropWindow     ShapeEdPropWindow     = "ShapeEdPropWindow";
            MessageHud            MessageHud            = "MessageHud";

            EWTreeWindow["wasOpen"]                      = EWTreeWindow["isInPopup"];
            EWInspectorWindow["wasOpen"]                 = EWInspectorWindow["isInPopup"];
            TerrainPainter["wasOpen"]                    = TerrainPainter["isInPopup"];
            TerrainPainterPreview["wasOpen"]             = TerrainPainterPreview["isInPopup"];
            MaterialEditorPreviewWindow["wasOpen"]       = MaterialEditorPreviewWindow["isInPopup"];
            MaterialEditorPropertiesWindow["wasOpen"]    = MaterialEditorPropertiesWindow["isInPopup"];
            DatablockEditorTreeWindow["wasOpen"]         = DatablockEditorTreeWindow["isInPopup"];
            DatablockEditorInspectorWindow["wasOpen"]    = DatablockEditorInspectorWindow["isInPopup"];
            DecalEditorWindow["wasOpen"]                 = DecalEditorWindow["isInPopup"];
            DecalPreviewWindow["wasOpen"]                = DecalPreviewWindow["isInPopup"];
            ForestEditorPalleteWindow["wasOpen"]         = ForestEditorPalleteWindow["isInPopup"];
            ForestEditorPropertiesWindow["wasOpen"]      = ForestEditorPropertiesWindow["isInPopup"];
            MeshRoadEditorTreeWindow["wasOpen"]          = MeshRoadEditorTreeWindow["isInPopup"];
            MeshRoadEditorOptionsWindow["wasOpen"]       = MeshRoadEditorOptionsWindow["isInPopup"];
            MissionAreaEditorTerrainWindow["wasOpen"]    = MissionAreaEditorTerrainWindow["isInPopup"];
            MissionAreaEditorPropertiesWindow["wasOpen"] = MissionAreaEditorPropertiesWindow["isInPopup"];
            PE_Window["wasOpen"]                = PE_Window["isInPopup"];
            RiverEditorTreeWindow["wasOpen"]    = RiverEditorTreeWindow["isInPopup"];
            RiverEditorOptionsWindow["wasOpen"] = RiverEditorOptionsWindow["isInPopup"];
            RoadEditorTreeWindow["wasOpen"]     = RoadEditorTreeWindow["isInPopup"];
            RoadEditorOptionsWindow["wasOpen"]  = RoadEditorOptionsWindow["isInPopup"];
            ShapeEdAdvancedWindow["wasOpen"]    = ShapeEdAdvancedWindow["isInPopup"];
            ShapeEdSelectWindow["wasOpen"]      = ShapeEdSelectWindow["isInPopup"];
            ShapeEdPropWindow["wasOpen"]        = ShapeEdPropWindow["isInPopup"];

            EWTreeWindow.ClosePopOut();
            EWInspectorWindow.ClosePopOut();
            TerrainPainter.ClosePopOut();
            TerrainPainterPreview.ClosePopOut();
            MaterialEditorPreviewWindow.ClosePopOut();
            MaterialEditorPropertiesWindow.ClosePopOut();
            DatablockEditorTreeWindow.ClosePopOut();
            DatablockEditorInspectorWindow.ClosePopOut();
            DecalEditorWindow.ClosePopOut();
            DecalPreviewWindow.ClosePopOut();
            ForestEditorPalleteWindow.ClosePopOut();
            ForestEditorPropertiesWindow.ClosePopOut();
            MeshRoadEditorTreeWindow.ClosePopOut();
            MeshRoadEditorOptionsWindow.ClosePopOut();
            MissionAreaEditorTerrainWindow.ClosePopOut();
            MissionAreaEditorPropertiesWindow.ClosePopOut();
            PE_Window.ClosePopOut();
            RiverEditorTreeWindow.ClosePopOut();
            RiverEditorOptionsWindow.ClosePopOut();
            RoadEditorTreeWindow.ClosePopOut();
            RoadEditorOptionsWindow.ClosePopOut();
            ShapeEdAdvancedWindow.ClosePopOut();
            ShapeEdSelectWindow.ClosePopOut();
            ShapeEdPropWindow.ClosePopOut();

            this.editorDisabled();
            Canvas.setContent(gui);
            if (MessageHud.isObject())
            {
                MessageHud.close();
            }
            EditorGui.writeCameraSettings();

            Util._schedule("1000", "0", "checkCursor");
            checkCursor();
        }
        public void open()
        {
            EditorGui                      EditorGui                      = "EditorGui";
            GuiCanvas                      Canvas                         = "Canvas";
            GuiEditorGui                   GuiEditorGui                   = "GuiEditorGui";
            EWTreeWindow                   EWTreeWindow                   = "EWTreeWindow";
            TerrainPainter                 TerrainPainter                 = "TerrainPainter";
            GuiWindowCollapseCtrl          TerrainPainterPreview          = "TerrainPainterPreview";
            EWInspectorWindow              EWInspectorWindow              = "EWInspectorWindow";
            MaterialEditorPreviewWindow    MaterialEditorPreviewWindow    = "MaterialEditorPreviewWindow";
            MaterialEditorPropertiesWindow MaterialEditorPropertiesWindow = "MaterialEditorPropertiesWindow";
            DatablockEditorTreeWindow      DatablockEditorTreeWindow      = "DatablockEditorTreeWindow";
            DatablockEditorInspectorWindow DatablockEditorInspectorWindow = "DatablockEditorInspectorWindow";

            DecalEditorGui.DecalEditorWindow              DecalEditorWindow            = "DecalEditorWindow";
            DecalEditorGui.DecalPreviewWindow             DecalPreviewWindow           = "DecalPreviewWindow";
            ForestEditorGui.ForestEditorPalleteWindow     ForestEditorPalleteWindow    = "ForestEditorPalleteWindow";
            ForestEditorGui.ForestEditorPropertiesWindow  ForestEditorPropertiesWindow = "ForestEditorPropertiesWindow";
            MeshRoadEditorGui.MeshRoadEditorTreeWindow    MeshRoadEditorTreeWindow     = "MeshRoadEditorTreeWindow";
            MeshRoadEditorGui.MeshRoadEditorOptionsWindow MeshRoadEditorOptionsWindow  = "MeshRoadEditorOptionsWindow";
            GuiWindowCollapseCtrl MissionAreaEditorTerrainWindow    = "MissionAreaEditorTerrainWindow";
            GuiWindowCollapseCtrl MissionAreaEditorPropertiesWindow = "MissionAreaEditorPropertiesWindow";

            ParticleEditor.gui.ParticleEditor.PE_Window PE_Window                = "PE_Window";
            RiverEditorGui.RiverEditorTreeWindow        RiverEditorTreeWindow    = "RiverEditorTreeWindow";
            RiverEditorGui.RiverEditorOptionsWindow     RiverEditorOptionsWindow = "RiverEditorOptionsWindow";
            RoadEditorGui.RoadEditorTreeWindow          RoadEditorTreeWindow     = "RoadEditorTreeWindow";
            RoadEditorGui.RoadEditorOptionsWindow       RoadEditorOptionsWindow  = "RoadEditorOptionsWindow";
            ShapeEdAdvancedWindow ShapeEdAdvancedWindow = "ShapeEdAdvancedWindow";
            ShapeEdSelectWindow   ShapeEdSelectWindow   = "ShapeEdSelectWindow";
            ShapeEdPropWindow     ShapeEdPropWindow     = "ShapeEdPropWindow";

            // prevent the mission editor from opening while the GuiEditor is open.
            if (Canvas.getContent() == GuiEditorGui.getId())
            {
                return;
            }

            if (!EditorGui.isInitialized)
            {
                EditorGui.init();
            }

            this.editorEnabled();
            Canvas.setContent(EditorGui);
            EditorGui.syncCameraGui();

            if (EWTreeWindow["wasOpen"].AsBool())
            {
                EWTreeWindow.OpenPopOut();
            }

            if (EWInspectorWindow["wasOpen"].AsBool())
            {
                EWInspectorWindow.OpenPopOut();
            }

            if (TerrainPainter["wasOpen"].AsBool())
            {
                TerrainPainter.OpenPopOut();
            }

            if (TerrainPainterPreview["wasOpen"].AsBool())
            {
                TerrainPainterPreview.OpenPopOut();
            }

            if (MaterialEditorPreviewWindow["wasOpen"].AsBool())
            {
                MaterialEditorPreviewWindow.OpenPopOut();
            }

            if (MaterialEditorPropertiesWindow["wasOpen"].AsBool())
            {
                MaterialEditorPropertiesWindow.OpenPopOut();
            }

            if (DatablockEditorTreeWindow["wasOpen"].AsBool())
            {
                DatablockEditorTreeWindow.OpenPopOut();
            }

            if (DatablockEditorInspectorWindow["wasOpen"].AsBool())
            {
                DatablockEditorInspectorWindow.OpenPopOut();
            }

            if (DecalEditorWindow["wasOpen"].AsBool())
            {
                DecalEditorWindow.OpenPopOut();
            }

            if (DecalPreviewWindow["wasOpen"].AsBool())
            {
                DecalPreviewWindow.OpenPopOut();
            }

            if (ForestEditorPalleteWindow["wasOpen"].AsBool())
            {
                ForestEditorPalleteWindow.OpenPopOut();
            }

            if (ForestEditorPropertiesWindow["wasOpen"].AsBool())
            {
                ForestEditorPropertiesWindow.OpenPopOut();
            }

            if (MeshRoadEditorTreeWindow["wasOpen"].AsBool())
            {
                MeshRoadEditorTreeWindow.OpenPopOut();
            }

            if (MeshRoadEditorOptionsWindow["wasOpen"].AsBool())
            {
                MeshRoadEditorOptionsWindow.OpenPopOut();
            }

            if (MissionAreaEditorTerrainWindow["wasOpen"].AsBool())
            {
                MissionAreaEditorTerrainWindow.OpenPopOut();
            }

            if (MissionAreaEditorPropertiesWindow["wasOpen"].AsBool())
            {
                MissionAreaEditorPropertiesWindow.OpenPopOut();
            }

            if (PE_Window["wasOpen"].AsBool())
            {
                PE_Window.OpenPopOut();
            }

            if (RiverEditorTreeWindow["wasOpen"].AsBool())
            {
                RiverEditorTreeWindow.OpenPopOut();
            }

            if (RiverEditorOptionsWindow["wasOpen"].AsBool())
            {
                RiverEditorOptionsWindow.OpenPopOut();
            }

            if (RoadEditorTreeWindow["wasOpen"].AsBool())
            {
                RoadEditorTreeWindow.OpenPopOut();
            }

            if (RoadEditorOptionsWindow["wasOpen"].AsBool())
            {
                RoadEditorOptionsWindow.OpenPopOut();
            }

            if (ShapeEdAdvancedWindow["wasOpen"].AsBool())
            {
                ShapeEdAdvancedWindow.OpenPopOut();
            }

            if (ShapeEdSelectWindow["wasOpen"].AsBool())
            {
                ShapeEdSelectWindow.OpenPopOut();
            }

            if (ShapeEdPropWindow["wasOpen"].AsBool())
            {
                ShapeEdPropWindow.OpenPopOut();
            }
        }