Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Mail Systems
Eclipse Documentation

How To Guides
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Problem Solutions
Privacy Policy




Eclipse Plug-in Developer Guide
Previous Page Home Next Page

Element Factories


This extension point is used to add element factories to the workbench. An element factory is used to recreate IAdaptable objects which are persisted during workbench shutdown.

As an example, the element factory is used to persist editor input. The input for an editor must implement org.eclipse.ui.EditorInput. The life cycle of an IEditorInput within an editor has a number of phases.

  1. The initial input for an editor is passed in during editor creation.
  2. On shutdown the workbench state is captured. In this process the workbench will create a memento for each open editor and its input. The input is saved as a two part memento containing a factory ID and any primitive data required to recreate the element on startup. For more information see the documentation on org.eclipse.ui.IPersistableElement.
  3. On startup the workbench state is read and the editors from the previous session are recreated. In this process the workbench will recreate the input element for each open editor. To do this it will map the original factory ID for the input element to a concrete factory class defined in the registry. If a mapping exists, and the factory class is valid, an instance of the factory class is created. Then the workbench asks the factory to recreate the original element from the remaining primitive data within the memento. The resulting IAdaptable is cast to an IEditorInput and passed to the new editor.

Configuration Markup:

<!ELEMENT extension ( factory*)>

<!ATTLIST extension





  • point - a fully qualified identifier of the target extension point
  • id - an optional identifier of the extension instance
  • name - an optional name of the extension instance

<!ELEMENT factory EMPTY>

<!ATTLIST factory




  • id - a unique name that will be used to identify this factory.
  • class - a fully qualified name of a class that implements org.eclipse.ui.IElementFactory

The following is an example of an element factory extension:

        point = 
           id =

Supplied Implementation:
The workbench provides an IResource factory. Additional factories should be added to recreate other IAdaptable types commonly found in other object models, such as the Java Model.

Copyright (c) 2002, 2005 IBM Corporation and others.
All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at

  Published under the terms of the Eclipse Public License Version 1.0 ("EPL") Design by Interspire