From fe7af043b758a8a5dd538e272319838a7cd1c11c Mon Sep 17 00:00:00 2001 From: 7u83 <7u83@mail.ru> Date: Mon, 10 Dec 2018 12:37:45 +0100 Subject: [PATCH] Uses GodWorld.getTypeName to get name of asset --- .../gui/AssetEditor/AssetEditorPanel.java | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/opensesim/gui/AssetEditor/AssetEditorPanel.java b/src/opensesim/gui/AssetEditor/AssetEditorPanel.java index 6059952..24b92f3 100644 --- a/src/opensesim/gui/AssetEditor/AssetEditorPanel.java +++ b/src/opensesim/gui/AssetEditor/AssetEditorPanel.java @@ -42,6 +42,7 @@ import opensesim.gui.util.Json.Import; import opensesim.util.SeSimException; import opensesim.world.GodWorld; import opensesim.world.RealWorld; +import opensesim.world.World; import org.json.JSONObject; @@ -97,12 +98,15 @@ public class AssetEditorPanel extends javax.swing.JPanel { AbstractAsset ait; Class asset_type = asset_types.get(i); - try { - ait = asset_type.newInstance(); - vector.add(i, ait.getTypeName()); - } catch (InstantiationException | IllegalAccessException | ClassCastException ex) { - Logger.getLogger(AssetEditorPanel.class.getName()).log(Level.SEVERE, null, ex); - } +// try { +// ait = asset_type.newInstance(); + // vector.add(i, ait.getTypeName()); + + vector.add(i,GodWorld.getTypeName(asset_type)); + + // } catch (InstantiationException | IllegalAccessException | ClassCastException ex) { + // Logger.getLogger(AssetEditorPanel.class.getName()).log(Level.SEVERE, null, ex); + // } } return new DefaultComboBoxModel(vector.toArray()); } @@ -250,7 +254,7 @@ public class AssetEditorPanel extends javax.swing.JPanel { AbstractAsset a; try { - a = ac.getConstructor(RealWorld.class, JSONObject.class).newInstance(null, null); + a = ac.getConstructor(GodWorld.class, JSONObject.class).newInstance(null, null); } catch (NoSuchMethodException | SecurityException | InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException ex) { Logger.getLogger(AssetEditorPanel.class.getName()).log(Level.SEVERE, null, ex); return;