Search in sources :

Example 1 with IContentProvider

use of org.eclipse.jface.viewers.IContentProvider in project tdi-studio-se by Talend.

the class AbstractVersionManagementProjectSettingPage method processItems.

protected void processItems(List<ItemVersionObject> objects, RepositoryNode node) {
    if (node == null) {
        return;
    }
    // if the root node of type is not init, force init.
    IProjectRepositoryNode root = node.getRoot();
    if (root instanceof ProjectRepositoryNode) {
        ((ProjectRepositoryNode) root).initNode(node);
    }
    if (node.getType() == ENodeType.REPOSITORY_ELEMENT) {
        if (node.getObject() != null) {
            Property property = node.getObject().getProperty();
            Item item = property.getItem();
            if (item != null && filterRepositoryNode(node)) {
                // must be item
                ItemVersionObject object = createItemVersionObject(node, property);
                objects.add(object);
            }
        }
    } else {
        IContentProvider contentProvider = treeViewer.getContentProvider();
        if (contentProvider instanceof NavigatorContentServiceContentProvider) {
            NavigatorContentServiceContentProvider navigatorProvider = (NavigatorContentServiceContentProvider) contentProvider;
            Object[] children = navigatorProvider.getChildren(node);
            for (Object child : children) {
                if (child instanceof RepositoryNode) {
                    processItems(objects, (RepositoryNode) child);
                }
            }
        } else {
            for (IRepositoryNode child : node.getChildren()) {
                processItems(objects, (RepositoryNode) child);
            }
        }
    }
}
Also used : Item(org.talend.core.model.properties.Item) TableItem(org.eclipse.swt.widgets.TableItem) IContentProvider(org.eclipse.jface.viewers.IContentProvider) IRepositoryNode(org.talend.repository.model.IRepositoryNode) NavigatorContentServiceContentProvider(org.eclipse.ui.internal.navigator.NavigatorContentServiceContentProvider) ProjectRepositoryNode(org.talend.core.repository.model.ProjectRepositoryNode) IProjectRepositoryNode(org.talend.repository.model.nodes.IProjectRepositoryNode) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) ItemVersionObject(org.talend.repository.model.ItemVersionObject) ItemVersionObject(org.talend.repository.model.ItemVersionObject) ProjectRepositoryNode(org.talend.core.repository.model.ProjectRepositoryNode) RepositoryNode(org.talend.repository.model.RepositoryNode) IProjectRepositoryNode(org.talend.repository.model.nodes.IProjectRepositoryNode) IRepositoryNode(org.talend.repository.model.IRepositoryNode) Property(org.talend.core.model.properties.Property) IProjectRepositoryNode(org.talend.repository.model.nodes.IProjectRepositoryNode)

Example 2 with IContentProvider

use of org.eclipse.jface.viewers.IContentProvider in project tdi-studio-se by Talend.

the class JobScriptsExportWizardPage method collectNodes.

private void collectNodes(Map<String, Item> items, RepositoryNode repositoryNode) {
    IRepositoryViewObject repositoryObject = repositoryNode.getObject();
    if (repositoryObject != null) {
        if (repositoryObject.getRepositoryObjectType().isResourceItem()) {
            Item item = repositoryObject.getProperty().getItem();
            items.put(item.getProperty().getId(), item);
        }
    } else {
        if (repositoryNode.getParent() != null && repositoryNode.getParent().getObject() != null) {
            Item item = repositoryNode.getParent().getObject().getProperty().getItem();
            items.put(item.getProperty().getId(), item);
        }
    }
    if (this.treeViewer != null) {
        IContentProvider contentProvider = this.treeViewer.getFilteredCheckboxTree().getViewer().getContentProvider();
        if (contentProvider instanceof ITreeContentProvider) {
            Object[] children = ((ITreeContentProvider) contentProvider).getChildren(repositoryNode);
            collectNodes(items, children);
        }
    }
}
Also used : Item(org.talend.core.model.properties.Item) FolderItem(org.talend.core.model.properties.FolderItem) TableItem(org.eclipse.swt.widgets.TableItem) ProcessItem(org.talend.core.model.properties.ProcessItem) ITreeContentProvider(org.eclipse.jface.viewers.ITreeContentProvider) IContentProvider(org.eclipse.jface.viewers.IContentProvider) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject)

Example 3 with IContentProvider

use of org.eclipse.jface.viewers.IContentProvider in project tdi-studio-se by Talend.

the class NotificationDetailsDialog method refreshWidgets.

/**
     * Refreshes the widgets.
     */
protected void refreshWidgets() {
    final Notification notification = (Notification) ((StructuredSelection) tree.getViewer().getSelection()).getFirstElement();
    if (notification == null) {
        return;
    }
    dateLabel.setText(new SimpleDateFormat(DATE_FORMAT).format(new Date(notification.getTimeStamp())));
    sequenceNumberText.setText(String.valueOf(notification.getSequenceNumber()));
    sourceLabel.setText(notification.getSource().toString());
    typeLabel.setText(notification.getType());
    messageText.setText(notification.getMessage());
    Object userData = notification.getUserData();
    if (userData != null) {
        IContentProvider contentProvider = detailsViewer.getContentProvider();
        if (contentProvider != null) {
            ((DetailsContentProvider) contentProvider).refresh(userData);
        }
    }
    if (prevButton != null && !prevButton.isDisposed()) {
        prevButton.setEnabled(tree.getPrevItem() != null);
    }
    if (nextButton != null && !nextButton.isDisposed()) {
        nextButton.setEnabled(tree.getNextItem() != null);
    }
}
Also used : IContentProvider(org.eclipse.jface.viewers.IContentProvider) SimpleDateFormat(java.text.SimpleDateFormat) Notification(javax.management.Notification) Date(java.util.Date)

Example 4 with IContentProvider

use of org.eclipse.jface.viewers.IContentProvider in project tdi-studio-se by Talend.

the class UseDynamicJobSelectionDialog method setCheckingNodes.

private void setCheckingNodes() {
    final IContentProvider contentProvider = getItemsTreeViewer().getContentProvider();
    final Object input = getItemsTreeViewer().getInput();
    if (contentProvider instanceof ITreeContentProvider && input instanceof ProjectRepositoryNode && getNeedCheckedjobs() != null && getNeedCheckedjobs().length > 0) {
        ITreeContentProvider cnfContentProvider = (ITreeContentProvider) contentProvider;
        List<IRepositoryNode> checkingNodes = new ArrayList<IRepositoryNode>();
        List<String> needCheckedJobIds = new ArrayList(Arrays.asList(getNeedCheckedjobs()));
        final ProjectRepositoryNode root = (ProjectRepositoryNode) input;
        final RepositoryNode rootRepositoryNode = root.getRootRepositoryNode(getSupportType());
        if (rootRepositoryNode == null) {
            return;
        }
        withReferenceProjects(cnfContentProvider, rootRepositoryNode, needCheckedJobIds, checkingNodes);
        // set check for node
        getItemsTreeViewer().setCheckedElements(checkingNodes.toArray());
        // select and will expand the selected node auto
        getItemsTreeViewer().setSelection(new StructuredSelection(checkingNodes), true);
        // let scroll bar on top
        getItemsTreeViewer().setSelection(new StructuredSelection(rootRepositoryNode));
        getItemsTreeViewer().setSelection(StructuredSelection.EMPTY);
    }
}
Also used : ITreeContentProvider(org.eclipse.jface.viewers.ITreeContentProvider) IContentProvider(org.eclipse.jface.viewers.IContentProvider) IRepositoryNode(org.talend.repository.model.IRepositoryNode) ArrayList(java.util.ArrayList) StructuredSelection(org.eclipse.jface.viewers.StructuredSelection) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) ProjectRepositoryNode(org.talend.core.repository.model.ProjectRepositoryNode) ProjectRepositoryNode(org.talend.core.repository.model.ProjectRepositoryNode) RepositoryNode(org.talend.repository.model.RepositoryNode) IRepositoryNode(org.talend.repository.model.IRepositoryNode)

Example 5 with IContentProvider

use of org.eclipse.jface.viewers.IContentProvider 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

IContentProvider (org.eclipse.jface.viewers.IContentProvider)15 IRepositoryNode (org.talend.repository.model.IRepositoryNode)5 RepositoryNode (org.talend.repository.model.RepositoryNode)5 ITreeContentProvider (org.eclipse.jface.viewers.ITreeContentProvider)4 TreeViewer (org.eclipse.jface.viewers.TreeViewer)4 Item (org.talend.core.model.properties.Item)4 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)4 ProjectRepositoryNode (org.talend.core.repository.model.ProjectRepositoryNode)4 Composite (org.eclipse.swt.widgets.Composite)3 TableItem (org.eclipse.swt.widgets.TableItem)3 TreePathFilteredTree (eu.esdihumboldt.hale.ui.util.viewer.tree.TreePathFilteredTree)2 ArrayList (java.util.ArrayList)2 Property (org.talend.core.model.properties.Property)2 RepositoryObject (org.talend.core.model.repository.RepositoryObject)2 IProjectRepositoryNode (org.talend.repository.model.nodes.IProjectRepositoryNode)2 CubridDeferredTreeContentManager (com.cubrid.common.ui.common.navigator.CubridDeferredTreeContentManager)1 DeferredContentProvider (com.cubrid.common.ui.common.navigator.DeferredContentProvider)1 Category (eu.esdihumboldt.cst.functions.groovy.helper.Category)1 HelperFunctionOrCategory (eu.esdihumboldt.cst.functions.groovy.helper.HelperFunctionOrCategory)1 HelperFunctionsService (eu.esdihumboldt.cst.functions.groovy.helper.HelperFunctionsService)1