In the previous article, I introduced JBoss Tools 4.14.0 final and Red Hat CodeReady Studio 12.14 for Eclipse 4.14 (2019-12), focusing on the big new features: OpenShift Application Explorer view, feedback loops, and new Quarkus tooling. This article focuses on the many smaller additions and updates. Here, I'll quickly run through the new features and small changes that improve the development experience in Hibernate Tools and the Java Developer Tools (JDT) extensions, which were updated for Java 13. I'll also highlight UI changes to platform views, dialogs, and toolbars.
Hibernate Tools updated
The Hibernate 5.4 runtime provider now incorporates Hibernate Core version 5.4.12.Final and Hibernate Tools version 5.4.1.Final. The Hibernate 5.3 runtime provider now includes Hibernate Core version 5.3.15.Final and Hibernate Tools version 5.3.15.Final.
Forge, JST, and VPE deprecated
Forge, Java Server Tools (JST), and Visual Page Editor (VPE) were updated for this release, but we have no plans to maintain or add new features to future releases. We might remove them. We've also deprecated the adapters for Red Hat JBoss Enterprise Application Server 4.3 and 5.0.
Platform changes to views, dialogs, and toolbars
We've made a number of platform changes to views, dialogs, and toolbars.
New views icon for accessing additional settings
Almost every view has a menu that could contain additional configuration settings like filters, layout settings, and so on. The View menu is often overlooked, so we've replaced the old Chevron icon with a more modern equivalent, a vertical ellipsis. We expect the new icon, shown in Figure 1, will help more users locate and use the View menu.
Find actions replaces Quick Access with updated UI
The feature formerly called Quick Access has been renamed to Find actions. We think the new name better describes what this feature does. We've also changed the Find actions UI to improve its usage and accessibility:
- The widget item is now a regular toolbar item (button-like).
- An icon is shown.
- Right-clicking on the tool item works and shows typical actions such as Hide.
- Proposals are now a regular dialog, centered on the workbench.
These changes will greatly improve user experience for people using a screen reader because those rely on a more standardized focus state. Find actions also leverages all of the usual dialog accessibility features, such as making screens and toolbars moveable and resizable. We've also improved proposal loading to avoid UI freezes during loading.
Let's walk through using Find actions to run quick text searches, and locate workspace files.
Do a quick text search in Find actions
We've extended Find actions with the Quick Text Search feature, which shows potential text matches in file contents and proposals. Figure 2 shows a text search in progress.
In the past, if you had not started the Quick Text Search bundle, you might miss those matches. Now, you can use Find actions to activate Quick Text Search. All you need to do is find and select the Activate bundle for 'File content' proposals entry, as shown in Figure 3.
Locate workspace files in Find actions
Find actions can now list matching file names from the workspace (similar to the Open Resource dialog). Upon selection, the file is opened in the editor, as shown in Figure 4.
Simple resource renaming inline
Project Explorer now offers inline renaming for simple resources. You can use the F2 shortcut or the Rename context menu to rename normal resources, just as long as other files aren't affected by the rename. The new inline-renaming feature is shown in Figure 5.
Text editors
Most of the text editors can now show problem markers like errors, warnings, and info markers inline. No more mousing around to see the actual error message. Figure 6 shows an example.
You can also see available quick fixes by clicking on the error or warning message, as shown in Figure 7.
Use the General -> Editors -> Text Editors preference page to enable this feature. You'll be asked to set the Show Code Minings for Annotations preference to any of these options:
- None (default)
- Errors only
- Errors and Warnings
- Errors, Warnings, and Info
Remove multiple spaces on backspace or delete
If you use the Insert spaces for tabs option in your text editor, you can now change the behavior of backspace and delete keys to remove multiple spaces at once, as if each space was a tab. The new setting is called Remove multiple spaces on backspace/delete. You'll find it on the Text Editors preferences page, as shown in Figure 8.
Collapse All in Debug view
We've added a new Collapse All button in the Debug view. You can use this new button to collapse all of your project launches. Figure 9 shows the launch toolbar before collapsing.
And here's the list after collapsing, shown in Figure 10.
Control characters in Console view
We've also updated the interpretation of control characters in the Console view. You can now set the console to interpret the backslash (\b
) and carriage return (\r
) control characters. This feature is disabled by default. You can enable it on the Run/Debug -> Console preference page. Figure 11 shows this new feature in action.
Improved themes and styling
We've improved UI form styling. Updates to Cascading Style Sheets (CSS) in ExpandableComposite and Section give you more control over styling these elements. In dark mode, both elements now integrate better with other form elements. Figure 12 shows UI forms styling prior to this release.
Figure 13 shows these forms in the new release.
We've also aligned the Perspective switcher with normal toolbar styling and removed the special features seen in earlier releases. This change improves consistency in the appearance of the toolbar. It also reduces operating system (OS)-specific styling issues with this tool. Figure 14 shows the Perspective switcher in the toolbar prior to this release.
Figure 15 shows the new look.
We've also updated the Dark theme to use more consistent colors and fewer shades of gray. Additionally, the widget's styling is no longer based on the selected view, which makes the UI more consistent.
General updates
We've made a number of general updates to JBoss Tools 4.14.0, which I'll quickly review.
Updated to Ant 1.10.7
Eclipse has adopted Ant version 1.10.7, so we've updated to the newer version. As a result of the update, the ant-ui-plugin
now recognizes and validates the Ant include
task. The include
task has been available in the Ant library since Ant 1.8.0.
Updated to Java 13
Eclipse supports Java 13 for the Eclipse 4.14 release. We've accordingly updated to Java 13 for our Java Development Tools (JDT) extensions.
Preview two new language features in JDK 13
Two notable features included with the new release are JEP 354: Switch Expressions (preview), and JEP 355: Text Blocks (preview). Note that these are preview language features, so if you want to use them you'll need to turn on the Enable preview option. See the Java 13 Examples wiki for an informal introduction to this support.
We've added a keyboard shortcut (Ctrl+Shift+') for creating text blocks in the Java Editor. Note that the new keyboard shortcut only works for Java projects that are compliant with Java 13 or higher, and which have the Enable preview option selected. Additionally, this feature only works if the selection in the editor is not part of a string, a comment, or a text block. Consider the example in Figure 16.
When you press the keyboard shortcut, you will see what's shown in Figure 17.
You can also encompass selected text in a text block, as shown in Figure 18.
Figure 19 displays what you will see when you execute the shortcut.
Improvements to the Java Editor
We've also improved the Java Editor itself, starting with a new cleanup action for removing unnecessary array creation. This new action removes explicit array creation for varargs
parameters, as shown in Figure 20.
Consider the code shown in Figure 21.
Here's the code after cleanup, shown in Figure 22.
Reducing double negation
The Java Editor has a new cleanup action called Push down negation that reduces double negation by reverting arithmetic expressions, as shown in Figure 23. For instance, !!isValid;
becomes isValid;
, and !(a != b);
becomes (a == b);
.
New templates for empty Java source files
We've made some basic templates available for populating empty Java source files. You'll find the new templates using the Content Assist popup shown in Figure 24.
Postfix completion
Postfix completion is a new feature that allows certain kinds of language constructs to be applied to text that was previously entered. As an example, entering "input text".var
and selecting the var - Creates a new variable proposal results in String name = "input text"
. A different option is shown in Figure 25.
A new quickfix for try-with-resources
We've added a quickfix to create a try-with-resources
statement for selected lines of code. Selected lines must start with a declaration of one or more objects that implement AutoCloseable
. These declarations will then be added as the resources within the try-with-resources
statement. If you select one or more statements that do not contain eligible resources (such as Object
s that don't implement AutoCloseable
), then all of the selected statements will be placed in the try-with-resources
body.
As an example, consider the following method before applying try-with-resources
, shown in Figure 26.
Select all of the lines inside the method, followed by the keyboard shortcut, Ctrl+1. Click Surround with try-with-resources from the drop-down list shown in Figure 27.
The code will be updated as shown in Figure 28.
Javadoc: Tag checking for dmodules
We've added support to check the Javadoc of a module-info.java
file and report missing and duplicate @uses
and @provides
tags, depending on the compiler settings. Access this feature at Preferences->Java->Compiler->Javadoc. Figure 29 shows the option to identify missing@uses
tags.
Updates to the Java Formatter
We've also made updates to the Java Formatter, which I'll describe next.
Text block formatting
The code formatter can now handle the new Text Blocks (preview) feature added in Java 13. It's controlled by the Text block indentation setting, found in the Profile Editor's Indentation section. The path for that is: Preferences->Java->Code Style->Formatter->Edit….
By default, text-block lines are indented in the same way as wrapped code lines; that is, with two extra tabs relative to the starting indentation (or whatever you've set as the default indentation for wrapped lines in the Line Wrapping section). You can also set your preferences to use only one tab for indentation (Indent by one), align all lines to the position of the opening quotes (Indent on column), or preserve the original formatting (Do not touch).
Figure 30 shows the option to default for wrapped lines.
Blank lines between Javadoc tags
The code formatter can now divide Javadoc tags into groups by type (for example, @param
, @throws
, and @returns
) and separate these groups with blank lines. You can turn on this feature in the Comments > Javadocs section, by checking the Blank lines between tags of different type box.
Space after not operator
A new setting controls whether to add a space after the not (!
) operator, independently from other unary operators. To find it, expand the Whitespace->Expressions->Unary operators and go to the last checkbox, as shown in Figure 31.
Update to the JUnit execution environment
We've updated the Bundle Required Execution Environment (BREE) for the org.eclipse.jdt.junit.runtime
J2SE-1.5 bundle.
Handling exception breakpoints in JDT Debugger
We've added a new workspace preference for exception breakpoints: Suspend policy for recurring exception instances controls whether the same exception instance may cause the debugger to suspend more than once. This new option is shown in Figure 32.
You'll find this option relevant when debugging an application that has try
blocks at several levels of the architecture. In this situation, an exception breakpoint could fire multiple times for the same exception instance. For example, a throw
statement inside a catch
block could re-throw the same exception.
The same is true for each finally
block or try-with-resources
block. When the debugger stops due to an exception breakpoint, you might want to continue your debug session by pressing Resume (F8), but all that catching and re-throwing will force you to observe all locations where the same exception will surface again and again.
Suspending at all try
blocks on the call stack could also spoil your context of open Java editors, by opening more editors of classes that are likely irrelevant for the debugging task at hand. The JDT Debugger can now detect this situation. The first time it notices the same exception instance recurring at the surface, you'll see the question dialog in Figure 33.
If you select Skip in this dialog, the exception instance will be dismissed for good. If you do nothing more, new instances of the same exception type will cause a suspension when they are thrown. However, if you check Remember my decision, your choice will be stored in your workspace preferences and applied at all exception breakpoints. Even after choosing Skip — reps only once in the preferences, you can have the old behavior restored simply by pressing Step Return (F7) instead of Resume.
Content assistance for JDT developers
Three existing extension points now allow a new attribute, requiresUIThread
, which flags whether the Content Assist extension needs to run in a UI thread. The extension points are:
org.eclipse.jdt.ui.javaCompletionProposalComputer
org.eclipse.jdt.ui.javadocCompletionProposalComputer
org.eclipse.jdt.ui.javaCompletionProposalSorters
Developers can use the requiresUIThread
attribute to declare whether running in the UI thread is required or not. The Content Assist operation will use this information to allow optimizations and prevent UI freezes by reducing the amount of work happening in the UI thread. To preserve backward compatibility, the default value for this attribute (if not set) is true
, meaning the extension is expected to run in the UI thread.
Conclusion
The newest release of JBoss Tools improves container-based development with support for OpenShift Container Platform 4.3 and the new OpenShift Application Explorer view. We've added tooling for Quarkus, updated the Hibernate Tools runtime providers, and updated the Java Developer Tools (JDT) extensions for compatibility with Java 13.
In this article, I've shared highlights of the changes for Hibernate Tools and the JDT extensions, as well as numerous smaller upgrades and feature additions to platform views, dialogs, and toolbars in JBoss Tools 4.14.0. Now that we've released JBoss Tools 4.14.0 and Red Hat CodeReady Studio 12.14, we're already working on the next release for Eclipse 2020-03. Stay tuned for information about that upcoming release.
Last updated: September 26, 2024