Eclipse get its power from its plug-ins. The Eclipse framework consists of plug-ins like SWT, JFace, and OSGi. By adding a few more specific plug-ins and some original code, one can create a User Interface (UI). Eclipse uses plug-ins or bundles for grouping, delivering, and managing code.
The eclipse mechanism is declarative: plug-ins are connected without loading any of their code/data greatly reducing code bulk and startup time. RCP has the ability to do more than UI, such as providing server capabilities. Rich client replaced simple clients with powerful features for ease of use such as:
User Interface (UI): Action sets, editors, perspectives, views, and the workbench are parts of the Graphical User Interface (GUI), while anything else such as sound is part of the more broad UI.
UI workbench: Contains windows, perspectives, actions, views and editors; adds presentation and coordination to JFace.
Perspective: visual container for a set of views and content editors. Views and editors cannot be mixed into the same stack.
Editor: Primary focus of attention, such as a text IO. Shared between perspectives. Must have title. Need an IEditorInput before they can be opened. Contributes to main toolbar & menu.
View: Supporting information for a given task; output needed for user decision. A title is not needed. Can be detached from a workbench window. Contributes to local toolbar & menu.
Stand-alone view: Hides the title area and prevent the view from being altered.
TreeViewer: Display tree structures using providers.
Content provider: Supply the tree nodes.
Label Provider: Produces human readable names and images for the nodes.
JFace: Provides Actions, Viewers, Wizards, and Databinding; essentially connecting the graphical components to the real underlying actions.
Standard Widget Toolkit (SWT): Contains widgets; stand alone low level graphics library that can be used outside RCP, allows portable and native experience.
Equinox: Contains extensions, applications, products; is an implementation of the OSGi framework specification, allowing applications to implement bundles
OSGi: Provides Bundles (normal jar files), and Services (connecting bundles dynamically); knits together the installed plug-ins to allow them to collaborate.
Manifest.mf : This is the OSGi bundle manifest - The execution specification; plug-in configuration (OSGi).
plugin.xml : This is the Eclipse extension manifest – The extension specification; plug-in configuration (Eclipse Equinox).
.product: The build.
Product: Application with branding, splash, preferences and configuration files, something the user can understand and run.
Form: A collection of widgets, their form styles, etc.
Composite: Instances of this class control all other controls such as the layout and text of buttons.
IApplication: Interface that represents the executable entry points into an application.
Application: Class that controls all aspects of application's execution, acting as the main routine. (All it does is create a Workbench and attach another class called a Workbench Advisor to it)
Activator: controls the plug-in life cycle
Actions: Given a reference to the container in which they are placed allowing them to query for or access information. Actions can be placed in views, editors, or toolbars and can be controlled by mouse clicks, keyboard strokes or other user input.
Action bar: Any menu, toolbar, status bar, etc.
ApplicationActionBar: Class responsible for creating, adding, and disposing of the actions added to a workbench window.
ApplicationWorkbenchAdvisor: Class creates the window advisor and specifies the perspective id for the initial window.
ApplicationWorkbenchWindowAdvisor: Class determines properties of the window such as its initial size, position, toolbars, or name on the header.
(SomeAction): Any class created to give a mechanism (or mechanisms) an action (or actions).
ViewPart: Class to be subclassed to define new views.
View: Creates the GUI; create layouts, buttons, banners, scroll bars, etc.
Perspective: a mechanism for arranging views and editors, supporting scalable UI's.
There is only one Workbench but there can be many WorkBenchWindows
The Advisor Classes: These
WorkbenchAdvisor: creates the WorkbenchWindowAdvisor, and specifies the perspective id for the initial window.
WorkbenchWindowAdvisor: defines initial settings (position, size) , creation, destruction of windows
ActionBarAdvisor: instantiated by WorkbenchWindowAdvisor createActionBarAdvisor(); creates actions in a window. Controls what appears in the toolbar (Coolbar), menu bar, & status line. (Focal point of customization in RCP) ActionBarAdvisor is responsible for creating, adding, and disposing of the actions added to a workbench window. Each window will be populated with new actions.
ApplicationWorkbenchWindowAdvisor sets window features , size, and position.
ICommandIds is the interface defining the application's command Ids. Key bindings can be defined for specific commands. To associate an action with a command, use Iaction.setActionDefinitionId(commandId).
This example will show the use of GridLayout to organize components, other layouts such as TableWrapLayout can be used for org.eclipse.ui.forms components.
GridLayout is a blue print which describes the layout of controls on a composite. This works with any SWT components, the example below chooses to to use buttons for convenience.
GridData is the attribute of the control, describing its span, indentation, margin etc for each gird(cell).
This example code breakdown the usage of each piece:
//Creates an instance of Display which is the
Display display = new Display();
//Creates a instance of Shell, in display, which is the
Shell shell = new Shell(display);
//Creates an instance of GridLayout which controls the layout of the controls on
//the composite
GridLayout gridLayout = new GridLayout();
//Determines the number of columns in a table configuration for the ___ added,
//where once the given number is reached the next ___ will go start at the next row
gridLayout.numColumns = 3;
//Sets the instance gridLayout on the instance shell
shell.setLayout(gridLayout);
//Create one button, the default button size is to allow just enough room for the
//given text, but this can be changed with “Hints” shown later.
new Button(shell, SWT.PUSH).setText("Button");
//Forces each column to be same width, the default is false
gridLayout.makeColumnsEqualWidth = true;
//To set a widget's GridData object, you use the setLayoutData
GridData gridData = new GridData();
gridData.horizontalAlignment = GridData.FILL;
//This is one instance of GridData, do not reuse any instance of GridData
gridData.grabExcessHorizontalSpace = true;
//The default horizontalAlignment is BEGINNING, while verticalAlignment is CENTER.
//BEGINNING refers to being leftward or upward in a cell, CENTER is toward the
//center, END is rightward or downward, and FILL occupies the the entirety of the
//cell.
//Button is set leftward, downward, and to occupy all the horizontal space in the
//cell while maintaining a constant height
gridData.horizontalAlignment = SWT.BEGINNING
gridData.verticalAlignment = SWT.END
gridData.horizontalAlignment = SWT.FILL
//sets indent 4 pixels
gridData.horizontalIndent = 4;
//Expands across one cell
gridData.horizontalAlignment = GridData.FILL;
//Makes two cells into one
gridData.horizontalSpan = 2;
//Fills window as it resizes. If more than one widget is trying to grab the same
//space, then the excess space is shared evenly among the grabbing widgets
gridData.grabExcessVerticalSpace = true;
//These hints set the initial size of the button to be 70 pixels wide and 40 tall.
gridData.widthHint = 70;
gridData.heightHint = 40;
//This sets the window to fit the given parts such that they have enough room for each component to show correctly, giving leftover room to the last component
shell.pack();
//Opens the window
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) display.sleep();
}
NOTE: To write the gridData in a more compact notation you can pass arguments to gridData as you instantiate it;
GridData gridData = new GridData(GridData.FILL_HORIZONTAL | GridData.FILL_VERTICAL);
Java Runtime Environment: A subset of the Java Development Kit (JDK) for end-users and developers who want to redistribute the runtime environment alone. The Java runtime environment consists of the Java virtual machine, the Java core classes, and supporting files.
Launch Configuration: Manage name, data allocation, which program to run, choose a JRE and command line arguments.
Eclipse provides forms (define these) which allow you to simply input images from your workspace into the RCP as icon pictures, headers, and more (.gif images are required for icons and pictures).