Search in sources :

Example 1 with RepositoryTreeViewer

use of org.talend.repository.viewer.ui.viewer.RepositoryTreeViewer in project tesb-studio-se by Talend.

the class RouteResourceSelectionDialog method createDialogArea.

@Override
protected Control createDialogArea(Composite parent) {
    final Composite container = (Composite) super.createDialogArea(parent);
    final RepositoryViewerProvider provider = new RepositoryViewerProvider() {

        @Override
        protected TreeViewer createTreeViewer(Composite parent, int style) {
            return new RepositoryTreeViewer(parent, style);
        }

        @Override
        protected ERepositoryObjectType getCheckingType() {
            return CamelRepositoryNodeType.repositoryRouteResourceType;
        }

        @Override
        protected int getStyle() {
            // http://jira.talendforge.org/browse/TESB-6582 Xiaopeng Li
            return SWT.BORDER | SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL;
        }
    };
    repositoryTreeViewer = (RepositoryTreeViewer) provider.createViewer(container);
    repositoryTreeViewer.expandAll();
    repositoryTreeViewer.addSelectionChangedListener(new ISelectionChangedListener() {

        public void selectionChanged(SelectionChangedEvent event) {
            getButton(IDialogConstants.OK_ID).setEnabled(validateSelection((IStructuredSelection) event.getSelection()));
        }
    });
    repositoryTreeViewer.addDoubleClickListener(new IDoubleClickListener() {

        public void doubleClick(DoubleClickEvent event) {
            if (getButton(IDialogConstants.OK_ID).isEnabled()) {
                okPressed();
            }
        }
    });
    return container;
}
Also used : RepositoryViewerProvider(org.talend.repository.viewer.ui.provider.RepositoryViewerProvider) RepositoryTreeViewer(org.talend.repository.viewer.ui.viewer.RepositoryTreeViewer) Composite(org.eclipse.swt.widgets.Composite) ISelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) IDoubleClickListener(org.eclipse.jface.viewers.IDoubleClickListener) SelectionChangedEvent(org.eclipse.jface.viewers.SelectionChangedEvent) DoubleClickEvent(org.eclipse.jface.viewers.DoubleClickEvent)

Aggregations

DoubleClickEvent (org.eclipse.jface.viewers.DoubleClickEvent)1 IDoubleClickListener (org.eclipse.jface.viewers.IDoubleClickListener)1 ISelectionChangedListener (org.eclipse.jface.viewers.ISelectionChangedListener)1 SelectionChangedEvent (org.eclipse.jface.viewers.SelectionChangedEvent)1 Composite (org.eclipse.swt.widgets.Composite)1 RepositoryViewerProvider (org.talend.repository.viewer.ui.provider.RepositoryViewerProvider)1 RepositoryTreeViewer (org.talend.repository.viewer.ui.viewer.RepositoryTreeViewer)1