|
Runtime | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.eclipse.jface.action.ContributionItem
org.eclipse.gmf.runtime.common.ui.action.AbstractContributionItem
A custom contribution item that goes into a workbenchpart's toolbar
| Nested Class Summary |
| Nested classes inherited from class org.eclipse.gmf.runtime.common.ui.action.IActionWithProgress |
IActionWithProgress.WorkIndicatorType |
| Constructor Summary | |
AbstractContributionItem(IWorkbenchPage workbenchPage)
Creates a new WorkbenchPartContributionItem |
|
AbstractContributionItem(IWorkbenchPage workbenchPage,
java.lang.String id)
Creates a new WorkbenchPartContributionItem |
|
| Method Summary | |
protected abstract boolean |
calculateEnabled()
Calculates enablement of the widget. |
protected int |
computeWidth(Control cont)
Method is being called when there control created by subclasses is not null. |
protected Control |
createControl(Composite parent)
Creates the control of this contributor - override only if a custom control is needed. |
protected MenuItem |
createMenuItem(Menu parent,
int index)
Creates the menuitem with the given parent and index. |
protected ToolItem |
createToolItem(ToolBar parent,
int index)
Creates the ToolItem with the given parent and index. |
void |
dispose()
Dispose should only clean up what was done in the fill
methods It is not meant to clean up what was done in constructors |
protected abstract void |
doRun(IProgressMonitor progressMonitor)
Performs the actual work when this action handler is run. |
protected void |
execute(ICommand command)
Executes the given ommand. |
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. |
protected ActionManager |
getActionManager()
Retrieves the action manager for this action delegate from its workbench part. |
protected Control |
getControl()
Gets the item control |
protected Item |
getItem()
Gets the item widget |
protected Listener |
getItemListener()
Returns the item listenr |
java.lang.String |
getLabel()
Gets the control tooltip text |
protected MenuItem |
getMenuItem()
Gets the tool item widget |
protected IOperationHistory |
getOperationHistory()
Returns the operation history for this contribution item from its action manager. |
protected ISelection |
getSelection()
Retrieves the current selection. |
protected IStructuredSelection |
getStructuredSelection()
Retrieves the current structured selection. |
protected ToolItem |
getToolItem()
Gets the tool item widget |
protected IUndoContext |
getUndoContext()
Gets the undo context from my workbench part. |
protected IWorkbenchPart |
getWorkbenchPart()
Gets the current workbench part. |
IActionWithProgress.WorkIndicatorType |
getWorkIndicatorType()
Gets type of work indicator (progress monitor, hourglass, or none). |
protected void |
handle(java.lang.Exception exception)
Handles the specified exception. |
protected void |
handleWidgetDispose(Event e)
Handles a widget dispose event for the widget corresponding to this item. |
protected void |
handleWidgetEvent(Event e)
Handles an event from the widget (forwarded from nested listener). |
void |
historyNotification(OperationHistoryEvent event)
Refreshes me if the history event has my workbench part's context, and the event is one of: OperationHistoryEvent.UNDONE
OperationHistoryEvent.REDONE
OperationHistoryEvent.OPERATION_ADDED
OperationHistoryEvent.OPERATION_CHANGED
OperationHistoryEvent.OPERATION_NOT_OK
OperationHistoryEvent.OPERATION_REMOVED
The other operation history events are ignored because they are
intermediate events that will be followed by one of those listed above.
|
protected void |
init()
init is used to initialize the common part of filling this
item in a contribution manager. |
boolean |
isEnabled()
|
protected boolean |
isOperationHistoryListener()
Retrieves a Boolean indicating whether this contribution item is interested in operation history changed events. |
boolean |
isRunnable()
Retrieves a Boolean indicating whether this action can be run. |
protected boolean |
isSelectionListener()
Retrieves a Boolean indicating whether this action handler is interested in selection events. |
boolean |
isSetup()
Returns the setup state of this action. |
protected boolean |
needsSetup()
Answers whether or not this action should be setup before it is run. |
protected void |
openErrorDialog(IStatus status)
Opens an error dialog for the specified status object. |
void |
refresh()
refreshed the properties of this contribution item This method should not be called directly, instead update method should be
called.
|
protected void |
refreshItem()
Refreshes the item's GUI |
void |
run(IProgressMonitor progressMonitor)
Runs this action. |
protected void |
runWithEvent(Event event)
A generalized convinience method. |
void |
selectionChanged(SelectionChangedEvent event)
|
protected void |
setEnabled(boolean enabled)
Method setEnabled. |
void |
setItem(Item item)
|
protected void |
setLabel(java.lang.String label)
Sets the control label |
protected void |
setSetup(boolean setup)
Sets the setup state of this action. |
boolean |
setup()
Sets up the action. |
protected void |
setWorkbenchPart(IWorkbenchPart workbenchPart)
Sets the current workbench part |
void |
update()
updates the properties of this contribution item Subclasses should call this method when an update is requested This method is not intended to be overriden. |
| Methods inherited from class org.eclipse.jface.action.ContributionItem |
fill, getId, getParent, isDirty, isDynamic, isGroupMarker, isSeparator, isVisible, saveWidgetState, setParent, setVisible, toString, update |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
public AbstractContributionItem(IWorkbenchPage workbenchPage)
workbenchPage - The workbench Page
public AbstractContributionItem(IWorkbenchPage workbenchPage,
java.lang.String id)
workbenchPage - The workbench Pageid - The id of the contribution item| Method Detail |
protected void init()
init is used to initialize the common part of filling this
item in a contribution manager. The dispose method is
later called to clean up what has been initialized in the
fill and init methods
public void dispose()
fill
methods It is not meant to clean up what was done in constructors
dispose in interface IContributionItemprotected IWorkbenchPart getWorkbenchPart()
protected IUndoContext getUndoContext()
protected Control getControl()
protected Item getItem()
protected ToolItem getToolItem()
protected MenuItem getMenuItem()
public java.lang.String getLabel()
getLabel in interface IActionWithProgresspublic void setItem(Item item)
item - widgetprotected void setLabel(java.lang.String label)
label - The control labelprotected void setWorkbenchPart(IWorkbenchPart workbenchPart)
workbenchPart - The current workbench partpublic final void fill(Composite parent)
IContributionItem
method calls the createControl framework method.
Subclasses must implement createControl rather than
overriding this method.
fill in interface IContributionItemparent - The parent of the control to fill
public final void fill(Menu parent,
int index)
IContributionItem
method throws an exception since controls cannot be added to menus.
fill in interface IContributionItemparent - The menuindex - Menu index
public 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 IContributionItemparent - The ToolBar to add the new control toindex - Index
protected ToolItem createToolItem(ToolBar parent,
int index)
ToolItem with the given parent and index.
parent - The ToolBar to add the new control toindex - Index
ToolItem for specified ToolBar at specifiec index
protected MenuItem createMenuItem(Menu parent,
int index)
parent - The Menu to add the new control toindex - Index
MenuItemprotected Control createControl(Composite parent)
parent - the parent Composite
Compositeprotected int computeWidth(Control cont)
cont - the control being added
public final void update()
refresh() method
update in interface IContributionItempublic void refresh()
update method should be
called.
Subclasses could override this method to add to the refresh and at the
end call super.refresh()
refresh in interface IActionWithProgressprotected void refreshItem()
protected abstract boolean calculateEnabled()
protected void setEnabled(boolean enabled)
enabled - public boolean isEnabled()
isEnabled in interface IContributionItemprotected void execute(ICommand command)
ommand.
command - ICommand to be executedprotected ActionManager getActionManager()
protected IOperationHistory getOperationHistory()
protected void runWithEvent(Event event)
event - an optional associated SWT eventprotected abstract void doRun(IProgressMonitor progressMonitor)
progressMonitor - the progress monitor for tracking the progress of this action
when it is run.protected void handle(java.lang.Exception exception)
exception - The exception to be handled.protected void openErrorDialog(IStatus status)
status - The status object for which to open an error dialog.protected void handleWidgetEvent(Event e)
e - Event to be handled by this methodprotected void handleWidgetDispose(Event e)
e - widget dispose Eventprotected boolean isSelectionListener()
true if this action handler is interested;
false otherwise.protected boolean isOperationHistoryListener()
true if this action handler is interested;
false otherwise.public final void selectionChanged(SelectionChangedEvent event)
selectionChanged in interface ISelectionChangedListenerpublic void historyNotification(OperationHistoryEvent event)
OperationHistoryEvent.UNDONEOperationHistoryEvent.REDONEOperationHistoryEvent.OPERATION_ADDEDOperationHistoryEvent.OPERATION_CHANGEDOperationHistoryEvent.OPERATION_NOT_OKOperationHistoryEvent.OPERATION_REMOVED
historyNotification in interface IOperationHistoryListenerprotected ISelection getSelection()
protected IStructuredSelection getStructuredSelection()
IStructuredSelection for current selectionprotected Listener getItemListener()
public IActionWithProgress.WorkIndicatorType getWorkIndicatorType()
IActionWithProgress
getWorkIndicatorType in interface IActionWithProgresspublic boolean isRunnable()
IActionWithProgress
isRunnable in interface IActionWithProgresstrue if this action can be run;
false otherwise.public void run(IProgressMonitor progressMonitor)
IActionWithProgress
run in interface IActionWithProgressprogressMonitor - IProgressMonitor monitoring the execution of this actionpublic boolean setup()
IActionWithProgressIActionWithProgress.run(IProgressMonitor) is called.
setup in interface IActionWithProgresstrue if the setup completed successfully,
false otherwise.public boolean isSetup()
true if the action has been setup,
false otherwise.protected void setSetup(boolean setup)
setup - true if the action has been setup,
false otherwise.protected boolean needsSetup()
true if the action has a setup, false
otherwise.
|
Runtime | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
Guidelines for using Eclipse APIs.
Copyright (c) IBM Corp., Borland Software Corp., and others 2005,2006. All rights reserved.