當前位置: 首頁>>代碼示例>>Java>>正文


Java Transfer類代碼示例

本文整理匯總了Java中org.eclipse.swt.dnd.Transfer的典型用法代碼示例。如果您正苦於以下問題:Java Transfer類的具體用法?Java Transfer怎麽用?Java Transfer使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Transfer類屬於org.eclipse.swt.dnd包,在下文中一共展示了Transfer類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: attachDropListener

import org.eclipse.swt.dnd.Transfer; //導入依賴的package包/類
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();

		}
	});
}
 
開發者ID:capitalone,項目名稱:Hydrograph,代碼行數:27,代碼來源:ExcelFormattingDialog.java

示例2: setClipboard

import org.eclipse.swt.dnd.Transfer; //導入依賴的package包/類
/**
 * 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);
		}
	}
}
 
開發者ID:gama-platform,項目名稱:gama,代碼行數:30,代碼來源:CopyAction.java

示例3: createContextMenuFor

import org.eclipse.swt.dnd.Transfer; //導入依賴的package包/類
/**
 * 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 ) );
}
 
開發者ID:eclipse,項目名稱:neoscada,代碼行數:22,代碼來源:ProtocolEditor.java

示例4: createContextMenuFor

import org.eclipse.swt.dnd.Transfer; //導入依賴的package包/類
/**
 * 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 ) );
}
 
開發者ID:eclipse,項目名稱:neoscada,代碼行數:29,代碼來源:ChartEditor.java

示例5: createContextMenuFor

import org.eclipse.swt.dnd.Transfer; //導入依賴的package包/類
/**
 * 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 ) );
}
 
開發者ID:eclipse,項目名稱:neoscada,代碼行數:21,代碼來源:ChartConfiguratorView.java

示例6: createContextMenuFor

import org.eclipse.swt.dnd.Transfer; //導入依賴的package包/類
/**
 * 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 ) );
}
 
開發者ID:eclipse,項目名稱:neoscada,代碼行數:22,代碼來源:MemoryEditor.java

示例7: createContextMenuFor

import org.eclipse.swt.dnd.Transfer; //導入依賴的package包/類
/**
 * 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 ) );
}
 
開發者ID:eclipse,項目名稱:neoscada,代碼行數:24,代碼來源:ComponentEditor.java

示例8: createXhtmlTree

import org.eclipse.swt.dnd.Transfer; //導入依賴的package包/類
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());
		}
	});
	
}
 
開發者ID:convertigo,項目名稱:convertigo-eclipse,代碼行數:19,代碼來源:SourcePickerView.java

示例9: addDefaultInternalCommands

import org.eclipse.swt.dnd.Transfer; //導入依賴的package包/類
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();
	});		
}
 
開發者ID:dakaraphi,項目名稱:eclipse-plugin-commander,代碼行數:26,代碼來源:InternalCommandContextProviderFactory.java

示例10: getTransferType

import org.eclipse.swt.dnd.Transfer; //導入依賴的package包/類
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);
}
 
開發者ID:TRUEJASONFANS,項目名稱:JavaFX-FrameRateMeter,代碼行數:22,代碼來源:OldFXCanvas.java

示例11: getTransferTypes

import org.eclipse.swt.dnd.Transfer; //導入依賴的package包/類
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;
}
 
開發者ID:TRUEJASONFANS,項目名稱:JavaFX-FrameRateMeter,代碼行數:17,代碼來源:OldFXCanvas.java

示例12: getMime

import org.eclipse.swt.dnd.Transfer; //導入依賴的package包/類
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;
}
 
開發者ID:TRUEJASONFANS,項目名稱:JavaFX-FrameRateMeter,代碼行數:25,代碼來源:OldFXCanvas.java

示例13: applyDragFromTableViewer

import org.eclipse.swt.dnd.Transfer; //導入依賴的package包/類
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());
		}
	});

}
 
開發者ID:capitalone,項目名稱:Hydrograph,代碼行數:17,代碼來源:ELTSWTWidgets.java

示例14: copySelectedAsTabDelimited

import org.eclipse.swt.dnd.Transfer; //導入依賴的package包/類
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();
	
}
 
開發者ID:capitalone,項目名稱:Hydrograph,代碼行數:27,代碼來源:CopyAction.java

示例15: copyToClipBoard

import org.eclipse.swt.dnd.Transfer; //導入依賴的package包/類
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 );
 }
}
 
開發者ID:BiglySoftware,項目名稱:BiglyBT,代碼行數:27,代碼來源:ClipboardCopy.java


注:本文中的org.eclipse.swt.dnd.Transfer類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。