Eclipse Platform
Release 3.1

org.eclipse.ui.actions
Class ContributionItemFactory

java.lang.Object
  extended byorg.eclipse.ui.actions.ContributionItemFactory

public abstract class ContributionItemFactory
extends Object

Access to standard contribution items provided by the workbench.

Most of the functionality of this class is provided by static methods and fields. Example usage:

 MenuManager menu = ...;
 IContributionItem reEdit
 	  = ContributionItemFactory.REOPEN_EDITORS.create(window);
 menu.add(reEdit);
 

Clients may declare subclasses that provide additional application-specific contribution item factories.

Since:
3.0

Field Summary
static ContributionItemFactory HELP_SEARCH
          Workbench contribution item (id "helpSearch"): An editable field for entering help search queries.
static ContributionItemFactory NEW_WIZARD_SHORTLIST
          Workbench contribution item (id "newWizardShortlist"): A list of new item wizards available to be opened, arranged as a shortlist of promising new item wizards and an "Other" subitem.
static ContributionItemFactory OPEN_WINDOWS
          Workbench contribution item (id "openWindows"): A list of windows currently open in the workbench.
static ContributionItemFactory PERSPECTIVES_SHORTLIST
          Workbench contribution item (id "perspectivesShortlist"): A list of perspectives available to be opened, arranged as a shortlist of promising perspectives and an "Other" subitem.
static ContributionItemFactory PIN_EDITOR
          Workbench action (id "pinEditor"): Toggle whether the editor is pinned.
static ContributionItemFactory REOPEN_EDITORS
          Workbench contribution item (id "reopenEditors"): A list of recent editors (with inputs) available to be reopened in the window.
static ContributionItemFactory VIEWS_SHORTLIST
          Workbench contribution item (id "viewsShortlist"): A list of views available to be opened in the window, arranged as a shortlist of promising views and an "Other" subitem.
static ContributionItemFactory VIEWS_SHOW_IN
          Workbench contribution item (id "viewsShowIn"): A list of views available to be opened in the window, arranged as a list of alternate views to show the same item currently selected.
 
Constructor Summary
protected ContributionItemFactory(String contributionItemId)
          Creates a new workbench contribution item factory with the given id.
 
Method Summary
abstract  IContributionItem create(IWorkbenchWindow window)
          Creates a new standard contribution item for the given workbench window.
 String getId()
          Returns the id of this contribution item factory.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PIN_EDITOR

public static final ContributionItemFactory PIN_EDITOR
Workbench action (id "pinEditor"): Toggle whether the editor is pinned. This action maintains its enablement state.


OPEN_WINDOWS

public static final ContributionItemFactory OPEN_WINDOWS
Workbench contribution item (id "openWindows"): A list of windows currently open in the workbench. Selecting one of the items makes the corresponding window the active window. This action dynamically maintains the list of windows.


VIEWS_SHORTLIST

public static final ContributionItemFactory VIEWS_SHORTLIST
Workbench contribution item (id "viewsShortlist"): A list of views available to be opened in the window, arranged as a shortlist of promising views and an "Other" subitem. Selecting one of the items opens the corresponding view in the active window. This action dynamically maintains the view shortlist.


VIEWS_SHOW_IN

public static final ContributionItemFactory VIEWS_SHOW_IN
Workbench contribution item (id "viewsShowIn"): A list of views available to be opened in the window, arranged as a list of alternate views to show the same item currently selected. Selecting one of the items opens the corresponding view in the active window. This action dynamically maintains the view list.


REOPEN_EDITORS

public static final ContributionItemFactory REOPEN_EDITORS
Workbench contribution item (id "reopenEditors"): A list of recent editors (with inputs) available to be reopened in the window. Selecting one of the items reopens the corresponding editor on its input in the active window. This action dynamically maintains the list of editors.


PERSPECTIVES_SHORTLIST

public static final ContributionItemFactory PERSPECTIVES_SHORTLIST
Workbench contribution item (id "perspectivesShortlist"): A list of perspectives available to be opened, arranged as a shortlist of promising perspectives and an "Other" subitem. Selecting one of the items makes the corresponding perspective active. Should a new perspective need to be opened, a workbench user preference controls whether the prespective is opened in the active window or a new window. This action dynamically maintains the perspectives shortlist.


NEW_WIZARD_SHORTLIST

public static final ContributionItemFactory NEW_WIZARD_SHORTLIST
Workbench contribution item (id "newWizardShortlist"): A list of new item wizards available to be opened, arranged as a shortlist of promising new item wizards and an "Other" subitem. Selecting one of the items invokes the corresponding new item wizard. This action dynamically maintains the new item wizard shortlist.

Since:
3.1

HELP_SEARCH

public static final ContributionItemFactory HELP_SEARCH
Workbench contribution item (id "helpSearch"): An editable field for entering help search queries.

Since:
3.1
Constructor Detail

ContributionItemFactory

protected ContributionItemFactory(String contributionItemId)
Creates a new workbench contribution item factory with the given id.

Parameters:
contributionItemId - the id of contribution items created by this factory
Method Detail

create

public abstract IContributionItem create(IWorkbenchWindow window)
Creates a new standard contribution item for the given workbench window.

A typical contribution item automatically registers listeners against the workbench window so that it can keep its enablement state up to date. Ordinarily, the window's references to these listeners will be dropped automatically when the window closes. However, if the client needs to get rid of a contribution item while the window is still open, the client must call IContributionItem#dispose to give the item an opportunity to deregister its listeners and to perform any other cleanup.

Parameters:
window - the workbench window
Returns:
the workbench contribution item

getId

public String getId()
Returns the id of this contribution item factory.

Returns:
the id of contribution items created by this factory

Eclipse Platform
Release 3.1

Guidelines for using Eclipse APIs.

Copyright (c) IBM Corp. and others 2000, 2005. All rights reserved.