use of org.talend.repository.viewer.ui.provider.RepositoryViewerProvider 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;
}
use of org.talend.repository.viewer.ui.provider.RepositoryViewerProvider in project tdi-studio-se by Talend.
the class ExportTreeViewer method createTreeViewer.
private void createTreeViewer(Composite itemComposite) {
filteredCheckboxTree = new FilteredCheckboxTree(itemComposite, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL | SWT.MULTI) {
@Override
protected CheckboxTreeViewer doCreateTreeViewer(Composite parent, int style) {
RepositoryViewerProvider provider = new RepositoryViewerProvider() {
@Override
protected ERepositoryObjectType getCheckingType() {
return ExportTreeViewer.this.getCheckingType();
}
};
return (CheckboxTreeViewer) provider.createViewer(parent);
}
@Override
protected void refreshCompleted() {
getViewer().expandToLevel(3);
restoreCheckedElements();
}
@Override
protected boolean isNodeCollectable(TreeItem item) {
Object obj = item.getData();
if (obj instanceof RepositoryNode) {
RepositoryNode node = (RepositoryNode) obj;
if (node.getObjectType() == ERepositoryObjectType.METADATA_CONNECTIONS) {
return true;
}
}
return false;
}
};
getExportItemsTreeViewer().addFilter(new ViewerFilter() {
@Override
public boolean select(Viewer viewer, Object parentElement, Object element) {
RepositoryNode node = (RepositoryNode) element;
return filterRepositoryNode(node);
}
});
}
Aggregations