Search in sources :

Example 1 with ModelDragListener

use of org.eclipse.vorto.perspective.dnd.ModelDragListener 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)

Example 2 with ModelDragListener

use of org.eclipse.vorto.perspective.dnd.ModelDragListener in project vorto by eclipse.

the class DatatypeTreeViewer method init.

@Override
protected void init() {
    super.init();
    int operations = DND.DROP_COPY | DND.DROP_MOVE;
    Transfer[] transferTypes = new Transfer[] { LocalSelectionTransfer.getTransfer() };
    treeViewer.addDragSupport(operations, transferTypes, new ModelDragListener(treeViewer));
    treeViewer.addDropSupport(operations, transferTypes, ModelDropListenerFactory.datatypeViewPartDropListener(treeViewer, localModelWorkspace));
}
Also used : LocalSelectionTransfer(org.eclipse.jface.util.LocalSelectionTransfer) Transfer(org.eclipse.swt.dnd.Transfer) ModelDragListener(org.eclipse.vorto.perspective.dnd.ModelDragListener)

Example 3 with ModelDragListener

use of org.eclipse.vorto.perspective.dnd.ModelDragListener in project vorto by eclipse.

the class FunctionblockTreeViewer method init.

@Override
public void init() {
    super.init();
    int operations = DND.DROP_COPY | DND.DROP_MOVE;
    Transfer[] transferTypes = new Transfer[] { LocalSelectionTransfer.getTransfer() };
    treeViewer.addDragSupport(operations, transferTypes, new ModelDragListener(treeViewer));
    treeViewer.addDropSupport(operations, transferTypes, ModelDropListenerFactory.functionblockViewPartDropListener(treeViewer, localModelWorkspace));
}
Also used : LocalSelectionTransfer(org.eclipse.jface.util.LocalSelectionTransfer) Transfer(org.eclipse.swt.dnd.Transfer) ModelDragListener(org.eclipse.vorto.perspective.dnd.ModelDragListener)

Aggregations

ModelDragListener (org.eclipse.vorto.perspective.dnd.ModelDragListener)3 LocalSelectionTransfer (org.eclipse.jface.util.LocalSelectionTransfer)2 Transfer (org.eclipse.swt.dnd.Transfer)2 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 ModelRepositoryLabelProvider (org.eclipse.vorto.perspective.labelprovider.ModelRepositoryLabelProvider)1