Java 类org.eclipse.swt.dnd.Transfer 实例源码

项目:gama    文件:CopyAction.java   
/**
 * Set the clipboard contents. Prompt to retry if clipboard is busy.
 *
 * @param resources
 *            the resources to copy to the clipboard
 * @param fileNames
 *            file names of the resources to copy to the clipboard
 * @param names
 *            string representation of all names
 */
private void setClipboard(final IResource[] resources, final String[] fileNames, final String names) {
    try {
        // set the clipboard contents
        if (fileNames.length > 0) {
            clipboard.setContents(new Object[] { resources, fileNames, names }, new Transfer[] {
                    ResourceTransfer.getInstance(), FileTransfer.getInstance(), TextTransfer.getInstance() });
        } else {
            clipboard.setContents(new Object[] { resources, names },
                    new Transfer[] { ResourceTransfer.getInstance(), TextTransfer.getInstance() });
        }
    } catch (final SWTError e) {
        if (e.code != DND.ERROR_CANNOT_SET_CLIPBOARD) { throw e; }
        if (MessageDialog.openQuestion(shell, "Problem with copy title", // TODO //$NON-NLS-1$
                                                                            // ResourceNavigatorMessages.CopyToClipboardProblemDialog_title,
                "Problem with copy.")) { //$NON-NLS-1$
            setClipboard(resources, fileNames, names);
        }
    }
}
项目:neoscada    文件:ProtocolEditor.java   
/**
 * 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" ); //$NON-NLS-1$
    contextMenu.add ( new Separator ( "additions" ) ); //$NON-NLS-1$
    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 (), LocalSelectionTransfer.getTransfer (), FileTransfer.getInstance () };
    viewer.addDragSupport ( dndOperations, transfers, new ViewerDragAdapter ( viewer ) );
    viewer.addDropSupport ( dndOperations, transfers, new EditingDomainViewerDropAdapter ( editingDomain, viewer ) );
}
项目:neoscada    文件:ChartEditor.java   
/**
 * 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 NOT
 */
protected void createContextMenuFor ( final StructuredViewer viewer )
{
    final MenuManager contextMenu = new MenuManager ( "#PopUp" ); //$NON-NLS-1$
    contextMenu.add ( new Separator ( "additions" ) ); //$NON-NLS-1$
    contextMenu.setRemoveAllWhenShown ( true );
    contextMenu.addMenuListener ( this );
    final Menu menu = contextMenu.createContextMenu ( viewer.getControl () );
    viewer.getControl ().setMenu ( menu );
    getSite ().registerContextMenu ( contextMenu, new UnwrappingSelectionProvider ( viewer ) );

    final int dndOperations = DND.DROP_COPY | DND.DROP_MOVE | DND.DROP_LINK;
    final Transfer[] transfers = new Transfer[] {
            LocalTransfer.getInstance (),
            LocalSelectionTransfer.getTransfer (),
            FileTransfer.getInstance (),
            ItemTransfer.getInstance ()
    };
    viewer.addDragSupport ( dndOperations, transfers, new ViewerDragAdapter ( viewer ) );
    viewer.addDropSupport ( dndOperations, transfers, new DropAdapterExtension ( this.editingDomain, viewer ) );
}
项目:neoscada    文件:ChartConfiguratorView.java   
/**
 * 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 -->
 */
protected void createContextMenuFor ( final StructuredViewer viewer )
{
    final MenuManager contextMenu = new MenuManager ( "#PopUp" );
    contextMenu.add ( new Separator ( "additions" ) );
    contextMenu.setRemoveAllWhenShown ( true );
    contextMenu.addMenuListener ( this );
    final Menu menu = contextMenu.createContextMenu ( viewer.getControl () );
    viewer.getControl ().setMenu ( menu );
    getSite ().registerContextMenu ( contextMenu, new UnwrappingSelectionProvider ( viewer ) );

    final int dndOperations = DND.DROP_COPY | DND.DROP_MOVE | DND.DROP_LINK;
    final Transfer[] transfers = new Transfer[] { LocalTransfer.getInstance () };
    viewer.addDragSupport ( dndOperations, transfers, new ViewerDragAdapter ( viewer ) );
    viewer.addDropSupport ( dndOperations, transfers, new EditingDomainViewerDropAdapter ( this.editingDomain, viewer ) );
}
项目:neoscada    文件:DetailViewEditor.java   
/**
 * 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" ); //$NON-NLS-1$
    contextMenu.add ( new Separator ( "additions" ) ); //$NON-NLS-1$
    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 (), LocalSelectionTransfer.getTransfer (), FileTransfer.getInstance () };
    viewer.addDragSupport ( dndOperations, transfers, new ViewerDragAdapter ( viewer ) );
    viewer.addDropSupport ( dndOperations, transfers, new EditingDomainViewerDropAdapter ( editingDomain, viewer ) );
}
项目:neoscada    文件:VisualInterfaceEditor.java   
/**
 * 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" ); //$NON-NLS-1$
    contextMenu.add ( new Separator ( "additions" ) ); //$NON-NLS-1$
    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 (), LocalSelectionTransfer.getTransfer (), FileTransfer.getInstance () };
    viewer.addDragSupport ( dndOperations, transfers, new ViewerDragAdapter ( viewer ) );
    viewer.addDropSupport ( dndOperations, transfers, new EditingDomainViewerDropAdapter ( editingDomain, viewer ) );
}
项目:neoscada    文件:DeploymentEditor.java   
/**
 * 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" ); //$NON-NLS-1$
    contextMenu.add ( new Separator ( "additions" ) ); //$NON-NLS-1$
    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 (), LocalSelectionTransfer.getTransfer (), FileTransfer.getInstance () };
    viewer.addDragSupport ( dndOperations, transfers, new ViewerDragAdapter ( viewer ) );
    viewer.addDropSupport ( dndOperations, transfers, new EditingDomainViewerDropAdapter ( editingDomain, viewer ) );
}
项目:neoscada    文件:SetupEditor.java   
/**
 * 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" ); //$NON-NLS-1$
    contextMenu.add ( new Separator ( "additions" ) ); //$NON-NLS-1$
    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 (), LocalSelectionTransfer.getTransfer (), FileTransfer.getInstance () };
    viewer.addDragSupport ( dndOperations, transfers, new ViewerDragAdapter ( viewer ) );
    viewer.addDropSupport ( dndOperations, transfers, new EditingDomainViewerDropAdapter ( editingDomain, viewer ) );
}
项目:neoscada    文件:ProfileEditor.java   
/**
 * 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" ); //$NON-NLS-1$
    contextMenu.add ( new Separator ( "additions" ) ); //$NON-NLS-1$
    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 (), LocalSelectionTransfer.getTransfer (), FileTransfer.getInstance () };
    viewer.addDragSupport ( dndOperations, transfers, new ViewerDragAdapter ( viewer ) );
    viewer.addDropSupport ( dndOperations, transfers, new EditingDomainViewerDropAdapter ( editingDomain, viewer ) );
}
项目:neoscada    文件:OsgiEditor.java   
/**
 * 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" ); //$NON-NLS-1$
    contextMenu.add ( new Separator ( "additions" ) ); //$NON-NLS-1$
    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 (), LocalSelectionTransfer.getTransfer (), FileTransfer.getInstance () };
    viewer.addDragSupport ( dndOperations, transfers, new ViewerDragAdapter ( viewer ) );
    viewer.addDropSupport ( dndOperations, transfers, new EditingDomainViewerDropAdapter ( editingDomain, viewer ) );
}
项目:neoscada    文件:WorldEditor.java   
/**
 * 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" ); //$NON-NLS-1$
    contextMenu.add ( new Separator ( "additions" ) ); //$NON-NLS-1$
    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 (), LocalSelectionTransfer.getTransfer (), FileTransfer.getInstance () };
    viewer.addDragSupport ( dndOperations, transfers, new ViewerDragAdapter ( viewer ) );
    viewer.addDropSupport ( dndOperations, transfers, new EditingDomainViewerDropAdapter ( editingDomain, viewer ) );
}
项目:neoscada    文件:MemoryEditor.java   
/**
 * 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 (), LocalSelectionTransfer.getTransfer (), FileTransfer.getInstance () };
    viewer.addDragSupport ( dndOperations, transfers, new ViewerDragAdapter ( viewer ) );
    viewer.addDropSupport ( dndOperations, transfers, new EditingDomainViewerDropAdapter ( editingDomain, viewer ) );
}
项目:neoscada    文件:RecipeEditor.java   
/**
 * 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" ); //$NON-NLS-1$
    contextMenu.add ( new Separator ( "additions" ) ); //$NON-NLS-1$
    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 (), LocalSelectionTransfer.getTransfer (), FileTransfer.getInstance () };
    viewer.addDragSupport ( dndOperations, transfers, new ViewerDragAdapter ( viewer ) );
    viewer.addDropSupport ( dndOperations, transfers, new EditingDomainViewerDropAdapter ( editingDomain, viewer ) );
}
项目:neoscada    文件:InfrastructureEditor.java   
/**
 * 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" ); //$NON-NLS-1$
    contextMenu.add ( new Separator ( "additions" ) ); //$NON-NLS-1$
    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 (), LocalSelectionTransfer.getTransfer (), FileTransfer.getInstance () };
    viewer.addDragSupport ( dndOperations, transfers, new ViewerDragAdapter ( viewer ) );
    viewer.addDropSupport ( dndOperations, transfers, new EditingDomainViewerDropAdapter ( editingDomain, viewer ) );
}
项目:neoscada    文件:SecurityEditor.java   
/**
 * 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" ); //$NON-NLS-1$
    contextMenu.add ( new Separator ( "additions" ) ); //$NON-NLS-1$
    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 (), LocalSelectionTransfer.getTransfer (), FileTransfer.getInstance () };
    viewer.addDragSupport ( dndOperations, transfers, new ViewerDragAdapter ( viewer ) );
    viewer.addDropSupport ( dndOperations, transfers, new EditingDomainViewerDropAdapter ( editingDomain, viewer ) );
}
项目:neoscada    文件:GlobalizeEditor.java   
/**
 * 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" ); //$NON-NLS-1$
    contextMenu.add ( new Separator ( "additions" ) ); //$NON-NLS-1$
    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 (), LocalSelectionTransfer.getTransfer (), FileTransfer.getInstance () };
    viewer.addDragSupport ( dndOperations, transfers, new ViewerDragAdapter ( viewer ) );
    viewer.addDropSupport ( dndOperations, transfers, new EditingDomainViewerDropAdapter ( editingDomain, viewer ) );
}
项目:neoscada    文件:ComponentEditor.java   
/**
 * 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 NOT
 */
protected void createContextMenuFor ( final StructuredViewer viewer )
{
    final MenuManager contextMenu = new MenuManager ( "#PopUp" ); //$NON-NLS-1$
    contextMenu.add ( new Separator ( "additions" ) ); //$NON-NLS-1$
    contextMenu.setRemoveAllWhenShown ( true );
    contextMenu.addMenuListener ( this );
    final Menu menu = contextMenu.createContextMenu ( viewer.getControl () );
    viewer.getControl ().setMenu ( menu );
    getSite ().registerContextMenu ( contextMenu, new UnwrappingSelectionProvider ( viewer ) );

    final int dndOperations = DND.DROP_COPY | DND.DROP_MOVE | DND.DROP_LINK;
    final Transfer[] transfers = new Transfer[] { LocalTransfer.getInstance (), LocalSelectionTransfer.getTransfer (), FileTransfer.getInstance (), ItemTransfer.getInstance () };
    viewer.addDragSupport ( dndOperations, transfers, new ViewerDragAdapter ( viewer ) );
    viewer.addDropSupport ( dndOperations, transfers, new DropAdapterExtension ( this.editingDomain, viewer ) );
}
项目:neoscada    文件:ItemEditor.java   
/**
 * 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" ); //$NON-NLS-1$
    contextMenu.add ( new Separator ( "additions" ) ); //$NON-NLS-1$
    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 (), LocalSelectionTransfer.getTransfer (), FileTransfer.getInstance () };
    viewer.addDragSupport ( dndOperations, transfers, new ViewerDragAdapter ( viewer ) );
    viewer.addDropSupport ( dndOperations, transfers, new EditingDomainViewerDropAdapter ( editingDomain, viewer ) );
}
项目:neoscada    文件:ConfigurationEditor.java   
/**
 * 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" ); //$NON-NLS-1$
    contextMenu.add ( new Separator ( "additions" ) ); //$NON-NLS-1$
    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 (), LocalSelectionTransfer.getTransfer (), FileTransfer.getInstance () };
    viewer.addDragSupport ( dndOperations, transfers, new ViewerDragAdapter ( viewer ) );
    viewer.addDropSupport ( dndOperations, transfers, new EditingDomainViewerDropAdapter ( editingDomain, viewer ) );
}
项目:convertigo-eclipse    文件:SourcePickerView.java   
private void createXhtmlTree() {
    sourcePicker.createXhtmlTree(treesSashForm);

    // DND support
    int ops = DND.DROP_COPY | DND.DROP_MOVE;
    Transfer[] transfers = new Transfer[] {StepSourceTransfer.getInstance()};

    DragSource source = new DragSource(sourcePicker.getTwsDomTree().getTree(), ops);
    source.setTransfer(transfers);
    source.addDragListener(new DragSourceAdapter() {            
        @Override
        public void dragStart(DragSourceEvent event) {
            event.doit = true;
            StepSourceTransfer.getInstance().setStepSource(sourcePicker.getDragData());
        }
    });

}
项目:eclipse-plugin-commander    文件:InternalCommandContextProviderFactory.java   
private static void addDefaultInternalCommands(InternalCommandContextProvider provider, KaviPickListDialog kaviPickList) {
    provider.addCommand("list: toggle view selected", (currentProvider) -> {
        currentProvider.toggleViewOnlySelected();
        kaviPickList.togglePreviousProvider().refreshFromContentProvider();
    });

    provider.addCommand("list: selected to clipboard", (currentProvider) -> {

        Clipboard clipboard = new Clipboard(kaviPickList.getShell().getDisplay());
        final List<BiFunction<Object, Integer, String>> fieldResolvers = currentProvider.getKaviListColumns().getColumnOptions().stream()
                   .filter(column -> column.isSearchable())
                   .map(column -> column.getColumnContentFn())
                   .collect(Collectors.toList());

        FieldCollectorTransform transform = new FieldCollectorTransform(fieldResolvers, currentProvider.getSelectedEntriesImplied().stream().map(rankedItem -> rankedItem.dataItem).collect(Collectors.toList()));

        clipboard.setContents(new Object[] { transform.asAlignedColumns() },    new Transfer[] { TextTransfer.getInstance() });
        kaviPickList.togglePreviousProvider().refreshFromContentProvider();
        clipboard.dispose();
    });

    provider.addCommand("working", "list: toggle sort name", (currentProvider) -> {
        kaviPickList.togglePreviousProvider().sortDefault().refreshFromContentProvider();
    });     
}
项目:JavaFX-FrameRateMeter    文件:OldFXCanvas.java   
Transfer getTransferType(String mime) {
    if (mime.equals("text/plain")) {
      return TextTransfer.getInstance();
    }
    if (mime.equals("text/rtf")) {
      return RTFTransfer.getInstance();
    }
    if (mime.equals("text/html")) {
      return HTMLTransfer.getInstance();
    }
    if (mime.equals("text/uri-list")) {
      return URLTransfer.getInstance();
    }
    if (mime.equals("application/x-java-rawimage")) {
      return ImageTransfer.getInstance();
    }
    if (mime.equals("application/x-java-file-list") || mime.equals("java.file-list")) {
        return FileTransfer.getInstance();
    }
    return getCustomTransfer(mime);
}
项目:JavaFX-FrameRateMeter    文件:OldFXCanvas.java   
Transfer [] getTransferTypes(String [] mimeTypes) {
    int count= 0;
    Transfer [] transfers = new Transfer [mimeTypes.length];
    for (int i=0; i<mimeTypes.length; i++) {
        Transfer transfer = getTransferType(mimeTypes[i]);
        if (transfer != null) {
          transfers [count++] = transfer;
        }
    }
    if (count != mimeTypes.length) {
        Transfer [] newTransfers = new Transfer[count];
        System.arraycopy(transfers, 0, newTransfers, 0, count);
        transfers = newTransfers;
    }
    return transfers;
}
项目:JavaFX-FrameRateMeter    文件:OldFXCanvas.java   
String getMime(Transfer transfer) {
    if (transfer.equals(TextTransfer.getInstance())) {
      return "text/plain";
    }
    if (transfer.equals(RTFTransfer.getInstance())) {
      return "text/rtf";
    } ;
    if (transfer.equals( HTMLTransfer.getInstance())) {
      return "text/html";
    }
    if (transfer.equals(URLTransfer.getInstance())) {
      return "text/uri-list";
    }
    if (transfer.equals( ImageTransfer.getInstance())) {
      return "application/x-java-rawimage";
    }
    if (transfer.equals(FileTransfer.getInstance())) {
      return "application/x-java-file-list";
    }
    if (transfer instanceof CustomTransfer) {
      return ((CustomTransfer)transfer).getMime();
    }
    return null;
}
项目:Hydrograph    文件:ELTSWTWidgets.java   
public void applyDragFromTableViewer(Control sourceControl, int index) {
    Transfer[] types = new Transfer[] { TextTransfer.getInstance() };
    final String portLabel = "in" + index + ".";
    int operations = DND.DROP_MOVE | DND.DROP_COPY | DND.DROP_LINK;
    final Table table = (Table) sourceControl;
    DragSource source = new DragSource(table, operations);
    source.setTransfer(types);
    final String[] columnData = new String[1];
    source.addDragListener(new DragSourceAdapter() {
        public void dragSetData(DragSourceEvent event) {
            // Set the data to be the first selected item's text
            event.data = addDelimeter(portLabel, table.getSelection());
        }
    });

}
项目:Hydrograph    文件:ExcelFormattingDialog.java   
private void attachDropListener() {
    dropTarget = new DropTarget(targetTable, DND.DROP_MOVE);
    dropTarget.setTransfer(new Transfer[] { TextTransfer.getInstance() });
    dropTarget.addDropListener(new DropTargetAdapter() {
        public void drop(DropTargetEvent event) {
            for (String fieldName : getformatedData((String) event.data)) {
                if(isPropertyAlreadyExists(fieldName)){
                    return;
                }else{
                    ExcelConfigurationDataStructure excelConfigurationDataStructure = new ExcelConfigurationDataStructure();
                    excelConfigurationDataStructure.setFieldName(fieldName);
                    listOfExcelConfiguration.add(excelConfigurationDataStructure);
                    targetTableViewer.refresh();
                    draggedFields.add(fieldName);
                    enableDeleteButton();
                }
            }
            combo.setItems(convertToArray(draggedFields));
            combo.select(0);
            top_composite.layout();
            top_composite.getParent().layout();
            highlightDropFields();

        }
    });
}
项目:Hydrograph    文件:CopyAction.java   
private void copySelectedAsTabDelimited() {
    StringBuffer stringBuffer = new StringBuffer();
    int totalRowCount = debugDataViewer.getTableViewer().getTable().getItemCount();
    int totalColumnCount = debugDataViewer.getTableViewer().getTable().getColumnCount();
    boolean hasRow=false;
    for (int rowCount = 0; rowCount < totalRowCount; rowCount++) {
        for (int columnCount = 0; columnCount < totalColumnCount; columnCount++) {
            Point cell = new Point(rowCount, columnCount);
            if(debugDataViewer.getSelectedCell().contains(cell)){
                stringBuffer.append(debugDataViewer.getTableViewer().getTable().getItem(rowCount).getText(columnCount) + "\t");
                hasRow=true;
            }
            cell=null;
        }
        if(hasRow){
            stringBuffer.append("\n");
            hasRow=false;
        }               
    }
    Clipboard cb = new Clipboard(Display.getCurrent());
    TextTransfer textTransfer = TextTransfer.getInstance();
    String textData = stringBuffer.toString();
    cb.setContents(new Object[] { textData }, new Transfer[] { textTransfer });
    cb.dispose();

}
项目:BiglyBT    文件:ClipboardCopy.java   
public static void
copyToClipBoard(
  final String    data )
{
 Runnable do_it =
new Runnable()
    {
  @Override
  public void
  run()
  {
      new Clipboard(Utils.getDisplay()).setContents(
              new Object[] {data.replaceAll("\\x00", " " )  },
              new Transfer[] {TextTransfer.getInstance()});
  }
    };

 if ( Utils.isSWTThread()){

  do_it.run();

 }else{

  Utils.execSWTThread( do_it );
 }
}
项目:BiglyBT    文件:ClipboardCopy.java   
public static void
 addCopyToClipMenu(
final Menu      menu,
final String    text )
 {
  MenuItem   item = new MenuItem( menu,SWT.NONE );

  String    msg_text_id= "label.copy.to.clipboard";

  item.setText( MessageText.getString( msg_text_id ));

  item.addSelectionListener(
      new SelectionAdapter()
      {
          @Override
          public void
          widgetSelected(
                  SelectionEvent arg0)
          {
              new Clipboard(menu.getDisplay()).setContents(new Object[] {text}, new Transfer[] {TextTransfer.getInstance()});
          }
      });
 }
项目:avro-schema-editor    文件:SchemaViewer.java   
protected void configureDragAndDrop(DragAndDropConfiguration dragAndDropConfiguration, TreeViewer treeViewer) {

      // drop
      Transfer[] transferTypes = new Transfer[] { LocalSelectionTransfer.getTransfer() };
      int operations = dragAndDropConfiguration.getSupportedDropOperations(this);

      DropTarget target = new DropTarget(treeViewer.getControl(), operations);
      target.setTransfer(transferTypes);

      // Drop listeners pour le drop des elements sur l'arbre
      SchemaViewerDropPolicy dropPolicy = dragAndDropConfiguration.getDropPolicy(this);
      DnDTargetListener targetListener = new DnDTargetListener(this, nodeConverter, dropPolicy);
      target.addDropListener(targetListener);

      // Drag listener pour le drag des elements de l'arbre
      DragSourceListener sourceListener = new DnDSourceListener(this);
      operations = DND.DROP_MOVE | DND.DROP_COPY | DND.DROP_DEFAULT;
      transferTypes = new Transfer[] { LocalSelectionTransfer.getTransfer() };
      treeViewer.addDragSupport(operations, transferTypes, sourceListener);

  }
项目:M2Doc    文件:GenconfEditor.java   
/**
 * 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(), LocalSelectionTransfer.getTransfer(),
        FileTransfer.getInstance()};
    viewer.addDragSupport(dndOperations, transfers, new ViewerDragAdapter(viewer));
    viewer.addDropSupport(dndOperations, transfers, new EditingDomainViewerDropAdapter(editingDomain, viewer));
}
项目:team-explorer-everywhere    文件:TableControl.java   
/**
 * Copies the currently selected elements to the clipboard. The exact format
 * of the clipboard data is specified by the {@link TableControl} subclass.
 * If there are no currently selected elements, or if the
 * {@link TableControl} subclass has not configured clipboard transfer, this
 * method does nothing.
 */
public void copySelectionToClipboard() {
    final Object[] selectedElements = getSelectedElements();

    if (selectedElements.length == 0) {
        return;
    }

    final Transfer[] transferTypes = clipboardTransferTypes;

    if (transferTypes == null || transferTypes.length == 0) {
        return;
    }

    final Object[] transferData = new Object[transferTypes.length];
    for (int i = 0; i < transferTypes.length; i++) {
        transferData[i] = getTransferData(transferTypes[i], selectedElements);
    }

    getClipboard().setContents(transferData, transferTypes);
}
项目:TranskribusSwtGui    文件:StructureTreeWidget.java   
void initDragAndDrop() {
        int operations = DND.DROP_MOVE;
        Transfer[] transferTypes = new Transfer[]{ LocalSelectionTransfer.getTransfer() };

        treeViewer.addDragSupport(operations, transferTypes, new DragSourceAdapter() {          
            @Override public void dragStart(DragSourceEvent event) {
                LocalSelectionTransfer.getTransfer().setSelection(treeViewer.getSelection()); // not really needed since we can get selection from member variable
            }
//          @Override public void dragSetData(DragSourceEvent event) {
//          }
//          @Override public void dragFinished(DragSourceEvent event) {
//          }
        });

        treeViewer.addDropSupport(operations, transferTypes, new StructureTreeDropAdapter(treeViewer));
    }
项目:mesfavoris    文件:CopyBookmarkUrlHandler.java   
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
    IStructuredSelection selection = (IStructuredSelection) HandlerUtil.getCurrentSelection(event);
    String url = getBookmarkUrl(selection);
    if (url == null) {
        return null;
    }

    Clipboard clipboard = new Clipboard(null);
    try {
        TextTransfer textTransfer = TextTransfer.getInstance();
        Transfer[] transfers = new Transfer[] { textTransfer };
        Object[] data = new Object[] { url };
        clipboard.setContents(data, transfers);
    } finally {
        clipboard.dispose();
    }
    return null;
}
项目:logbook    文件:TableToClipboardAdapter.java   
/**
 * テーブルの選択されている部分をヘッダー付きでクリップボードにコピーします
 *
 * @param header ヘッダー
 * @param table テーブル
 */
public static void copyTable(String[] header, Table table) {
    TableItem[] tableItems = table.getSelection();
    StringBuilder sb = new StringBuilder();
    sb.append(StringUtils.join(header, "\t"));
    sb.append("\r\n");
    for (TableItem column : tableItems) {
        String[] columns = new String[header.length];
        for (int i = 0; i < header.length; i++) {
            columns[i] = column.getText(i);
        }
        sb.append(StringUtils.join(columns, "\t"));
        sb.append("\r\n");
    }
    Clipboard clipboard = new Clipboard(Display.getDefault());
    clipboard.setContents(new Object[] { sb.toString() }, new Transfer[] { TextTransfer.getInstance() });
}
项目:logbook    文件:TreeToClipboardAdapter.java   
/**
 * ツリーの選択されている部分をヘッダー付きでクリップボードにコピーします
 * 
 * @param header ヘッダー
 * @param tree ツリー
 */
public static void copyTree(String[] header, Tree tree) {
    TreeItem[] treeItems = tree.getSelection();
    StringBuilder sb = new StringBuilder();
    sb.append(StringUtils.join(header, "\t"));
    sb.append("\r\n");
    for (TreeItem column : treeItems) {
        String[] columns = new String[header.length];
        for (int i = 0; i < header.length; i++) {
            columns[i] = column.getText(i);
        }
        sb.append(StringUtils.join(columns, "\t"));
        sb.append("\r\n");
    }
    Clipboard clipboard = new Clipboard(Display.getDefault());
    clipboard.setContents(new Object[] { sb.toString() }, new Transfer[] { TextTransfer.getInstance() });
}
项目:bts    文件:BtsmodelEditor.java   
/**
 * 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(), LocalSelectionTransfer.getTransfer(), FileTransfer.getInstance() };
    viewer.addDragSupport(dndOperations, transfers, new ViewerDragAdapter(viewer));
    viewer.addDropSupport(dndOperations, transfers, new EditingDomainViewerDropAdapter(editingDomain, viewer));
}
项目:statecharts    文件:ExampleDropTargetInstaller.java   
protected void registerWithExistingTarget(DropTarget target) {
    Transfer[] transfers = target.getTransfer();
    boolean exists = false;
    if (transfers != null) {
        for (Transfer transfer : transfers) {
            if (transfer instanceof URLTransfer) {
                exists = true;
                break;
            }
        }
        if (!exists) {
            Transfer[] newTransfers = new Transfer[transfers.length + 1];
            System.arraycopy(transfers, 0, newTransfers, 0, transfers.length);
            newTransfers[transfers.length] = URLTransfer.getInstance();
            target.setTransfer(newTransfers);
        }
    }
}
项目:mondo-demo-wt    文件:WTSpec4MEditor.java   
/**
 * 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(), LocalSelectionTransfer.getTransfer(),
            FileTransfer.getInstance() };
    viewer.addDragSupport(dndOperations, transfers, new ViewerDragAdapter(viewer));
    viewer.addDropSupport(dndOperations, transfers, new EditingDomainViewerDropAdapter(editingDomain, viewer));
}
项目:SMVHunter    文件:NativeHeapPanel.java   
private void copyToClipboard(TreeItem[] items, Clipboard clipboard) {
    StringBuilder sb = new StringBuilder();

    for (TreeItem item : items) {
        Object data = item.getData();
        if (data != null) {
            sb.append(data.toString());
            sb.append('\n');
        }
    }

    String content = sb.toString();
    if (content.length() > 0) {
        clipboard.setContents(
                new Object[] {sb.toString()},
                new Transfer[] {TextTransfer.getInstance()}
                );
    }
}