Why does Eclipse show incomplete Scala classes in the Outline view? - eclipse

Context: Scala project with imported library such as akka-http.
IDE: Eclipse (mars) + Scala-IDE 4.3
OS: Windows
I've configured sbt to download source code related to dependent projects, so I can view/inspect libraries more fully.
When I bring up akka.http.scaladsl.server.Directive I see only the first few members of that class in the Outline view. I can see additional members in the code that are not displayed in the Outline.
Why am I not seeing the full outline?

Short Answer
Right click on the project to open Properties -> Resource -> Text file encoding, and set to UTF-8.
This can also be set for the workspace properties; it's not clear to me if changing the workspace properties auto-sets existing projects, I'm guess it doesn't.
Why?
Admittedly a guess, but...
The problem seems to be associated with the combination of Scala IDE 4.3 (for Eclipse), Windows, and assumptions about source files and text encodings:
The Eclipse Scala-IDE 4.3 has a new Outline view, which seems to render a better representation of Scala classes by deferring to source. And it fails to do that properly when it doesn't grok the text encoding.
In Eclipse the default text file encoding is "Inherited from container" for the workspace. I presume existing projects inherit that setting from the workspace.
The Windows text file encoding (the container mentioned previously) is ISO-8859-1, or possibly something else... but not UTF-8.
In my problem Outline view, it turns out that the last member displayed for a class contains a unicode '⇒' (syntactically equivalent to '=>' in Scala).
silent boom

Related

New Eclipse hierarchical package presentation is partially broken

With the new Eclipse release 2022-03 some (but not all) java projects changed appearance in the Project Explorer view. Although Package Presentation is set to Hierarchical, the Project Explorer view still displays long/full package names instead of showing them as a tree of sub-directories (see the screenshot)
I can't find any reference as to how to control this behavior. This also seems to be project specific as half of my existing projects in the same workspace do not exhibit this behavior and display the package hierarchy as expected like directories (see below)
I just can't find a way to control this.
It seems an Eclipse bug as referred by #greg-449.
Until a fix is provided, the following worked for me as workaround:
open the project properties
select "Project Natures"
remove "Eclipse Faceted Project Properties"

No more tabs in Properties File Editor

I am using Eclipse Neon.3 (4.6.3). In the past, Eclipse used to have several tabs on the bottom of the editor window, when a file was opened in the Properties File Editor mode. There you could choose to view the file either in a table-like view or as a plain text file.
I usually edit my resource files in plain text, which still works fine. However, the table view had one nice feature: Duplicate entries were highlighted in red color in the table-view.
But this view is no longer available, since there are no tabs in the Properties File Editor anymore. Did I miss anything? Where has this tab gone? Do I need an additional plug-in for this feature? As far as I can tell, this used to be a built-in feature of Eclipse.
I still had an old installation of Eclipse Mars and found out, that the feature in question is not built-in to Eclipse. The feature is provided by the JBoss Tools Properties Editor, which is part of Red Hat's Hibernate Tools.
To install on Eclipse Mars, follow the instructions of this StackOverflow post.

Eclipse Class Editor Formatting

Eclipse's class editor has no formatting or collapsable fields / methods. How can I make the class editor have the same text formatting as the java editor? Or at least make it more readable and user friendly, such as the one in Netbeans.
Opening a class in Netbeans:
Opening a class in ECLIPSE:
I would like to make classes more readable in Eclipse, is there any way to do that? I have tried attaching a source / javadocs before with no luck. I am hoping there is a simpler way
You want to see a source like representation of a .class file. Although not exactly what you are looking for JD-Eclipse can be used for that purpose. Addmitedly the scope is broader, because it is a full blown decompiler, that will actually show you the code, but should work for you.
When installed it will by default open .class files and present the code instead of default view that only presents somewhat raw results of parsing bytecode.
Another option is Bytecode Outline that is not a decompiler, it only deassemples bytecodes in the editor, but can make debugging a bit easier, because it seems to handle line numbers in sync with the debugger, unlike JD-Eclipse, which just outputs line number comments.

In an eclipse plugin: How can I programmatically highlight lines of codes in the java editor?

I am trying to develop an eclipse plugin that does some documentation check on java code and highlights some lines of code in the editor.
To achieve my goal, I DON'T want to create a new editor in eclipse, I simply want to extend the default java editor to draw a line under (or highlight) the methods that do not satisfy some set of predetermined requirements.
Do I need to create a PresentationReconciler? If yes, how do I make the JDT or workbench use my reconciler.
I have never done plugin development and this is my first attempt.
Several starting points for you:
Annotations are an UI feature of JFace's text editor that allows you to visually mark some places in an open editor.
Markers are a Workbench feature, more high-level. They are generic "objects that may be associated with Workbench resources", and they can display in several places: in text editors (as annotations) or in the Problems view, for example.
Depending on what you want to do, you would plug in your plug-in into extension points related to either of those.
The Eclipse Java editor is located in the org.eclipse.jdt.internal.ui.javaeditor.JavaEditor package.
The "internal" in the package name means that the Eclipse development team can change how the Java editor works with new revisions.
Try this help page: Juno Help on syntax highlighting
At the end of the page, it describes how to dynamically add a PresentationReconciler, which is used for syntax highlighting. See if that fits the problem that you want to solve.
I assume you already have a plugin project.
In your plugin.xml, open the tab Extensions, click Add..., search for org.eclipse.ui.editors, then you should see a template named Editor, which will produce a simple xml editor to experiment and play with. Also, you will be able to see the needed structure to define a custom editor.
Hope this helps...
I don't know if you still have a need for this, but you are going to want to use Annotations to keep track of what parts of the editor you need to highlight.
For actually doing the graphical effect of highlighting, you could do syntax highlighting via a PresentationReconciler, but I have no experience with that.
We used a technique we borrowed from http://editbox.sourceforge.net/, replacing the background image of the editor Shell. Its open source, so check it out. (Our code might also help -- its at https://github.com/IDE4edu/EclipseEditorOverlay )

Eclipse 3.4.1 - how to view compiler output in Console while building a project

I have what appears to be a very annoying problem. When compiling a project in Eclipse, I see no Console that shows the invocation of the Java compiler and the build results (as in NetBeans).
If I, for instance, import an existing project into Eclipse and invoke Project->Build Project, is there a view that will show me results of the compilation? While I know that my project contains a number of files that have errors, invoking Build Project shows no visual result/progress of the compilation. It does not show the list of errors so that I can quickly jump to them.
I'm aware that there is a "Problems" view, which shows a list of problems (and not just compiler errors) in all projects and not the particular project that I am working with, which makes it very inconvenient to locate and jump to source of the problem.
You can configure the problem view to show only problems in the current project:
Click on the small triangle at the far right of the view.
In the popup menu, select "Configure Contents..."
Select each item in the "Configurations" list and click on "Scope: On any element in the same project"
If you want to see the compiler working, you need open the "Progress" view.
Since Eclipse JDT provides its own built-in Java compiler, you generally do not see the invocation of Java Compiler.
The built-in Java compiler is tightly integrated with Eclipse and JDT, and provides the source indexing that enables powerful IDE features such as refactoring and quick fix.
Plus, it enables incremental build in background after each file modification, hence no visible "java" invocation.
You can replace/complete the java compiler with a javac` call of your own:
For instance, Using Alcatel-Lucent nmake with Eclipse JDT does precisely that, and uses a configuration launcher (which you can instruct to show a console):
You will need to add that special builder in the "builder" section of your project.
Do not forget you can create many "Problem view", and set one of them to show only problems for your current project.
Select: "on any element in same project"
Goto Windows->Show View->Console
or
Alt+Shift+Q,C
Console appears in tab with Problem view
Your question contains a couple of assumptions that you might want to re-think.
It does not show the list of errors so that I can quickly jump to them.
Errors are flagged in the edit window while you are editing. You can fix them on the spot, without having to "jump" anywhere.
If you drop an entire source file into your project, you may not be in an edit window on that file. (And, of course, that's not standard Eclipse usage.) The simplest way I know do deal with that is simply to "Refresh" the project and look in the Package Explorer view to see whether there are any errors detected (which will happen immediately if you "refresh" a file into a source folder). Double-click on any files which show an error icon and look at the right-hand side of the edit window to see exactly where the errors are.
I'm aware that there is a "Problems" view, which shows a list of problems (and not just compiler errors) in all projects and not the particular project that I am working with...
Unless you are using multiple projects, with inter-project dependencies, I find it useful to close all but the current project on which I'm working. Then the "Problems" view is specific to the current context.
Finally, I'd recommend looking at the Mylin "getting started" page for other hints on how Eclipse can help you focus on the current task.