use of org.obeonetwork.graal.design.ui.providers.RootElement in project InformationSystem by ObeoNetwork.
the class CreateUseRelationshipDialog method createDialogArea.
/**
* Create contents of the dialog.
* @param parent
*/
@Override
protected Control createDialogArea(Composite parent) {
Composite container = (Composite) super.createDialogArea(parent);
container.setLayout(new GridLayout(2, false));
Label lblSource = new Label(container, SWT.NONE);
lblSource.setText("Source :");
Label lblTarget = new Label(container, SWT.NONE);
lblTarget.setText("Target :");
treeSourceViewer = new TreeViewer(container, SWT.BORDER | SWT.MULTI);
treeSourceViewer.setContentProvider(new TasksContentProvider());
treeSourceViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory));
treeSourceViewer.addSelectionChangedListener(new ISelectionChangedListener() {
@SuppressWarnings("rawtypes")
public void selectionChanged(SelectionChangedEvent event) {
if (event.getSelection().isEmpty()) {
selectedTasksAsSource.clear();
} else if (event.getSelection() instanceof IStructuredSelection) {
selectedTasksAsSource.clear();
IStructuredSelection selection = (IStructuredSelection) event.getSelection();
for (Iterator iterator = selection.iterator(); iterator.hasNext(); ) {
Object domain = (Object) iterator.next();
if (domain instanceof Task) {
selectedTasksAsSource.add((Task) domain);
}
}
}
computeOkButtonState();
}
});
treeSourceViewer.setInput(new RootElement(this.source));
treeSourceViewer.setSelection(new StructuredSelection(this.source), true);
Tree treeSource = treeSourceViewer.getTree();
treeSource.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
treeTargetViewer = new TreeViewer(container, SWT.BORDER | SWT.MULTI);
treeTargetViewer.setContentProvider(new TasksContentProvider());
treeTargetViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory));
treeTargetViewer.addSelectionChangedListener(new ISelectionChangedListener() {
@SuppressWarnings("rawtypes")
public void selectionChanged(SelectionChangedEvent event) {
if (event.getSelection().isEmpty()) {
selectedTasksAsTarget.clear();
} else if (event.getSelection() instanceof IStructuredSelection) {
selectedTasksAsTarget.clear();
IStructuredSelection selection = (IStructuredSelection) event.getSelection();
for (Iterator iterator = selection.iterator(); iterator.hasNext(); ) {
Object domain = (Object) iterator.next();
if (domain instanceof Task) {
selectedTasksAsTarget.add((Task) domain);
}
}
}
computeOkButtonState();
}
});
treeTargetViewer.setInput(new RootElement(this.target));
treeTargetViewer.setSelection(new StructuredSelection(this.target), true);
Tree treeTarget = treeTargetViewer.getTree();
treeTarget.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
return container;
}
Aggregations