本文整理汇总了Java中org.eclipse.swt.widgets.Composite.addDisposeListener方法的典型用法代码示例。如果您正苦于以下问题:Java Composite.addDisposeListener方法的具体用法?Java Composite.addDisposeListener怎么用?Java Composite.addDisposeListener使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.swt.widgets.Composite
的用法示例。
在下文中一共展示了Composite.addDisposeListener方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createControl
import org.eclipse.swt.widgets.Composite; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public void createControl(Composite parent) {
Composite listComposite = new Composite(parent, NONE);
listComposite.setLayout(new FillLayout());
ListViewer projectListViewer = new ListViewer(listComposite, SWT.BORDER | SWT.MULTI);
projectListViewer.setContentProvider(ArrayContentProvider.getInstance());
projectListViewer.setInput(getNonTestProjects());
// Data binding
DataBindingContext databindingContext = new DataBindingContext();
parent.addDisposeListener(e -> databindingContext.dispose());
databindingContext.bindList(ViewersObservables.observeMultiSelection(projectListViewer),
PojoProperties.list(N4MFProjectInfo.class, N4MFProjectInfo.TESTED_PROJECT_PROP_NAME)
.observe(projectInfo));
setControl(listComposite);
}
示例2: createTopContent
import org.eclipse.swt.widgets.Composite; //导入方法依赖的package包/类
protected void createTopContent(String title, InputStream imageName) {
Composite top = new Composite(composite, SWT.NONE);
top.setLayout(new GridLayout(2, false));
top.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
top.setBackground(display.getSystemColor(SWT.COLOR_WHITE));
final Image image = new Image(top.getDisplay(), imageName);
Image resized = resizeImage(image, 48, 48);
Label labelImage = new Label(top, SWT.CENTER);
labelImage.setImage(resized);
Label label = new Label(top, SWT.NONE);
label.setText(title);
final Font newFont = new Font(display, fontName, getTitleFontSize(), SWT.NORMAL);
label.setFont(newFont);
label.setBackground(rowColorSelection);
createLineContent();
top.addDisposeListener(e -> {
newFont.dispose();
resized.dispose();
});
}
示例3: createControl
import org.eclipse.swt.widgets.Composite; //导入方法依赖的package包/类
public void createControl ( final Composite parent )
{
this.wrapper = new Composite ( parent, SWT.NONE );
this.wrapper.setLayout ( GridLayoutFactory.slimStack () );
final Composite extensionSpace = new Composite ( this.wrapper, SWT.NONE );
extensionSpace.setLayoutData ( new GridData ( SWT.FILL, SWT.FILL, true, false ) );
extensionSpace.setLayout ( new RowLayout ( SWT.HORIZONTAL ) );
this.chartArea = new ChartArea ( this.wrapper, SWT.NONE );
this.chartArea.setLayoutData ( new GridData ( SWT.FILL, SWT.FILL, true, true ) );
this.viewer = new ChartViewer ( this.chartArea.getDisplay (), this.chartArea.getChartRenderer (), this.configuration, new CompositeExtensionSpace ( extensionSpace ), null );
parent.addDisposeListener ( new DisposeListener () {
@Override
public void widgetDisposed ( final DisposeEvent e )
{
handleDispose ();
}
} );
}
示例4: createComposite
import org.eclipse.swt.widgets.Composite; //导入方法依赖的package包/类
private Composite createComposite ( final Composite wrapper )
{
this.dbc = new DataBindingContext ( DisplayRealm.getRealm ( wrapper.getDisplay () ) );
wrapper.addDisposeListener ( new DisposeListener () {
@Override
public void widgetDisposed ( final DisposeEvent e )
{
CallbackDialog.this.dbc.dispose ();
}
} );
final Composite composite = new Composite ( wrapper, SWT.NONE );
composite.setLayout ( new GridLayout ( 2, false ) );
for ( final CallbackWidgetFactory factory : this.factories )
{
factory.createGridWidgets ( this.dbc, composite );
}
return composite;
}
示例5: init
import org.eclipse.swt.widgets.Composite; //导入方法依赖的package包/类
private void init(Composite parent, BrowserContext browserContext) {
browserView = new BrowserView(new Browser(browserContext));
Frame frame = SWT_AWT.new_Frame(this);
frame.add(browserView);
threadSwt = parent.getDisplay().getThread();
parent.addDisposeListener(new DisposeListener() {
@Override
public void widgetDisposed(DisposeEvent e) {
dispose();
}
});
}
示例6: initialize
import org.eclipse.swt.widgets.Composite; //导入方法依赖的package包/类
public void initialize(Composite composite, int defaultOrientation) {
display = composite.getDisplay();
composite.addDisposeListener((DisposeListener) this::dispose);
tableViewer = new TableViewer(composite, SWT.MULTI | SWT.FULL_SELECTION | SWT.VIRTUAL | SWT.NO_BACKGROUND | SWT.DOUBLE_BUFFERED );
table = tableViewer.getTable();
GridData gridData = new GridData();
gridData.verticalAlignment = GridData.FILL;
gridData.horizontalSpan = 2;
gridData.grabExcessHorizontalSpace = true;
gridData.grabExcessVerticalSpace = true;
gridData.horizontalAlignment = GridData.FILL;
tableViewer.getControl().setLayoutData(gridData);
tableViewer.setContentProvider((ILazyContentProvider) rowIndex -> tableViewer.replace(contentProvider().getTableEntries().get(rowIndex), rowIndex));
table.addListener(SWT.Selection, event-> {
TableItem item = (TableItem) event.item;
contentProvider().setCursorIndex(contentProvider().getRowIndex((RankedItem<T>) item.getData()));
handleSelection();
});
composite.getShell().addListener(SWT.Resize, event -> autoAdjustColumnWidths(composite));
// TODO try throttleLast or custom scheduler
//subjectFilter.debounce(0, TimeUnit.MILLISECONDS).subscribe( filter -> handleRefresh(filter));
}
示例7: ProjectCompareTree
import org.eclipse.swt.widgets.Composite; //导入方法依赖的package包/类
/**
* Create an instance.
*/
public ProjectCompareTree(Composite parent, int style, ProjectCompareTreeHelper projectCompareTreeHelper) {
super(parent, style);
this.projectCompareTreeHelper = projectCompareTreeHelper;
parent.addDisposeListener(new DisposeListener() {
@Override
public void widgetDisposed(DisposeEvent e) {
onDispose();
}
});
col_diff_error_fg = new Color(parent.getDisplay(), 255, 40, 40);
col_diff_conformant_fg = new Color(parent.getDisplay(), 60, 127, 95);
col_classifier_bg = new Color(parent.getDisplay(), 200, 220, 250);
final Tree tree = getTree();
for (int n = 0; n < NUM_OF_COLUMNS; n++) {
final TreeColumn colN = new TreeColumn(tree, SWT.LEFT);
if (n == 0)
colN.setWidth(300); // make API column a bit wider
else
colN.setWidth(200);
}
tree.setHeaderVisible(true);
tree.setLinesVisible(true);
setLabelProvider(new MyLabelProvider());
setContentProvider(new MyContentProvider());
setComparison(null, null, null);
}
示例8: createControl
import org.eclipse.swt.widgets.Composite; //导入方法依赖的package包/类
@Override
public void createControl(final Composite parent) {
super.createControl(parent); // We need to create the UI controls from the parent class.
final Composite control = (Composite) getControl();
control.setLayout(GridLayoutFactory.fillDefaults().create());
control.setLayoutData(fillDefaults().align(FILL, FILL).grab(true, true).create());
final DataBindingContext dbc = new DataBindingContext();
control.addDisposeListener(e -> dbc.dispose());
createVendorIdControls(dbc, control);
ComboViewer projectTypeCombo = new ComboViewer(control, READ_ONLY);
projectTypeCombo.setLabelProvider(new ProjectTypeLabelProvider());
projectTypeCombo.setContentProvider(ArrayContentProvider.getInstance());
projectTypeCombo.getControl().setLayoutData(fillDefaults().grab(true, false).create());
projectTypeCombo.setInput(ProjectType.values());
Composite projectTypePropertyControls = new Composite(control, NONE);
StackLayout changingStackLayout = new StackLayout();
projectTypePropertyControls.setLayout(changingStackLayout);
projectTypePropertyControls.setLayoutData(fillDefaults().align(FILL, FILL).grab(true, true).create());
Composite defaultOptions = initDefaultOptionsUI(dbc, projectTypePropertyControls);
Composite libraryProjectOptionsGroup = initLibraryOptionsUI(dbc, projectTypePropertyControls);
Composite testProjectOptionsGroup = initTestProjectUI(dbc, projectTypePropertyControls);
initProjectTypeBinding(dbc, projectTypeCombo);
// Configure stack layout to show advanced options
projectTypeCombo.addPostSelectionChangedListener(e -> {
switch (projectInfo.getProjectType()) {
case LIBRARY:
changingStackLayout.topControl = libraryProjectOptionsGroup;
break;
case TEST:
changingStackLayout.topControl = testProjectOptionsGroup;
break;
default:
changingStackLayout.topControl = defaultOptions;
}
projectTypePropertyControls.layout(true);
setPageComplete(validatePage());
});
// IDs from: org.eclipse.jdt.internal.ui.workingsets.IWorkingSetIDs.class
createWorkingSetGroup(
(Composite) getControl(),
null,
new String[] { "org.eclipse.ui.resourceWorkingSetPage",
"org.eclipse.jdt.ui.JavaWorkingSetPage",
"org.eclipse.jdt.internal.ui.OthersWorkingSet"
}); // $NON-NLS-1$
Dialog.applyDialogFont(getControl());
dbc.updateTargets();
setControl(control);
}
示例9: createToolTipContentArea
import org.eclipse.swt.widgets.Composite; //导入方法依赖的package包/类
@Override
protected Composite createToolTipContentArea ( final Event event, final Composite parent )
{
parent.setLayout ( new FillLayout () );
final Composite wrapper = new Composite ( parent, SWT.NONE );
wrapper.addDisposeListener ( new DisposeListener () {
@Override
public void widgetDisposed ( final DisposeEvent e )
{
DataItemToolTip.this.resourceManager.dispose ();
}
} );
final GridLayout layout = new GridLayout ( 2, false );
layout.marginHeight = 10;
layout.marginWidth = 10;
layout.horizontalSpacing = 20;
layout.verticalSpacing = 20;
wrapper.setLayout ( layout );
wrapper.setBackground ( wrapper.getDisplay ().getSystemColor ( SWT.COLOR_WHITE ) );
wrapper.setBackgroundMode ( SWT.INHERIT_DEFAULT );
this.headerLabel = new Label ( wrapper, SWT.NONE );
this.headerLabel.setText ( this.item.getId () );
this.headerLabel.setLayoutData ( new GridData ( SWT.FILL, SWT.FILL, true, false, 2, 1 ) );
this.headerLabel.setFont ( JFaceResources.getHeaderFont () );
final Label warnIcon = new Label ( wrapper, SWT.NONE );
warnIcon.setLayoutData ( new GridData ( SWT.CENTER, SWT.CENTER, false, false ) );
warnIcon.setImage ( Activator.getDefault ().getImageRegistry ().get ( Activator.IMG_WARN_BIG ) );
this.text = new StyledText ( wrapper, SWT.MULTI );
this.text.setLayoutData ( new GridData ( SWT.FILL, SWT.FILL, true, true ) );
if ( this.currentText != null )
{
this.text.setText ( this.currentText.getString () );
this.text.setStyleRanges ( this.currentText.getStyleRanges () );
}
return wrapper;
}