本文整理汇总了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);
}
示例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 ) );
}
示例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 ) );
}
示例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));
}
示例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));
}
示例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));
}
示例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);
}
示例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);
}
示例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);
}
}
}
});
}
示例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));
}
示例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;
}
示例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));
}
示例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));
}
示例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);
}
示例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));
}