本文整理匯總了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());
}
示例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);
}
示例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;
}
示例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;
}