rcp by example
DESCRIPTION
RCPTRANSCRIPT
![Page 1: Rcp by example](https://reader035.vdocuments.mx/reader035/viewer/2022062307/554d582eb4c90578428b47f3/html5/thumbnails/1.jpg)
RCP by Example
by
Subramanian Thiruppathi
![Page 2: Rcp by example](https://reader035.vdocuments.mx/reader035/viewer/2022062307/554d582eb4c90578428b47f3/html5/thumbnails/2.jpg)
Agenda
Talk about RCP RCP Features Real Time Examples Discuss about Important Classes in
RCP Recommended Reading
![Page 3: Rcp by example](https://reader035.vdocuments.mx/reader035/viewer/2022062307/554d582eb4c90578428b47f3/html5/thumbnails/3.jpg)
End User Expectation …
High Quality end-user experience High-Speed local processing Rich native UI
drag-and-drop Clipboard Navigation Customization
![Page 4: Rcp by example](https://reader035.vdocuments.mx/reader035/viewer/2022062307/554d582eb4c90578428b47f3/html5/thumbnails/4.jpg)
Developer Expectation …
Good Development Environment Easy Deployment Easy update latest code in Client
side And lot more ….
![Page 5: Rcp by example](https://reader035.vdocuments.mx/reader035/viewer/2022062307/554d582eb4c90578428b47f3/html5/thumbnails/5.jpg)
What is RCP
An application that uses the windowing and GUI features of the operating system
![Page 6: Rcp by example](https://reader035.vdocuments.mx/reader035/viewer/2022062307/554d582eb4c90578428b47f3/html5/thumbnails/6.jpg)
RCP Features Components Middleware and infrastructure Native user experience
Look and Feel Portability
Even support Mobile Application (J2ME) Intelligent install and update
Java web start Disconnected operation
Local processing Development tooling support
RCP IDE
![Page 7: Rcp by example](https://reader035.vdocuments.mx/reader035/viewer/2022062307/554d582eb4c90578428b47f3/html5/thumbnails/7.jpg)
Real time Examples for RCP
IBM Workplace Client Technology Maestro - NASA Space Mission
Management And lot more ….
![Page 8: Rcp by example](https://reader035.vdocuments.mx/reader035/viewer/2022062307/554d582eb4c90578428b47f3/html5/thumbnails/8.jpg)
Important Classes
Application
![Page 9: Rcp by example](https://reader035.vdocuments.mx/reader035/viewer/2022062307/554d582eb4c90578428b47f3/html5/thumbnails/9.jpg)
Application class
Must Implement IPlatformRunnable
Note: We can use any name as Class but here we are following RCP Standard naming convention.
![Page 10: Rcp by example](https://reader035.vdocuments.mx/reader035/viewer/2022062307/554d582eb4c90578428b47f3/html5/thumbnails/10.jpg)
Application class
Must Implement IPlatformRunnable Implement run method
![Page 11: Rcp by example](https://reader035.vdocuments.mx/reader035/viewer/2022062307/554d582eb4c90578428b47f3/html5/thumbnails/11.jpg)
Application class
Implement IPlatformRunnable Implement run method Run method is Main method
![Page 12: Rcp by example](https://reader035.vdocuments.mx/reader035/viewer/2022062307/554d582eb4c90578428b47f3/html5/thumbnails/12.jpg)
Application class
Implement IPlatformRunnable Implement run method Run method is Main method Starting point of your application and
Ending of your application
![Page 13: Rcp by example](https://reader035.vdocuments.mx/reader035/viewer/2022062307/554d582eb4c90578428b47f3/html5/thumbnails/13.jpg)
Application class
package com.rcp.example;
import org.eclipse.core.runtime.IPlatformRunnable;import org.eclipse.swt.widgets.Display;import org.eclipse.ui.PlatformUI;
/** * This class controls all aspects of the application's execution */public class Application implements IPlatformRunnable {
public Object run(Object args) throws Exception {Display display = PlatformUI.createDisplay();
try {int returnCode = PlatformUI.createAndRunWorkbench(display,new ApplicationWorkbenchAdvisor()); if (returnCode == PlatformUI.RETURN_RESTART) { return IPlatformRunnable.EXIT_RESTART; }
return IPlatformRunnable.EXIT_OK;} finally {
display.dispose();}
}
}
![Page 14: Rcp by example](https://reader035.vdocuments.mx/reader035/viewer/2022062307/554d582eb4c90578428b47f3/html5/thumbnails/14.jpg)
Important Classes
Application ApplicationWorkbenchAdivsor
![Page 15: Rcp by example](https://reader035.vdocuments.mx/reader035/viewer/2022062307/554d582eb4c90578428b47f3/html5/thumbnails/15.jpg)
ApplicationWorkbenchAdivsor class
Extend WorkbenchAdvisor
![Page 16: Rcp by example](https://reader035.vdocuments.mx/reader035/viewer/2022062307/554d582eb4c90578428b47f3/html5/thumbnails/16.jpg)
ApplicationWorkbenchAdivsor class
Must extend WorkbenchAdvisor Application Level advice
![Page 17: Rcp by example](https://reader035.vdocuments.mx/reader035/viewer/2022062307/554d582eb4c90578428b47f3/html5/thumbnails/17.jpg)
ApplicationWorkbenchAdivsor class
Must extend WorkbenchAdvisor Application Level advice Participates in the start up and shut
down of the workbench
![Page 18: Rcp by example](https://reader035.vdocuments.mx/reader035/viewer/2022062307/554d582eb4c90578428b47f3/html5/thumbnails/18.jpg)
ApplicationWorkbenchAdivsor class
Must extend WorkbenchAdvisor Application Level advice Participates in the start up and shut
down of the workbench One running Workbench per running
Eclipse application
![Page 19: Rcp by example](https://reader035.vdocuments.mx/reader035/viewer/2022062307/554d582eb4c90578428b47f3/html5/thumbnails/19.jpg)
ApplicationWorkbenchAdivsor class
package com.rcp.example;
import org.eclipse.ui.application.IWorkbenchWindowConfigurer;import org.eclipse.ui.application.WorkbenchAdvisor;import org.eclipse.ui.application.WorkbenchWindowAdvisor;
public class ApplicationWorkbenchAdvisor extends WorkbenchAdvisor {
private static final String PERSPECTIVE_ID = "RCPView.perspective";
public WorkbenchWindowAdvisor createWorkbenchWindowAdvisor(IWorkbenchWindowConfigurer configurer) {return new ApplicationWorkbenchWindowAdvisor(configurer);
}
public String getInitialWindowPerspectiveId() {return PERSPECTIVE_ID;
}
}
![Page 20: Rcp by example](https://reader035.vdocuments.mx/reader035/viewer/2022062307/554d582eb4c90578428b47f3/html5/thumbnails/20.jpg)
Important Classes
Application ApplicationWorkbenchAdivsor ApplicationWorkbenchWindowAdiv
sor
![Page 21: Rcp by example](https://reader035.vdocuments.mx/reader035/viewer/2022062307/554d582eb4c90578428b47f3/html5/thumbnails/21.jpg)
ApplicationWorkbenchWindowAdivsor class
Must Extend WorkbenchWindowAdvisor
![Page 22: Rcp by example](https://reader035.vdocuments.mx/reader035/viewer/2022062307/554d582eb4c90578428b47f3/html5/thumbnails/22.jpg)
ApplicationWorkbenchWindowAdivsor class
Must Extend WorkbenchWindowAdvisor
Window-level advice
![Page 23: Rcp by example](https://reader035.vdocuments.mx/reader035/viewer/2022062307/554d582eb4c90578428b47f3/html5/thumbnails/23.jpg)
ApplicationWorkbenchWindowAdivsor class
Must Extend WorkbenchWindowAdvisor
Window-level advice Helps to show or hide the menu, cool
bar etc.,
![Page 24: Rcp by example](https://reader035.vdocuments.mx/reader035/viewer/2022062307/554d582eb4c90578428b47f3/html5/thumbnails/24.jpg)
ApplicationWorkbenchWindowAdivsor class
Must Extend WorkbenchWindowAdvisor
Window-level advice Helps to show or hide the menu, cool
bar etc., Only one instance for each window
![Page 25: Rcp by example](https://reader035.vdocuments.mx/reader035/viewer/2022062307/554d582eb4c90578428b47f3/html5/thumbnails/25.jpg)
ApplicationWorkbenchWindowAdivsor class
package com.rcp.example;
import org.eclipse.swt.graphics.Point;import org.eclipse.ui.application.ActionBarAdvisor;import org.eclipse.ui.application.IActionBarConfigurer;import org.eclipse.ui.application.IWorkbenchWindowConfigurer;import org.eclipse.ui.application.WorkbenchWindowAdvisor;
public class ApplicationWorkbenchWindowAdvisor extends WorkbenchWindowAdvisor {
public ApplicationWorkbenchWindowAdvisor(IWorkbenchWindowConfigurer configurer) {super(configurer);
}
public ActionBarAdvisor createActionBarAdvisor(IActionBarConfigurer configurer) {
return new ApplicationActionBarAdvisor(configurer);}
public void preWindowOpen() {IWorkbenchWindowConfigurer configurer = getWindowConfigurer();configurer.setInitialSize(new Point(400, 300));configurer.setShowCoolBar(false);configurer.setShowStatusLine(false);configurer.setTitle("RCP Application");
}}
![Page 26: Rcp by example](https://reader035.vdocuments.mx/reader035/viewer/2022062307/554d582eb4c90578428b47f3/html5/thumbnails/26.jpg)
Important Classes
Application ApplicationWorkbenchAdivsor ApplicationWorkbenchWindowAdiv
sor ActionBarAdvisor
![Page 27: Rcp by example](https://reader035.vdocuments.mx/reader035/viewer/2022062307/554d582eb4c90578428b47f3/html5/thumbnails/27.jpg)
ActionBarAdvisor class
Must extend ActionBarAdvisor Important methods are
makeActions fillMenuBar
![Page 28: Rcp by example](https://reader035.vdocuments.mx/reader035/viewer/2022062307/554d582eb4c90578428b47f3/html5/thumbnails/28.jpg)
Important Classes
Application ApplicationWorkbenchAdivsor ApplicationWorkbenchWindowAdiv
sor ActionBarAdvisor Perspective
![Page 29: Rcp by example](https://reader035.vdocuments.mx/reader035/viewer/2022062307/554d582eb4c90578428b47f3/html5/thumbnails/29.jpg)
Perspective class
Must implement IPerspectiveFactory Implement createInitialLayout method
![Page 30: Rcp by example](https://reader035.vdocuments.mx/reader035/viewer/2022062307/554d582eb4c90578428b47f3/html5/thumbnails/30.jpg)
Perspective class
package com.rcp.example;
import org.eclipse.ui.IPageLayout;import org.eclipse.ui.IPerspectiveFactory;
public class Perspective implements IPerspectiveFactory {
public void createInitialLayout(IPageLayout layout) {String editorArea = layout.getEditorArea();layout.setEditorAreaVisible(false);layout.setFixed(true);layout.addStandaloneView(View.ID, false, IPageLayout.LEFT, 1.0f, editorArea);
}
}
![Page 31: Rcp by example](https://reader035.vdocuments.mx/reader035/viewer/2022062307/554d582eb4c90578428b47f3/html5/thumbnails/31.jpg)
Perspective class
Must implement IPerspectiveFactory Implement createInitialLayout method
Generates the initial page layout
![Page 32: Rcp by example](https://reader035.vdocuments.mx/reader035/viewer/2022062307/554d582eb4c90578428b47f3/html5/thumbnails/32.jpg)
Important Classes
Application ApplicationWorkbenchAdivsor ApplicationWorkbenchWindowAdiv
sor ActionBarAdvisor Perspective View
![Page 33: Rcp by example](https://reader035.vdocuments.mx/reader035/viewer/2022062307/554d582eb4c90578428b47f3/html5/thumbnails/33.jpg)
View class
Must extend ViewPart
![Page 34: Rcp by example](https://reader035.vdocuments.mx/reader035/viewer/2022062307/554d582eb4c90578428b47f3/html5/thumbnails/34.jpg)
View class
Must extend ViewPart Page design (Forms,Showing Buttons,
etc)
![Page 35: Rcp by example](https://reader035.vdocuments.mx/reader035/viewer/2022062307/554d582eb4c90578428b47f3/html5/thumbnails/35.jpg)
View class
package com.rcp.example;import org.eclipse.jface.viewers.TableViewer;import org.eclipse.swt.SWT;import org.eclipse.swt.widgets.Composite;import org.eclipse.ui.part.ViewPart;public class View extends ViewPart {public static final String ID = "RCPView.view";private TableViewer viewer;/** This is a callback that will allow us to create the viewer and initialize it */public void createPartControl(Composite parent) {
viewer = new TableViewer(parent, SWT.MULTI | SWT.H_SCROLL| SWT.V_SCROLL);viewer.setContentProvider(new ViewContentProvider());viewer.setLabelProvider(new ViewLabelProvider());viewer.setInput(getViewSite());
}/** Passing the focus request to the viewer's control. */public void setFocus() {
viewer.getControl().setFocus();} }
![Page 36: Rcp by example](https://reader035.vdocuments.mx/reader035/viewer/2022062307/554d582eb4c90578428b47f3/html5/thumbnails/36.jpg)
Flow
![Page 37: Rcp by example](https://reader035.vdocuments.mx/reader035/viewer/2022062307/554d582eb4c90578428b47f3/html5/thumbnails/37.jpg)
Plugin.xml<?xml version="1.0" encoding="UTF-8"?><?eclipse version="3.2"?><plugin>
<extension id="application" point="org.eclipse.core.runtime.applications"> <application> <run class="com.rcp.example.Application"> </run> </application> </extension> <extension point="org.eclipse.ui.perspectives"> <perspective name="Perspective" class="com.rcp.example.Perspective" id="RCPView.perspective"> </perspective> </extension> <extension point="org.eclipse.ui.views"> <view name="View" class="com.rcp.example.View" id="RCPView.view"> </view> </extension>
</plugin>
![Page 38: Rcp by example](https://reader035.vdocuments.mx/reader035/viewer/2022062307/554d582eb4c90578428b47f3/html5/thumbnails/38.jpg)
Run the Application
![Page 39: Rcp by example](https://reader035.vdocuments.mx/reader035/viewer/2022062307/554d582eb4c90578428b47f3/html5/thumbnails/39.jpg)
Recommended Reading Eclipse Rich Client Platform
By Jeff McAffer and Jean-Michel Lemieux Addison-Wesley Professional ISBN: 0321334612
SWT : The Standard Widget Toolkit, Volume 1 By Steve Northover, Mike Wilson Addison-Wesley Professional ISBN: 0321256638
Contributing to Eclipse: Principles, Patterns, and Plugins By Erich Gamma, Kent Beck Addison-Wesley Professional ISBN: 0321205758
![Page 40: Rcp by example](https://reader035.vdocuments.mx/reader035/viewer/2022062307/554d582eb4c90578428b47f3/html5/thumbnails/40.jpg)
Prerequisites
Eclipse RCP Target download used is eclipse-RCP-SDK-3.1.2-win32.zip
j2sdk 1.4.2 or higher
![Page 41: Rcp by example](https://reader035.vdocuments.mx/reader035/viewer/2022062307/554d582eb4c90578428b47f3/html5/thumbnails/41.jpg)
Thanks for your time