简体   繁体   English

如何编辑将字符串列表作为模型的jface表

[英]How to edit a jface table which holds a list of string as the model

I have created a table viewer with input as a List<String> with the default array-content provider, column label provider. 我已经创建了一个表查看器,其输入为带有默认数组内容提供程序,列标签提供程序的List<String>

In addition to that I have added the EditingSupport for that column. 除此之外,我还为该列添加了EditingSupport。

EditingSupport#setValue(java.lang.Object element, java.lang.Object value)

The problem am facing is not able to change the string contents after the cell is being edited. 面临的问题是在单元格被编辑后无法更改字符串内容。 Using a default TextCellEditor. 使用默认的TextCellEditor。

In the function setValue the element and value are strings. 在函数setValue ,元素和值是字符串。 Can anyone provide some suggestions. 谁能提供一些建议。

Since it is not possible to change the value of a String you will have to change the model used by your content provider to use a class which contains the string. 由于无法更改String的值,因此您将必须更改内容提供商使用的模型以使用包含字符串的类。 You can then call methods of that class to set the new value. 然后,您可以调用该类的方法来设置新值。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何设置双击以在SWT / JFace中编辑表格单元格? - How to set double click to edit a Table cell in SWT/JFace? 如何创建一个包含 class 的任何子级列表的 class? - How to create a class which holds list of any children of a class? Java Linked List 如何创建一个包含字符串和int的节点? - Java Linked List How to create a node that holds a string and an int? 如何使用tableviewer创建一个表,该表在jface中具有2个列和10行 - How to create a table using tableviewer which has 2 coloumns and 10 rows in jface 包含双精度值的字符串列表中的Collections.min()方法混乱 - Collections.min() method confusion in list of string which holds double values 保留设置的值的序列化器 <String> 在Redis中 - Serializer for Value which holds Set<String> in redis 如何使用jface在列表中搜索所需元素 - How to search for required elements in list using jface 如何在 JFace 表查看器中侦听复选框 - How listen for check box in JFace Table Viewer 当模型嵌套字段更改时更新jface表 - Update jface table when model nested field changed 如何从保存数据库中值的java中的字符串数组中计算一个小时前的时间 - How to calculate one hour ago time from an string array in java which holds value from database
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM