Repository navigation
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
Source loading can block the UI thread, and preview layout, error fallback, and RTL rendering need correction.
4 open findings
What changed in this PR
Adds a source-code preview pane to the Open Type dialog.
Changes:
- Adds syntax-highlighted source preview with line numbers and declaration highlighting.
- Supports workspace and binary source with a fallback message.
- Adds a UI test for workspace source rendering.
| File | Description |
|---|---|
JavaUIMessages.properties |
Adds the unavailable-source message. |
JavaUIMessages.java |
Exposes the message field. |
OpenTypeSelectionDialog.java |
Implements preview creation and updates. |
FilteredTypesSelectionDialogTests.java |
Tests basic preview rendering. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Thanks alot.
I'll check on the clear/refresh/scroll bar parts - thanks for the feedback. |
39c9823 to
3070fc1
Compare
de9d779 to
3b60f6b
Compare
|
@deepika-u : if you fix some review comments by pushing new commits to the PR, please also resolve the review comments which were addressed by latest push, so it is easier to understand what is fixed and what not. |
All the issues listed above are addressed, can you check now please? and share opinion on the query please. |
Yes done, Thanks for your time. |
Let me check them, thanks. |
96da788 to
05ae7bb
Compare
All the failures are fixed. Once you let me know your preference in 1 other comment - i can go ahead with that and we can merge this issue once done. |
05ae7bb to
0bf301d
Compare
|
@iloveeclipse : Thanks for your time, 2 new comments are fixed. Waiting for your reply to fix 1 last comment to be implemented. |
0bf301d to
55f8c4e
Compare
01d7624 to
cdf814a
Compare
SougandhS
left a comment
There was a problem hiding this comment.
LGTM, thanks @deepika-u.
Screen.Recording.2026-10-23.at.10.55.55.AM.mov
With ambiguous results, users can now find the exact type from the preview instead of opening several editors.
|
No functional issue raised. Layout and lifecycle re-checked, CI tests are passing. @iloveeclipse : is it ready to be merged now? |
cdf814a to
f57c08a
Compare
iloveeclipse
left a comment
There was a problem hiding this comment.
Can you please fix comments, for example via this patch:
diff --git a/org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/ui/tests/dialogs/FilteredTypesSelectionDialogTests.java b/org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/ui/tests/dialogs/FilteredTypesSelectionDialogTests.java
index 868aeac..37b9659 100644
--- a/org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/ui/tests/dialogs/FilteredTypesSelectionDialogTests.java
+++ b/org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/ui/tests/dialogs/FilteredTypesSelectionDialogTests.java
@@ -44,2 +44,3 @@
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.jobs.Job;
@@ -220,3 +221,3 @@
// result is queued with asyncExec, but not yet delivered.
- Thread.sleep(500);
+ joinPreviewJob();
@@ -250,3 +251,3 @@
// Block the UI thread without dispatching events, so the job's result is queued but not delivered.
- Thread.sleep(500);
+ joinPreviewJob();
openTypeDialog.close();
@@ -280,3 +281,3 @@
// Block the UI thread without dispatching events, so the job's result is queued but not delivered.
- Thread.sleep(500);
+ joinPreviewJob();
@@ -426,2 +427,17 @@
/**
+ * Waits until the preview job has finished, deliberately <b>without</b> running the event
+ * loop. The job posts its result with <code>asyncExec</code> before it finishes, so afterwards
+ * the result is queued in the display but not yet delivered, which is the state these tests
+ * need. Blocking the UI thread is safe because the job never waits for the UI thread. The wait
+ * is bounded, so that a stuck job fails the test instead of hanging it.
+ */
+ private static void joinPreviewJob() throws InterruptedException {
+ long deadline = System.currentTimeMillis() + 5000;
+ while (Job.getJobManager().find(OpenTypeSelectionDialog.PREVIEW_JOB_FAMILY).length > 0) {
+ assertTrue(System.currentTimeMillis() < deadline, "Preview job did not finish in time");
+ Thread.sleep(10);
+ }
+ }
+
+ /**
* Runs the event loop until the condition holds or a timeout elapsed.
diff --git a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/dialogs/OpenTypeSelectionDialog.java b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/dialogs/OpenTypeSelectionDialog.java
index 7cd1254..e78d0e2 100644
--- a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/dialogs/OpenTypeSelectionDialog.java
+++ b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/dialogs/OpenTypeSelectionDialog.java
@@ -72,3 +72,2 @@
import org.eclipse.jdt.ui.text.IJavaPartitions;
-import org.eclipse.jdt.ui.text.JavaSourceViewerConfiguration;
import org.eclipse.jdt.ui.text.JavaTextTools;
@@ -82,2 +81,3 @@
import org.eclipse.jdt.internal.ui.text.FastJavaPartitioner;
+import org.eclipse.jdt.internal.ui.text.SimpleJavaSourceViewerConfiguration;
import org.eclipse.jdt.internal.ui.util.SWTUtil;
@@ -102,2 +102,7 @@
+ /**
+ * Job family of the preview jobs, for example to join them in tests.
+ */
+ public static final Object PREVIEW_JOB_FAMILY= new Object();
+
/** The partition types of the Java partitioner, the same as the ones used by the Java editor. */
@@ -278,3 +283,5 @@
if (tools != null) {
- fPreviewViewer.configure(new JavaSourceViewerConfiguration(tools.getColorManager(), store, null, IJavaPartitions.JAVA_PARTITIONING));
+ // The simple configuration, as used by other read-only Java previews: no hovers, hyperlinks,
+ // or information presenters, which require an editor.
+ fPreviewViewer.configure(new SimpleJavaSourceViewerConfiguration(tools.getColorManager(), store, null, IJavaPartitions.JAVA_PARTITIONING, false));
}
@@ -367,2 +374,7 @@
}
+
+ @Override
+ public boolean belongsTo(Object family) {
+ return family == PREVIEW_JOB_FAMILY;
+ }
};
|
Thanks for your time, let me check on them. |
66a6d56 to
8b84809
Compare
|
All four comments are addressed in the updated commit, you may take a look when you get some time please? Will monitor for tests to complete meanwhile. |
|
@iloveeclipse : Tests have passed. When you get some time, you may check please. |
This is also fixed. |
8b84809 to
614a614
Compare
|
@iloveeclipse |
614a614 to
0a61d1d
Compare
|
@iloveeclipse |
|
@jjohnstn |
0a61d1d to
5735d13
Compare



Summary
Adds a source preview pane to the Open Type dialog (Ctrl+Shift+T), similar to Quick Search (Ctrl+Alt+Shift+L). It shows the selected type's source with line numbers and Java syntax highlighting, scrolled to the type declaration.
Problem
To inspect a type, or to tell apart types with the same simple name in different packages or modules, you have to open each one in an editor.
Solution
JavaSourceViewerbelow the results list, using the Java editor font and given an accessible name. It stays hidden until a single type is selected.OpenTypeSelectionDialogis shared, so the preview also appears in Open Type in Hierarchy (Ctrl+Shift+H) and in the Add Super Interface dialog.Tests (
FilteredTypesSelectionDialogTests)Verification
After the pr ->
