public abstract class ControlContribution extends ContributionItem
The createControl
framework method must be implemented
by concrete subclasses.
Modifier | Constructor and Description |
---|---|
protected |
ControlContribution(String id)
Creates a control contribution item with the given id.
|
Modifier and Type | Method and Description |
---|---|
protected int |
computeWidth(Control control)
Computes the width of the given control which is being added
to a tool bar.
|
protected abstract Control |
createControl(Composite parent)
Creates and returns the control for this contribution item
under the given parent composite.
|
void |
fill(Composite parent)
The control item implementation of this
IContributionItem
method calls the createControl framework method. |
void |
fill(Menu parent,
int index)
The control item implementation of this
IContributionItem
method throws an exception since controls cannot be added to menus. |
void |
fill(ToolBar parent,
int index)
The control item implementation of this
IContributionItem
method calls the createControl framework method to
create a control under the given parent, and then creates
a new tool item to hold it. |
dispose, fill, getId, getParent, isDirty, isDynamic, isEnabled, isGroupMarker, isSeparator, isVisible, saveWidgetState, setId, setParent, setVisible, toString, update, update
protected ControlContribution(String id)
id
- the contribution item idprotected int computeWidth(Control control)
The default implementation of this framework method returns
control.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x
.
Subclasses may override if required.
control
- the control being addedprotected abstract Control createControl(Composite parent)
This framework method must be implemented by concrete subclasses.
parent
- the parent compositenull
public final void fill(Composite parent)
IContributionItem
method calls the createControl
framework method.
Subclasses must implement createControl
rather than
overriding this method.fill
in interface IContributionItem
fill
in class ContributionItem
parent
- the parent controlpublic final void fill(Menu parent, int index)
IContributionItem
method throws an exception since controls cannot be added to menus.fill
in interface IContributionItem
fill
in class ContributionItem
parent
- the parent menuindex
- the index where the controls are inserted,
or -1
to insert at the endpublic final void fill(ToolBar parent, int index)
IContributionItem
method calls the createControl
framework method to
create a control under the given parent, and then creates
a new tool item to hold it.
Subclasses must implement createControl
rather than
overriding this method.fill
in interface IContributionItem
fill
in class ContributionItem
parent
- the parent tool barindex
- the index where the controls are inserted,
or -1
to insert at the end
Copyright (c) 2000, 2014 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.