I have a requirement to design a plugin which is OS specific. Depending on OS (MAC or Windows), the content of the plugin will vary.
Currently we are maintaining two different plugins, one for Windows and other for MAC, plugin id's com.core.win and com.core.mac.
My main plugin is dependent on above plugin. But as my plugin ID is different depending on OS, both the plugins are added in Plug-ins Dependency as "Optional".
com.core.win; resolution:=optional,
com.core.mac; resolution:=optional
But in reality the dependency is a must, "Required". How do I design my plugin structure, such that a tight dependency can be defined ? Is there any standard solution approach ?
Thank You!
Usually you have one base plugin with a platform specific fragment for each platform.
You use the
Eclipse-PlatformFilter
MANIFEST.MF entry to specify the platform, something like:which specifies the Cocoa window system, Mac OS X operating system and 64 bit (this is the normal setting for current Macs).
In the plugin.xml/MANIFEST.MF editor this is the 'Platform Filter' field in the 'General Information' section of the 'Overview' tab.
Here is a good introduction about fragments, the Eclipse PDE Help also has documentation. Also, SWT is a good example of usage of fragments for platform-specific code. See this FAQ entry to learn how to get the SWT code for inspection (you don't need to actually do the build and export part).