Launching Eclipse plug in template - eclipse

I created a Eclipse plug-in project by selecting a plug-in template provides by the eclipse. Then i ran the plug-in it opened another eclipse and the plug-in executed there.Why so? is the plugin taking eclipse's application class to create workbench?

As an elaboration of "If you want to run the plugin in your main workspace you will have to export the plugin and install it in your main Eclipse." that #greg-449 had in his answer. You can do this.
Step 1 - Export your plugin
From the File menu, choose Export... and then choose the Deployable plug-ins and fragments wizard.
Step 2 - Configure your Wizard Options
Select the plug-ins you want to export.
As the destination, choose Install into host
Press Finish
Step 3 - Confirm unsigned content
As you are probably not signing your plug-in, but you do trust it, say Yes to the Warning: you are installing software that contains unsigned content.
Step 4 - Restart Eclipse
Restart Eclipse when prompted to to enable the plug-ins.
Result
You should now see your new plug-ins. To make this example I used the new Plug-in wizard and choose the "Hello, World Command" template. The arrows below point to the contributions in the UI that the plug-in made.

When you run a plugin (Run As > Eclipse Application) Eclipse starts a new instance of Eclipse including your plugin and uses a new workspace. This enables you to test the plugin without damaging your main Eclipse installation and workspace.
If you want to run the plugin in your main workspace you will have to export the plugin and install it in your main Eclipse.
If you want to run your plugin as part of an RCP you can set the application or product launched in the 'Run > Run Configurations...' entry.
For example:
Here I am running a product called 'greg.music.e4.rcp.product'

Related

eclipse RCP: plugin runs via popup-menu

I have created a non-RCP plugin project in eclipse. To run my eclipse plugin, the user must right clicks on a file and select my tool option from a popup menu. Is it possible to have a RCP for such a plugin? How can I provide a RCP distribution (zip) ready to be tested for such a plugin? Would you help me to find an appropriate manual for such a case?

How to deploy an Eclipse Plugin?

Environment: Eclipse Oxygen.3a Release (4.7.3a), Build id: 20180405-1200
I have completely developed my new Eclipse Plugin. I have debugged it successfully and It´s ready to be deployed for beta testing by other developers in my organization.
The Overview tab in plugin.xml Eclipse editor offers an Export Wizard that works and produces a .jar file (theoretically) containing the plugin to be installed in other Eclipse installations.
After exporting the plugin to a local folder in my computer I tried to install it in Eclipse by using Help > Install new software... > [Add...] > [Archive...], selecting the .jar file generated and clicking [Ok].
However, I get the error message "Could not find jar:file:*<the selected plugin file>*!" and the [Finnish] button remains disabled.
What is missing to make my new plugin fully installable?
The most robust way to publish a plug-in (or Feature) for others to consume is to produce an Update Site. Then you can direct users to that site so they can install your plug-is/features via the Install New Software UI. It also provides an easy way to publish updates to your plug-ins.
Here is documentation about creating an Update Site.

Running plugins without opening Eclipse IDE

Using Eclipse IDE we have created plugin which is used to open the Directory Dialog on selection of the option openDialog in menu bar which performs the operation of reading the file names inside the directory and then creates a new file and pops up the Save Dialog in which we can specify the desired location to save the created file. So to run this plugin we need Eclipse IDE to be opened.
Question 1: Can we run that plugin without opening the Eclipse IDE.
Question 2: I want to export this plugin in the form of .exe or jar such that when I run that .exe in the windows we want to start executing that plugin.
Finally we want to run the plugins as Standalone application without opening the eclipse IDE
Thanks in Advance
No you can't run a plug-in on its own, it will depend on many other plug-ins and the Eclipse/OSGi framework.
You may be able to write an Eclipse Rich Client Program (RCP) standalone application containing the plug-in and the other required plug-ins.

Eclipse - how to setup plugin run configuration to run it inside custom Eclipse RCP?

When you create new Plug-in project inside Eclipse, you can run it as Eclipse Application (eg. new Eclipse instance will start with that plugin included by default).
I need start that plugin but in instance of my own Eclipse RCP app (which i have as other project in my workspace).
Is it possible?
Open 'Run > Run Configurations' and find the configuration for your RCP application (under 'Eclipse Application')
Look at the 'Plug-ins' tab.
If the 'Launch with:' is set to 'all workspace and enabled target plugins' your plugin is already being included.
If the 'Launch with:' is set to 'plug-ins selected below only' select the plugin you want to include if it is not already selected.

Language editor/generator on normal eclipse

I've created my DSL language and code generator using Xtext nad Xtend. But when I want to use it, I need to open my Xtext project and click "Run as-> Launch Runtime Eclipse". Is it possible to have my editor/generator in the normal eclipse run? In other words, I want to download plain eclipse installation,than install some plugin or somehow configure my eclipse, and than create files of my language, have syntax coloring and all editor features, code generation etc.
You have to export your plugins and install them into eclipse.
option 1: use File>Export...>Deployable plugins and fragments to export your plugins, then install them into an eclipse. That wizard has an option to deploy them directly into your running eclipse.
option 2: build your plugins using PDE build or maven/tycho and create a p2 update site. Then you can install them into any eclipse you have.
Both options are easier to manage if you create a feature that contains your plugins. It's easier to export, and easier to install the feature.