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


Java Control.setData方法代码示例

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


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

示例1: createControl

import org.eclipse.swt.widgets.Control; //导入方法依赖的package包/类
public void createControl(Composite parent) {
	sash = new SashForm(parent, SWT.VERTICAL);
	IActionBars bars = getSite().getActionBars();
	ActionRegistry ar = getActionRegistry();

	bars.setGlobalActionHandler(ActionFactory.COPY.getId(), ar.getAction(ActionFactory.COPY.getId()));
	bars.setGlobalActionHandler(ActionFactory.PASTE.getId(), ar.getAction(ActionFactory.PASTE.getId()));

	OutLineComposite composite = new OutLineComposite(filter, sash, SWT.NONE);

	Control tree = getViewer().createControl(composite.getComposite());
	tree.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 10, 1));
	tree.setData(GW_WIDGET_ID,GW_OUTLINE_ELEMENTS_TREE);
	getViewer().setEditDomain(getEditDomain());
	getViewer().setEditPartFactory(gwtpf);
	getViewer().setContents(gWGraph);
	
	getSelectionSynchronizer().addViewer(getViewer());

}
 
开发者ID:gw4e,项目名称:gw4e.project,代码行数:21,代码来源:GW4EEditor.java

示例2: bindControl

import org.eclipse.swt.widgets.Control; //导入方法依赖的package包/类
/**
 * Bind a control. If it is a composite, also bind all of its children.
 * @param control Highest level control.
 * @param unbind If true, unbind instead of bind.
 */
private static void bindControl(IWorkbenchPartReference partRef,
		Control control, boolean unbind) {
    //If composite, bind children.
    if (control instanceof Composite) {
        Composite composite = (Composite) control;

        Control[] children = composite.getChildren();
        if (children.length > 0 && children[0] != null) {
           for (Control curControl : children)
               bindControl(partRef, curControl, unbind);
        }
    }
    
    //control should not have any data set
    //upon reaching this part of the method
    IGazeHandler handler = GazeHandlerFactory.
                           createHandler(control, partRef);
    if (handler != null && !unbind)
        control.setData(KEY_HANDLER, handler);
    else
        control.setData(KEY_HANDLER, null);
}
 
开发者ID:SERESLab,项目名称:iTrace-Archive,代码行数:28,代码来源:HandlerBindManager.java

示例3: dataSourceChanged

import org.eclipse.swt.widgets.Control; //导入方法依赖的package包/类
@Override
public Object dataSourceChanged(SWTSkinObject skinObject, Object params) {
	datasource = params;
	if (soListArea != null) {
		Control control = soListArea.getControl();

		if ( !control.isDisposed()){

			control.setData("DataSource", params);
		}
	}

	return null;
}
 
开发者ID:BiglySoftware,项目名称:BiglyBT,代码行数:15,代码来源:SBC_LibraryView.java

示例4: setCommentAndFormatLinks

import org.eclipse.swt.widgets.Control; //导入方法依赖的package包/类
private static boolean setCommentAndFormatLinks(Control c, String new_comment) {
 String old_comment = (String)c.getData("comment");
 if (new_comment == null) {new_comment = "";}
 if (new_comment.equals(old_comment)) {return false;}

 c.setData("comment", new_comment);
 if (c instanceof Label) {
  ((Label) c).setText(new_comment);
 } else if (c instanceof Link) {
				String sNewComment;
  sNewComment = new_comment.replaceAll(
						"([^=\">][\\s]+|^)((?:https?://|chat:)[\\S]+)", "$1<A HREF=\"$2\">$2</A>");
				// need quotes around url
  sNewComment = sNewComment.replaceAll("(href=)(htt[^\\s>]+)", "$1\"$2\"");

  	// probably want to URL decode the link text if it is a URL

  try{
	  Pattern p = Pattern.compile("(?i)(<A HREF=[^>]*>)([^<]*</A>)");

	  Matcher m = p.matcher( sNewComment );

	  boolean result = m.find();

	  if ( result ){

		  StringBuffer sb = new StringBuffer();

		  while( result ){

			  m.appendReplacement(sb, m.group(1));

			  String str = m.group(2);

			  sb.append( UrlUtils.decode( str ));

			  result = m.find();
		  }

		  m.appendTail(sb);

		  sNewComment = sb.toString();

	  }}catch( Throwable e ){
	  }

				// Examples:
				// http://cowbow.com/fsdjl&sdfkj=34.sk9391 moo
				// <A HREF=http://cowbow.com/fsdjl&sdfkj=34.sk9391>moo</a>
				// <A HREF="http://cowbow.com/fsdjl&sdfkj=34.sk9391">moo</a>
				// <A HREF="http://cowbow.com/fsdjl&sdfkj=34.sk9391">http://moo.com</a>
  ((Link)c).setText(sNewComment);
 }

 return true;
}
 
开发者ID:BiglySoftware,项目名称:BiglyBT,代码行数:57,代码来源:GeneralView.java


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