summaryrefslogtreecommitdiff
path: root/NET/worlds/scape/URLEditorDialog.java
blob: 904e3db2517f3c6e5fd6a3dac9b39d8806c71534 (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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
/*    */ package NET.worlds.scape;
/*    */ 
/*    */ import NET.worlds.console.Console;
/*    */ import NET.worlds.network.URL;
/*    */ import java.net.MalformedURLException;
/*    */ import java.util.Vector;
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ class URLEditorDialog
/*    */   extends FieldWithListEditorDialog
/*    */ {
/*    */   private static final long serialVersionUID = 1L;
/*    */   Property property;
/*    */   FileList extChecker;
/*    */   
/*    */   URLEditorDialog(EditTile parent, String title, Property property, Vector<String> files, FileList extChecker)
/*    */   {
/* 36 */     super(parent, title + " dir: " + URL.getBestContainer((SuperRoot)property.getOwner()), files);
/* 37 */     this.property = property;
/* 38 */     this.extChecker = extChecker;
/* 39 */     ready();
/*    */   }
/*    */   
/*    */   protected String getValue()
/*    */   {
/* 44 */     SuperRoot context = (SuperRoot)this.property.getOwner();
/*    */     
/*    */ 
/*    */ 
/* 48 */     if ((context != null) && (this.property.getName().equals("Source URL"))) {
/* 49 */       context = context.getOwner();
/*    */     }
/* 51 */     String s = URL.getRelativeTo((URL)this.property.get(), context);
/* 52 */     if (s == null)
/* 53 */       return "";
/* 54 */     return s;
/*    */   }
/*    */   
/*    */   protected boolean setValue(String text)
/*    */   {
/* 59 */     URL url = null;
/*    */     
/* 61 */     if (text.length() == 0) {
/* 62 */       if (!this.property.canSetNull())
/* 63 */         return false;
/*    */     } else {
/* 65 */       if ((this.extChecker != null) && (!this.extChecker.extMatches(text))) {
/* 66 */         Console.println(
/*    */         
/* 68 */           Console.message("extension-match") + this.extChecker.getExtList());
/* 69 */         return false;
/*    */       }
/*    */       try
/*    */       {
/* 73 */         url = new URL((SuperRoot)this.property.getOwner(), text);
/*    */       } catch (MalformedURLException e) {
/* 75 */         Console.println(Console.message("Illegal-URL") + e);
/* 76 */         return false;
/*    */       }
/*    */     }
/*    */     
/* 80 */     this.parent.addUndoableSet(this.property, url);
/* 81 */     return true;
/*    */   }
/*    */ }


/* Location:              C:\Program Files (x86)\Worlds Inc\WorldsPlayer - Win7\lib\worlds.jar!\NET\worlds\scape\URLEditorDialog.class
 * Java compiler version: 6 (50.0)
 * JD-Core Version:       0.7.1
 */