use of org.talend.repository.viewer.ui.viewer.RepositoryTreeViewer in project tesb-studio-se by Talend.
the class RouteResourceSelectionDialog method createDialogArea.
@Override
protected Control createDialogArea(Composite parent) {
final Composite container = (Composite) super.createDialogArea(parent);
final RepositoryViewerProvider provider = new RepositoryViewerProvider() {
@Override
protected TreeViewer createTreeViewer(Composite parent, int style) {
return new RepositoryTreeViewer(parent, style);
}
@Override
protected ERepositoryObjectType getCheckingType() {
return CamelRepositoryNodeType.repositoryRouteResourceType;
}
@Override
protected int getStyle() {
// http://jira.talendforge.org/browse/TESB-6582 Xiaopeng Li
return SWT.BORDER | SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL;
}
};
repositoryTreeViewer = (RepositoryTreeViewer) provider.createViewer(container);
repositoryTreeViewer.expandAll();
repositoryTreeViewer.addSelectionChangedListener(new ISelectionChangedListener() {
public void selectionChanged(SelectionChangedEvent event) {
getButton(IDialogConstants.OK_ID).setEnabled(validateSelection((IStructuredSelection) event.getSelection()));
}
});
repositoryTreeViewer.addDoubleClickListener(new IDoubleClickListener() {
public void doubleClick(DoubleClickEvent event) {
if (getButton(IDialogConstants.OK_ID).isEnabled()) {
okPressed();
}
}
});
return container;
}
Aggregations