Search in sources :

Example 1 with ServerSorter

use of org.talend.mdm.workbench.serverexplorer.ui.providers.ServerSorter in project tmdm-studio-se by Talend.

the class ServerExplorer method createPartControl.

/**
 * Create contents of the view part.
 *
 * @param parent
 */
@Override
public void createPartControl(Composite parent) {
    Composite container = new Composite(parent, SWT.NONE);
    container.setLayout(new FillLayout(SWT.HORIZONTAL));
    treeViewer = new TreeViewer(container, SWT.BORDER);
    treeViewer.setSorter(new ServerSorter());
    tree = treeViewer.getTree();
    tree.addMouseListener(new MouseAdapter() {

        @Override
        public void mouseDoubleClick(MouseEvent e) {
            IRepositoryViewObject viewObject = getCurSelectedViewObject();
            String name = null;
            if (viewObject != null) {
                MDMServerDefItem serverDefItem = getMDMItem(viewObject);
                name = serverDefItem.getServerDef().getName();
            }
            editServerDef();
        }
    });
    toolkit.paintBordersFor(tree);
    treeViewer.setContentProvider(new TreeContentProvider());
    treeViewer.setLabelProvider(new ViewerLabelProvider());
    initAdapter();
    initializeToolBar();
    initializeMenu();
    refreshServerDefs();
    reInputPassword();
}
Also used : TreeContentProvider(org.talend.mdm.workbench.serverexplorer.ui.providers.TreeContentProvider) ViewerLabelProvider(org.talend.mdm.workbench.serverexplorer.ui.providers.ViewerLabelProvider) MouseEvent(org.eclipse.swt.events.MouseEvent) Composite(org.eclipse.swt.widgets.Composite) TreeViewer(org.eclipse.jface.viewers.TreeViewer) MouseAdapter(org.eclipse.swt.events.MouseAdapter) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) MDMServerDefItem(org.talend.mdm.repository.model.mdmproperties.MDMServerDefItem) FillLayout(org.eclipse.swt.layout.FillLayout) ServerSorter(org.talend.mdm.workbench.serverexplorer.ui.providers.ServerSorter)

Example 2 with ServerSorter

use of org.talend.mdm.workbench.serverexplorer.ui.providers.ServerSorter in project tmdm-studio-se by Talend.

the class SelectServerDefDialog method createDialogArea.

/**
 * Create contents of the dialog.
 *
 * @param parent
 */
@Override
protected Control createDialogArea(Composite parent) {
    setTitle(Messages.SelectServerDefDialog_selectServerLocation);
    Composite area = (Composite) super.createDialogArea(parent);
    Composite container = new Composite(area, SWT.NONE);
    container.setLayout(new FillLayout(SWT.HORIZONTAL));
    container.setLayoutData(new GridData(GridData.FILL_BOTH));
    treeViewer = new TreeViewer(container, SWT.BORDER);
    treeViewer.setSorter(new ServerSorter());
    treeViewer.setContentProvider(new TreeContentProvider());
    treeViewer.setLabelProvider(new ViewerLabelProvider());
    // 
    treeViewer.addSelectionChangedListener(new ISelectionChangedListener() {

        public void selectionChanged(SelectionChangedEvent event) {
            IRepositoryViewObject viewObject = getCurSelectedViewObject();
            if (viewObject == null)
                return;
            MDMServerDefItem item = (MDMServerDefItem) viewObject.getProperty().getItem();
            serverDef = item.getServerDef();
            okBun.setEnabled(serverDef != null);
        }
    });
    treeViewer.addDoubleClickListener(new IDoubleClickListener() {

        public void doubleClick(DoubleClickEvent event) {
            okPressed();
        }
    });
    // 
    initServerDefList();
    return area;
}
Also used : ViewerLabelProvider(org.talend.mdm.workbench.serverexplorer.ui.providers.ViewerLabelProvider) Composite(org.eclipse.swt.widgets.Composite) TreeViewer(org.eclipse.jface.viewers.TreeViewer) ISelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) SelectionChangedEvent(org.eclipse.jface.viewers.SelectionChangedEvent) DoubleClickEvent(org.eclipse.jface.viewers.DoubleClickEvent) FillLayout(org.eclipse.swt.layout.FillLayout) ServerSorter(org.talend.mdm.workbench.serverexplorer.ui.providers.ServerSorter) TreeContentProvider(org.talend.mdm.workbench.serverexplorer.ui.providers.TreeContentProvider) IDoubleClickListener(org.eclipse.jface.viewers.IDoubleClickListener) GridData(org.eclipse.swt.layout.GridData) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) MDMServerDefItem(org.talend.mdm.repository.model.mdmproperties.MDMServerDefItem)

Aggregations

TreeViewer (org.eclipse.jface.viewers.TreeViewer)2 FillLayout (org.eclipse.swt.layout.FillLayout)2 Composite (org.eclipse.swt.widgets.Composite)2 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)2 MDMServerDefItem (org.talend.mdm.repository.model.mdmproperties.MDMServerDefItem)2 ServerSorter (org.talend.mdm.workbench.serverexplorer.ui.providers.ServerSorter)2 TreeContentProvider (org.talend.mdm.workbench.serverexplorer.ui.providers.TreeContentProvider)2 ViewerLabelProvider (org.talend.mdm.workbench.serverexplorer.ui.providers.ViewerLabelProvider)2 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 MouseAdapter (org.eclipse.swt.events.MouseAdapter)1 MouseEvent (org.eclipse.swt.events.MouseEvent)1 GridData (org.eclipse.swt.layout.GridData)1