Running plugins without opening Eclipse IDE - eclipse

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.

Related

Launching Eclipse plug in template

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'

Using intellij to debug eclipse plugins

I am currently working on eclipse plug-in that involves many modules, and I would like to debug and run this eclipse plug-in from IntelliJ.I open this project in IntelliJ to edit code but when I have to run/debug this project I have to open eclipse IDE and start it from there. How can I use IntelliJ to do this?
I haven't actually tried this ... but you could try launching the RCP application stand alone but with the remote debug parameters specified for in your application's .ini file.
Then just point IntelliJ to the appropriate source and attach it's debugger to the running app.
Why do you want to do that? Eclipse has multiple tools for the plugin development that you will miss in IntelliJ. Also you need to build your plugin as product headless and then attach a debugger to it.
In my opinion it doesn't worth the effort. I would install Eclipse and devolop with eclipse.

Eclipse Kepler: how to export RCP product as an executable jar

I just started using Eclipse Kepler. From the Overview tab I'm able to select 'Eclipse Product export wizard' which generates an executable (.exe) that can be executed from the command line.
How can I export the product as an executable .jar that can be executed from the command line?
Eclipse RCPs are always executable .exe files (or the equivalent on other platforms), there is no option to create a Jar file.
Eclipse code contains platform specific components so you have to do a different build for each platform.
If you want to generate code to run on Linux, Mac OS X or the other supported platforms you need to check the Export for multiple platforms option on the product export page and select the platforms on the next page of the wizard.
You will need to install the RCP Delta Pack to build for multiple platforms.
Update: The Export wizard is now deprecated. tycho and maven is now the recommened way to build RCPs.
See Eclipse Products and Deployment for more details.
While there is no option to export your product as an executable .jar, you can start your application without using the executable (.exe). All the executable does is show the splash screen, load a JVM and start the Equinox launcher which is an executable .jar.
You can start the Equinox launcher from the command line yourself with the command java -jar plugin\org.eclipse.equinox.launcher_<version>.jar which will start the application (without the splash screen of course).
The Eclipse wiki has launcher scripts that make it easier to deal with the version part of the plugin name.
This will however not make the application launch on other platforms as it still contains platform specific plugins. See greg-449's answer on how to export for multiple platforms if that's what you want to do.

How can I run an Eclipse plug-in written by me that automates Eclipse through its GUI using SWTBot

I wrote an Eclipse plug-in using SWTBot to automate Eclipse through its GUI. Actually I'm running this plug-in from Eclipse with Eclipse Application run configuration to test it. That opens a new Eclipse instance. After that I can start the plug-in with a toolbarbutton using ui.actionSets extension.
I'd like to start an Eclipse from command prompt and would like this plug-in to start automatically. In my case Eclipse shall be started with GUI of course.
Do you know any working solution for this problem?
You can use the org.eclipse.ui.startup extension point. You need to provide a IStartup implementing class that is called when the workbench is started.
Note: this is not a complete fail safe method, as the user is able to disable this extension point in the Workbench > Startup preference page.

Unable to debug Eclipse Application because of missing classes

I have written an DSL plug-in using Xtext 2.2.1. After upgrading to Xtext 2.3.0, I cannot debug the related Eclipse Application (i.e. I'm using a launch config which is labeled "Eclipse Application" to start an instance with my DSL plug-in from within Eclipse) because of this error:
Error instantiating builder 'org.eclipse.xtext.ui.shared.xtextBuilder'.
Plug-in org.eclipse.xtext.ui.shared was unable to load class org.eclipse.xtext.ui.shared.internal.ExecutableExtensionFactory.
org/eclipse/xtext/ui/guice/AbstractGuiceAwareExecutableExtensionFactory
What I tried:
I deselected all bundles from the target platform in the launch configuration, clicked "Add Required Plug-ins", tried again, same error.
I made sure that org.eclipse.xtext.ui and org.eclipse.xtext.ui.shared version 2.3.0 are available in the plug-ins list and both are enabled.
When I install the plug-in into my IDE, it works perfectly. I just can't launch an Eclipse Application from within the IDE.
"Validate Plug-ins" doesn't show any problems.
Any ideas how I can fix this?
While this is neither an answer to the question, why the launcher stopped working, nor a way to fix the existing launcher, you should at least be able to get back to work by creating a new launcher. To do this, just select Run As > Eclipse Application from the context menu of the XText project. This way, Eclipse should handle the creation and configuration of the launcher for you.
Be sure that Eclipse actually creates a new launcher! If Eclipse finds an existing Eclipse Application launcher, it might use that one instead. You should at least rename the old launcher, so you can tell which one is used (shown at the top of the Console View). The new launcher will by default have the name "Eclipse Application". If Eclipse still uses the old launcher you may have to remove that launcher first.
If you want to find out what was wrong with the old launcher, or if that launcher was specifically configured and you want to preserve that configuration, this may help: Eclipse stores the launcher configurations in the directory .metadata/.plugins/org.eclipse.debug.core/.launches/ located in the workspace, so you could back up the old launcher and then compare it to the newly created one using some diff tool.