Skip to content

Commit 9a862f0

Browse files
authored
Merge branch 'master' into feature/global-search-navigation
2 parents 8a00631 + ce17c9e commit 9a862f0

File tree

2,441 files changed

+30503
-19658
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

2,441 files changed

+30503
-19658
lines changed

AGENTS.md

Lines changed: 350 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,350 @@
1+
# AGENTS.md
2+
3+
This file provides guidance to AI Agents (claude-code, codex, gemini cli, ...) when working with code in this repository.
4+
5+
## Repository Overview
6+
7+
Eclipse Platform UI provides the UI building blocks for Eclipse IDE and Eclipse Rich Client Platform (RCP). This includes JFace, workbench, commands framework, data binding, dialogs, editors, views, perspectives, and more. Built on top of SWT (Eclipse Standard Widget Toolkit).
8+
9+
**Key Facts:**
10+
- **Language:** Java 17
11+
- **Build System:** Maven 3.9.x with Tycho (OSGi/Eclipse plugin build)
12+
- **Architecture:** OSGi bundles, E4 application model
13+
14+
## Project Structure
15+
16+
```
17+
eclipse.platform.ui/
18+
├── bundles/ # OSGi bundles (production code)
19+
│ ├── org.eclipse.ui.workbench # Main workbench implementation
20+
│ ├── org.eclipse.jface # JFace toolkit (viewers, dialogs, etc.)
21+
│ ├── org.eclipse.jface.databinding # Data binding framework
22+
│ ├── org.eclipse.jface.text # Text editing framework
23+
│ ├── org.eclipse.core.commands # Commands framework
24+
│ ├── org.eclipse.core.databinding* # Core data binding
25+
│ ├── org.eclipse.e4.ui.* # E4 workbench, CSS, DI, model
26+
│ └── org.eclipse.ui.* # UI components (IDE, editors, views, etc.)
27+
├── tests/ # Test bundles (mirror structure of bundles/)
28+
├── examples/ # Example bundles
29+
├── features/ # Eclipse feature definitions
30+
├── releng/ # Release engineering artifacts
31+
├── docs/ # Documentation (JFace, RCP, Commands, etc.)
32+
└── .github/ # GitHub workflows and CI configuration
33+
```
34+
35+
### Key Architectural Components
36+
37+
**E4 Platform (Modern):**
38+
- `org.eclipse.e4.ui.model.workbench` - E4 application model
39+
- `org.eclipse.e4.ui.workbench*` - E4 workbench implementation
40+
- `org.eclipse.e4.ui.di` - Dependency injection
41+
- `org.eclipse.e4.ui.css.*` - CSS styling engine
42+
- `org.eclipse.e4.core.commands` - Command framework
43+
44+
**JFace Toolkit:**
45+
- `org.eclipse.jface` - Viewers, dialogs, resources, actions
46+
- `org.eclipse.jface.databinding` - Data binding for UI
47+
- `org.eclipse.jface.text` - Text editing infrastructure
48+
49+
**Legacy Workbench (3.x compatibility):**
50+
- `org.eclipse.ui.workbench` - Workbench implementation
51+
- `org.eclipse.ui.ide` - IDE-specific components
52+
- `org.eclipse.ui.editors` - Editor framework
53+
54+
### OSGi Bundle Structure
55+
56+
Each bundle contains:
57+
- `META-INF/MANIFEST.MF` - Bundle metadata and dependencies
58+
- `build.properties` - Build configuration (what to include in binary)
59+
- `plugin.xml` - Extension point declarations and contributions (optional)
60+
- `src/` or `eclipseui/` - Java source code
61+
- `.settings/` - Eclipse compiler settings
62+
63+
## Build System
64+
65+
### Critical Limitation
66+
67+
**⚠️ IMPORTANT:** Standalone `mvn clean verify` at repository root **WILL FAIL** with "Non-resolvable parent POM" error. This repository requires a parent POM from `eclipse.platform.releng.aggregator`.
68+
69+
### Building Individual Bundles
70+
71+
Use the `-Pbuild-individual-bundles` profile:
72+
73+
```bash
74+
# Compile a single bundle
75+
cd bundles/org.eclipse.jface
76+
mvn clean compile -Pbuild-individual-bundles
77+
78+
# Run tests for a single bundle
79+
cd tests/org.eclipse.jface.tests
80+
mvn clean verify -Pbuild-individual-bundles
81+
82+
# Run specific test class
83+
mvn test -Pbuild-individual-bundles -Dtest=ViewerTestClass
84+
```
85+
86+
### Maven Configuration
87+
88+
Default config in `.mvn/maven.config`:
89+
- `-Pbuild-individual-bundles` - Enable individual bundle builds
90+
- `-Dtycho.target.eager=true` - Eager target resolution
91+
- `-Dtycho.localArtifacts=ignore` - Ignore local artifacts
92+
93+
### Test Properties
94+
95+
From `pom.xml`:
96+
- `tycho.surefire.useUIHarness=true` - Use Eclipse UI test harness
97+
- `tycho.surefire.useUIThread=true` - Run tests on UI thread
98+
- `failOnJavadocErrors=true` - Fail build on Javadoc errors
99+
100+
## Testing
101+
102+
### Running Tests
103+
104+
**⚠️ IMPORTANT:** Use `mvn verify` (NOT `mvn test`) for Tycho projects. Due to Maven Tycho lifecycle binding, tests run in the `integration-test` phase, not the `test` phase. Running `mvn test` will NOT execute tests.
105+
106+
```bash
107+
# Run all tests in a specific test bundle
108+
cd tests/org.eclipse.jface.tests
109+
mvn clean verify -Pbuild-individual-bundles
110+
111+
# Run without clean (faster if no changes to dependencies)
112+
mvn verify -Pbuild-individual-bundles
113+
114+
# Run tests for a specific test bundle from repository root
115+
mvn clean verify -pl :org.eclipse.jface.tests -Pbuild-individual-bundles
116+
117+
# Run specific test class within a bundle
118+
cd tests/org.eclipse.jface.tests
119+
mvn clean verify -Pbuild-individual-bundles -Dtest=StructuredViewerTest
120+
121+
# Skip tests during compilation
122+
mvn clean compile -Pbuild-individual-bundles -DskipTests
123+
```
124+
125+
**Finding test bundles:** Test bundles mirror production bundles:
126+
- Production: `bundles/org.eclipse.jface`
127+
- Tests: `tests/org.eclipse.jface.tests`
128+
129+
### JUnit Guidelines
130+
131+
- Prefer JUnit 5 (`org.junit.jupiter.api.*`) for new tests
132+
- Use `@BeforeEach`/`@AfterEach` instead of `@Before`/`@After`
133+
- Use `@Disabled` instead of `@Ignore`
134+
- Use `Assertions.*` instead of `Assert.*`
135+
- JUnit 3 usage is limited to compatibility helpers (e.g., `org.eclipse.ui.tests.harness`)
136+
137+
**Common test pattern:**
138+
```java
139+
@BeforeEach
140+
public void setUp() {
141+
fDisplay = Display.getDefault();
142+
fShell = new Shell(fDisplay);
143+
}
144+
145+
@AfterEach
146+
public void tearDown() {
147+
if (fShell != null) {
148+
fShell.dispose();
149+
}
150+
}
151+
152+
@Test
153+
public void testSomething() {
154+
// Test implementation
155+
Assertions.assertEquals(expected, actual);
156+
}
157+
```
158+
159+
## Common Development Commands
160+
161+
### Compilation
162+
163+
```bash
164+
# Compile single bundle
165+
mvn clean compile -pl :bundle-artifact-id -Pbuild-individual-bundles -q
166+
167+
# Compile and run tests
168+
mvn clean test -pl :bundle-artifact-id -Pbuild-individual-bundles
169+
```
170+
171+
### Finding Code
172+
173+
```bash
174+
# Find test files for a bundle
175+
ls tests/org.eclipse.jface.tests/src
176+
177+
# Find bundle MANIFEST
178+
cat bundles/org.eclipse.jface/META-INF/MANIFEST.MF
179+
180+
# Search for specific code pattern
181+
grep -r "pattern" bundles/org.eclipse.jface/src
182+
```
183+
184+
## Critical Development Rules
185+
186+
### 1. OSGi Dependencies
187+
188+
**Always check `META-INF/MANIFEST.MF` before adding imports.** If a package is not in `Import-Package` or `Require-Bundle`, the import will fail at runtime.
189+
190+
```
191+
Require-Bundle: org.eclipse.core.runtime,
192+
org.eclipse.swt,
193+
org.eclipse.jface
194+
Import-Package: org.osgi.service.event
195+
```
196+
197+
### 2. SWT Resource Disposal
198+
199+
**Must dispose SWT resources** (except system colors/fonts):
200+
201+
```java
202+
// CORRECT - dispose in finally
203+
Shell shell = new Shell();
204+
try {
205+
// use shell
206+
} finally {
207+
shell.dispose();
208+
}
209+
210+
// CORRECT - dispose custom colors/fonts/images
211+
Color color = new Color(display, 255, 0, 0);
212+
try {
213+
// use color
214+
} finally {
215+
color.dispose();
216+
}
217+
218+
// INCORRECT - system resources don't need disposal
219+
Color systemColor = display.getSystemColor(SWT.COLOR_RED);
220+
// No dispose needed
221+
```
222+
223+
### 3. UI Thread Requirements
224+
225+
**All SWT/JFace UI code must run on the Display thread:**
226+
227+
```java
228+
// Run asynchronously on UI thread
229+
Display.getDefault().asyncExec(() -> {
230+
label.setText("Updated");
231+
});
232+
233+
// Run synchronously (blocks until complete)
234+
Display.getDefault().syncExec(() -> {
235+
button.setEnabled(false);
236+
});
237+
238+
// Check if on UI thread
239+
if (Display.getCurrent() != null) {
240+
// Already on UI thread
241+
} else {
242+
// Need to use asyncExec/syncExec
243+
}
244+
```
245+
246+
### 4. API Compatibility
247+
248+
**Do not break API compatibility.** The build includes API tools that verify:
249+
- No removal of public API
250+
- No changes to method signatures
251+
- No changes to class hierarchies
252+
253+
Breaking changes will fail CI with errors in `**/target/apianalysis/*.xml`.
254+
255+
### 5. Update build.properties
256+
257+
When adding new files or packages, update `build.properties`:
258+
259+
```properties
260+
# Include in binary build
261+
bin.includes = plugin.xml,\
262+
META-INF/,\
263+
.,\
264+
icons/
265+
266+
# Source folders
267+
source.. = src/
268+
269+
# Output folder
270+
output.. = bin/
271+
```
272+
273+
## Common Patterns
274+
275+
### Data Binding
276+
277+
```java
278+
DataBindingContext ctx = new DataBindingContext();
279+
280+
// Bind widget to model
281+
ctx.bindValue(
282+
WidgetProperties.text(SWT.Modify).observe(textWidget),
283+
BeanProperties.value("propertyName").observe(model)
284+
);
285+
286+
// Dispose when done
287+
ctx.dispose();
288+
```
289+
290+
### JFace Viewers
291+
292+
```java
293+
TableViewer viewer = new TableViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
294+
viewer.setContentProvider(ArrayContentProvider.getInstance());
295+
viewer.setLabelProvider(new LabelProvider() {
296+
@Override
297+
public String getText(Object element) {
298+
return element.toString();
299+
}
300+
});
301+
viewer.setInput(myList);
302+
```
303+
304+
### Eclipse Commands
305+
306+
Commands are defined in `plugin.xml` and handled via handlers:
307+
308+
```java
309+
@Execute
310+
public void execute(IEclipseContext context) {
311+
// Command implementation
312+
}
313+
```
314+
315+
## CI/GitHub Workflows
316+
317+
- CI definition: `.github/workflows/ci.yml` (runs full aggregator build)
318+
- PRs are gated by: compiler checks, API compatibility, Javadoc, and unit/UI tests
319+
- UI tests run with the Eclipse UI harness in headless mode
320+
321+
## Troubleshooting
322+
323+
### "Non-resolvable parent POM"
324+
Expected when running `mvn verify` at root. Use `-Pbuild-individual-bundles` for individual bundles.
325+
326+
### "Package does not exist"
327+
Check `META-INF/MANIFEST.MF` - add missing package to `Import-Package` or bundle to `Require-Bundle`.
328+
329+
### "API baseline errors"
330+
You've broken API compatibility. Revert the breaking change or mark it appropriately.
331+
332+
### Test hangs
333+
UI tests must run on Display thread. Use `Display.asyncExec()` or ensure `useUIHarness=true`.
334+
335+
### "Widget is disposed"
336+
Attempting to access disposed SWT widget. Check disposal order and lifecycle.
337+
338+
## Documentation
339+
340+
Key docs in `docs/` directory:
341+
- `JFace.md` - JFace framework overview
342+
- `JFaceDataBinding.md` - Data binding guide
343+
- `Eclipse4_RCP_FAQ.md` - E4 RCP frequently asked questions
344+
- `PlatformCommandFramework.md` - Command framework
345+
- `CSS.md` - CSS styling for E4
346+
347+
External links:
348+
- [Platform UI Wiki](https://wiki.eclipse.org/Platform_UI)
349+
- [Contributing Guide](https://github.com/eclipse-platform/.github/blob/main/CONTRIBUTING.md)
350+
- [Eclipse Platform Project](https://projects.eclipse.org/projects/eclipse.platform)

CLAUDE.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
@AGENTS.md

bundles/org.eclipse.core.commands/src/org/eclipse/core/commands/AbstractParameterValueConverter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
* <p>
3131
* This class will typically be extended so the subclass can be referenced from
3232
* the <code>converter</code> attribute of the
33-
* <code>commandParameterType</code> elemement of the
33+
* <code>commandParameterType</code> element of the
3434
* <code>org.eclipse.ui.commands</code> extension-point. Objects implementing
3535
* this interface may also be passed directly to
3636
* {@link ParameterType#define(String, AbstractParameterValueConverter)} by

bundles/org.eclipse.core.commands/src/org/eclipse/core/commands/Command.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@
4242
* defined if it is declared in the XML of a resolved plug-in. If the plug-in is
4343
* unloaded or the command is simply not declared, then it is undefined. Trying
4444
* to reference an undefined command will succeed, but trying to access any of
45-
* its functionality will fail with a <code>NotDefinedException</code>. If
46-
* you need to know when a command changes from defined to undefined (or vice
45+
* its functionality will fail with a <code>NotDefinedException</code>. If you
46+
* need to know when a command changes from defined to undefined (or vice
4747
* versa), then attach a command listener.
4848
* </p>
4949
* <p>

0 commit comments

Comments
 (0)