public void deleteMat() { SimSet TerrainMaterialSet = "TerrainMaterialSet"; SimGroup TerrainMaterialDlgDeleteGroup = "TerrainMaterialDlgDeleteGroup"; TerrainEditor ETerrainEditor = "ETerrainEditor"; if (!this["activeMat"].isObject()) { return; } // Cannot delete this material if it is the only one left on the Terrain if ((ETerrainEditor.getMaterialCount() == 1) && ETerrainEditor.getMaterialIndex(((SimObject)this["activeMat"]).internalName) != -1) { messageBox.MessageBoxOK("Error", "Cannot delete this Material, it is the only Material still in use by the active Terrain."); return; } TerrainMaterialSet.remove(this["activeMat"]); TerrainMaterialDlgDeleteGroup.add(this["activeMat"]); GuiTreeViewCtrl matLibTree = this.findObjectByInternalName("matLibTree", true); buildTree(); //matLibTree.open("TerrainMaterialSet", false); //matLibTree.selectItem(1); }