start rcp application from another rcp application - eclipse-rcp

I have an rcp eclipse application and from that application, using a context menu action I want to start a new rcp application .
How do I do that ?
Thank you.

As I see it, you have two options.
Either you create a dependency between the two RCPs and when the user clicks the menu, just instantiate the second RCPs main class.
Or you could execute the second RCP as an external command. That means you will have to know where it is installed.

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.

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 :-)

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

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;

How to add plugin with perspective and view to my own RCP app

I have a very basic RCP application (e3.7.1) with only one (Hello World) plugin. For reasons of code control I want to develop all perspectives and views in separate plugins. I have now set up one plugin with a perspective and a view. How do I get them into my main RCP plugin, e.g., where do I configure which extensions/extension points? I want the perspective and view to appear in the Perspective Menu as well.
How did you create you RCP application, did you create a .product definition ? did you create a feature ?
Basically Eclipse is based around plugins (OSGI bundles) and you can create view and perspective in different plugins. As long as your plugin is part of you RCP .product definition either as a plain plugin or into a feature definition, you should be able to export your RCP application with all the desired plugins.
If you are just talking about how to run them from Eclipse, you need to edit the run configuration and add all the plugin you need to activate in the Eclipse Application run configuration. This configuration is the on you use to launch the RCP application.
The set of view and perspective shortcuts in those menus is specific to current perspective.
If the perspective on which you want to make those shortcuts available is your own, then you need to call IPageLayout methods addShowViewShortcut() and addPerspectiveShortcut() from your IPerspectiveFactory. If you want to make those shortcuts available on someone else's perspective then use org.eclipse.ui.perspectiveExtensions extension point.

how to load a web start application into eclipse rcp

I have a Webstart Apps/jnlp in which I would like to add into an already made rcp client. Can I integrate the web start application into the RCP so it will appear under the menu toolbar so if it was clicked it will load ithe application.If so How will I go about doing that, would it need to be place into as a plug-in?
Thanks for any help!
Check out this tutorial by Lars Vogel to learn how to use commands in Eclipse RCP (and enable command execution from menus).
Then, in your command handler, write the code that opens the web browser with the url of your application passed as parameter:
//Assuming 'url' is the url of your application
PlatformUI.getWorkbench().getBrowserSupport().createBrowser(null).openURL(url);
Also, check out this link to learn more about Eclipse RCP browser support. Since you didn't specify whether you want this to be opened with an internal or an external browser, you might want to tweak the code I posted.