当前位置: 首页>>代码示例>>Java>>正文


Java ResourceTransfer类代码示例

本文整理汇总了Java中org.eclipse.ui.part.ResourceTransfer的典型用法代码示例。如果您正苦于以下问题:Java ResourceTransfer类的具体用法?Java ResourceTransfer怎么用?Java ResourceTransfer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ResourceTransfer类属于org.eclipse.ui.part包,在下文中一共展示了ResourceTransfer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setClipboard

import org.eclipse.ui.part.ResourceTransfer; //导入依赖的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

示例2: runWithEvent

import org.eclipse.ui.part.ResourceTransfer; //导入依赖的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

示例3: initializeEditor

import org.eclipse.ui.part.ResourceTransfer; //导入依赖的package包/类
protected void initializeEditor() {
	GraphicalViewer graphicalViewer = getGraphicalViewer();
	graphicalViewer.addDropTargetListener(new JSSTemplateTransferDropTargetListener(graphicalViewer));
	graphicalViewer.addDropTargetListener(new ReportUnitDropTargetListener(graphicalViewer));
	graphicalViewer.addDropTargetListener(new ImageResourceDropTargetListener(graphicalViewer, ResourceTransfer
			.getInstance()));
	graphicalViewer.addDropTargetListener(new ImageResourceDropTargetListener(graphicalViewer, FileTransfer
			.getInstance()));
	graphicalViewer.addDropTargetListener(new ImageResourceDropTargetListener(graphicalViewer, ImageURLTransfer
			.getInstance()));

	// Load the contributed drop providers for the contributed template styles
	List<TemplateViewProvider> dropProviders = JaspersoftStudioPlugin.getExtensionManager().getStylesViewProvider();
	for (TemplateViewProvider provider : dropProviders) {
		AbstractTransferDropTargetListener listener = provider.getDropListener(graphicalViewer);
		if (listener != null)
			graphicalViewer.addDropTargetListener(listener);
	}

	getEditorSite().getActionBarContributor();
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:22,代码来源:AbstractVisualEditor.java

示例4: preWindowOpen

import org.eclipse.ui.part.ResourceTransfer; //导入依赖的package包/类
public void preWindowOpen()
{
  IWorkbenchWindowConfigurer configurer = getWindowConfigurer();

  // show the shortcut bar and progress indicator, which are hidden by
  // default
  configurer.setShowPerspectiveBar(true);
  configurer.setShowFastViewBars(true);
  configurer.setShowProgressIndicator(true);

  // add the drag and drop support for the editor area
  configurer.addEditorAreaTransfer(EditorInputTransfer.getInstance());
  configurer.addEditorAreaTransfer(ResourceTransfer.getInstance());
  configurer.addEditorAreaTransfer(FileTransfer.getInstance());
  configurer.addEditorAreaTransfer(MarkerTransfer.getInstance());
  configurer.configureEditorAreaDropListener(new EditorAreaDropAdapter(
      configurer.getWindow()));

  hookTitleUpdateListeners(configurer);
}
 
开发者ID:debrief,项目名称:limpet,代码行数:21,代码来源:ApplicationWorkbenchWindowAdvisor.java

示例5: setClipboard

import org.eclipse.ui.part.ResourceTransfer; //导入依赖的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(IResource[] resources, String[] fileNames, 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 (SWTError e) {
		if (e.code != DND.ERROR_CANNOT_SET_CLIPBOARD) {
			throw e;
		}
		if (MessageDialog.openQuestion(shell, "Problem Copying to Clipboard", "There was a problem when accessing the system clipboard. Retry?")) {
			setClipboard(resources, fileNames, names);
		}
	}
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:28,代码来源:EditActionProvider.java

示例6: addDragAdapters

import org.eclipse.ui.part.ResourceTransfer; //导入依赖的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

示例7: setClipboard

import org.eclipse.ui.part.ResourceTransfer; //导入依赖的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(IResource[] resources, String[] fileNames, 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 (SWTError e) {
        if (e.code != DND.ERROR_CANNOT_SET_CLIPBOARD) {
            throw e;
        }
        if (MessageDialog.openQuestion(shell, "Problem with copy title", // TODO ResourceNavigatorMessages.CopyToClipboardProblemDialog_title,  //$NON-NLS-1$
                "Problem with copy.")) { //$NON-NLS-1$
            setClipboard(resources, fileNames, names);
        }
    }
}
 
开发者ID:fabioz,项目名称:Pydev,代码行数:30,代码来源:CopyAction.java

示例8: isDroppedDataAnImage

import org.eclipse.ui.part.ResourceTransfer; //导入依赖的package包/类
private boolean isDroppedDataAnImage(DropTargetEvent event) {
	if (ResourceTransfer.getInstance().isSupportedType(event.currentDataType)){
		if(event.data instanceof IResource[]){
			// Dropping an image resource from inside workspace
			IResource imgResource = ((IResource[])event.data)[0];
			return ImageUtils.hasValidFileImageExtension(
					imgResource.getProjectRelativePath().getFileExtension());
		}
	}
	else if(FileTransfer.getInstance().isSupportedType(event.currentDataType)){
		// Dropping an image resource from outside workspace
		if(event.data instanceof String[]){
			String filepath = ((String[])event.data)[0];
			if(filepath!=null){
				int lastIndexOfDot = filepath.lastIndexOf(".");
				if(lastIndexOfDot!=-1){
					String extension = filepath.substring(lastIndexOfDot+1);
					return ImageUtils.hasValidFileImageExtension(extension);				
				}
			}
		}
	}
	else if(ImageURLTransfer.getInstance().isSupportedType(event.currentDataType)){
		// Dropping an image dropped from a contributed view (i.e: repository view)
		return (event.data instanceof String);
	}

	return false;
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:30,代码来源:ImageResourceDropTargetListener.java

示例9: handleDrop

import org.eclipse.ui.part.ResourceTransfer; //导入依赖的package包/类
@Override
public IStatus handleDrop(final CommonDropAdapter adapter, final DropTargetEvent event, final Object target) {
	if (FileTransfer.getInstance().isSupportedType(event.currentDataType)) {
		final String[] files = (String[]) event.data;
		if (files != null && files.length > 0) {
			PasteAction.handlePaste(files);
			return Status.OK_STATUS;
		}
	} else if (ResourceTransfer.getInstance().isSupportedType(event.currentDataType)) {

	}
	return Status.CANCEL_STATUS;
}
 
开发者ID:gama-platform,项目名称:gama,代码行数:14,代码来源:NavigatorDropAssistant.java

示例10: getClipboardResources

import org.eclipse.ui.part.ResourceTransfer; //导入依赖的package包/类
protected final IResource[] getClipboardResources(TransferData[] availableDataTypes) {
	Transfer transfer= ResourceTransfer.getInstance();
	if (isAvailable(transfer, availableDataTypes)) {
		return (IResource[])getContents(fClipboard2, transfer, getShell());
	}
	return null;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:8,代码来源:PasteAction.java

示例11: canEnable

import org.eclipse.ui.part.ResourceTransfer; //导入依赖的package包/类
@Override
public boolean canEnable(TransferData[] availableDataTypes) {
	boolean resourceTransfer= isAvailable(ResourceTransfer.getInstance(), availableDataTypes);
	boolean javaElementTransfer= isAvailable(JavaElementTransfer.getInstance(), availableDataTypes);
	if (! javaElementTransfer)
		return canPasteSimpleProjects(availableDataTypes);
	if (! resourceTransfer)
		return canPasteJavaProjects(availableDataTypes);
	return canPasteJavaProjects(availableDataTypes) && canPasteSimpleProjects(availableDataTypes);
  	}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:11,代码来源:PasteAction.java

示例12: createDataTypeArray

import org.eclipse.ui.part.ResourceTransfer; //导入依赖的package包/类
private static Transfer[] createDataTypeArray(IResource[] resources, IJavaElement[] javaElements, String[] fileNames, TypedSource[] typedSources) {
	List<ByteArrayTransfer> result= new ArrayList<ByteArrayTransfer>(4);
	if (resources.length != 0)
		result.add(ResourceTransfer.getInstance());
	if (javaElements.length != 0)
		result.add(JavaElementTransfer.getInstance());
	if (fileNames.length != 0)
		result.add(FileTransfer.getInstance());
	if (typedSources.length != 0)
		result.add(TypedSourceTransfer.getInstance());
	result.add(TextTransfer.getInstance());
	return result.toArray(new Transfer[result.size()]);
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:14,代码来源:CopyToClipboardAction.java

示例13: start

import org.eclipse.ui.part.ResourceTransfer; //导入依赖的package包/类
public void start() {
	Assert.isLegal(!fStarted);

	int ops= DND.DROP_COPY | DND.DROP_MOVE | DND.DROP_LINK;

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

	fViewer.addDragSupport(ops, transfers, fDragAdapter);

	fStarted= true;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:15,代码来源:JdtViewerDragSupport.java

示例14: addDragAdapters

import org.eclipse.ui.part.ResourceTransfer; //导入依赖的package包/类
private void addDragAdapters(StructuredViewer viewer) {
	Transfer[] transfers= new Transfer[] { LocalSelectionTransfer.getInstance(), ResourceTransfer.getInstance() };
	int ops= DND.DROP_COPY | DND.DROP_LINK;

	JdtViewerDragAdapter dragAdapter= new JdtViewerDragAdapter(viewer);
	dragAdapter.addDragSourceListener(new SelectionTransferDragAdapter(viewer));
	dragAdapter.addDragSourceListener(new EditorInputTransferDragAdapter(viewer));
	dragAdapter.addDragSourceListener(new ResourceTransferDragAdapter(viewer));
	viewer.addDragSupport(ops, transfers, dragAdapter);
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:11,代码来源:JavaSearchResultPage.java

示例15: addDragAdapters

import org.eclipse.ui.part.ResourceTransfer; //导入依赖的package包/类
private void addDragAdapters(StructuredViewer viewer) {
	int ops= DND.DROP_COPY | DND.DROP_LINK;
	Transfer[] transfers= new Transfer[] { LocalSelectionTransfer.getInstance(), ResourceTransfer.getInstance(), FileTransfer.getInstance()};

	JdtViewerDragAdapter dragAdapter= new JdtViewerDragAdapter(viewer);
	dragAdapter.addDragSourceListener(new SelectionTransferDragAdapter(viewer));
	dragAdapter.addDragSourceListener(new EditorInputTransferDragAdapter(viewer));
	dragAdapter.addDragSourceListener(new ResourceTransferDragAdapter(viewer));
	dragAdapter.addDragSourceListener(new FileTransferDragAdapter(viewer));

	viewer.addDragSupport(ops, transfers, dragAdapter);
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:13,代码来源:TypeHierarchyViewPart.java


注:本文中的org.eclipse.ui.part.ResourceTransfer类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。