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


Java DND.ERROR_CANNOT_SET_CLIPBOARD属性代码示例

本文整理汇总了Java中org.eclipse.swt.dnd.DND.ERROR_CANNOT_SET_CLIPBOARD属性的典型用法代码示例。如果您正苦于以下问题:Java DND.ERROR_CANNOT_SET_CLIPBOARD属性的具体用法?Java DND.ERROR_CANNOT_SET_CLIPBOARD怎么用?Java DND.ERROR_CANNOT_SET_CLIPBOARD使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.eclipse.swt.dnd.DND的用法示例。


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

示例1: setClipboard

/**
 * 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,代码行数:29,代码来源:CopyAction.java

示例2: setClipboard

/**
 * 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,代码行数:27,代码来源:EditActionProvider.java

示例3: copyToClipboard

private void copyToClipboard(IResource[] resources, String[] fileNames, String names, IJavaElement[] javaElements, TypedSource[] typedSources, int repeat, Clipboard clipboard) {
	final int repeat_max_count= 10;
	try{
		clipboard.setContents(createDataArray(resources, javaElements, fileNames, names, typedSources),
								createDataTypeArray(resources, javaElements, fileNames, typedSources));
	} catch (SWTError e) {
		if (e.code != DND.ERROR_CANNOT_SET_CLIPBOARD || repeat >= repeat_max_count)
			throw e;
		if (fAutoRepeatOnFailure) {
			try {
				Thread.sleep(500);
			} catch (InterruptedException e1) {
				// do nothing.
			}
		}
		if (fAutoRepeatOnFailure || MessageDialog.openQuestion(fShell, ReorgMessages.CopyToClipboardAction_4, ReorgMessages.CopyToClipboardAction_5))
			copyToClipboard(resources, fileNames, names, javaElements, typedSources, repeat + 1, clipboard);
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:19,代码来源:CopyToClipboardAction.java

示例4: run

@Override
public void run() {
	IStructuredSelection selection= (IStructuredSelection) fLocationViewer.getSelection();
	StringBuffer buf= new StringBuffer();
	for (Iterator<?> iterator= selection.iterator(); iterator.hasNext();) {
		CallLocation location= (CallLocation) iterator.next();
		buf.append(location.getLineNumber()).append('\t').append(location.getCallText());
		buf.append('\n');
	}
	TextTransfer plainTextTransfer = TextTransfer.getInstance();
	try {
		fClipboard.setContents(
				new String[]{ CopyCallHierarchyAction.convertLineTerminators(buf.toString()) },
				new Transfer[]{ plainTextTransfer });
	} catch (SWTError e){
		if (e.code != DND.ERROR_CANNOT_SET_CLIPBOARD)
			throw e;
		if (MessageDialog.openQuestion(fViewSite.getShell(), CallHierarchyMessages.CopyCallHierarchyAction_problem, CallHierarchyMessages.CopyCallHierarchyAction_clipboard_busy))
			run();
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:21,代码来源:LocationCopyAction.java

示例5: run

@Override
public void run() {
	StringBuffer buf= new StringBuffer();
	addCalls(fViewer.getTree().getSelection()[0], 0, buf);

	TextTransfer plainTextTransfer= TextTransfer.getInstance();
	try {
		fClipboard.setContents(
				new String[] { convertLineTerminators(buf.toString()) },
				new Transfer[] { plainTextTransfer });
	} catch (SWTError e) {
		if (e.code != DND.ERROR_CANNOT_SET_CLIPBOARD)
			throw e;
		if (MessageDialog.openQuestion(fView.getViewSite().getShell(), CallHierarchyMessages.CopyCallHierarchyAction_problem, CallHierarchyMessages.CopyCallHierarchyAction_clipboard_busy))
			run();
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:17,代码来源:CopyCallHierarchyAction.java

示例6: copyToClipboard

private void copyToClipboard(Clipboard clipboard, String str, Shell shell) {
	try {
		clipboard.setContents(new String[] { str }, new Transfer[] { TextTransfer.getInstance() });
	} catch (SWTError ex) {
		if (ex.code != DND.ERROR_CANNOT_SET_CLIPBOARD) throw ex;
		String title = ActionMessages.CopyToClipboardAction_error_title;
		String message = ActionMessages.CopyToClipboardAction_error_message;
		if (MessageDialog.openQuestion(shell, title, message)) copyToClipboard(clipboard, str, shell);
	}
}
 
开发者ID:grosenberg,项目名称:fluentmark,代码行数:10,代码来源:CopyToClipboardAction.java

示例7: copyToClipboard

private void copyToClipboard(ITextSelection selection, int repeatCount) {
	try{
		fClipboard.setContents(new String[] { selection.getText() }, new Transfer[] { TextTransfer.getInstance() });
	} catch (SWTError e) {
		if (e.code != DND.ERROR_CANNOT_SET_CLIPBOARD || repeatCount >= MAX_REPEAT_COUNT)
			throw e;

		if (MessageDialog.openQuestion(getShell(), InfoViewMessages.CopyToClipboard_error_title, InfoViewMessages.CopyToClipboard_error_message))
			copyToClipboard(selection, repeatCount + 1);
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:11,代码来源:CopyToClipboardAction.java

示例8: setClipboardContents

private void setClipboardContents(Clipboard clipboard, Object[] datas, Transfer[] transfers) {
	try {
		clipboard.setContents(datas, transfers);
	} catch (SWTError e) {
		if (e.code != DND.ERROR_CANNOT_SET_CLIPBOARD) {
			throw e;
		}
		// silently fail.  see e.g. https://bugs.eclipse.org/bugs/show_bug.cgi?id=65975
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:10,代码来源:ClipboardOperationAction.java

示例9: setClipboard

/**
  * 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,
                         WorkbenchNavigatorMessages.actions_CopyAction_msgTitle, // TODO ResourceNavigatorMessages.CopyToClipboardProblemDialog_title,  //$NON-NLS-1$
                         WorkbenchNavigatorMessages.actions_CopyAction_msg)) { //$NON-NLS-1$
	setClipboard(resources, fileNames, names);
}
     }
 }
 
开发者ID:heartsome,项目名称:translationstudio8,代码行数:35,代码来源:CopyAction.java


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