Search in sources :

Example 6 with ProjectRepositoryNode

use of org.talend.core.repository.model.ProjectRepositoryNode in project tdi-studio-se by Talend.

the class MetadataGenericContentProvider method getChildren.

@Override
public Object[] getChildren(Object element) {
    if (!(element instanceof RepositoryNode)) {
        return super.getChildren(element);
    }
    RepositoryNode repoNode = (RepositoryNode) element;
    ProjectRepositoryNode projectRepositoryNode = (ProjectRepositoryNode) repoNode.getRoot();
    if (metadataNodeTester.isMetadataTopNode(repoNode)) {
        getTopLevelNodes().clear();
        getTopLevelNodes().addAll(projectRepositoryNode.getGenericTopNodesMap().values());
        // so as to inherit common settings from parent.
        getAndStoreTopLevelNode(projectRepositoryNode);
        return getTopLevelNodes().toArray();
    }
    if (!repoNode.isInitialized() && getTopLevelNodes().contains(repoNode)) {
        projectRepositoryNode.initializeChildren(repoNode);
        repoNode.setInitialized(true);
    }
    return repoNode.getChildren().toArray();
}
Also used : ProjectRepositoryNode(org.talend.core.repository.model.ProjectRepositoryNode) ProjectRepositoryNode(org.talend.core.repository.model.ProjectRepositoryNode) RepositoryNode(org.talend.repository.model.RepositoryNode)

Example 7 with ProjectRepositoryNode

use of org.talend.core.repository.model.ProjectRepositoryNode 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 8 with ProjectRepositoryNode

use of org.talend.core.repository.model.ProjectRepositoryNode in project tdi-studio-se by Talend.

the class CreateProcess method selectRootObject.

protected final void selectRootObject(Properties params) {
    IWorkbenchWindow workbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
    if (null == workbenchWindow) {
        return;
    }
    IWorkbenchPage workbenchPage = workbenchWindow.getActivePage();
    if (null == workbenchPage) {
        return;
    }
    IPerspectiveDescriptor currentPerspective = workbenchPage.getPerspective();
    if (!getPerspectiveId().equals(currentPerspective.getId())) {
        // show di perspective
        try {
            workbenchWindow.getWorkbench().showPerspective(getPerspectiveId(), workbenchWindow);
            workbenchPage = workbenchWindow.getActivePage();
        } catch (WorkbenchException e) {
            ExceptionHandler.process(e);
            return;
        }
    }
    IRepositoryView view = RepositoryManagerHelper.getRepositoryView();
    if (view != null) {
        Object type = params.get("type");
        if (getProcessType().name().equals(type)) {
            IRepositoryNode processNode = ((ProjectRepositoryNode) view.getRoot()).getRootRepositoryNode(getProcessType());
            if (processNode != null) {
                setWorkbenchPart(view);
                final StructuredViewer viewer = view.getViewer();
                if (viewer instanceof TreeViewer) {
                    ((TreeViewer) viewer).expandToLevel(processNode, 1);
                }
                viewer.setSelection(new StructuredSelection(processNode));
            }
        }
    }
}
Also used : IWorkbenchWindow(org.eclipse.ui.IWorkbenchWindow) IRepositoryNode(org.talend.repository.model.IRepositoryNode) TreeViewer(org.eclipse.jface.viewers.TreeViewer) StructuredSelection(org.eclipse.jface.viewers.StructuredSelection) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) IWorkbenchPage(org.eclipse.ui.IWorkbenchPage) IPerspectiveDescriptor(org.eclipse.ui.IPerspectiveDescriptor) ProjectRepositoryNode(org.talend.core.repository.model.ProjectRepositoryNode) StructuredViewer(org.eclipse.jface.viewers.StructuredViewer) WorkbenchException(org.eclipse.ui.WorkbenchException) IRepositoryView(org.talend.repository.ui.views.IRepositoryView)

Example 9 with ProjectRepositoryNode

use of org.talend.core.repository.model.ProjectRepositoryNode in project tdi-studio-se by Talend.

the class StatusManagerSettingPage method processItems.

private void processItems(List<RepositoryObject> objects, IRepositoryNode 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((RepositoryNode) node)) {
                // must be item
                RepositoryObject object = new RepositoryObject(node.getObject().getProperty());
                object.setRepositoryNode(node);
                // ItemVersionObject object = new ItemVersionObject(node, property.getVersion());
                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, child);
            }
        }
    }
}
Also used : Item(org.talend.core.model.properties.Item) TableItem(org.eclipse.swt.widgets.TableItem) RepositoryObject(org.talend.core.model.repository.RepositoryObject) 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) RepositoryObject(org.talend.core.model.repository.RepositoryObject) 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 10 with ProjectRepositoryNode

use of org.talend.core.repository.model.ProjectRepositoryNode in project tesb-studio-se by Talend.

the class CreateCamelBean method selectRootObject.

private void selectRootObject(Properties params) {
    IRepositoryView view = RepositoryManagerHelper.getRepositoryView();
    if (view != null) {
        Object type = params.get("type");
        if (CamelRepositoryNodeType.repositoryBeansType.name().equals(type)) {
            IRepositoryNode processNode = ((ProjectRepositoryNode) view.getRoot()).getRootRepositoryNode(ERepositoryObjectType.PROCESS);
            if (processNode != null) {
                setWorkbenchPart(view);
                final StructuredViewer viewer = view.getViewer();
                if (viewer instanceof TreeViewer) {
                    ((TreeViewer) viewer).expandToLevel(processNode, 1);
                }
                viewer.setSelection(new StructuredSelection(processNode));
            }
        }
    }
}
Also used : IRepositoryNode(org.talend.repository.model.IRepositoryNode) TreeViewer(org.eclipse.jface.viewers.TreeViewer) StructuredSelection(org.eclipse.jface.viewers.StructuredSelection) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) ProjectRepositoryNode(org.talend.core.repository.model.ProjectRepositoryNode) StructuredViewer(org.eclipse.jface.viewers.StructuredViewer) IRepositoryView(org.talend.repository.ui.views.IRepositoryView)

Aggregations

ProjectRepositoryNode (org.talend.core.repository.model.ProjectRepositoryNode)13 IRepositoryNode (org.talend.repository.model.IRepositoryNode)10 RepositoryNode (org.talend.repository.model.RepositoryNode)10 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)6 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)5 IProjectRepositoryNode (org.talend.repository.model.nodes.IProjectRepositoryNode)5 IRepositoryView (org.talend.repository.ui.views.IRepositoryView)5 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)4 StructuredViewer (org.eclipse.jface.viewers.StructuredViewer)4 TreeViewer (org.eclipse.jface.viewers.TreeViewer)4 IContentProvider (org.eclipse.jface.viewers.IContentProvider)3 IPerspectiveDescriptor (org.eclipse.ui.IPerspectiveDescriptor)3 IWorkbenchPage (org.eclipse.ui.IWorkbenchPage)3 IWorkbenchWindow (org.eclipse.ui.IWorkbenchWindow)3 WorkbenchException (org.eclipse.ui.WorkbenchException)3 Item (org.talend.core.model.properties.Item)3 ArrayList (java.util.ArrayList)2 TableItem (org.eclipse.swt.widgets.TableItem)2 NavigatorContentServiceContentProvider (org.eclipse.ui.internal.navigator.NavigatorContentServiceContentProvider)2 Property (org.talend.core.model.properties.Property)2