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