Skip to content

Commit a9b0d7f

Browse files
committed
Streamlined AGENDS
Removed very specific example code and reduce redundancy in build instructions.
1 parent e358cd6 commit a9b0d7f

File tree

1 file changed

+13
-128
lines changed

1 file changed

+13
-128
lines changed

AGENTS.md

Lines changed: 13 additions & 128 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
# AGENTS.md
22

3-
This file provides guidance to AI Agents (claude-code, codex, gemini cli, ...) when working with code in this repository.
3+
This file provides guidance to AI Agents.
44

55
## Repository Overview
66

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).
7+
Eclipse Platform UI provides the building blocks for Eclipse IDE and Eclipse Rich Client Platform (RCP).
8+
This includes JFace, workbench, commands framework, data binding, dialogs, editors, views, perspectives, and more. Built on top of SWT (Eclipse Standard Widget Toolkit).
89

910
**Key Facts:**
1011
- **Language:** Java 21
@@ -64,27 +65,15 @@ Each bundle contains:
6465

6566
### Critical Limitation
6667

68+
6769
Use the `-Pbuild-individual-bundles` profile:
6870

6971
```bash
70-
# Compile a single bundle
71-
cd bundles/org.eclipse.jface
72-
mvn clean compile -Pbuild-individual-bundles
73-
74-
# Run tests for a single bundle
75-
cd tests/org.eclipse.jface.tests
76-
mvn clean verify -Pbuild-individual-bundles
77-
78-
# Run specific test class
79-
mvn test -Pbuild-individual-bundles -Dtest=ViewerTestClass
80-
```
81-
82-
### Maven Configuration
72+
# Compile single bundle
73+
mvn clean compile -pl :bundle-artifact-id -Pbuild-individual-bundles -q
8374

84-
Default config in `.mvn/maven.config`:
85-
- `-Pbuild-individual-bundles` - Enable individual bundle builds
86-
- `-Dtycho.target.eager=true` - Eager target resolution
87-
- `-Dtycho.localArtifacts=ignore` - Ignore local artifacts
75+
# Example for building a single bundle
76+
mvn clean verify -Pbuild-individual-bundles mvn clean verify -pl bundles/org.eclipse.ui -DskipTests
8877

8978
### Test Properties
9079

@@ -97,22 +86,15 @@ From `pom.xml`:
9786

9887
### Running Tests
9988

100-
**⚠️ 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.
89+
**⚠️ IMPORTANT:** Use `mvn verify` (NOT `mvn test`) for Tycho projects.
90+
Due to Maven Tycho lifecycle binding, tests run in the `integration-test` phase, not the `test` phase. Running `mvn test` will NOT execute tests.
10191

10292
```bash
103-
# Run all tests in a specific test bundle
104-
cd tests/org.eclipse.jface.tests
105-
mvn clean verify -Pbuild-individual-bundles
106-
107-
# Run without clean (faster if no changes to dependencies)
108-
mvn verify -Pbuild-individual-bundles
109-
11093
# Run tests for a specific test bundle from repository root
111-
mvn clean verify -pl :org.eclipse.jface.tests -Pbuild-individual-bundles
94+
mvn clean verify -pl :org.eclipse.ui.tests -Pbuild-individual-bundles
11295
11396
# Run specific test class within a bundle
114-
cd tests/org.eclipse.jface.tests
115-
mvn clean verify -Pbuild-individual-bundles -Dtest=StructuredViewerTest
97+
mvn clean verify -pl :org.eclipse.ui.tests -Pbuild-individual-bundles -Dtest=StructuredViewerTest
11698
11799
# Skip tests during compilation
118100
mvn clean compile -Pbuild-individual-bundles -DskipTests
@@ -125,40 +107,11 @@ mvn clean compile -Pbuild-individual-bundles -DskipTests
125107
### JUnit Guidelines
126108

127109
- Prefer JUnit 5 (`org.junit.jupiter.api.*`) for new tests
128-
- Use `@BeforeEach`/`@AfterEach` instead of `@Before`/`@After`
129-
- Use `@Disabled` instead of `@Ignore`
130-
- Use `Assertions.*` instead of `Assert.*`
131-
- JUnit 3 usage is limited to compatibility helpers (e.g., `org.eclipse.ui.tests.harness`)
132-
133-
**Common test pattern:**
134-
```java
135-
@BeforeEach
136-
public void setUp() {
137-
fDisplay = Display.getDefault();
138-
fShell = new Shell(fDisplay);
139-
}
140-
141-
@AfterEach
142-
public void tearDown() {
143-
if (fShell != null) {
144-
fShell.dispose();
145-
}
146-
}
147-
148-
@Test
149-
public void testSomething() {
150-
// Test implementation
151-
Assertions.assertEquals(expected, actual);
152-
}
153-
```
154110

155111
## Common Development Commands
156112

157113
### Compilation
158114

159-
```bash
160-
# Compile single bundle
161-
mvn clean compile -pl :bundle-artifact-id -Pbuild-individual-bundles -q
162115

163116
# Compile and run tests
164117
mvn clean test -pl :bundle-artifact-id -Pbuild-individual-bundles
@@ -192,29 +145,7 @@ Import-Package: org.osgi.service.event
192145

193146
### 2. SWT Resource Disposal
194147

195-
**Must dispose SWT resources** (except system colors/fonts):
196-
197-
```java
198-
// CORRECT - dispose in finally
199-
Shell shell = new Shell();
200-
try {
201-
// use shell
202-
} finally {
203-
shell.dispose();
204-
}
205-
206-
// CORRECT - dispose custom colors/fonts/images
207-
Color color = new Color(display, 255, 0, 0);
208-
try {
209-
// use color
210-
} finally {
211-
color.dispose();
212-
}
213-
214-
// INCORRECT - system resources don't need disposal
215-
Color systemColor = display.getSystemColor(SWT.COLOR_RED);
216-
// No dispose needed
217-
```
148+
**Must dispose SWT resources** (except colors and system fonts):
218149

219150
### 3. UI Thread Requirements
220151

@@ -226,11 +157,6 @@ Display.getDefault().asyncExec(() -> {
226157
label.setText("Updated");
227158
});
228159

229-
// Run synchronously (blocks until complete)
230-
Display.getDefault().syncExec(() -> {
231-
button.setEnabled(false);
232-
});
233-
234160
// Check if on UI thread
235161
if (Display.getCurrent() != null) {
236162
// Already on UI thread
@@ -266,47 +192,6 @@ source.. = src/
266192
output.. = bin/
267193
```
268194

269-
## Common Patterns
270-
271-
### Data Binding
272-
273-
```java
274-
DataBindingContext ctx = new DataBindingContext();
275-
276-
// Bind widget to model
277-
ctx.bindValue(
278-
WidgetProperties.text(SWT.Modify).observe(textWidget),
279-
BeanProperties.value("propertyName").observe(model)
280-
);
281-
282-
// Dispose when done
283-
ctx.dispose();
284-
```
285-
286-
### JFace Viewers
287-
288-
```java
289-
TableViewer viewer = new TableViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
290-
viewer.setContentProvider(ArrayContentProvider.getInstance());
291-
viewer.setLabelProvider(new LabelProvider() {
292-
@Override
293-
public String getText(Object element) {
294-
return element.toString();
295-
}
296-
});
297-
viewer.setInput(myList);
298-
```
299-
300-
### Eclipse Commands
301-
302-
Commands are defined in `plugin.xml` and handled via handlers:
303-
304-
```java
305-
@Execute
306-
public void execute(IEclipseContext context) {
307-
// Command implementation
308-
}
309-
```
310195

311196
## CI/GitHub Workflows
312197

0 commit comments

Comments
 (0)