Search in sources :

Example 1 with RepositoryContentProvider

use of org.talend.repository.viewer.ui.provider.RepositoryContentProvider in project tdi-studio-se by Talend.

the class DynamicComposite method getConnectionItems.

/**
     * DOC qzhang Comment method "getConnectionItems".
     * 
     * @return
     * @throws PersistenceException
     */
private List<ConnectionItem> getConnectionItems() throws PersistenceException {
    List<ConnectionItem> list = new ArrayList<ConnectionItem>();
    IRepositoryView repositoryView = RepositoryManagerHelper.findRepositoryView();
    if (repositoryView != null) {
        TreeViewer viewer = (TreeViewer) repositoryView.getViewer();
        IContentProvider contentProvider = viewer.getContentProvider();
        if (contentProvider instanceof RepositoryContentProvider) {
            RepositoryContentProvider provider = (RepositoryContentProvider) contentProvider;
            RepositoryNode metadataConNode = provider.getRootRepositoryNode(ERepositoryObjectType.METADATA);
            for (IRepositoryNode connectionItem : metadataConNode.getChildren()) {
                if (viewer.isExpandable(connectionItem)) {
                    provider.getChildren(connectionItem);
                }
                for (IRepositoryNode node : connectionItem.getChildren()) {
                    addConnectionItem(viewer, provider, list, (RepositoryNode) node);
                }
            }
        }
    }
    return list;
}
Also used : IContentProvider(org.eclipse.jface.viewers.IContentProvider) IRepositoryNode(org.talend.repository.model.IRepositoryNode) RepositoryContentProvider(org.talend.repository.viewer.ui.provider.RepositoryContentProvider) ConnectionItem(org.talend.core.model.properties.ConnectionItem) TreeViewer(org.eclipse.jface.viewers.TreeViewer) ArrayList(java.util.ArrayList) IRepositoryView(org.talend.repository.ui.views.IRepositoryView) RepositoryNode(org.talend.repository.model.RepositoryNode) IRepositoryNode(org.talend.repository.model.IRepositoryNode)

Aggregations

ArrayList (java.util.ArrayList)1 IContentProvider (org.eclipse.jface.viewers.IContentProvider)1 TreeViewer (org.eclipse.jface.viewers.TreeViewer)1 ConnectionItem (org.talend.core.model.properties.ConnectionItem)1 IRepositoryNode (org.talend.repository.model.IRepositoryNode)1 RepositoryNode (org.talend.repository.model.RepositoryNode)1 IRepositoryView (org.talend.repository.ui.views.IRepositoryView)1 RepositoryContentProvider (org.talend.repository.viewer.ui.provider.RepositoryContentProvider)1