ツリーコンポーネントのEclipse RCPでカスタム列を実装する必要があります。コンボのような列、または別の選択ダイアログを表示できる選択ボタン。デフォルトでは、Eclipseツリー列は生のテキスト文字列のみをサポートしています。私は単純なテキストボックス(またはラベル)を別のコントロールに置き換えたいです。それをどうすれば実現できますか? 次の例では、単純なテキストセルを実装しています。Eclipse RCPでカスタムツリーの列とセルを実装する方法
Display display = new Display();
Shell shell = new Shell(display);
shell.setLayout(new FillLayout());
Table table = new Table(shell, SWT.BORDER);
table.setHeaderVisible(true);
table.setLinesVisible(true);
for (int i = 0; i < 2; i++) {
new TableColumn(table, SWT.NONE);
}
table.getColumn(0).setText ("Task");
table.getColumn(1).setText ("Progress");
for (int i = 0; i < 40; i++) {
TableItem item = new TableItem(table, SWT.NONE);
item.setText("Task " + i);
}
table.getColumn(0).pack();
table.getColumn(1).setWidth(128);
shell.pack();
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
display.dispose();
これは実際にEclipse RCPやプラグインではなくSWTアプリケーションです。 Eclipseの場合、SWT.MeasureItem/PaintItem/EraseItemを使用するSWTの場合、OwnerDrawLabelProviderとともにJFace TableViewerを使用します。 –