use of com.intellij.util.ui.ListTableModel in project intellij-community by JetBrains.
the class DynamicMethodDialog method setupParameterList.
private void setupParameterList(List<ParamInfo> arguments) {
final ListTableModel<ParamInfo> dataModel = new ListTableModel<>(new NameColumnInfo(), new TypeColumnInfo());
dataModel.setItems(arguments);
myParametersTable.setModel(dataModel);
if (arguments.isEmpty())
return;
String max0 = arguments.get(0).name;
String max1 = arguments.get(0).type;
for (ParamInfo argument : arguments) {
if (argument.name.length() > max0.length())
max0 = argument.name;
if (argument.type.length() > max1.length())
max1 = argument.type;
}
final FontMetrics metrics = myParametersTable.getFontMetrics(myParametersTable.getFont());
final TableColumn column0 = myParametersTable.getColumnModel().getColumn(0);
column0.setPreferredWidth(metrics.stringWidth(max0 + " "));
final TableColumn column1 = myParametersTable.getColumnModel().getColumn(1);
column1.setPreferredWidth(metrics.stringWidth(max1 + " "));
}
Aggregations