Search in sources :

Example 56 with Transfer

use of org.eclipse.swt.dnd.Transfer in project InformationSystem by ObeoNetwork.

the class RequirementEditor method createContextMenuFor.

/**
 * This creates a context menu for the viewer and adds a listener as well registering the menu for extension.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
protected void createContextMenuFor(StructuredViewer viewer) {
    MenuManager contextMenu = new MenuManager("#PopUp");
    contextMenu.add(new Separator("additions"));
    contextMenu.setRemoveAllWhenShown(true);
    contextMenu.addMenuListener(this);
    Menu menu = contextMenu.createContextMenu(viewer.getControl());
    viewer.getControl().setMenu(menu);
    getSite().registerContextMenu(contextMenu, new UnwrappingSelectionProvider(viewer));
    int dndOperations = DND.DROP_COPY | DND.DROP_MOVE | DND.DROP_LINK;
    Transfer[] transfers = new Transfer[] { LocalTransfer.getInstance() };
    viewer.addDragSupport(dndOperations, transfers, new ViewerDragAdapter(viewer));
    viewer.addDropSupport(dndOperations, transfers, new EditingDomainViewerDropAdapter(editingDomain, viewer));
}
Also used : UnwrappingSelectionProvider(org.eclipse.emf.edit.ui.provider.UnwrappingSelectionProvider) ViewerDragAdapter(org.eclipse.emf.edit.ui.dnd.ViewerDragAdapter) MenuManager(org.eclipse.jface.action.MenuManager) IMenuManager(org.eclipse.jface.action.IMenuManager) LocalTransfer(org.eclipse.emf.edit.ui.dnd.LocalTransfer) Transfer(org.eclipse.swt.dnd.Transfer) Menu(org.eclipse.swt.widgets.Menu) Separator(org.eclipse.jface.action.Separator) Point(org.eclipse.swt.graphics.Point) EditingDomainViewerDropAdapter(org.eclipse.emf.edit.ui.dnd.EditingDomainViewerDropAdapter)

Example 57 with Transfer

use of org.eclipse.swt.dnd.Transfer in project InformationSystem by ObeoNetwork.

the class EnvironmentEditor method createContextMenuFor.

/**
 * This creates a context menu for the viewer and adds a listener as well registering the menu for extension.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
protected void createContextMenuFor(StructuredViewer viewer) {
    MenuManager contextMenu = new MenuManager("#PopUp");
    contextMenu.add(new Separator("additions"));
    contextMenu.setRemoveAllWhenShown(true);
    contextMenu.addMenuListener(this);
    Menu menu = contextMenu.createContextMenu(viewer.getControl());
    viewer.getControl().setMenu(menu);
    getSite().registerContextMenu(contextMenu, new UnwrappingSelectionProvider(viewer));
    int dndOperations = DND.DROP_COPY | DND.DROP_MOVE | DND.DROP_LINK;
    Transfer[] transfers = new Transfer[] { LocalTransfer.getInstance() };
    viewer.addDragSupport(dndOperations, transfers, new ViewerDragAdapter(viewer));
    viewer.addDropSupport(dndOperations, transfers, new EditingDomainViewerDropAdapter(editingDomain, viewer));
}
Also used : UnwrappingSelectionProvider(org.eclipse.emf.edit.ui.provider.UnwrappingSelectionProvider) ViewerDragAdapter(org.eclipse.emf.edit.ui.dnd.ViewerDragAdapter) MenuManager(org.eclipse.jface.action.MenuManager) IMenuManager(org.eclipse.jface.action.IMenuManager) LocalTransfer(org.eclipse.emf.edit.ui.dnd.LocalTransfer) Transfer(org.eclipse.swt.dnd.Transfer) Menu(org.eclipse.swt.widgets.Menu) Separator(org.eclipse.jface.action.Separator) Point(org.eclipse.swt.graphics.Point) EditingDomainViewerDropAdapter(org.eclipse.emf.edit.ui.dnd.EditingDomainViewerDropAdapter)

Example 58 with Transfer

use of org.eclipse.swt.dnd.Transfer in project InformationSystem by ObeoNetwork.

the class InteractionEditor method createContextMenuFor.

/**
 * This creates a context menu for the viewer and adds a listener as well registering the menu for extension.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
protected void createContextMenuFor(StructuredViewer viewer) {
    MenuManager contextMenu = new MenuManager("#PopUp");
    contextMenu.add(new Separator("additions"));
    contextMenu.setRemoveAllWhenShown(true);
    contextMenu.addMenuListener(this);
    Menu menu = contextMenu.createContextMenu(viewer.getControl());
    viewer.getControl().setMenu(menu);
    getSite().registerContextMenu(contextMenu, new UnwrappingSelectionProvider(viewer));
    int dndOperations = DND.DROP_COPY | DND.DROP_MOVE | DND.DROP_LINK;
    Transfer[] transfers = new Transfer[] { LocalTransfer.getInstance() };
    viewer.addDragSupport(dndOperations, transfers, new ViewerDragAdapter(viewer));
    viewer.addDropSupport(dndOperations, transfers, new EditingDomainViewerDropAdapter(editingDomain, viewer));
}
Also used : UnwrappingSelectionProvider(org.eclipse.emf.edit.ui.provider.UnwrappingSelectionProvider) ViewerDragAdapter(org.eclipse.emf.edit.ui.dnd.ViewerDragAdapter) MenuManager(org.eclipse.jface.action.MenuManager) IMenuManager(org.eclipse.jface.action.IMenuManager) LocalTransfer(org.eclipse.emf.edit.ui.dnd.LocalTransfer) Transfer(org.eclipse.swt.dnd.Transfer) Menu(org.eclipse.swt.widgets.Menu) Separator(org.eclipse.jface.action.Separator) Point(org.eclipse.swt.graphics.Point) EditingDomainViewerDropAdapter(org.eclipse.emf.edit.ui.dnd.EditingDomainViewerDropAdapter)

Example 59 with Transfer

use of org.eclipse.swt.dnd.Transfer in project InformationSystem by ObeoNetwork.

the class OverviewEditor method createContextMenuFor.

/**
 * This creates a context menu for the viewer and adds a listener as well registering the menu for extension.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
protected void createContextMenuFor(StructuredViewer viewer) {
    MenuManager contextMenu = new MenuManager("#PopUp");
    contextMenu.add(new Separator("additions"));
    contextMenu.setRemoveAllWhenShown(true);
    contextMenu.addMenuListener(this);
    Menu menu = contextMenu.createContextMenu(viewer.getControl());
    viewer.getControl().setMenu(menu);
    getSite().registerContextMenu(contextMenu, new UnwrappingSelectionProvider(viewer));
    int dndOperations = DND.DROP_COPY | DND.DROP_MOVE | DND.DROP_LINK;
    Transfer[] transfers = new Transfer[] { LocalTransfer.getInstance() };
    viewer.addDragSupport(dndOperations, transfers, new ViewerDragAdapter(viewer));
    viewer.addDropSupport(dndOperations, transfers, new EditingDomainViewerDropAdapter(editingDomain, viewer));
}
Also used : UnwrappingSelectionProvider(org.eclipse.emf.edit.ui.provider.UnwrappingSelectionProvider) ViewerDragAdapter(org.eclipse.emf.edit.ui.dnd.ViewerDragAdapter) MenuManager(org.eclipse.jface.action.MenuManager) IMenuManager(org.eclipse.jface.action.IMenuManager) LocalTransfer(org.eclipse.emf.edit.ui.dnd.LocalTransfer) Transfer(org.eclipse.swt.dnd.Transfer) Menu(org.eclipse.swt.widgets.Menu) Separator(org.eclipse.jface.action.Separator) Point(org.eclipse.swt.graphics.Point) EditingDomainViewerDropAdapter(org.eclipse.emf.edit.ui.dnd.EditingDomainViewerDropAdapter)

Example 60 with Transfer

use of org.eclipse.swt.dnd.Transfer in project titan.EclipsePlug-ins by eclipse.

the class TestSetTab method createTestsetViewer.

private void createTestsetViewer(final Composite parent) {
    Composite composite = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    layout.numColumns = 1;
    GridData data = new GridData();
    data.horizontalAlignment = SWT.FILL;
    data.verticalAlignment = SWT.FILL;
    data.grabExcessHorizontalSpace = true;
    data.grabExcessVerticalSpace = true;
    composite.setLayout(layout);
    composite.setLayoutData(data);
    composite.setFont(parent.getFont());
    Label label = new Label(composite, SWT.NONE);
    label.setText("test sets:");
    testsetViewer = new TreeViewer(composite, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER | SWT.MULTI);
    data = new GridData();
    data.horizontalAlignment = SWT.FILL;
    data.verticalAlignment = SWT.FILL;
    data.grabExcessHorizontalSpace = true;
    data.grabExcessVerticalSpace = true;
    testsetViewer.getControl().setLayoutData(data);
    testsetViewer.setContentProvider(new TestcasesContentProvider());
    testsetViewer.setLabelProvider(testcasesLabelProvider);
    int dragOps = DND.DROP_COPY | DND.DROP_MOVE;
    Transfer[] types = new Transfer[] { TestcaseTransfer.getInstance() };
    testsetViewer.addDragSupport(dragOps, types, new TestsetTreeDragSourceListener(testsetViewer));
    int dropOps = DND.DROP_COPY | DND.DROP_MOVE | DND.DROP_DEFAULT;
    testsetViewer.addDropSupport(dropOps, types, new TestsetTreeDropTargetListener(testsetViewer, this));
    testsetViewer.addSelectionChangedListener(new ISelectionChangedListener() {

        @Override
        public void selectionChanged(final SelectionChangedEvent event) {
            IStructuredSelection selection = (IStructuredSelection) event.getSelection();
            remove.setEnabled(!selection.isEmpty());
            rename.setEnabled(!selection.isEmpty() && (selection.getFirstElement() instanceof TestsetTreeElement));
        }
    });
    treeRoot = new TestsetTreeElement("treeRoot");
    testsetViewer.setInput(treeRoot);
    label = new Label(composite, SWT.NONE);
    label.setText("Right click to add or remove testsets.\nUse drag&drop to add,remove or\nreorder testcases.");
}
Also used : Composite(org.eclipse.swt.widgets.Composite) TreeViewer(org.eclipse.jface.viewers.TreeViewer) ISelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) Label(org.eclipse.swt.widgets.Label) SelectionChangedEvent(org.eclipse.jface.viewers.SelectionChangedEvent) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) GridLayout(org.eclipse.swt.layout.GridLayout) GridData(org.eclipse.swt.layout.GridData) Transfer(org.eclipse.swt.dnd.Transfer)

Aggregations

Transfer (org.eclipse.swt.dnd.Transfer)151 TextTransfer (org.eclipse.swt.dnd.TextTransfer)71 Point (org.eclipse.swt.graphics.Point)63 Clipboard (org.eclipse.swt.dnd.Clipboard)51 Menu (org.eclipse.swt.widgets.Menu)37 IMenuManager (org.eclipse.jface.action.IMenuManager)32 MenuManager (org.eclipse.jface.action.MenuManager)32 Separator (org.eclipse.jface.action.Separator)32 LocalSelectionTransfer (org.eclipse.jface.util.LocalSelectionTransfer)32 EditingDomainViewerDropAdapter (org.eclipse.emf.edit.ui.dnd.EditingDomainViewerDropAdapter)30 LocalTransfer (org.eclipse.emf.edit.ui.dnd.LocalTransfer)30 ViewerDragAdapter (org.eclipse.emf.edit.ui.dnd.ViewerDragAdapter)30 UnwrappingSelectionProvider (org.eclipse.emf.edit.ui.provider.UnwrappingSelectionProvider)30 FileTransfer (org.eclipse.swt.dnd.FileTransfer)30 DropTargetEvent (org.eclipse.swt.dnd.DropTargetEvent)27 DropTarget (org.eclipse.swt.dnd.DropTarget)23 GridData (org.eclipse.swt.layout.GridData)23 GridLayout (org.eclipse.swt.layout.GridLayout)22 Composite (org.eclipse.swt.widgets.Composite)22 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)20