integrating external products into eclipse

37
Integrating external products into Eclipse Eclipse Day India 2011 Presenters: Aditya Madduri Girish Kumar Balre

Upload: girish-kumar-balre

Post on 26-Nov-2014

113 views

Category:

Documents


3 download

TRANSCRIPT

Integrating external products into EclipseEclipse Day India 2011

Presenters: Aditya Madduri Girish Kumar Balre

Agenda

Need for Integration Challenges in Integration Eclipse Integration Points Discussing different scenarios: Web Services Testing Tool Win32 Applications Swing Applications

2

2011 Progress Software Corporation. All rights reserved.

Need for Integration

Leverage Eclipses predefined facilities and usability Enforce company standards Multiple tools under ONE application (e.g., IDE) Improved usage of the screen real estate Increased functionality thereby increased productivity Retaining Legacy Applications Huge customer base Huge effort for full migration

3

2011 Progress Software Corporation. All rights reserved.

Challenges in Integration

Communication Between different technologies Between different languages

Attaching to Eclipse UI Hosting foreign technology inside Eclipse UI Event Handling, and Wiring between views, menus etc

4

2011 Progress Software Corporation. All rights reserved.

Eclipse Integration Points

Editor/View integration Outline/Properties View integration Problems View Integration Toolbar/menu actions Perspective Preferences

5

2011 Progress Software Corporation. All rights reserved.

Agenda

Need for Integration Challenges in Integration Discussing different scenarios Web apps Win32 apps Swing apps

6

2011 Progress Software Corporation. All rights reserved.

Integrating Web Applications

Need a web server Eclipse ships Jetty Server Configure any server using WTP

Launching application Toolbar/Menu actions Needs Artifacts Use Wizards

Links to different pages Views SWT Trees

Communicate between Web app & Eclipse controls Eclipse Web App (change URLs) Web App Eclipse (???)7

2011 Progress Software Corporation. All rights reserved.

Example: Progress Actional Diagnostics

Progress Actional Diagnostics Progress Web Application with comprehensive Web Services testing capabilities having using browser front end Rich functionality Extensive support for various bindings Pseudo code view, no XML required

Raw view

Pseudo code view

8

2011 Progress Software Corporation. All rights reserved.

Example: Progress Actional Diagnostics (contd.)

Integration with Eclipse IDE General Wizards to create a Web Service Test Allow user to begin testing immediately sans wizards using Untitled WS Test File(a la Untitled Text File)

Editor Persist/load changes from custom file on Left pane Left pane and right pane need to be kept in synch Maintain state- mark as dirty when messages sent/received

9

2011 Progress Software Corporation. All rights reserved.

Example: Progress Actional Diagnostics (contd.)

Root Contract Binding Operation Messages Web Application

Left Pane: Tree for intuitive navigation

Right Pane: Browser Component

10

2011 Progress Software Corporation. All rights reserved.

Example: Progress Actional Diagnostics (contd.)

Changes to the tree should reflect in the browser and vice-versa

SWT Tree11 2011 Progress Software Corporation. All rights reserved.

Browser Component

Example: Progress Actional Diagnostics (contd.)

Synching between the Tree and the Browser Tree Browser

Straightforward - Just need to change the URL set on the browser component

Browser Tree Complicated - ???

12

2011 Progress Software Corporation. All rights reserved.

Example: Progress Actional Diagnostics (contd.)

Producer Consumer Communication ModelThe design pattern for sending messages between two or more clients.

Eclipse EditorListens Messages

WS Web ApplicationSend Messages

Consumer/subscriber

Producer/publisher

13

2011 Progress Software Corporation. All rights reserved.

Example: Progress Actional Diagnostics (contd.)

Eclipse EditorListens to Messages

On receiving Message

Parses the message Updates the artifact file with tests current state Updates and refreshes the tree

Consumer/subscriber

14

2011 Progress Software Corporation. All rights reserved.

Agenda

Need for Integration Challenges in Integration Discussing different scenarios Web apps Win32 apps Swing apps

15

2011 Progress Software Corporation. All rights reserved.

Integrating Win32 Applications

Use case: Hosting and Integrating a win32 application inside a Eclipse IDE. Hosting: Bringing a win32 app to open inside an Eclipse UI Integrating: The win32 app needs to Respond to Eclipses menu actions (Open, Save, Exit) Respond to resizing, minimizing, closing Fire events to other Eclipse views

16

2011 Progress Software Corporation. All rights reserved.

Integrating Win32 Applications (contd.)

Hosting: Opening a win32 app to open inside an Eclipse Solution: Each window has a handle (hWnd) Desktopproperty i.e., a UID Win32 API offers a SetParent function. An application can use the SetParent function to set the parent window of a pop-up, overlapped, or child window.

Window1

Window 2Child Window 1

Window 3

org.eclipse.swt.widgets.Control has a handle property which is the hWnd i.e., this controls unique identification ID17 2011 Progress Software Corporation. All rights reserved.

Integrating Win32 Applications (contd.)

Integrating: This involves the win32 app to Responds to Eclipses menu actions Responds to resizing, minimizing, closing Is capable to firing events to other Eclipse views

Inter process communication File system IPC Message-based IPC Procedure call IPC Shared memory IPC Process2

Process1

18

2011 Progress Software Corporation. All rights reserved.

Example: Progress OpenEdge AppBuilderInter process comm nication

Win32 Application

Socket Comm nication

Eclipse IDE

IDE API showView hideView deleteView getViewHwnd setChildWindow addWindow setViewTitle

Appication API showView hideView deleteView getViewHwnd setChildWindow addWindow setViewTitle

Eclipse Framework (org.eclipse.swt.internal.win32) setParent, getParent setWindowPosition showWindow getWindow bringWindowToTop

19

2011 Progress Software Corporation. All rights reserved.

Example: Progress OpenEdge AppBuilder (contd.)

20

2011 Progress Software Corporation. All rights reserved.

Example: Progress OpenEdge AppBuilder (contd.)AppBuilder showView hideView deleteView getViewHwnd setEmbeddedWindow addWindow setViewTitle isIDERunning IDE_Command IDE showView hideView deleteView getViewHwnd setEmbeddedWindow addWindow setViewTitle AppBuilder IDE

PVM

Eclipse Framework

PVM SESSION:IDE-DEFAULT-PARENT-HWND hWindow:IDE-PARENT-HWND hWindow:IDE-WINDOW-TYPE

Eclipse Framework showView hideView setPartName

21

2011 Progress Software Corporation. All rights reserved.

Example: Progress OpenEdge AppBuilder (contd.)IDE Open File openLinkedEditor AppBuilder Open File openABFile

File Changes Editor gets Focus syncFromAB

File Changes

Editor loses Focus

syncFromIDE

Save File

syncFromAB

Save File saveLinkedEditor syncFromAB

unlinkEditor

Close File

Close Editor 22 2011 Progress Software Corporation. All rights reserved.

closeABFile

Example: DOTNET Designer & controls

Inter process communication

Eclipse IDE Editor

Designer CLR Common Language Runtime

Socket Communication

IPC

Prowin32 runtime

Java runtime

23

2011 Progress Software Corporation. All rights reserved.

Example: DOTNET Designer & controls (contd.)

24

2011 Progress Software Corporation. All rights reserved.

Agenda

Need for Integration Challenges in Integration Discussing different scenarios Web apps Win32 apps Swing apps

25

2011 Progress Software Corporation. All rights reserved.

Swing Need for integration Technology convergence - Eclipse platform as IDE Eclipse is SWT based (Editors, Views etc) Swing and SWT are parallel technologies 2 Options1. Convert Swing code to SWT Tedious and Costly migration Increases development and testing effort 2. Integrate Swing with SWT Swing-SWT Bridge Swing component dwells in SWT containers Write only bridge code Most preferred option26 2011 Progress Software Corporation. All rights reserved.

Swing - Eclipse Integration points

Editor/View integration Embed the main panel of Swing inside a composite. Trap and delegate Key binding actions

Outline/Properties View integration Listen for selection - Update Swing/SWT

Problems View Integration Validation markers Double click on problem - select Swing control

27

2011 Progress Software Corporation. All rights reserved.

Swing - Eclipse Integration points (contd.)

Toolbar/menu actions Placeholder for Swing Editor specific actions.

Preferences Migrate the app preferences to eclipse preferences Project level preferences as relevant

Reverse integration Swing to Eclipse Drive eclipse code from swing actions (For ex: new File wizard) Modal Swing dialogs

28

2011 Progress Software Corporation. All rights reserved.

Swing - Eclipse Integration points (contd.)

Use effective code-bridge mechanisms Wrap and Delegate to Swing code/actions. Clean separation between SWT and Swing code. Interface dependencies

29

2011 Progress Software Corporation. All rights reserved.

SWT/AWT Bridge

SWT/AWT bridge (Eclipse plugin) part of SWT Embedding Swing application made easy. has API for creation of Swing Frame from SWT composite.composite = new Composite(parent, SWT.EMBEDDED| SWT.NO_BACKGROUND); Frame frame = SWT_AWT.new_Frame(composite);

Embeds the Swing frame in to the Bridge

30

2011 Progress Software Corporation. All rights reserved.

Swing App

31

2011 Progress Software Corporation. All rights reserved.

Example - Integrated Swing App in Eclipse EditorExisting Swing based graphical editors have been integrated tightly into Eclipse views.

32

2011 Progress Software Corporation. All rights reserved.

Issues

UI Threads SWT & Swing have there own UI threads. Prevent/Pre-empt Deadlocks.

Look and Feel SWT has native look and feel. Swing look and feel has to be configured.

Modal dialogs of SWT & Swing are independent Tab traversal, popup menus etc., have to be handled Clubbing various Swing entities in to one eclipse

33

2011 Progress Software Corporation. All rights reserved.

Solutions

Issues can be addressed as per their merit. For instance when Swing opens a model dialog it can block SWT SWT code should be written in such a way to delegate the events to the frame composite too

34

2011 Progress Software Corporation. All rights reserved.

Summary

Integrated environment Good for the user Its possible to integrate External products built on foreign technologies inside Eclipse Things to take care Optimal technique to communicate between different environments Try to make full use of Eclipse offered usability

35

2011 Progress Software Corporation. All rights reserved.

References

http://web.progress.com/en/actional/actionaldiagnostics.html http://web.progress.com/en/downloads.html http://www.eclipse.org/articles/article.php?file=ArticleSwing-SWT-Integration/index.html

36

2011 Progress Software Corporation. All rights reserved.

37

2011 Progress Software Corporation. All rights reserved.