summaryrefslogtreecommitdiff
path: root/NET/worlds/scape/PropPropEditorDialog.java
blob: 4852b5a8273470a7ed20ff3a45c65a49686a25f0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
package NET.worlds.scape;

class PropPropEditorDialog extends ListChooserDialog {
   private SuperRoot _target;
   private Property _property;
   private boolean _nullHandling;

   PropPropEditorDialog(EditTile parent, String title, Property property, SuperRoot target, boolean nullHandling) {
      super(parent, title);
      this._target = target;
      this._property = property;
      this._nullHandling = nullHandling;
      this.ready();
   }

   @Override
   protected String getEntry(int index) {
      Property p = null;

      try {
         p = (Property)this._target.properties(index, 0, 0, null);
      } catch (NoSuchPropertyException var4) {
      }

      return p == null ? null : p.getName();
   }

   @Override
   protected int getSelected() {
      if (this._property == null) {
         return -1;
      } else {
         Property val = (Property)this._property.get();
         return val == null ? -1 : val.getIndex();
      }
   }

   @Override
   protected boolean setValue(String text, int index) {
      if (index == -1 && !this._nullHandling) {
         return false;
      } else {
         Object val = null;

         try {
            val = this._target.properties(index, 0, 0, null);
         } catch (NoSuchPropertyException var5) {
            assert false;
         }

         this._parent.addUndoableSet(this._property, val);
         return true;
      }
   }
}