Is it possible to mock all the objects around an eclipse RCP application? - eclipse

I've been trying for a while now to do something a bit strange...
I need to invoke some code that gets executed by a eclipse rcp wizard window from outside the rcp environment.
Basically some third party team has built an installer using the eclipse rcp framework and one of the functionalities of this installer is to export some data.
I need to perform that same data export programmatically but from outside this whole rcp scope. (basically from ant).
The issues I seem to be facing are connected to not having the org.osgi.framework.BundleContext objects populated.
Any idea how I can mock them?
thank you in advance

Found the answer... import org.springframework.osgi.mock;

Related

Can I use Eclipse Dependency injection (DI) in normal Java Model?

I am trying to write Java model which will act as model for Eclipse RCP. This model I should be able to run without UI also (i.e in command line). I wanted to use (Explore, I am new to this) DI supported by e4. Can any one guide me on this?
As described in Eclipse bug 323075 the e4 RCP startup currently always wants to create a Window. So it does not look like you can use it for a 'headless' RCP.

Eclipse RCP: NullPointer on getSite().setSelectionProvider(...)

As I have done the following tutorials:
http://www.vogella.com/tutorials/EclipseRCP/article.html
http://www.vogella.com/tutorials/EclipseJFaceTable/article.html
http://www.vogella.com/tutorials/EclipseJFaceTableAdvanced/article.html
I wanted to combine the JFace table viewer (plugin from 2nd and 3rd tutorial) and the ToDo application from the first tutorial. In the JFace table example(s) there is a View extended from a ViewPart. In this the call:
getSite().setSelectionProvider(view)
inside the createPartControl method is fine and works.
But when I do the same in the other tutorial it does not work, I get a NullPointerException. The first article creates a plugin and then transform it using features and products into an Eclipse 4 application. So the classes in the application are not derived from a 'Part'. They are referenced using the application model and only use the annotation #PostConstruct.
Why is it that I get this NullPointerException?
And really, how can I get the SelectionProvider service linked to the Workbench?
I also tried to use PlatformUI.getWorkbench() but it says that the workbench does not yet exist.
Any help highly appreciated.
Thanks.
Eclipse 4 (e4) applications are completely different from traditional Eclipse 3.x style applications.
In an e4 application you cannot use a lot of things that are used in a Eclipse 3.x application - so you need to check which style the example you are using is based on. The e4 application has access to a lot of new features that are not available in a 3.x application.
In an e4 application you inject the ESelectionService to get and set the current selection.

How to create Eclipse RCP application that behaves like a wizard?

I want create a installer by using Eclipse RCP. I need to give the user a wizard-like installer. This means user can do some options then click next. Or they can go back to previous page by click previous. Or they can cancel the installation by clicking cancel.
Here is my problem:
I don't know how to switch between views when clicking "next","previous". I need to create something like WizardPages and i can change between these pages?
I can't use JFace wizard because I'm required not to pop up any dialog.
I'm totally new to Eclipse RCP so please help!
thanks.
Maybe "StackLayout" is what you need.
Consider whether you actually want/need Eclipse RCP in this context. Eclipse RCP shines in complex applications with an extensive business domain and complex user interface.
An installer wizard, however, is very straightforward and static. I cannot imagine you requiring more than two or three user inputs. Your question is a bit like "I want to hear beautiful music. How do I program a robot to play the piano?"
It is much easier to limit yourself to using SWT and JFace. Use the JFace WizardDialog to make a nice installation wizard. You will find you will have never needed the Eclipse RCP framework.
See http://www.vogella.com/tutorials/EclipseWizards/article.html for a nice tutorial.
If you do think you need the features of the Eclipse RCP runtime framework, I suggest you follow the path below instead:
Create an RCP application (e.g. the sample 'Mail' application). A class will be created that is the main entry point in your application. This class will launch the Eclipse Workbench. Delete this code, and instead launch the WizardDialog.
A lot of things will not be available, such as menu's, views with drag-and-drop functionality, keybindings, etc. I cannot imagine you will need those things. However, you will benefit from the following Eclipse RCP features:
Eclipse launch framework. Ability to create a self-contained product including the JRE.
OSGi framework. Ability to easily add new plugins. Ability to use services, blueprint, etc.
JFace framework.
EMF (if you have a very complicated installation wizard)
All other eclipse plugins, although a lot of them may not work outside of the context of the Eclipse Workbench.
If you are convinced you need the full Eclipse Workbench, you can always do the following:
Define a 'base' perspective that is 'locked down'.
Use a Command to move from one perspective to the other. This will allow you to keep the previous wizard views open in other (hidden) perspectives.
Use Eclipse Contexts to hide all the standard Eclipse Workbench functionality, menu's, etc.
Since you are new to Eclipse RCP, I do not recommend learning the framework in the particular usecase of an Installation Wizard. You already need good knowledge of Eclipse RCP to be able to hack it this way, and it will not be a clean or nice implementation :-)

Error on creating a BPMN diagram with BPMN2 and Graphiti

I'm trying to use Drools Gorm plugin to build process in my Grails application. Therefore, it is needed to use bpmn diagrams in order to instanciate a process. For this, i'm started to use two eclipse plugins: the BPMN2 and Graphiti (that is required for the first one).
But, when i try to create a .bpmn file on src/diagrams, i'm getting this error on output alert screen:
Error org/eclipse/graphiti/ui/editor/diagrameditorfactory
I looked everywhere and i don't find any reasonable solutions. Any help is welcome!
Did you try the drools jBPM plugin? It seems to work pretty well. If you are alright with using another editor, you should try that. The update site is located here

Lift and Eclipse RCP Integration

I work on a fairly simple but large two-tier application that consists approximately 40 Eclipse RCP plugins. We have a new use case that is taking us to the web for a very small portion of this functionality. I'd like to prototype this using Lift. Clearly, I'm facing a few challenges.
Lift + OSGi. Can Lift get at OSGi bundles? Can it be packaged as an OSGi bundle itself and integrated into a web container?
Build System. We use the archaic Eclipse PDE build (read: Eclipse has no build system) with Cruise Control. Lift uses Maven.
Development Environment. This one I'm not sure anyone can help me with. I've tried to use the Scala plugin with Eclipse and it's still not ready. There are just too many impediments to make it useful. Saying that, I don't see this as a major issue because I can keep all the Lift code in one module, only referencing the Java code a very specific areas.
I'm wondering if anyone has tried anything similar to this and has any advice. Note that I won't be using any of the ORM stuff in Lift because all persistence is managed in the existing plugins behind an API. So, am I barking up the wrong tree? Is there something else I need to be aware of?
I could revert to simply using these instructions but I'd really like to take Lift for a spin because Java is... well... it's Java. :-(
There's thread in google groups about using lift as an OSGi bundle.
For the build system as far as I remember PDE sit's on top of ant, so you can use maven for building lift related stuff first and then call PDE's build.xml