Search in sources :

Example 1 with ModelRepositoryContentProvider

use of org.eclipse.vorto.perspective.contentprovider.ModelRepositoryContentProvider in project vorto by eclipse.

the class AbstractModelRepositoryViewPart method createTableViewer.

private TableViewer createTableViewer(Composite parent, Button btnSearch) {
    TableViewer viewer = new TableViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.BORDER);
    FormData fd_table = new FormData();
    fd_table.top = new FormAttachment(btnSearch, 2);
    fd_table.left = new FormAttachment(searchField, 0, SWT.LEFT);
    fd_table.bottom = new FormAttachment(100, -5);
    fd_table.right = new FormAttachment(100, -10);
    viewer.getTable().setLayoutData(fd_table);
    viewer.getTable().setHeaderVisible(true);
    viewer.getTable().setLinesVisible(true);
    String[] columnLabels = { "", NAMESPACE, NAME, VERSION, DESCRIPTION };
    int[] columnBounds = { 50, 300, 200, 100, 400 };
    for (int i = 0; i < columnLabels.length; i++) {
        createTableViewerColumn(viewer, columnLabels[i], columnBounds[i]);
    }
    viewer.setContentProvider(new ModelRepositoryContentProvider());
    viewer.setLabelProvider(new ModelRepositoryLabelProvider());
    comparator = new ModelResourceViewerComparator();
    viewer.setComparator(comparator);
    viewer.setInput(getViewSite());
    viewer.addDragSupport(DND.DROP_COPY | DND.DROP_MOVE, new Transfer[] { LocalSelectionTransfer.getTransfer() }, new ModelDragListener(viewer));
    return viewer;
}
Also used : FormData(org.eclipse.swt.layout.FormData) ModelRepositoryLabelProvider(org.eclipse.vorto.perspective.labelprovider.ModelRepositoryLabelProvider) TableViewer(org.eclipse.jface.viewers.TableViewer) ModelRepositoryContentProvider(org.eclipse.vorto.perspective.contentprovider.ModelRepositoryContentProvider) FormAttachment(org.eclipse.swt.layout.FormAttachment) ModelDragListener(org.eclipse.vorto.perspective.dnd.ModelDragListener)

Aggregations

TableViewer (org.eclipse.jface.viewers.TableViewer)1 FormAttachment (org.eclipse.swt.layout.FormAttachment)1 FormData (org.eclipse.swt.layout.FormData)1 ModelRepositoryContentProvider (org.eclipse.vorto.perspective.contentprovider.ModelRepositoryContentProvider)1 ModelDragListener (org.eclipse.vorto.perspective.dnd.ModelDragListener)1 ModelRepositoryLabelProvider (org.eclipse.vorto.perspective.labelprovider.ModelRepositoryLabelProvider)1