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


Java FileTransfer.getInstance方法代碼示例

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


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

示例1: getTransferType

import org.eclipse.swt.dnd.FileTransfer; //導入方法依賴的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

示例2: createContextMenuFor

import org.eclipse.swt.dnd.FileTransfer; //導入方法依賴的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,代碼來源:DeploymentEditor.java

示例3: createContextMenuFor

import org.eclipse.swt.dnd.FileTransfer; //導入方法依賴的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

示例4: createContextMenuFor

import org.eclipse.swt.dnd.FileTransfer; //導入方法依賴的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:ObeoNetwork,項目名稱:M2Doc,代碼行數:23,代碼來源:GenconfEditor.java

示例5: createContextMenuFor

import org.eclipse.swt.dnd.FileTransfer; //導入方法依賴的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:cplutte,項目名稱:bts,代碼行數:22,代碼來源:BtsmodelEditor.java

示例6: createContextMenuFor

import org.eclipse.swt.dnd.FileTransfer; //導入方法依賴的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:mondo-project,項目名稱:mondo-demo-wt,代碼行數:23,代碼來源:WTSpec4MEditor.java

示例7: runWithEvent

import org.eclipse.swt.dnd.FileTransfer; //導入方法依賴的package包/類
@Override
public void runWithEvent(Event event) {
	ISelection selection = selectionProvider.getSelection();
	Collection<IProductModel> productModels = ProductSupport.toProductModels(selection);
	Collection<IFeatureModel> featureModels = FeatureSupport.toFeatureModels(selection);
	Collection<IPluginModelBase> pluginModels = PluginSupport.toPluginModels(selection);

	Collection<IProject> projects = new HashSet<IProject>();
	addUnderlyingResources(projects, productModels);
	addUnderlyingResources(projects, featureModels);
	addUnderlyingResources(projects, pluginModels);

	String[] fileData = new String[projects.size()];
	int i = 0;
	for (IProject project : projects) {
		fileData[i++] = project.getLocation().toOSString();
	}

	String textData = getTextData(productModels, featureModels, pluginModels);

	Object[] data = { projects.toArray(new IResource[projects.size()]), textData, fileData };
	Transfer[] dataTypes = { ResourceTransfer.getInstance(), TextTransfer.getInstance(), FileTransfer.getInstance() };
	clipboard.setContents(data, dataTypes);
}
 
開發者ID:secondfiddle,項目名稱:pep-tools,代碼行數:25,代碼來源:FeatureAndPluginCopyAction.java

示例8: addDragAdapters

import org.eclipse.swt.dnd.FileTransfer; //導入方法依賴的package包/類
private void addDragAdapters(StructuredViewer viewer) {
	int ops= DND.DROP_COPY | DND.DROP_LINK;

	Transfer[] transfers= new Transfer[] { LocalSelectionTransfer.getInstance(), ResourceTransfer.getInstance(), FileTransfer.getInstance()};

	DelegatingDragAdapter dragAdapter= new DelegatingDragAdapter() {
		@Override
		public void dragStart(DragSourceEvent event) {
			IStructuredSelection selection= (IStructuredSelection) fSelectionProviderMediator.getSelection();
			if (selection.isEmpty()) {
				event.doit= false;
				return;
			}
			super.dragStart(event);
		}
	};
	dragAdapter.addDragSourceListener(new SelectionTransferDragAdapter(fSelectionProviderMediator));
	dragAdapter.addDragSourceListener(new EditorInputTransferDragAdapter(fSelectionProviderMediator));
	dragAdapter.addDragSourceListener(new ResourceTransferDragAdapter(fSelectionProviderMediator));
	dragAdapter.addDragSourceListener(new FileTransferDragAdapter(fSelectionProviderMediator));

	viewer.addDragSupport(ops, transfers, dragAdapter);
}
 
開發者ID:trylimits,項目名稱:Eclipse-Postfix-Code-Completion,代碼行數:24,代碼來源:CallHierarchyViewPart.java

示例9: createPartControl

import org.eclipse.swt.dnd.FileTransfer; //導入方法依賴的package包/類
@Override
public void createPartControl(Composite parent) {
	parent.setLayout(new FillLayout());
	this.container = parent;
	CellEditorGlobalActionHanlder.getInstance().setIActionBars(getViewSite().getActionBars());
	DropTarget target = new DropTarget(parent, DND.DROP_MOVE | DND.DROP_COPY);
	Transfer[] tfs = new Transfer[] { FileTransfer.getInstance() };
	target.setTransfer(tfs);
	target.addDropListener(new DropTargetAdapter() {
		@Override
		public void drop(DropTargetEvent event) {
			Object o = event.data;
			if (o instanceof String[]) {
				String[] s = (String[]) o;
				if (s.length == 0 && s[0] == null || s[0].length() == 0) {
					return;
				}
				File f = new File(s[0]);
				if (f.exists() && f.isFile()) {
					open(f);
				}
			}
		}
	});
}
 
開發者ID:heartsome,項目名稱:tmxeditor8,代碼行數:26,代碼來源:TmxEditorViewer.java

示例10: createContextMenuFor

import org.eclipse.swt.dnd.FileTransfer; //導入方法依賴的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:kopl,項目名稱:SPLevo,代碼行數:22,代碼來源:JaMoPPDiffEditor.java

示例11: createContextMenuFor

import org.eclipse.swt.dnd.FileTransfer; //導入方法依賴的package包/類
private final MenuManager createContextMenuFor(StructuredViewer viewer) {
	
	MenuManager contextMenu = new MenuManager("#PopUp", "eu.cloudscale.env.toolcahin.treeview.menumanager");
	contextMenu.add(new Separator("additions"));
	contextMenu.setRemoveAllWhenShown(true);
	contextMenu.addMenuListener(this);
	Menu menu = contextMenu.createContextMenu(viewer.getControl());
	viewer.getControl().setMenu(menu);
	
	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));
	
	return contextMenu;
}
 
開發者ID:CloudScale-Project,項目名稱:Environment,代碼行數:17,代碼來源:EMFPopupMenuSupport.java

示例12: createContextMenuFor

import org.eclipse.swt.dnd.FileTransfer; //導入方法依賴的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:polarsys,項目名稱:time4sys,代碼行數:21,代碼來源:MappingEditor.java

示例13: createContextMenuFor

import org.eclipse.swt.dnd.FileTransfer; //導入方法依賴的package包/類
/**
 * Creates the generic menu for the given {@link StructuredViewer}.
 * 
 * @param viewer
 *            the {@link StructuredViewer}
 */
protected void createContextMenuFor(StructuredViewer viewer) {
    MenuManager contextMenu = new MenuManager("#PopUp");
    contextMenu.add(new Separator("additions"));
    contextMenu.setRemoveAllWhenShown(true);
    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));
}
 
開發者ID:ObeoNetwork,項目名稱:M2Doc,代碼行數:20,代碼來源:M2DocTemplateEditor.java

示例14: initializeDragAndDrop

import org.eclipse.swt.dnd.FileTransfer; //導入方法依賴的package包/類
private void initializeDragAndDrop() {
	int ops = DND.DROP_COPY | DND.DROP_DEFAULT;
	Transfer[] transfers = new Transfer[] { FileTransfer.getInstance() };
	TreeViewer viewer = getViewer();
	JSBuildFileViewDropAdapter adapter = new JSBuildFileViewDropAdapter(
			this);
	viewer.addDropSupport(ops, transfers, adapter);
}
 
開發者ID:angelozerr,項目名稱:jsbuild-eclipse,代碼行數:9,代碼來源:JSBuildFileView.java

示例15: createContextMenuFor

import org.eclipse.swt.dnd.FileTransfer; //導入方法依賴的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 -->
 *
 * @param viewer the viewer
 * @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:germanattanasio,項目名稱:traceability-assistant-eclipse-plugins,代碼行數:23,代碼來源:CarchaEditor.java


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