Debugging eclipse e4 source code - eclipse

I have an Eclipse e4 RCP project using the compatibility layer.
The targets include org.eclipse.e4.* plug-ins and their source code. For example:
$ ls org.eclipse.e4.core.di*
org.eclipse.e4.core.di.extensions.source_0.12.0.v20140417-2033.jar
org.eclipse.e4.core.di.extensions_0.12.0.v20140417-2033.jar
org.eclipse.e4.core.di.source_1.4.0.v20140414-1837.jar
org.eclipse.e4.core.di_1.4.0.v20140414-1837.jar
The launcher configurations include the plug-ins without source code.
Source code for classes within those plug-ins is not being found with Navigate>Open Type or when debugging. In the debugger, I'm given a button Edit Source Lookup Path -- but I'd like the source path to automatically update when I switch targets.
I can make that happen by adding these plug-ins to the manifest of one of my plug-ins. However, these are not direct dependencies, and it seems inelegant to list these here.
Adding the plug-ins to the product configuration file does not appear to help.
How can I automatically access the current target's source code within the org.eclipse.e4 packages, when debugging, and when using Navigate>Open Type?

You include the target platform plugins in the Java searches (including Navigate > Open Type) by checking the
Include all plug-ins from target in Java search
check box on the Preferences > Plug-in Development preference page.
The first time after this that you use Navigate > Open Type or another search it may be a bit slow while the Java indexer runs on the extra source files. It should run normally once the indexes are built.

Related

"Bare" Eclipse Installation for Generic Projects

Members of my team will be working on a number of plain-text files. Rather than using a normal text editor, I would like them to utilize eclipse, so we can take advantage of the plug-ins that will make life easier... such as the svn plugin.
Therefore, I would like to provide them with an installation of Eclipse where they will set up generic projects, rather than Java projects.
However, the basic Eclipse download from the website includes all the java functionality. This means that their GUI is littered with java-related functions that are not required, and I don't really want them using.
I have attempted to remove the JDT plugins / features from the installation, but at this point the generic project functions disappear too!
How can one go about removing java functionality whilst retaining generic project functionality?
The 'Eclipse Platform' contains the minimal Eclipse without the JDT or PDE Tools.
Go to http://download.eclipse.org/eclipse/downloads/ and choose either Eclipse Kepler 4.3.2 or the release candidate of Eclipse Luna 4.4.RC3 (RC4 later today). Choose the appropriate download from the 'Platform Runtime Binary' section.
Update:
You need to open the Resource perspective to create projects and edit files - use Window > Open Perspective > Other... > Resource. The resource perspective should already be open if you start with a new workspace.

Eclipse - How to open and set breakpoints in code attached to the target platform plugins?

I am a newbie to Eclipse. I have some plug-ins installed in my eclipse workbench along with their source plugins (thus i have attached code with these plugins).
How can I open(and view) the source code of these installed plugins and set break-points so that I could debug these plug-ins?
My motive behind this task is to get a deeper understanding of the source code of some of these plug-ins.
Though the post How to set a breakpoint in Eclipse in a third party library? explains some methods, it doesn't tell how to open and view the attached source code.
Thanks in advance.
If you only need breakpoints, use Ctrl-Shift-T (Open Type), enter the name of the class and set the breakpoints.
But if you really want to learn about the plugin in question, there is more: Open PDE perspective, there is a view "Plugins". Select the plugin you are interested in, choose Import->As Source from the context menu of the plugin. This imports the plugin into your workspace, so you can really investigate all artifacts inside, not only the source. By default, your launch configuration will use the plugins from the workspace as first choice, so you can even modify that imported plugin now and see the effects when running your workspace.

How can I get Eclipse to index an entire C/C++ source tree that contains multiple "make projects"?

I'm having trouble getting Eclipse to index my source code. I'm using Eclipse Helios on Windows XP at the moment.
I have a directory called src. Within it, I have a bunch of dirs, something like this:
src
-include (common headers)
-lib
-libIO (source code for this library)
-libGUI (source code for this library)
-pgms
-pgm1 (source code and headers for this pgm)
-pgm2 (source code and headers for this pgm)
Each leaf has its own Makefile. There is no top-level Makefile in src. pgm1 can and does include files from include and lib/libIO and lib/libGUI.
Basically, I want Eclipse to index my entire src directory, without having to set up a C/C++ project for every leaf in my tree. I can't seem to find a way to make this happen.
Here's my symptoms; what I'm trying to solve for:
When editing source in the pgm1 dir, it references functions that are declared in my include dir header files and defined in source files found in lib/libIO.
However, when I press F3 to get to the declaration of a function, Eclipse says "Could not find symbol 'X' in index". I can't seem to get Eclipse to find either the header declaration or the source definition for the method under my cursor (like the Java module does perfectly). Is this possible?
I had exactly same issue as OP but for some reason the menus in Eclipse I was using (Helios Service Release 2) were not "Go to Properties -> C/C++ General -> Paths and Symbols -> Source Location.".
The way I fixed the issue was :
in C/C++ view, right-click on top project name;
in the menu, select New->C++ Project;
in the window that appears, select Convert to and then select C++ project;
click OK to close the window.
Eclipse will start indexing right away. Depending on the size of source tree it may take a while but you will have the indexing working finally after that.
I faced similar situation. I solved it in this way: right-click the project in project View-->select Index-->rebuild.
I managed to solve this thanks to comments here.... I ended up recreating my project. I used the Import method to download a project from CVS, and told it to use the New Project wizard to do so. When I got the New Project dialog, I told it this was a C++ Project, and the indexing now works fine.
I still wish I could index files without having to attach a specific project type to it, but at least I found an answer.
Thanks for the help all.
Exit Eclipse. In workspace go to ".metadata/.plugins/org.eclipse.cdt.core" and delete everything in there.
in the project explorer panel, right click the project you want to re-index, then select index, then select the action you want
Indexing of files and variables under different flags is always complicated when we have a huge project, lot of files and more importantly lot of different build options. I prefer playing around with the Indexer option to help me browse the entire code.
You can find it : Project Properties>C/C++ General/Indexer.
You can choose "Enable project specific settings"
Then it's up to you to choose the options you want for your project.
For a particular build we can choose "Use active build configuration" so that only the files and MACROS are considered which are used by the build script.
Or Index all source files in the entire project.
I am using Eclipse Neon 3, here's the solution that worked for me :
go to File
New
Convert to C/C++ Autotools project
then select your project and finish.
It can take some time to finish indexing, it depends on your project size.
I have experienced problems with the indexer of Eclipse Luna when there was an unresolved friend declaration in the class declaration - it seems then that the indexer skipped indexing the rest of that class, and all references to it was shown as unresolved by the indexer.
Solution: removed the unresolved friend declaration (in my case, it was legacy code that was no longer needed).
Please try the following (my project is set up differently, so I am not sure this will work for you).
Go to Properties -> C/C++ General -> Paths and Symbols -> Source Location.
Do you see your source folder there?
I observe this behavior:
When I add a source folder and then exclude it from build, it disappears from the above list. After that the folder is no longer indexed. Re-adding it to "Source Location" solves the problem: the folder is now indexed; remains excluded from build (as intended); is visible among source locations.
I believe it is a bug -- excluding a source folder from build should not remove it from source locations list.
In Coocox IDE (Eclipse + gcc) the problem is resolved by going from file menu
Edit > Preferences > C/C++ / Indexer > Build configuration for Indexer set to Active build configuration and the rebuild the project (Ctrl R).
If the project is already converted to C/C++ and still the index is not working you can right click on the project and Index and rebuild. The project will start indexing right away.
I am using
Eclipse IDE for C/C++ Linux Developers
Version: Helios Service Release 2
Build id: 20110218-0911
I followed the suggestions above and in addition I had to mark all referenced projects (with in the work space) using project properties->Project references
The following has worked for me in Eclipse Neon:
New Project -> C/C++ -> Makefile project with existing code -> Next. Then Navigate to the code and finish the project creation. Indexing starts automatically.

Why is eclipse trying to compile files not in my build path?

I have a rather large project which contains a number of third-party dependencies which are linked via svn:externals. These include tomcat and blazeDS, which are packaged by our installer via ant. The problem is that these projects contain dozens of sample JSP pages, and eclipse chokes on them when trying to build the project, producing hundreds of errors.
Our project setup is something like this:
src/
main/
test/
third-party/
blazeDS/
tomcat/
etc.
Now, in eclipse, my project's build path is set to only include subfolders in src/main and src/test. Yet, for some reason, it still tries to build everything beneath third-party. I have clicked on third-party and selected "remove from build path", but this had no effect. I even tried adding the third-party folder to the build path, and then excluding "", "/*", and "**/*.jsp", but again, to no effect.
What is going on here?
Edit: Thanks for the suggestions, though unfortunately, they don't seem to fix the issue. I don't have the CheckStyle plugin installed (I'm using Eclipse 3.4.1 with the only custom plugins being subclipse and flex builder), and I tried disabling all extra builders except for Java, but the errors are still being thrown.
I usually have this kind of issue with CheckStyle plugin, where you need to specify in its properties (right-click on project -> Properties -> CheckStyle):
"Exclude from check Files non located in a source directory"
Otherwise it does analyze (and reports warning/errors on) files which are not candidate to be compiled in the first place.
Couple of other suggestions:
try restarting your eclipse with the -clean option (eclipse software version of 'did you reboot it ?' ;) ). Beware it can reset your workspace perspectives, so you may want to try that with a copy of your workspace instead.
try deleting your project (your workspace reference of your project, not its actual content), and reimporting it (beware of your custom launchers, they may get removed in the process).
check if you do not have any linked directory within src or test, which would point to thirdparty(/**): that would explain the unwanted compilation.
It could be that your eclipse project is configured to have extra Builders. You can check that in the project's properties (right-click on project -> Properties -> Builders).
In my case it was because there was a reference to the file (which I had excluded from the build path) in another file which was in the build path. I wanted to exclude SegModel.hpp from the build path, but in another file, I had specified template short K::KEstimate<SegModel>(SegModel& m, short stepCode);

How do I attach source code locations to plugins in my Eclipse RCP target platform?

I've got a workspace with multiple RCP plugin projects.
We've set the target platform, so we can build against a standard set of plugins, but are not able to see source code and Javadoc for all the platform plugins.
The Windows -> Preferences -> Plug-in Development -> Target Platform -> Source Code Locations page doesn't seem to have any effect when I add the eclipse directory (it only allows you to add directories).
Copying the source jars from the eclipse directory into the target platform has a similar effect.
What am I doing wrong? How do I attach a set of Source jars to my target platform?
I had the same problem today. In my case I wanted to debug into the source of the plugin embedded jetty (org.mortbay.jetty_5.1.14.v200806031611.jar) which comes with Eclipse Equinox (OSGI) which is part of my eclipse target platform.
When debugged and wanted to go into any class inside a jetty package I always got the message that it is a class from Plugin-Dependencies and the source attachment cannot be modified.
I solved it like this:
Switch to the Plugins View in Eclipse ( Window / Show View / Plugins)
locate the bundle org.mortbay.jetty
right click on that bundle and select "Import as" -> "Binary Project with linked content"
Now that Bundle shows up in your Package Explorer as a new Eclipse project, in my case org.mortbay.jetty.
Now right click on that new project in the package explorer and goto 'Properties / Java Build Path / Libraries'. You see the the jetty jar file there and if you expand this entry you can edit the 'Source Attachment' as usual. I pointed it to the downloaded Jetty Source code located in a completely different folder than my target platform which I am using for my project.
If you use Eclipse SDK bundles when building your target platform, you should be immediately provided with "Java Source Attachment" and "Javadoc Location" for each Eclipse plugin.
For example, I used "Eclipse Platform SDK" (eclipse-platform-SDK-3.4.2-win32) as target space and when I display the "Source Code Locations page" that you mentionned, it is filled with "Source locations declared in the target platform". In the Eclise IDE, I can then see Eclipse core plugins source code and javadoc (in JFace packages for example).
Otherway, it is not so easy to add plugins source code locations but you can succeed it in 2 ways :
providing a "source plugin" (the easiest way if the plugin provider also supplies the source plugin) into the target platform, as an ordinary plugin (PDE will recognise it)
providing an additional source location (not the easy way ...)
You can find more information about Target Source Code Locations in you Eclipse Help, in the following topic :
Plug-in Development Environment Guide > Tools > Preferences > Target Platform Preferences > Source Code Locations
All sources are available if you download the 'Eclipse for RCP and RAP Developers' build from the main downloads page. At least, that's what it's called for the Juno build, it used to be called Eclipse for RCP/Plug-in Developers.
It doesn't look like the plugin source code is available via the standard Java/J2ee Eclipse builds any longer. I was assuming the sources would be available via the update mechanism but have been unable to find the correct update site/feature. If anyone knows, please comment.
I can modify the target platform at runtime, using the -install runtime option. Keep the targetPlatform as the eclipse platform.
However, this loses a lot of the benefits of using a target platform in the first place - i.e. compile time safety.