當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。