1 19 20 21 package org.netbeans.modules.i18n.java; 22 23 24 import java.util.HashMap ; 25 import java.util.Map ; 26 27 import org.netbeans.modules.i18n.I18nString; 28 import org.netbeans.modules.i18n.I18nSupport; 29 30 import org.openide.util.MapFormat; 31 32 33 39 public class JavaI18nString extends I18nString { 40 41 45 protected String [] arguments; 46 47 48 public JavaI18nString(I18nSupport i18nSupport) { 49 super(i18nSupport); 50 } 51 52 55 protected JavaI18nString(JavaI18nString copy) { 56 super(copy); 57 if (arguments == null) return; 58 this.arguments = (String []) copy.arguments.clone(); 59 } 60 61 public void become(JavaI18nString i18nString) { 62 super.become(i18nString); 63 64 JavaI18nString peer = (JavaI18nString) i18nString; 65 this.setArguments(peer.arguments); 66 } 67 68 public Object clone() { 69 return new JavaI18nString(this); 70 } 71 72 75 public String [] getArguments() { 76 if(arguments == null) 77 arguments = new String [0]; 78 return arguments; 79 } 80 81 84 public void setArguments(String [] arguments) { 85 String [] oldArguments = arguments; 86 this.arguments = arguments; 87 } 88 89 92 protected void fillFormatMap(Map map) { 93 map.put("identifier", ((JavaI18nSupport)getSupport()).getIdentifier()); 95 String [] arguments = getArguments(); 97 StringBuffer stringBuffer = new StringBuffer (); 98 stringBuffer.append("new Object[] {"); 100 for(int i=0; i<arguments.length; i++) { 101 stringBuffer.append(arguments[i]); 102 103 if(i<arguments.length - 1) 104 stringBuffer.append(", "); } 106 107 stringBuffer.append("}"); 109 map.put("arguments", stringBuffer.toString()); 110 } 111 112 } 113 | Popular Tags |