该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
public class MDCellModifier implements ICellModifier {
private TreeViewer tv;
private TreeParent tree;
private MDTreeViewerLableProvider mdTreeViewerLableProvider = new MDTreeViewerLableProvider();
public static TreeParent to;
private MDTreeViewerContentProvider treeProvider;
private ScrolledPropertiesBlock block;
public MDCellModifier(TreeViewer tv) {
this.tv = tv;
}
public MDCellModifier(TreeViewer tv,
MDTreeViewerContentProvider treeProvider) {
this.tv = tv;
this.treeProvider = treeProvider;
}
public MDCellModifier(ScrolledPropertiesBlock block, TreeViewer tv,
MDTreeViewerContentProvider treeProvider) {
this.block = block;
this.tv = tv;
this.treeProvider = treeProvider;
}
@Override
public boolean canModify(Object element, String property) {
if (property.equals("ERROR"))
return false;
else if (property.equals("ID"))
return true;
else
return true;
}
@Override
public Object getValue(Object element, String property) {
if (property.equals("ERROR")) {
return mdTreeViewerLableProvider.getColumnImage(element, 0);
} else if (property.equals("ID")) {
return mdTreeViewerLableProvider.getColumnText(element, 1);
} else if (property.equals("MEMO")) {
return mdTreeViewerLableProvider.getColumnText(element, 2);
}
return null;
}
@Override
public void modify(Object element, String property, Object value) {
TreeItem item = (TreeItem) element;
to = (TreeParent) item.getData();
if (property.equals("ERROR")) {
} else if (property.equals("ID")) {
String text = (String) value;
to.setName(text);/
block.updateTree(treeProvider.getTree());
} else if (property.equals("MEMO")) {
String text = (String) value;
to.setMemo(text);
block.updateTree(treeProvider.getTree());
}
}
}
上面是关键代码~