Execute a function before debug in Eclipse - eclipse

Does anyone know if it's possible in Eclipse, to execute a script/function/anything right before launching my app in debug? There only seems to be a few options - after clean, during a clean, during manual builds, during auto-builds
I want to execute an external tool (rsync) so I can make sure my assets are up to date before running.
Cheers,
Shane

Eclipse CDT provides special launch configuration type (Launch Group), which you can use to group several launch configurations (included External Tools) to be executed either sequentially, parallel or mixed. The drawback is that you need to have CDT installed in your Eclipse.
Update: There is similar question, which deals with launching multiple launch configurations.

If you want to add the "Launch Group" feature onto an existing, not necessarily CDT, eclipse install, you can install just the plugin called "C/C++ Remote Launch". (org.eclipse.cdt.launch.remote) - it is not C/C++ specific.

Related

How to determine which Eclipse feature provides a specific jar file

I am the happy user of a Terminal view in my work and home instances of Eclipse Oxygen.2. According to the process manager on my Windows 10 system, the terminal is in this path:
D:\Programs\Eclipse Oxygen\plugins\org.eclipse.cdt.core.win32.x86_64_5.4.1.201709131603\os\win32\x86_64\winpty-agent.exe
Given that I haven't installed the CDT feature, I am guessing that one of my installed features drew this plugin in.
I would like to benefit from direct integration of a terminal in my other Eclipse instances so I can build some of my projects from within Eclipse, instead of switching to a different window.
More generally, is it possible to determine which feature provides a specific plugin? Other than by uninstalling features one by one until the terminal view is no longer available.
EDIT:
These are some tabs in Eclipse Installation Details.
I can see plugins related to the terminal:
But none of these providers can be seen in the Features tab (excerpt, sorted by provider):
It is TM Terminal that provides this feature. This can be installed to eclipse from the market place:
http://marketplace.eclipse.org/content/tm-terminal

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.

Debug in Eclipse while running from command line ubuntu

Is there a way I can debug my application (using breakpoints in eclipse) while running it from command line (ubuntu)? I'm using Eclipse Kepler version on Ubuntu 12.04LTS.
I know there's something like attach to process in .net, was wondering if eclipse has some such setup.
Thanks,
Is your application written in C or in Java?
If your application is in C and you are using CDT, you can attach to existing project by:
Run your application from terminal.
In Eclipse CDT, go to main menu "Run"->"Debug Configurations...", double-click "C/C++ Attach to Application" and press "Debug" (you should not need to specify executable and/or project).
For Java applications, see this

Debugging Eclipse plug-ins

This is my first attempt at creating an Eclipse plug-in. I've created one, along with a feature and update site. I set the target platform as my local Eclipse installation. When I run/debug the plugin from within the development environment everything works fine.
Now, my colleague installed the plug-in from the update site that I hosted. When he starts using any of the functionality exposed by my plugin he gets runtime exceptions.
He sees null pointer exceptions which didn't occur when I ran my plug-in project from my development environment.
I have a wizard that's part of my plug-in. When he close it he gets a "Unhandled event loop exception", and the wizard doesn't close. I didn't have this issue when I was running/debugging my plugin in my development environment.
Now I'm confused as to why the same plug-in is behaving differently in the production environment, as against the dev environment and when I was debugging it from my IDE. The target platform in both cases is the same Eclipse version. What could be the reasons?
And how do I debug the plug-in in a production environment? Is there a remote debugging capability for debugging the plug-ins on the production environment?
Any suggestions would be really useful!
To remote debug your plug-in, first add debug arguments to your target Eclipse .ini file
-vmargs
-Xdebug
-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=1044
before launching it.
Then open another Eclipse instance with a workspace containing your plug-in project.
Open Run > Debug Configurations..., select Remote Java Application and create a new configuration.
As Project, browse and select your plug-in project.
Also fill in your connection properties (host of target Eclipse and port 1044).
Launching the newly created debug configuration allows you to debug your plug-in the same way you debug locally.
Now I'm confused as to why the same plug-in is behaving differently in
the production environment, as against the dev environment and when I
was debugging it from my IDE. The target platform in both cases is the
same eclipse version. What could be the reasons?
This is a classic: Eclipse plugins and RCP applications do indeed behave differently between PDT (the Eclipse IDE) and the exported product.
In your case, a NullPointerException thrown from the exported version but not from Eclipse is 9 times out of 10 an image or other resource files (properties, etc.) that is loaded by your code but is not listed in the build.properties of your plugin.
Anyway, you'll need to check the logs to retrieve the stacktrace and hunt down its cause. Such logs could be found in your friend's workspace under le .metadata/.log file
From your development workspace as it stands now, use the "Debug As -> Eclipse Application" menu item to startup a test workspace. When it starts up, you'll have two workspaces running: the original development workspace and the new test workspace. You can set breakpoints in your plugin code in the development workspace and run your plugin in the test workspace.
When your plugin execution in the test workspace gets to one of your breakpoints, execution will pause and you can use the Debug view in your development workspace to look at variables, set more breakpoints or anything else you want to do to debuf your plugin.
See the Apache Wiki for Developing with Eclipse.
Under Windows 10 with Tomcat running as a windows service I started:
tomcat8.5\bin\Tomcat8w.exe
& added in the Java tab as the first entry in Java Options to enable remote debugging:
-agentlib:jdwp=transport=dt_socket,address=8000,server=y,suspend=n

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.