How can I make my application support plugins? - plugins

I'm work in an aplication that need be capable of support plugins, but i dont know how this work.

See Design Pattern for implementing plugins in your application?
The answers tend to get very platform specific. It also depends on how much control of your core app data and logic the plugin must have.
The C++ QT4 book has a good description of adding a file-type plugin to it's architecture, there area also a bunch of modeling apps (openscenegraph, blender, povray ) that have good documentation for their plugin architectures.

You need to design your application's API in such a way that plugins can be created, and you need to add the necessary plugin management interfaces and supporting code to invoke the plugins. There is no catch-all way of managing plugins.

Take a look at the open source application called Rawr (c#). Each addin is a seperate .dll and the main app uses reflection to access the code. Very nicely done.
www.codeplex.com/Rawr

Related

Hippo custom essential plugin creation

How do we add our own plugin. Lets say a new add-on or feature which can be installed and used. How do we develop that? I am sorry i am new to this.
Kindly help
Depending on your needs, I suggest you check out:
https://documentation.bloomreach.com/14/library/concepts/open-ui/introduction.html
You can also create various plugins more like the native functionality. Adding such to essentials is described here:
https://documentation.bloomreach.com/14/library/essentials-plugins/overview.html
That doesn't tell you how to create a plugin however. Essentials is just a helper application, the plugin can be various things from services, to configuration, to document types, to hst components... All of that requires some knowledge of the internals of the system. Look around the documentation, you can see how to create various things like workflows, perspectives, and more.
A plugin is no more than a collection of code and configuration bundled together. It could be a frontend thing or a backend thing. So I can't simply tell you how to create them. It can be quite difficult, depending on what you want, to create a plugin. Look into the code of some plugins, you will see that it is basically a java project with some configuration that can be found by the system on startup.
You might want to ask more specifically on what exactly you want to develop. That could lead to more specific advice. It can be daunting when you are starting to work with the cms. With experience it does start to make sense.

Settings in MvvmCross Core assembly?

In porting my WPF MVVM app to MvvmCross, what would be the recommended approach for persistent user settings in the Core assembly? Currently I'm using Properties.Settings for this task. Ideally, I'd like a solution that can play nicely with ClickOnce upgrades on Windows.
Thanks!
If you only want to support WPF, then you could continue using properties.settings.
If you want to support settings using native techniques on other platforms as well, then you could create an interface/abstraction for your settings and then use dependency injection to inject an appropriate settings implementation on each platform. You could do this in a plugin if you wanted to - but for getting started it's easiest to start by injecting this in your UI projects in Setup.cs (for how to build a plugin, see https://speakerdeck.com/cirrious/plugins-in-mvvmcross)
What I would probably do... is to use a portable settings implementation - either using a simple JSON file or using a small SQLite database (accessed via SQLite-net). This would enable you to reuse exactly the same code on all platforms. I don't know how this would work with ClickOnce (I don't know much about ClickOnce) but I'm assuming ClickOnce would preserve these data files during upgrades.
For portably saving a JSON file, see https://github.com/slodge/MvvmCross-Tutorials/blob/master/Sample%20-%20CirriousConference/Cirrious.Conference.Core/Models/FavoritesSaver.cs
For using SQLite-net, see https://speakerdeck.com/cirrious/using-sqlite-dot-net-in-mvvmcross - but be aware that the nuget packages for SQLite-net still suffer from the open issue on x64/x86/ARM differences - see How to distribute processor-specific WindowsStore assemblies with nuget :/

A layout implementation such as Eclipse

I have been working on a project model and pretty much completed it. Now I must implement the view of the project. I like eclipse view layout very much and tried to implement like this but I couln't. And then download source code of eclipse but couldn't find my specific code snippet in all of the source code. I mean I want to take basic layout implementation like eclipse Coolbar,ctabfolder and events. any suggections ?
Thanks.
If you like the Eclipse look and feel and the components used, you should have a look into the technologies used with Eclipse:
SWT is the GUI toolkit. It differs from Swing in that it uses the native widgets, if possible. This makes an application using it behave more like a native application than Swing does, which has its own set of components. You will find the raw components that you mention here.
JFace is an application framework based on SWT. It provides higher level conceptual components.
Eclipse RCP is a platform for building application. It takes away some common tasks of application building but, of course, you need to learn the concepts first.
Swing has similar components, but does not use the native widgets. It draws them itself. In my opinion Swing is easier to learn and to use but the results of SWT are often nicer - you can often "feel" that a Swing application behaves not completely right. It is better if Swing applications do not try to mimic the native look and feel to avoid the uncanny valley effect. So expect your resulting application to look and feel different.
There are more documentation and third-party libraries available for Swing, for example the very nice Netbeans RCP that let's you easily build applications.
What you are looking for is a docking framework. What the best framework is is open for debate.
You might have a look at this question for a list of popular frameworks

How to insert platform-specific code in eclipse?

I'm working on an eclipse-based application, composed by several plug-ins. One of these plugins performs a computationally-intensive task, hence I want to provide a "native" implementation for some platforms I support. What is the best way to do it?
I was thinking about a base plugin (which provides the default implementation) extended with some fragments (to provide platform-specific implementations). However, how can the base plugin be aware of the available fragments?
You could write a class in your main plugin similar to LocalFileNatives from org.eclipse.core.filesystem. It loads a library that implements its set of native methods. It then provides a facade to the system that uses the native implementation if it is available but has some default functionality for platforms where there are no native implementations.
Then each platform fragment simply provides the appropriate native DLL or .so
There are other options for having the fragment supply a service, that can be retrieved by the host plugin.
Eclipse plugin's are written in Java. So what you need to do is retrieve OS info.
If you scroll to the bottom of this page, you'll see a code that does this.

What is the basic idea behind Plugins? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
Wether you call it Addons, Plugins or extra peices of code that is connected with the original software later, it really doesn't matter. I would love to understand how they work, there has to be a simple explanation of how to design a Plugin System. Unfortunately, I never understood it, and there remains a lot of open question in my mind. For example, how does the program find a plugin? how does it interface with it? when is it preferable for a software to have Plugin System?
Thanks for all helpful answers. It seems I asked too open question, fortunately I got keywords to look for. I liked David answer though I am not a Java guy, but his talk made sense to me :)
Plug-ins work by conforming to well-known interfaces that the main application expects to work with.
There are several ways in which a plug-in architecture actually works, but in general, these are the steps:
Plug-ins are designed to match an interface that the application expects. For example, a simple application might require that plug-ins implement a IPlugin interface.
Plug-ins are loaded by the application, usually when the app is starting up
Plug-ins are often provided access to much of the data that the application manages. For example, Firefox plug-ins can access the current web page, and Eclipse plug-ins can access the open files.
Here are two ways (out of several) in which an application can find plug-ins:
The plug-ins are known to exist in a particular folder, and the application knows to load plug-ins from that folder
Each plug-in runs as a service, and the services are designed to work together (this is how an OSGi-based application works)
When plug-ins are found, they are loaded by the application (sometimes the job of a Class Loader).
A software architect might design a plug-in architecture when they expect that either the software provider or the user community will implement new features that were not originally part of the system. Two great examples are Eclipse and Firefox; other applications include Adobe Photoshop (for artistic techniques and graphical tools) and Winamp (for visualizations).
Create an interface that all plugins of a particular type will implement
Write the code that will 'consume' the plugin against the interface only.
Have a dynamic way to load a DLL containing the plugin type that implements your interface (for instance, have a configurable folder location to test whether any DLLs in that folder contain any types that implement your interface, and dynamically load any that do. In .NET this might use Assembly.LoadFile())
If you want to have a look at some source code, Paint.NET is free and open source, and has a plugin architecture.
A program typically has to be designed to look for a plug-in, and the plug-in has to have a standard access point to accept control from the main program. Every application or website does it a little differently.
The simplest type of plug-in is accessed something like this:
if (a plug-in exists/is configured)
call predefined plug-in code
In this case, the main program is coded to only handle a specific set of plug-ins (many php-based wordpress templates are like this). A slightly more advanced plug-in
perform application specific logic
if any plug-in exists that exposes the run_after_app_specific_logic function
call plug-in code
This second case can handle ridiculously complex plug-ins ... the plug-in would just need to implement more functions called by the master program.
Eclipse in an example of a application-framework which is entirely plugin-based, meaning that all functionality is implemented as plugins. There is a thin layer at the bottom for startup/shutdown and plugin-management, but everything else is implemented as plugins on top of that. This results in a framework which can be used for just about everything. More info about Eclipse plugin architecture can be found here: http://www.eclipse.org/articles/Article-Plug-in-architecture/plugin_architecture.html.
It's very language dependent.
In an interpreted language it simply involves calling a file that follows a pattern.
In C it's pretty hard to do without help. In C+windows a "DLL" can be a plug-in and are often used that way.
In an OO language with reflection, you might create an object that implements an interface and load it reflectively. After it's loaded, you can ignore the fact that it was a plug-in because it's treated as any other object in your code.
.net has a plugin architecture (is it COM?) Well anyway COM can be used as (is?) a plugin system.
Your question is probably too open-ended because of all the possibilities. There is no single answer.
I've never written a plugin system. But this is how I imagine it in my head:
Your program has a subdirectory for plugins (e.g. "C:\Program Files\My Program Name\plugins").
You create plugins as DLL files and place them in the plugins folder.
These DLLs would export functions with predefined names.
When you run your program, it looks through all the DLLs in your plugins folder. In each one it would look for an exported function with a certain name (e.g. "Load") and call that function. The plugin could then do any setup that it needed to do.
The program would then call an exported function on the plugin with a name like "GetPluginName". The plugin would return it's name and the program could then use that name when it displays a list of plugins to the user.
When it comes time to invoke the plugin, the program would call another exported function (maybe "Activate") and probably pass the plugin a pointer to the data that the plugin is going to work on. The program would then do its work on the data.
The plugin might also export another function that the program would call to show a setup dialog where you could change the plugin options.
A plugin system can be implemented in many ways, but the common way for a lot of C/C++ applications is a DLL-based plugin SDK.
The DLL will expose various automated function calls which may allow the plugin to "set itself up" in the running application such as adding menu items, new functionality or extra options for systems (like 3D rendering implementations).
More ofthen there's no need for any special discovery - the plugin mechanizm is generally dumb: Here's a code signature I understand, and here's a call(s) I can make. I have no clue how the thing I'm calling will do the job, but I expect result to be in certain format. And that is pretty much a contract. Now - the plugin will implement the contract and make itself available. In Java, for example "make available" simply means that implementing classes are loaded into memory. JDBC driver for a particular database would be a good example.