Skip to content

Conversation

@vogella
Copy link
Member

@vogella vogella commented Nov 11, 2025

No description provided.

@gemini-code-assist
Copy link

Summary of Changes

Hello @vogella, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces significant enhancements to the application's user interface and core functionality. It refactors the exit mechanism to include a user confirmation dialog, dynamically updates menu entries, and substantially upgrades the "Playground" view with interactive search capabilities and the integration of the Nebula Chips widget, providing a more modern and engaging user experience.

Highlights

  • Custom Exit Logic: Implemented a custom exit dialog and handler, replacing the default exit behavior. This includes a warning message before closing the application, ensuring user confirmation for data integrity.
  • Dynamic Menu Contribution: Introduced a menu processor to dynamically modify the 'File' menu. This processor removes the old 'Exit' entry and adds a new 'Another Exit' entry that triggers the custom exit handler, demonstrating flexible UI customization.
  • Enhanced Playground Part: Revamped the PlaygroundPart to feature an interactive city search input with content proposals, a Nebula Chips widget for visual elements, and a browser displaying Google Maps based on the search input, significantly improving user engagement.
  • Nebula Chips Integration: Integrated the Eclipse Nebula Chips widget into the PlaygroundPart and updated the target platform to include the necessary Nebula feature group, expanding the available UI components.
  • UI/UX Improvements: Added a dedicated search tool control to the application's trim bars and refined the layout of the PlaygroundPart, contributing to a more organized and intuitive user interface.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces new UI components and functionality related to an 'Exit' dialog and a 'Playground' part, including a Google Maps integration. It also refactors the application's menu structure and adds the Eclipse Nebula 'Chips' widget. The changes involve updates to OSGi manifests, build properties, E4 application model (.e4xmi), and new Java classes for dialogs, handlers, and UI processors. Overall, the changes are well-structured and implement the intended features. However, there are a few areas for improvement, particularly regarding error handling and robustness in menu item identification.

for (MMenuElement element : menu.getChildren()) {
// use ID instead of label as label is later translated
if (element.getElementId() != null) {
if (element.getElementId().contains("exit")) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The current approach of checking element.getElementId().contains("exit") to remove the old exit menu entry is fragile. If another menu item's ID unexpectedly contains "exit", it could be removed unintentionally. It's more robust to match the exact elementId of the original exit menu item, which is org.eclipse.ui.file.exit as defined in Application.e4xmi.

Suggested change
if (element.getElementId().contains("exit")) {
if (element.getElementId().equals("org.eclipse.ui.file.exit")) {

<?eclipse version="3.4"?>
<plugin>
<extension
id="id1"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The id="id1" for the extension is generic. It's a good practice to use more descriptive IDs to prevent potential conflicts and improve readability, especially in larger applications or when integrating with other plugins. Consider using a naming convention like com.vogella.tasks.ui.contribute.menuprocessor.extension.

Suggested change
id="id1"
id="com.vogella.tasks.ui.contribute.menuprocessor.extension"

browser.setUrl("https://www.google.com/maps/place/" + URLEncoder.encode(city, "UTF-8") + "/&output=embed");

} catch (UnsupportedEncodingException e1) {
e1.printStackTrace();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Using e1.printStackTrace(); is generally not recommended in production code as it can expose sensitive information and doesn't provide structured logging. Consider replacing this with a proper logging mechanism (e.g., SLF4J, Log4j) or displaying a user-friendly error message.

            // Log the exception properly or display a user-friendly error
            // Logger.error("Failed to encode city name for URL", e1);
            // MessageDialog.openError(parent.getShell(), "Encoding Error", "Failed to encode city name.");

@vogella
Copy link
Member Author

vogella commented Nov 11, 2025

/gemini review

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the Tycho version to 5.0.0, introduces a new contribution to the file menu for exiting with a confirmation dialog, and significantly refactors the "Playground" part to demonstrate a map search feature. The changes are substantial. My review has identified a critical issue in pom.xml where merge conflicts appear to have been incorrectly resolved. Additionally, I've provided several suggestions to improve code quality, such as simplifying code with modern Java features, improving robustness, and preparing the code for internationalization by externalizing hardcoded strings. Please address the critical issue in pom.xml and consider the other suggestions for improvement.

<?eclipse version="3.4"?>
<plugin>
<extension
id="id1"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The extension ID id1 is very generic. It's a best practice to use a more descriptive and unique ID, typically prefixed with the bundle's symbolic name, to avoid potential conflicts with other plugins. For example: com.vogella.tasks.ui.contribute.modelprocessor.menu.

Suggested change
id="id1"
id="com.vogella.tasks.ui.contribute.modelprocessor.menu"

Comment on lines +15 to +19
@Inject
public ExitDialog(@Named(IServiceConstants.
ACTIVE_SHELL) Shell shell) {
super(shell);
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

It's good practice to provide a title for a dialog window to give users context. You can override the configureShell method to set the title. The title string should also be externalized for internationalization.

	@Inject
	public ExitDialog(@Named(IServiceConstants.
			ACTIVE_SHELL) Shell shell) {
		super(shell);
	}

	@Override
	protected void configureShell(Shell newShell) {
		super.configureShell(newShell);
		newShell.setText("Confirm Exit"); // Should be externalized
	}

Comment on lines +24 to +25
label.setText("Closing this application may result in data loss. "
+ "Are you sure you want that?");

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The dialog message is hardcoded. For applications that might need to be translated, it's a best practice to externalize strings into a properties file and load them using Eclipse's NLS (National Language Support) mechanism.

Comment on lines +28 to +39
if (!menu.getChildren().isEmpty()) {
List<MMenuElement> list = new ArrayList<>();
for (MMenuElement element : menu.getChildren()) {
// use ID instead of label as label is later translated
if (element.getElementId() != null) {
if (element.getElementId().contains("exit")) {
list.add(element);
}
}
}
menu.getChildren().removeAll(list);
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The logic for removing menu elements can be significantly simplified by using removeIf with a lambda expression. This makes the code more concise and readable.

		menu.getChildren().removeIf(element -> element.getElementId() != null && element.getElementId().contains("exit"));


// now add a new menu entry
MDirectMenuItem menuItem = modelService.createModelElement(MDirectMenuItem.class);
menuItem.setLabel("Another Exit");

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The label "Another Exit" is hardcoded. For applications that might need to be translated into other languages, it's a best practice to externalize strings into a properties file and load them using Eclipse's NLS (National Language Support) mechanism.

Comment on lines +44 to +46
menuItem.setContributionURI("bundleclass://"
+ "com.vogella.tasks.ui.contribute/"
+ ExitHandlerWithCheck.class.getName());

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Hardcoding the bundle symbolic name com.vogella.tasks.ui.contribute makes the code fragile. If the bundle name is changed in META-INF/MANIFEST.MF, this code will break. It's better to define the bundle ID as a constant, for example in a dedicated constants class or at the top of this class, and reuse it here.

parent.setLayout(new GridLayout(2, false));
Chips chip1 = new Chips(parent, SWT.CLOSE);
chip1.setText("Example");
chip1.setChipsBackground(Display.getDefault().getSystemColor(SWT.COLOR_RED));

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

It's generally safer to get the Display instance from a widget (e.g., parent.getDisplay()) rather than using Display.getDefault(). Display.getDefault() returns null if the calling thread is not a UI thread, which could lead to a NullPointerException. Using parent.getDisplay() is more robust.

Suggested change
chip1.setChipsBackground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
chip1.setChipsBackground(parent.getDisplay().getSystemColor(SWT.COLOR_RED));

Comment on lines +56 to +61
try {
browser.setUrl("https://www.google.com/maps/place/" + URLEncoder.encode(city, "UTF-8") + "/&output=embed");

} catch (UnsupportedEncodingException e1) {
e1.printStackTrace();
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The try-catch block for UnsupportedEncodingException can be avoided. Since you are using Java 21, you can use URLEncoder.encode(String, Charset) with StandardCharsets.UTF_8. This version of the method does not throw a checked exception, which simplifies the code. Also, e1.printStackTrace() is generally discouraged in favor of proper logging.

			browser.setUrl("https://www.google.com/maps/place/" + URLEncoder.encode(city, java.nio.charset.StandardCharsets.UTF_8) + "/&output=embed");

final Composite comp = new Composite(parent, SWT.NONE);
comp.setLayout(new GridLayout());
Text text = new Text(comp, SWT.SEARCH | SWT.CANCEL | SWT.ICON_SEARCH | SWT.BORDER);
text.setMessage("Search");

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The message "Search" is hardcoded. For applications that might need to be translated, it's a best practice to externalize strings into a properties file and load them using Eclipse's NLS (National Language Support) mechanism.

@vogella vogella merged commit 32d81fe into main Dec 19, 2025
1 check passed
@vogella vogella deleted the update branch December 19, 2025 13:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants