From f62a385eabb02ba7e0c3ac33d5b2d5521367686b Mon Sep 17 00:00:00 2001 From: 7u83 <7u83@mail.ru> Date: Sun, 9 Dec 2018 18:43:29 +0100 Subject: [PATCH] List of asset types works again --- nbproject/project.properties | 2 +- .../gui/AssetEditor/SelectAssetTypeDialog.java | 5 +---- src/opensesim/gui/Globals.java | 16 ++-------------- src/opensesim/world/GodWorld.java | 2 +- 4 files changed, 5 insertions(+), 20 deletions(-) diff --git a/nbproject/project.properties b/nbproject/project.properties index c5be1ab..cbacd51 100644 --- a/nbproject/project.properties +++ b/nbproject/project.properties @@ -1,4 +1,4 @@ -#Sun, 09 Dec 2018 01:51:19 +0100 +#Sun, 09 Dec 2018 18:41:43 +0100 annotation.processing.enabled=true annotation.processing.enabled.in.editor=false annotation.processing.processors.list= diff --git a/src/opensesim/gui/AssetEditor/SelectAssetTypeDialog.java b/src/opensesim/gui/AssetEditor/SelectAssetTypeDialog.java index a677104..ee7590a 100644 --- a/src/opensesim/gui/AssetEditor/SelectAssetTypeDialog.java +++ b/src/opensesim/gui/AssetEditor/SelectAssetTypeDialog.java @@ -59,7 +59,7 @@ public class SelectAssetTypeDialog extends EscDialog { } ComboBoxModel getComboBoxModel() { - ArrayList vector = new ArrayList(); + ArrayList vector = new ArrayList(asset_types.size()+1); int i; for (i = 0; i < asset_types.size(); i++) { AbstractAsset ait; @@ -67,9 +67,6 @@ public class SelectAssetTypeDialog extends EscDialog { System.out.printf("ACL: %s\n", asset_type.getName()); String tn = GodWorld.getTypeName(asset_type); - if (tn == null) { - continue; - } vector.add(i, tn); } diff --git a/src/opensesim/gui/Globals.java b/src/opensesim/gui/Globals.java index e05f87e..ebd71d1 100644 --- a/src/opensesim/gui/Globals.java +++ b/src/opensesim/gui/Globals.java @@ -232,21 +232,9 @@ public class Globals { asset_types.sort(new Comparator>() { @Override public int compare(Class o1, Class o2) { - AbstractAsset a1, a2; - - try { - // a1 = o1.newInstance(); - a1 = o1.getConstructor(RealWorld.class,JSONObject.class).newInstance(null,null); - a2 = o2.getConstructor(RealWorld.class,JSONObject.class).newInstance(null,null); - } catch (InstantiationException | IllegalAccessException | NoSuchMethodException | SecurityException | IllegalArgumentException | InvocationTargetException ex) { - Logger.getLogger(AssetEditorPanel.class.getName()).log(Level.SEVERE, null, ex); - return 0; - } - String t1, t2; - t1 = a1.getTypeName(); - t2 = a2.getTypeName(); - + t1 = GodWorld.getTypeName(o1); + t2 = GodWorld.getTypeName(o2); return t1.compareToIgnoreCase(t2); } diff --git a/src/opensesim/world/GodWorld.java b/src/opensesim/world/GodWorld.java index eefd35f..f47491e 100644 --- a/src/opensesim/world/GodWorld.java +++ b/src/opensesim/world/GodWorld.java @@ -298,7 +298,7 @@ public class GodWorld implements GetJson, World { return ait.getTypeName(); } catch (NoSuchMethodException | SecurityException | InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException ex) { Logger.getLogger(GodWorld.class.getName()).log(Level.SEVERE, null, ex); - return null; + return asset_type.getName(); } }