use of org.talend.core.model.repository.IRepositoryReviewFilter in project tdi-studio-se by Talend.
the class ExportItemWizardPage 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) {
RepoCommonViewerProvider provider = RepoCommonViewerProvider.CHECKBOX;
if (baseViewId != null) {
provider.setViewId(baseViewId);
}
CheckboxTreeViewer viwer = (CheckboxTreeViewer) provider.createViewer(parent);
// FIXME this is temp fix for 5.4.2
INavigatorContentService navigatorContentService = ((INavigatorContentServiceProvider) viwer).getNavigatorContentService();
if (navigatorContentService != null) {
IExtensionStateModel findStateModel = navigatorContentService.findStateModel(//$NON-NLS-1$
"com.oaklandsw.transform.navigatorContent");
if (findStateModel != null) {
//$NON-NLS-1$
findStateModel.setBooleanProperty("org.talend.repository.ui.actions.importexport", true);
}
}
return viwer;
}
@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;
}
};
filteredCheckboxTree.getViewer().addFilter(new ViewerFilter() {
@Override
public boolean select(Viewer viewer, Object parentElement, Object element) {
boolean select = true;
if (element instanceof RepositoryNode) {
select = selectRepositoryNode(viewer, (RepositoryNode) element);
}
if (select) {
for (IRepositoryReviewFilter nodeHandler : RepositoryContentManager.getRepositoryReviewFilters()) {
//$NON-NLS-1$
boolean exportFilter = nodeHandler.filter(viewer, parentElement, element, "repository_review");
if (!exportFilter) {
return exportFilter;
}
}
}
return select;
}
});
}
Aggregations