Xtext cross-references work only with an Xtext Java Project? - eclipse

I followed this tutorial Second Iteration: Adding Packages and Imports by Xtext. I was trying to make a cross reference like the one shown in the last picture of the tutorial, that I paste here:
In first example of the tutorial page I had simply to create a java project and a file mymodel.dmodel and everything works fine.
I noticed that in second example (named Second Iteration: Adding Packages and Imports) the cross-references don't work (I have some Could'nt resolve reference errors) with a simple java project.
However it works fine if I convert the project to an Xtext project.
Is this a normal behaviour or have I missed some configuration steps?

To get the cross references work you need
A project with xtext nature + builder (that is what convert to xtext project does, this is an "add xtext" not a "remove java" operation
Build automatically should be enabled
Depending on the project type
Java Project: Put the files in a source folder
Non Java (General -> Project): Put the files anywhere

Related

Output folder of the Kotlin compiler in Eclipse

The Jetbrains Kotlin compiler in Eclipse outputs to a hidden folder inside the Eclipse compiler plugin. This hidden folder is then made available through the Eclipse Kotlin classpath container.
In bndtools we need a normal file system folder since bnd can run both from the file system as well as in Eclipse. Since the folder is a linked resource there is no known way to translate it outside Eclipse.
Anybody knows how to tell the Kotlin compiler to just output it in the bin folder?
Currently, this is not possible in the Kotlin Eclipse plugin.
To make it possible that Kotlin code can be used from Java, Kotlin plugin produce so-called lightweight class files to this folder. These class files do not contain bodies for methods and they are stored in memory.
Actual class files, that are used to run an application, are being built only before launch and they are produced to the default output folder. For now, we cannot produce class files on each save reasonably fast as there is no incremental compilation in the plugin yet:
Feel free to upvote for this issue.
From the short analysis of the code of Kotlin plugin, it looks like the proper method is KotlinCompiler.compileKotlinFiles. It is being called in two contexts:
KotlinBuilder.build — this is the one called on the project build; it makes a call stack trick (or rather a hack...) to check if being called from the LaunchConfigurationDelegate, and depending on the results, either compiles whole project (via its own private fun compileKotlinFiles), or just makes stubs in memory.
KotlinCompilerUtils.compileWholeProject — this is in fact being called from 1.; nice static method, perfect for abuse until the problem is correctly solved in the plugin. :)
So, I'd use the method from 2. wrapped in a similar way as compileKotlinFiles from file in 1.

java documentation of several packages

I've been recently asked to create a full Java documentation of all our APIs.
well creating a documentation for single project is easy (open project then eclipse->project->Generate javadoc).however, I'm not quite sure how is it possible to create a documentation for all the projects so they will be able to point to eachother.
in short to break down my question:
while commenting a packageONE.classA from project1 how am I able to point to package2.classB in project2 (assuming pakcageONE.classA uses API of project2 packageTWO.classB now I want to simply point to it while writing the documentation.)
how is it possible (or is it at all possible) to create javadoc for all the projects at once. so index.html will show a list of projects and upon click on a project it opens all the packages/classes of that project (if javadoc is used for one project index.html points to all packages/classes of that project)
when creating a javadoc even for one project all the native java classes come as full path (e.g. instead of String it shows java.lang.String without links to http://docs.oracle.com/javase/7/docs/api/java/lang/String.html) so is it possible to first show it as String (instead of java.lang.String) and also link it to http://docs.oracle.com/javase/7/docs/api/java/lang/String.html
I hope question is clear enough.
1-2 : did you try to select all projects before generating javadoc ?
3 : try using option -link or -noqualifier
see this for more explanation about options

How to show shortened project names in the Eclipse package explorer?

I work for a big company that has standards on Java project names. Long standards:
com.company.department.subdepartment.stream.project
Rather than let the package explorer take up a sizable portion of my screen, I'm looking for a way to shorten the project names. Mousing over project names shows the full name, but it's still very slow to determine which project I want to look at next with the incredibly long names. As has been answered before, package names can be shortened. I've got a rule set up, but it only works for packages:
com.company.department.subdepartment={department}
Is there a way to do an analogous thing for project names in Eclipse?
Package explorer uses the org.eclipse.jdt.internal.ui.packageview.PackageExplorerLabelProvider class to provide the view labels. Going through the source of this I don't see any support for shortening the project names.
The following ideas depend on how your eclipse workspaces are setup. If you're lucky and you just import project from your VCS, these could work for you.
If you're using maven, Eclipse project names are usually derived from your GAV. The Import as Maven project wizard has options for what pattern to use for the project name based on your maven GAV.
Otherwise, you can sometimes just right click the project -> rename. YMMV if you have any scripts or such that have the project name hardcoded. If you have these constraints, find those scripts and use variables rather than hardcoding.

Add a new Template in Eclipse for Project Type / Executable

First I'm really new to Eclipse.
I searched a long time for a solution for my problem, and I already found some threads but I can't really follow what they are doing.
So my problem is, I want to add a new "Template" to the New -> C Project -> Project Type - Executable folder in the Wizard.
Like the default "Empty Project" and the "Hello World"
http://s1.directupload.net/images/131027/ktganjqa.png
Somebody know how I can do this?
And it would be nice if you could explain it fully cause, like I'm said, I'm quiet new to Eclipse
Greetz AllesFam
You have to create a plug-in, add a simple definition in the plugin.xml that points to a template.xml where you define what files should be copied to the newly created project.
For simple to average templates, no Java programming is required, the descriptive xml-s are enough.
You can take a look how I added templates to GNU ARM Eclipse Plug-in, the source code is available from the SourceForce git.

How to make a new Eclipse project template?

I am using a kind of framework where every time I make a new Java project. I have to arrange the files in the appropriate packages and reference the appropriate external JAR libraries. How do I make a new project template like in the New Project dialog under a new folder?
I've just done a bit of research on this for our own nefarious purposes, and found the answer.
You need to create an Eclipse plugin that uses the org.eclipse.ui.newWizards package. You can define your own category or use an existing one once you find the category ID. To create a new project wizard rather than a new resource wizard, you need to set the "project=true".
Also, your plugin must contain a class that implement org.eclipse.ui.INewWizard. Clicking on the class link from the plugin.xml editor will do the trick.
That class must do all the work in the performFinish override, and must return true to indicate that it actually did its thing and the wizard can close. This is where you create files, directories, set natures, and so forth.
You need to write an Eclipse plugin for that, and concentrate on New Project Wizard.
Writing Eclipse plugins is covered in Stack Overflow question How to write a plugin for Eclipse?.