/** * Get the latest property by type. * @param type The type name. */ public Property getLatestProperty(String type) { Property[] props = getProperties(type); // System.out.println("here: "+type+" "+SUtil.arrayToString(props)); return props.length>0? props[props.length-1]: null; }
/** * Get the latest property by type. * @param type The type name. */ public static Property getLatestProperty(Properties[] props, String type) { Property ret = null; for(int i=props.length-1; i>-1 && ret==null; i--) { Property[] tmp = props[i].getProperties(type); if(tmp.length>0) ret = tmp[tmp.length-1]; } return ret; }
/** * Get properties by type. * @param type The type. */ public static Property[] getProperties(Properties[] props, String type) { List ret = new ArrayList(); for(int i=0; i<props.length; i++) { Property[] tmp = props[i].getProperties(type); for(int j=0; j<tmp.length; j++) ret.add(tmp[j]); } return (Property[])ret.toArray(new Property[ret.size()]); }
/** * Get a properties by type. * @param type The type name. */ public Property getProperty(String type) { Property[] props = getProperties(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; // Property ret = null; // for(int i=0; ret==null && i<properties.size(); i++) // { // Property prop = (Property)properties.get(i); // if(type.equals(prop.getType())) // ret = prop; // } // return ret; }
/** * Set the properties. * @param props The properties. */ public void setProperties(Properties props) { Property[] columnprops = props.getProperties("columnwidth"); TableColumnModel cm = getColumnModel(); for(int i=0; i<cm.getColumnCount() && i<columnprops.length; i++) { cm.getColumn(i).setPreferredWidth(Integer.parseInt(columnprops[i].getValue())); } } }
/** * Set the properties. * @param props The properties. */ public void setProperties(Properties props) { Property[] columnprops = props.getProperties("columnwidth"); TableColumnModel cm = getColumnModel(); for(int i=0; i<cm.getColumnCount() && i<columnprops.length; i++) { cm.getColumn(i).setPreferredWidth(Integer.parseInt(columnprops[i].getValue())); } } }
/** * Set the properties. * @param props The properties. */ public void setProperties(Properties props) { Property[] columnprops = props.getProperties("columnwidth"); TableColumnModel cm = getColumnModel(); for(int i=0; i<cm.getColumnCount() && i<columnprops.length; i++) { cm.getColumn(i).setPreferredWidth(Integer.parseInt(columnprops[i].getValue())); } } }
/** * Set the properties. * @param props The properties. */ public void setProperties(Properties props) { Property[] columnprops = props.getProperties("columnwidth"); TableColumnModel cm = getColumnModel(); for(int i=0; i<cm.getColumnCount() && i<columnprops.length; i++) { cm.getColumn(i).setPreferredWidth(Integer.parseInt(columnprops[i].getValue())); } } }
for(int i=0; i<subprops.length; i++) Property[] ps = subprops[i].getProperties(last); for(int j=0; j<ps.length; j++) ret.add(ps[j]);
/** * Update tool from given properties. */ public IFuture<Void> setProperties(final Properties props) { if(props!=null) { Property[] mps = props.getProperties(); Set<String> selected = new HashSet<String>(); for(int i=0; i<mps.length; i++) { if(Boolean.parseBoolean(mps[i].getValue())) selected.add(mps[i].getType()); } setSelectedComponentTypes(selected); } return IFuture.DONE; }
/** * Set the settings as properties. */ public void setProperties(Properties props) { for(int i=model.getRowCount()-1; i>=0; i--) { model.removeRow(i); } Property[] entries = props.getProperties("ENTRY"); for(int i=0; i<entries.length; i++) { model.addRow(new Object[]{new File(entries[i].getValue())}); } } }
/** * 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]); } } }
Property[] sents = props.getProperties(ConversationPlugin.SENT_MESSAGE); for(int i=0; i<sents.length; i++)
Property[] sents = props.getProperties(ConversationPlugin.SENT_MESSAGE); for(int i=0; i<sents.length; i++)
public void customResultAvailable(IResourceIdentifier rid) { lastrid = rid; Property[] aargs = props.getProperties("argument"); loadargs = new String[aargs.length]; for(int i=0; i<aargs.length; i++) { loadargs[i] = aargs[i].getValue(); } final String mo = props.getStringProperty("model"); if(mo!=null) { lastfile = mo; loadconfig = props.getStringProperty("config"); loadname = props.getStringProperty("name"); reloadModel(); } setStartSuspended(props.getBooleanProperty("startsuspended")); setAutoGenerate(props.getBooleanProperty("autogenerate")); numcomponents.setValue(Integer.valueOf(props.getIntProperty("number"))); ret.setResult(null); } });
public void customResultAvailable(IResourceIdentifier rid) { lastrid = rid; Property[] aargs = props.getProperties("argument"); loadargs = new String[aargs.length]; for(int i=0; i<aargs.length; i++) { loadargs[i] = aargs[i].getValue(); } final String mo = props.getStringProperty("model"); if(mo!=null) { lastfile = mo; loadconfig = props.getStringProperty("config"); loadname = props.getStringProperty("name"); reloadModel(); } setStartSuspended(props.getBooleanProperty("startsuspended")); setAutoGenerate(props.getBooleanProperty("autogenerate")); numcomponents.setValue(Integer.valueOf(props.getIntProperty("number"))); ret.setResult(null); } });
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); } } }
setAutoDeleteProxy(props.getProperty("autodelete")!=null ? props.getBooleanProperty("autodelete") : true); Property[] pincs = props.getProperties("include"); String[] incs = new String[pincs.length]; for(int i=0; i<pincs.length; i++) setIncludes(incs); Property[] pexcs = props.getProperties("exclude"); String[] excs = new String[pexcs.length]; for(int i=0; i<pexcs.length; i++)
setAutoDeleteProxy(props.getProperty("autodelete")!=null ? props.getBooleanProperty("autodelete") : true); Property[] pincs = props.getProperties("include"); String[] incs = new String[pincs.length]; for(int i=0; i<pincs.length; i++) setIncludes(incs); Property[] pexcs = props.getProperties("exclude"); String[] excs = new String[pexcs.length]; for(int i=0; i<pexcs.length; i++)
setAutoDeleteProxy(props.getProperty("autodelete")!=null ? props.getBooleanProperty("autodelete") : true); Property[] pincs = props.getProperties("include"); String[] incs = new String[pincs.length]; for(int i=0; i<pincs.length; i++) setIncludes(incs); Property[] pexcs = props.getProperties("exclude"); String[] excs = new String[pexcs.length]; for(int i=0; i<pexcs.length; i++)