下面列出了org.eclipse.swt.widgets.Shell#setData ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
private void configureContext(Shell shell) {
final IEclipseContext e4Context = ((Workbench) PlatformUI.getWorkbench()).getContext();
while (!Objects.equals(e4Context.getActiveLeaf(), e4Context)) {
e4Context.getActiveLeaf().deactivate();
}
final IEclipseContext expressionDialogContext = e4Context.createChild("expressionDialogContext");
expressionDialogContext.activate();
shell.setData("org.eclipse.e4.ui.shellContext", expressionDialogContext);
}
/**
* Constructs a new instance of this class given its parent.
*
* @param shell a shell that will be the parent of the new instance (cannot
* be null)
* @exception IllegalArgumentException
* <ul>
* <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
* </ul>
* @exception SWTException
* <ul>
* <li>ERROR_WIDGET_DISPOSED - if the parent has been
* disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the
* thread that created the parent</li>
* </ul>
*/
public DarkPanel(final Shell shell) {
if (shell == null) {
SWT.error(SWT.ERROR_NULL_ARGUMENT);
}
if (shell.isDisposed()) {
SWT.error(SWT.ERROR_INVALID_ARGUMENT);
}
parent = shell;
if (shell.getData(DARK_PANEL_KEY) != null) {
throw new IllegalArgumentException("This shell has already an infinite panel attached on it !");
}
shell.setData(DARK_PANEL_KEY, this);
alpha = 100;
}
/**
* Constructs a new instance of this class given its parent.
*
* @param shell a shell that will be the parent of the new instance (cannot
* be null)
* @exception IllegalArgumentException
* <ul>
* <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
* </ul>
* @exception SWTException
* <ul>
* <li>ERROR_WIDGET_DISPOSED - if the parent has been
* disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the
* thread that created the parent</li>
* </ul>
*/
public BlurredPanel(final Shell shell) {
if (shell == null) {
SWT.error(SWT.ERROR_NULL_ARGUMENT);
}
if (shell.isDisposed()) {
SWT.error(SWT.ERROR_INVALID_ARGUMENT);
}
parent = shell;
if (shell.getData(BLURED_PANEL_KEY) != null) {
throw new IllegalArgumentException("This shell has already an infinite panel attached on it !");
}
shell.setData(BLURED_PANEL_KEY, this);
radius = 2;
}
@Override
protected void configureShell(final Shell shell) {
super.configureShell(shell);
shell.setData(SWTBOT_WIDGET_ID_KEY, SWTBOT_ID_EXPRESSIONVIEWER_PROPOSAL_SHELL);
}