Search in sources :

Example 11 with ProjectRepositoryNode

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

the class CreateESBAction method selectRootObject.

private 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 (!IBrandingConfiguration.PERSPECTIVE_DI_ID.equals(currentPerspective.getId())) {
        // show Integration perspective
        try {
            workbenchWindow.getWorkbench().showPerspective(IBrandingConfiguration.PERSPECTIVE_DI_ID, workbenchWindow);
            workbenchPage = workbenchWindow.getActivePage();
        } catch (WorkbenchException e) {
            ExceptionHandler.process(e);
            return;
        }
    }
    IRepositoryView view = RepositoryManagerHelper.getRepositoryView();
    if (view != null) {
        Object type = params.get("type");
        if (ESBRepositoryNodeType.SERVICES.name().equals(type)) {
            RepositoryNode servicesNode = ((ProjectRepositoryNode) view.getRoot()).getRootRepositoryNode(ESBRepositoryNodeType.SERVICES);
            if (servicesNode != null) {
                setWorkbenchPart(view);
                final StructuredViewer viewer = view.getViewer();
                if (viewer instanceof TreeViewer) {
                    ((TreeViewer) viewer).expandToLevel(servicesNode, 1);
                }
                viewer.setSelection(new StructuredSelection(servicesNode));
            }
        }
    }
}
Also used : IWorkbenchWindow(org.eclipse.ui.IWorkbenchWindow) 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) ProjectRepositoryNode(org.talend.core.repository.model.ProjectRepositoryNode) RepositoryNode(org.talend.repository.model.RepositoryNode)

Example 12 with ProjectRepositoryNode

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

the class ESBService method getServicesTopNode.

private RepositoryNode getServicesTopNode(RepositoryNode node) {
    RepositoryNode parent = node.getParent();
    if (parent.getParent() instanceof ProjectRepositoryNode) {
        return parent;
    }
    parent = getServicesTopNode(parent);
    return parent;
}
Also used : 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 13 with ProjectRepositoryNode

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

the class AbstractVersionManagementProjectSettingPage method addRepositoryTreeViewer.

/**
     * repository tree viewer.
     */
private void addRepositoryTreeViewer(Composite leftComposite) {
    GridData gridData = new GridData(GridData.FILL_BOTH);
    gridData.widthHint = 210;
    gridData.heightHint = 400;
    leftComposite.setLayoutData(gridData);
    RepoCommonViewerProvider provider = RepoCommonViewerProvider.CHECKBOX;
    treeViewer = (CheckboxRepositoryTreeViewer) provider.createViewer(leftComposite);
    IProjectRepositoryNode projectRepositoryNode = provider.getProjectRepositoryNode();
    processItems(versionObjects, (RepositoryNode) projectRepositoryNode);
    addMenuAction(treeViewer.getTree());
    // filter
    treeViewer.addFilter(new ViewerFilter() {

        @Override
        public boolean select(Viewer viewer, Object parentElement, Object element) {
            RepositoryNode node = (RepositoryNode) element;
            return filterRepositoryNode(node);
        }
    });
    // event
    treeViewer.addCheckStateListener(checkStateListener);
    treeViewer.addTreeListener(new ITreeViewerListener() {

        @Override
        public void treeCollapsed(TreeExpansionEvent event) {
        //
        }

        @Override
        public void treeExpanded(TreeExpansionEvent event) {
        // refreshCheckedTreeView();
        }
    });
    expandSomeNodes(projectRepositoryNode);
}
Also used : ViewerFilter(org.eclipse.jface.viewers.ViewerFilter) GridData(org.eclipse.swt.layout.GridData) ITreeViewerListener(org.eclipse.jface.viewers.ITreeViewerListener) CheckboxRepositoryTreeViewer(org.talend.repository.viewer.ui.viewer.CheckboxRepositoryTreeViewer) Viewer(org.eclipse.jface.viewers.Viewer) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) 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) RepoCommonViewerProvider(org.talend.repository.viewer.ui.provider.RepoCommonViewerProvider) IProjectRepositoryNode(org.talend.repository.model.nodes.IProjectRepositoryNode) TreeExpansionEvent(org.eclipse.jface.viewers.TreeExpansionEvent)

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