• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Clipboard类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: run

import org.eclipse.gef.ui.actions.Clipboard; //导入依赖的package包/类
@Override
public void run() {
	List<?> list=(List<?>)Clipboard.getDefault().getContents();
	for(Object obj:list){
		if(obj instanceof NodeElementEditPart){
			NodeElementEditPart editPart=(NodeElementEditPart)obj;
			AbstractNodeElement model=editPart.getModel();
			AbstractNodeElement newModel=null;
			try{
				Class<?> clazz=model.getClass();
				Constructor<?> constructor=clazz.getConstructor(new Class[]{String.class});
				newModel=(AbstractNodeElement)constructor.newInstance(model.getLabel());
				newModel.setDescription(model.getDescription());
				newModel.setHeight(model.getHeight());
				newModel.setWidth(model.getWidth());
				newModel.setX(model.getX()+5);
				newModel.setY(model.getY()+5);
			}catch(Exception ex){
				ex.printStackTrace();
			}
			graphicalEditorPage.getProcessDefinition().addNode(newModel);
		}
	}
}
 
开发者ID:bsteker,项目名称:bdf2,代码行数:25,代码来源:PasteAction.java


示例2: canExecute

import org.eclipse.gef.ui.actions.Clipboard; //导入依赖的package包/类
@Override
public boolean canExecute() {
	ArrayList<Element> bList = (ArrayList<Element>) Clipboard.getDefault()
			.getContents();
	if (bList == null || bList.isEmpty())
		return false;
	Iterator<Element> it = bList.iterator();
	while (it.hasNext()) {
		Element element = (Element) it.next();
		if (isPastableElement(element)) {
			list.put(element, null);
		}else
			return false;
	}
	return true;
}
 
开发者ID:ShoukriKattan,项目名称:ForgedUI-Eclipse,代码行数:17,代码来源:PasteElementCommand.java


示例3: run

import org.eclipse.gef.ui.actions.Clipboard; //导入依赖的package包/类
@Override
public void run() {
	TreeSelection s = (TreeSelection) treeViewer.getSelection();
	TreePath[] p = s.getPaths();
	List<MResource> rlist = new ArrayList<MResource>();
	for (int i = 0; i < p.length; i++) {
		final Object obj = p[i].getLastSegment();
		if (obj instanceof MResource) {
			System.out.println(((MResource) obj).getToolTip());
			((MResource) obj).setCut(true);
			rlist.add((MResource) obj);
		}
	}
	if (!rlist.isEmpty())
		Clipboard.getDefault().setContents(rlist);
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:17,代码来源:CutResourceAction.java


示例4: canExecute

import org.eclipse.gef.ui.actions.Clipboard; //导入依赖的package包/类
@Override
public boolean canExecute() {
	if (list == null) {
		Object obj = Clipboard.getDefault().getContents();
		if (obj == null)
			return false;
		list = new LinkedHashMap<ANode, Command>();
		if (obj instanceof Collection<?>) {
			Collection<ANode> bList = (Collection<ANode>) obj;
			if (bList.isEmpty())
				return false;
			for (ANode node : bList) {
				if (isPastableNode(node))
					list.put(node, null);
			}
		} else if (obj instanceof ANode && isPastableNode(obj))
			list.put((ANode) obj, null);
	}
	return !list.isEmpty();
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:21,代码来源:PasteCommand.java


示例5: run

import org.eclipse.gef.ui.actions.Clipboard; //导入依赖的package包/类
public void run( )
{
	Object cloneElements = null;
	if ( getSelection( ) instanceof ExtendedItemHandle )
	{
		PropertyHandle container = ( (ExtendedItemHandle) getSelection( ) ).getPropertyHandle( "content" ); //$NON-NLS-1$
		cloneElements = DNDUtil.cloneSource( container.getContents( )
				.toArray( ) );
	}
	if ( getSelection( ) instanceof CrosstabCellHandle )
	{
		cloneElements = ( (CrosstabCellHandle) getSelection( ) ).getContents( )
				.toArray( );
	}
	if ( cloneElements != null )
	{
		Clipboard.getDefault( ).setContents( cloneElements );
	}
}
 
开发者ID:eclipse,项目名称:birt,代码行数:20,代码来源:CopyCrosstabCellContentsAction.java


示例6: execute

import org.eclipse.gef.ui.actions.Clipboard; //导入依赖的package包/类
public Object execute( ExecutionEvent event ) throws ExecutionException
{
	super.execute( event );

	Object[] selections = getElementHandles( ).toArray( );

	if ( selections.length != 1 )
		return Boolean.FALSE;

	CellHandle cellHandle = (CellHandle) selections[0];

	if ( Policy.TRACING_ACTIONS )
	{
		System.out.println( "Copy action >> Copy " + Arrays.toString( selections ) ); //$NON-NLS-1$
	}
	Object cloneElements = DNDUtil.cloneSource( cellHandle.getContent( )
			.getContents( )
			.toArray( ) );
	if ( cloneElements != null )
	{
		Clipboard.getDefault( ).setContents( cloneElements );
	}

	return Boolean.TRUE;
}
 
开发者ID:eclipse,项目名称:birt,代码行数:26,代码来源:CopyCellContentsHandler.java


示例7: execute

import org.eclipse.gef.ui.actions.Clipboard; //导入依赖的package包/类
public Object execute( ExecutionEvent event ) throws ExecutionException
{

	super.execute( event );
	
	Object[] selection = getElementHandles().toArray( );
	if ( Policy.TRACING_ACTIONS )
	{
		System.out.println( "Cut action >> Cut " + Arrays.toString( selection ) ); //$NON-NLS-1$
	}
	Object cloneElements = DNDUtil.cloneSource( selection );
	DeleteAction action = createDeleteAction( selection );
	action.run( );
	if ( action.hasExecuted( ) )
	{
		Clipboard.getDefault( ).setContents( cloneElements );
	}
	
	return Boolean.TRUE;
}
 
开发者ID:eclipse,项目名称:birt,代码行数:21,代码来源:CutHandler.java


示例8: execute

import org.eclipse.gef.ui.actions.Clipboard; //导入依赖的package包/类
public Object execute( ExecutionEvent event ) throws ExecutionException
{
	super.execute( event );

	Object[] selection = getElementHandles().toArray( );
	
	if ( Policy.TRACING_ACTIONS )
	{
		System.out.println( "Copy action >> Copy " + Arrays.toString( selection ) ); //$NON-NLS-1$
	}
	Object cloneElements = DNDUtil.cloneSource( selection );
	if(cloneElements != null)
	{
		Clipboard.getDefault( ).setContents( cloneElements );
	}	
	
	return Boolean.TRUE;
}
 
开发者ID:eclipse,项目名称:birt,代码行数:19,代码来源:CopyHandler.java


示例9: canExecute

import org.eclipse.gef.ui.actions.Clipboard; //导入依赖的package包/类
@Override
public boolean canExecute() {
	map = (Map<GWNode,EditPart>)Clipboard.getDefault().getContents();
	if (map == null || map.isEmpty())
		return false;

	Iterator<GWNode> it = map.keySet().iterator();
	while (it.hasNext()) {
		GWNode gWNode = (GWNode) it.next();
		if (!isPastableNode(gWNode)) {
			map.remove(gWNode);
		}
	}
	return true;
}
 
开发者ID:gw4e,项目名称:gw4e.project,代码行数:16,代码来源:PasteNodeCommand.java


示例10: canExecute

import org.eclipse.gef.ui.actions.Clipboard; //导入依赖的package包/类
@Override
public boolean canExecute() {
	List bList = (ArrayList) Clipboard.getDefault().getContents();
	if (bList == null || bList.isEmpty())
		return false;
	Iterator it = bList.iterator();
	while (it.hasNext()) {
		Object node = (Object) it.next();
		if (isPastableNode(node)) {
			list.put(node, null);
		}
	}

	return true;
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:16,代码来源:ComponentPasteCommand.java


示例11: calculateEnabled

import org.eclipse.gef.ui.actions.Clipboard; //导入依赖的package包/类
@Override
protected boolean calculateEnabled() {
	if(Clipboard.getDefault().getContents()!=null){
		return true;
	}else{
		return false;			
	}
}
 
开发者ID:bsteker,项目名称:bdf2,代码行数:9,代码来源:PasteAction.java


示例12: run

import org.eclipse.gef.ui.actions.Clipboard; //导入依赖的package包/类
@Override
public void run() {
	TreeSelection s = (TreeSelection) treeViewer.getSelection();
	TreePath[] p = s.getPaths();
	List<MResource> rlist = new ArrayList<MResource>();
	for (int i = 0; i < p.length; i++) {
		final Object obj = p[i].getLastSegment();
		if (obj instanceof MResource) {
			rlist.add((MResource) obj);
		}
	}
	if (!rlist.isEmpty())
		Clipboard.getDefault().setContents(rlist);
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:15,代码来源:CopyResourceAction.java


示例13: isEnabled

import org.eclipse.gef.ui.actions.Clipboard; //导入依赖的package包/类
@Override
public boolean isEnabled() {
	boolean res = super.isEnabled();
	boolean iscut = false;
	contents = Clipboard.getDefault().getContents();
	if (res && contents != null && contents instanceof List<?>) {
		List<?> list = (List<?>) contents;
		ANode parent = getSelected();
		res = false;
		for (Object obj : list)
			if (obj instanceof MResource && obj instanceof ICopyable) {
				ICopyable c = (ICopyable) obj;
				if (c.isCopyable2(parent)) {
					iscut = ((MResource) obj).isCut();
					res = true;
					break;
				}
			}
	}
	if (res) {
		Object firstElement = ((TreeSelection) treeViewer.getSelection()).getFirstElement();
		res = firstElement != null;
		if (res) {
			if (firstElement instanceof MResource) {
				MResource mres = (MResource) firstElement;
				int pmask = mres.getValue().getPermissionMask(mres.getWsClient());
				res = res && (pmask == 1 || (pmask & 8) == 8);
			}
		}
	}
	return res;
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:33,代码来源:PasteResourceAction.java


示例14: execute

import org.eclipse.gef.ui.actions.Clipboard; //导入依赖的package包/类
@Override
public void execute() {
	if (canExecute()) {
		for (ICopyable n : list)
			((ANode) n).setCut(true);
		Clipboard.getDefault().setContents(list);
	}
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:9,代码来源:CutCommand.java


示例15: getClipBoardContents

import org.eclipse.gef.ui.actions.Clipboard; //导入依赖的package包/类
protected Object getClipBoardContents( )
{
	Object obj = Clipboard.getDefault( ).getContents( );
	if ( obj instanceof Object[] )
	{
		return ( (Object[]) obj )[0];
	}
	return obj;
}
 
开发者ID:eclipse,项目名称:birt,代码行数:10,代码来源:InsertPasteColumnAction.java


示例16: execute

import org.eclipse.gef.ui.actions.Clipboard; //导入依赖的package包/类
@Override
public void execute() {
	Clipboard.getDefault().setContents(list);
	redo();
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:6,代码来源:SubJobCommand.java


示例17: execute

import org.eclipse.gef.ui.actions.Clipboard; //导入依赖的package包/类
@Override
public void execute() {
	if (canExecute()){
		Clipboard.getDefault().setContents(list);
	}
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:7,代码来源:ComponentCopyCommand.java


示例18: run

import org.eclipse.gef.ui.actions.Clipboard; //导入依赖的package包/类
@Override
public void run() {
	Clipboard.getDefault().setContents(super.getSelectedObjects());
}
 
开发者ID:bsteker,项目名称:bdf2,代码行数:5,代码来源:CopyAction.java


示例19: execute

import org.eclipse.gef.ui.actions.Clipboard; //导入依赖的package包/类
@Override
public void execute() {
	if (canExecute())
		Clipboard.getDefault().setContents(list);
}
 
开发者ID:ShoukriKattan,项目名称:ForgedUI-Eclipse,代码行数:6,代码来源:CopyElementCommand.java


示例20: getClipBoardContents

import org.eclipse.gef.ui.actions.Clipboard; //导入依赖的package包/类
protected Object getClipBoardContents( )
{
	return Clipboard.getDefault( ).getContents( );
}
 
开发者ID:eclipse,项目名称:birt,代码行数:5,代码来源:PasteAction.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java MultithreadEventLoopGroup类代码示例发布时间:2022-05-23
下一篇:
Java Result类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap