Composite interfaceComposite = new Composite(tabFolder, SWT.NONE);
tbtmInterfaces.setControl(interfaceComposite);
interfaceComposite.setLayout(new GridLayout(2, false));
listViewer = new ListViewer(interfaceComposite, SWT.BORDER | SWT.V_SCROLL);
listViewer.setSorter(new ViewerSorter());
List list = listViewer.getList();
GridData gd_list = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
gd_list.widthHint = 284;
list.setLayoutData(gd_list);
list.setSize(238, 111);
listViewer.setContentProvider(new IStructuredContentProvider() {
public Object[] getElements(Object inputElement) {
return ((Set<?>)inputElement).toArray();
}
public void dispose() {
System.out.println("Disposing ...");
}
public void inputChanged(
Viewer viewer,
Object oldInput,
Object newInput) {
System.out.println("Input changed: old=" + oldInput + ", new=" + newInput);
}
});
listViewer.setLabelProvider(new LabelProvider());
Composite buttonComposite = new Composite(interfaceComposite, SWT.NONE);
//buttonComposite.setSize(51, 46);
buttonComposite.setCapture(true);
GridLayout gl_buttonComposite = new GridLayout(1, false);
gl_buttonComposite.verticalSpacing = 0;
gl_buttonComposite.marginWidth = 0;
gl_buttonComposite.horizontalSpacing = 0;
gl_buttonComposite.marginHeight = 0;
buttonComposite.setLayout(gl_buttonComposite);
addButton = new Button(buttonComposite, SWT.NONE);
addButton.setBounds(0, 0, 94, 30);
addButton.setText("Add");
removeButton = new Button(buttonComposite, SWT.NONE);
removeButton.setBounds(0, 0, 94, 30);
removeButton.setText("Remove");
tableViewer.setContentProvider(new ArrayContentProvider());
Composite membersComposite = new Composite(parent, SWT.NONE);
membersComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
membersComposite.setLayout(new GridLayout(1, false));
treeViewer = new TreeViewer(membersComposite, SWT.BORDER);
treeViewer.addDoubleClickListener(new IDoubleClickListener() {
public void doubleClick(DoubleClickEvent event) {
ITreeSelection selection = (ITreeSelection)event.getSelection();
IWorkbenchWindow window=PlatformUI.getWorkbench().getActiveWorkbenchWindow();
IWorkbenchPage page = window.getActivePage();
Object element = selection.getFirstElement();
if (element instanceof IClassComponent){
OpenClassComponentAction action = new OpenClassComponentAction(page, (IClassComponent)element);
action.run();
treeViewer.refresh(element);
}
}
});
treeViewer.setSorter(new ViewerSorter());
treeViewer.setAutoExpandLevel(1);
Tree membersTree = treeViewer.getTree();
GridData gd_membersTree = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1);
gd_membersTree.widthHint = 300;
membersTree.setLayoutData(gd_membersTree);