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


Java Control.addDisposeListener方法代码示例

本文整理汇总了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;
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:23,代码来源:SpecComparePage.java

示例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);
    }
}
 
开发者ID:baloise,项目名称:eZooKeeper,代码行数:27,代码来源:BaseControlContribution.java

示例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();
			}
		}
	});
}
 
开发者ID:BiglySoftware,项目名称:BiglyBT,代码行数:26,代码来源:FontUtils.java

示例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;
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:22,代码来源:PackageJsonComparePage.java

示例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);
}
 
开发者ID:baloise,项目名称:eZooKeeper,代码行数:13,代码来源:ElementBinding.java

示例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);
		}
	});
}
 
开发者ID:BiglySoftware,项目名称:BiglyBT,代码行数:11,代码来源:ImageLoader.java

示例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);

    }
 
开发者ID:baloise,项目名称:eZooKeeper,代码行数:12,代码来源:BaseAction.java


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