Eclipse 4 RCP, is it possible to exclude/include extensions conditionally - eclipse

I'm working on an Eclipse rcp application which is using a middle layer to request data. I want to run my application in offline mode i.e. if data service is not available I should be able to work on some dummy data. For this purpose I want to exclude/ include extensions (not extension points but extension point providers). Is that possible?
Thanks

If you put the live and test versions of the extension point implementation in different plugins you can then choose which plugins to include in the product build - so you would have two product configurations, one for testing and one for production. When you are testing in Eclipse you can configure the plugins to include in the Run Configuration, so again you would have a test and production configuration.
It might also be possible to use a plugin fragment to contain just the part which varies. Use New / Project / Plug-in Development / Fragment Project to create.

Related

Eclipse - Publishing at Project Level

I have 2 projects in eclipse:
Project A
Project B
Project A is a Java REST API that I would like to be automatically published when anything changes.
Project B is the front end, I have a build process that converts TypeScript e.t.c into the relevant JavaScript. I write the build folder directly into it's Tomcat Location - I don't want it to be in my project.
With this is mind, is there a way for me to configure Eclipse so that:
Project A has the Automatic Publishing Option
Project B never gets Automatically published.
I know I can either enable/disable automatic publishing globally but I would like to do it on a project specific basis.
I don't think this is possible in Eclipse. But I've been using the built in support for Gulp tasks which has made things easier - I can configure whether or not to refresh projects when a task is ran.

(IBM Worklight) Shared Templates Vs (Import) Existing Project into Workspace

In worklight V6.1.0 and i see a new Project template as Shared Temlplates and i cant differentiate the use of the this provided by IBM and the normal import Existing Project into Workspace which is provided my the eclipse.
The final result is same and only the vendor and internal process are different
In eclipse we export it as the Generel->archive file and here we are just making it a template by (IBM Worklight->Worklight Project Template).
In eclipse we are importing it as General->Existing Project into Workspace and here we are just using Worklight Project->etc steps.
if there is any other difference please let me know?
IBM Worklight Project Template (Shared Template) enable you to accelerate the development of applications by not having to start from scratch. You can use Worklight project templates to provide value added services and you can add elements that are consistent with the look and feel of your brand.
And When we talk about exporting existing project into workspace then we don't have a choice of customization for e.g. certain elements like Company logo, company name etc. but in shared templates we have these capabilities, its totally customizable feature introduced in worklight 6.1
for more information please visit below link
http://pic.dhe.ibm.com/infocenter/wrklight/v6r1m0/index.jsp?topic=%2Fcom.ibm.worklight.dev.doc%2Fstudio_ext_assets%2Fc_wl_project_templates.html
Application Component:
Application components are reusable libraries that you can add to the applications you develop. An application component can be a client-side library or a server runtime block. Typical libraries might handle basic functions such as login or payments. They can also contain various elements such as non-visual runtime objects, visual components, integration adapters, and user interface screen packages.
For more information please visit below two links
http://pic.dhe.ibm.com/infocenter/wrklight/v6r1m0/index.jsp?topic=%2Fcom.ibm.worklight.dev.doc%2Fstudio_ext_assets%2Fc_application_components.html

Creating netbeans platform application bundles

I am developing a Netbeans Platform app. I assume there will be three types of typical users and each of these groups will use a slightly different set of modules. So I would like to create 4 different bundles (for the three user types + everything). This is similar to what Netbeans itself offers: there are 5 different downloads (Java SE, Java EE, C/C++, HTML5 & PHP and All). Note that this is just the default, the user can still download the Java SE bundle and then go to the Update Center and manually install all the plugins from the Java EE bundle.
How is this achieved? Do I have to manually create several different nbproject/project.properties and nbproject/platform.properties files (and then manually keep them up-to-date) and use external scripts to build the suite with each of them ? Or is there some less hacky way?
Create three module suites. Each of them will target one user type and can have 1 or more modules. Configure them to use their own cluster (you need to look it up in docs, README in NETBEANS_HOME/harness can be useful). Then it should be possible to customize NetBeans installer to build what you need.
NetBeans distros are same thing: set of clusters built together and wrapper with installer.

How to define an OSGI/Eclipse plugin with binary components for multiple platforms

I created an Eclipse plugin and there is a native binary needed to support its functionality. I have the native code ready for Win and Mac. The invocation of the native code is different for each platform, so there is also some plugin code related to the native code. (In fact the native code is JNA code, so very different indeed.) Currently I have an extension point and each native support plugin contributes there. So, as soon as a native support is here, the main plugin works. Also I have a test fragment for each of the native support plugins to unit test functionality.
How should I set the plugin(s) up, so that everybody get's the right plugin when downloading from update site or p2 repo? (I noticed that for example SWT uses fragments for the native code, so is this the way to go?)
Edit: After converting the plugins to fragments as indicated by the answer, what should I do with the unit test fragments of these plugins? Fragments of fragments are not possible.
How can I set this up in Tycho, so that Tycho build runs the test suitable for the current platform and ignores the other platform.
Edit: I have Mac and Windows native code, two fragments and therefore two environments in the pom. But then Tycho complains "plugin x cannot be installed in this environment because its filter is not applicable", of course not, only one of Win/Mac can be active at any certain time. Can Tycho figure out this itself or do I need os dependant Maven profiles?
Yes, you will need to package the native bundles into plug-in fragments. Each fragment should specify the platform filter to ensure only one fragment is valid per platform. For example on Windows 64 bit you need to specify os=win32, ws=win32 arch=x86_64.
If your fragments are part of a feature, you should also specify the platform filter in the feature definition.
Under Tycho, you need to specify all your supported platform filter combinations under the environments section of target platform configuration in your pom file.
Tycho always runs tests under the current platform. Add your fragments to your test runtime - see here on adding dependencies to the tycho test runtime. Tycho often needs help in identifying fragments to add to the test runtime.

Add headless capability to existing eclipse plugin

I have an existing Eclipse plugin which run as a regular IDE plugin, receiving commands from the GUI and returning output in custom views.
I want to add an ability to also be able to run that plugin in headless mode, with the input received from the command-line and the output going to some file. Is there some way of modifying the existing plugin to support that mode of execution in addition to the existing regular execution, or do I have to create a new headless plugin and just use code from the first one?
It depends on how you plan to use this plugin and the main question: is there a case, where your UI dependencies will not be available, i.e. whether there is a bundle configuration without SWT and RCP bundles?
No UI available
In this case, you'll need to extract the headless part of your plugin into new plugin, which then registers the headless entry point to it. The UI part of the plugin will depend on the new plugin and just delegate UI requests to the appropriate API in the headless part.
In order to provide headless application, you should take a look at org.eclipse.equinox.app.IApplication interface and respectively org.eclipse.equinox.applications extension point. When you've defined the application, you launch it by simply invoking:
eclipse -application <app-id> <app-param>
More information can be found in Eclipse Help.
UI available
The simpler case. Only the headless entry point needs to be specified and everything will work as previously.
My experience, however, shows that sooner or later, the case arise where the plugin needs to be split and depending on its complexity it might cause more trouble than it would have been if it was split earlier.