/** * Get subproperties by type. * @param type The type. */ public static Properties[] getSubproperties(Properties[] props, String type) { List ret = new ArrayList(); for(int i=0; i<props.length; i++) { Properties[] tmp = props[i].getSubproperties(type); for(int j=0; j<tmp.length; j++) ret.add(tmp[j]); } return (Properties[])ret.toArray(new Properties[ret.size()]); }
/** * Get a properties by type. * @param type The type name. */ public Properties getSubproperty(String type) { Properties[] props = getSubproperties(type); if(props.length>1) throw new RuntimeException("More than one property of type: "+type+" "+SUtil.arrayToString(props)); return props.length==1? props[0]: null; // Properties ret = null; // for(Iterator it=subproperties.values().iterator(); it.hasNext();) // { // Properties props = (Properties)it.next(); // if(SUtil.equals(type, props.getType())) // ret = props; // } // return ret; }
String last = type.substring(idx+1); Properties[] subprops = getSubproperties(first); for(int i=0; i<subprops.length; i++) Properties[] ps = subprops[i].getSubproperties(last); for(int j=0; j<ps.length; j++) ret.add(ps[j]);
String last = type.substring(idx+1); Properties[] subprops = getSubproperties(first); for(int i=0; i<subprops.length; i++)
/** * Add the complete content of another properties. */ public void addProperties(Properties toadd) { Property[] subprops = toadd.getProperties(); for(int j=0; j<subprops.length; j++) { addProperty(subprops[j]); } Properties[] subpropis = toadd.getSubproperties(); for(int i=0; i<subpropis.length; i++) { // Properties tmp = getSubproperty(subpropis[i].getType()); // if(tmp!=null) // { // tmp.addProperties(subpropis[i]); // } // else { addSubproperties(subpropis[i]); } } }
Properties[] links = props.getSubproperties("link");
private static void savePropertiesAsPreferences(Properties props, IPreferences prefs, String path) { String appendType = props.getType(); if (appendType != null) { path = path + appendType + "."; } for (Property prop : props.getProperties()) { String name = prop.getName(); String type = prop.getType(); String value = prop.getValue(); String prefKey = path + type; prefs.setString(prefKey, value); } for (Properties subprops : props.getSubproperties()) { savePropertiesAsPreferences(subprops, prefs, path); } } }
Properties[] links = props.getSubproperties("link");
Properties[] entries = props.getSubproperties("entry"); final CollectionResultListener<Tuple2<String, IResourceIdentifier>> crl = new CollectionResultListener<Tuple2<String, IResourceIdentifier>>(entries.length, false,
Properties[] entries = props.getSubproperties("entry"); final CollectionResultListener<Tuple2<String, IResourceIdentifier>> crl = new CollectionResultListener<Tuple2<String, IResourceIdentifier>>(entries.length, false,
Properties[] vis = props.getSubproperties("vis"); if(vis!=null && vis.length>0)
Properties[] vis = props.getSubproperties("vis"); if(vis!=null && vis.length>0)