本文整理汇总了Java中org.eclipse.swt.widgets.Control.addDisposeListener方法的典型用法代码示例。如果您正苦于以下问题:Java Control.addDisposeListener方法的具体用法?Java Control.addDisposeListener怎么用?Java Control.addDisposeListener使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.swt.widgets.Control
的用法示例。
在下文中一共展示了Control.addDisposeListener方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createPreviewer
import org.eclipse.swt.widgets.Control; //导入方法依赖的package包/类
private Control createPreviewer(Composite parent) {
final CompareConfiguration compareConfiguration = new CompareConfiguration();
compareConfiguration.setLeftLabel("Original " + docTypeName);
compareConfiguration.setLeftEditable(false);
compareConfiguration.setRightLabel("Updated " + docTypeName);
compareConfiguration.setRightEditable(false);
compareConfiguration.setProperty(CompareConfiguration.IGNORE_WHITESPACE, Boolean.FALSE);
compareConfiguration.setProperty(PREFIX_SUFFIX_PROPERTY, fPrefixSuffix);
fViewer = new TextMergeViewer(parent, SWT.NONE, compareConfiguration);
// add initial input in order to avoid problems when disposing the viewer later:
fViewer.setInput(new DiffNode(new TargetElementFromString(""), new TargetElementFromString("")));
Control control = fViewer.getControl();
control.addDisposeListener(new DisposeListener() {
@Override
public void widgetDisposed(DisposeEvent e) {
compareConfiguration.dispose();
}
});
return control;
}
示例2: addControlDisposeListener
import org.eclipse.swt.widgets.Control; //导入方法依赖的package包/类
/**
* Adds a {@link DisposeListener} to the created {@link Control}. Listeners can be added either before or after the
* Control is created.
*
* @param disposeListener The {@link DisposeListener} to add.
*
* @see Control#addControlDisposeListener(DisposeListener)
*/
public void addControlDisposeListener(DisposeListener disposeListener) {
Control control = getControl();
if (control != null) {
if (control.isDisposed()) {
return;
}
control.addDisposeListener(disposeListener);
}
else {
if (_DisposeListeners == null) {
_DisposeListeners = new LinkedHashSet<DisposeListener>();
}
_DisposeListeners.add(disposeListener);
}
}
示例3: setFontHeight
import org.eclipse.swt.widgets.Control; //导入方法依赖的package包/类
/**
* Change the height of the installed <code>Font</code> and takes care of disposing
* the new font when the control is disposed
* @param control
* @param height
* @param style one or both of SWT.BOLD, SWT.ITALIC, or SWT.NORMAL
*/
public static void setFontHeight(Control control, int height, int style) {
FontData[] fDatas = control.getFont().getFontData();
for (int i = 0; i < fDatas.length; i++) {
fDatas[i].height = height;
fDatas[i].setStyle(style);
}
final Font newFont = new Font(control.getDisplay(), fDatas);
control.setFont(newFont);
control.addDisposeListener(new DisposeListener() {
@Override
public void widgetDisposed(DisposeEvent e) {
if (null != newFont && !newFont.isDisposed()) {
newFont.dispose();
}
}
});
}
示例4: createPreviewer
import org.eclipse.swt.widgets.Control; //导入方法依赖的package包/类
private Control createPreviewer(Composite parent) {
final CompareConfiguration compareConfiguration = new CompareConfiguration();
compareConfiguration.setLeftLabel("Original package.json");
compareConfiguration.setLeftEditable(false);
compareConfiguration.setRightLabel("Merged package.json");
compareConfiguration.setRightEditable(false);
compareConfiguration.setProperty(CompareConfiguration.IGNORE_WHITESPACE, Boolean.FALSE);
fViewer = new TextMergeViewer(parent, SWT.NONE, compareConfiguration);
// add initial input in order to avoid problems when disposing the viewer later:
fViewer.setInput(new DiffNode(new DiffElementFromString(""), new DiffElementFromString("")));
Control control = fViewer.getControl();
control.addDisposeListener(new DisposeListener() {
@Override
public void widgetDisposed(DisposeEvent e) {
compareConfiguration.dispose();
}
});
return control;
}
示例5: addViewerControlDisposeListener
import org.eclipse.swt.widgets.Control; //导入方法依赖的package包/类
private void addViewerControlDisposeListener() {
StructuredViewer viewer = getViewer();
if (viewer == null) {
return;
}
Control control = viewer.getControl();
if (control.isDisposed()) {
return;
}
control.addDisposeListener(_ControlDisposeListener);
}
示例6: setBackgroundImage
import org.eclipse.swt.widgets.Control; //导入方法依赖的package包/类
public void setBackgroundImage(Control control, final String key) {
Image bg = getImage(key);
control.setBackgroundImage(bg);
control.addDisposeListener(new DisposeListener() {
@Override
public void widgetDisposed(DisposeEvent e) {
releaseImage(key);
}
});
}
示例7: hookViewer
import org.eclipse.swt.widgets.Control; //导入方法依赖的package包/类
protected void hookViewer(Viewer viewer) {
final Control control = viewer.getControl();
if (_SelectionProviderDisposeListener == null) {
_SelectionProviderDisposeListener = new SelectionProviderDisposeListener();
}
control.addDisposeListener(_SelectionProviderDisposeListener);
}