|
| 1 | +--- |
| 2 | +name: eclipse-plugin-development |
| 3 | +description: Guidance for implementing and modifying Eclipse plugin, RCP, and OSGi-based code while preserving target-platform and JDK compatibility. |
| 4 | +--- |
| 5 | + |
| 6 | +# Eclipse Plugin Development |
| 7 | + |
| 8 | +Use this skill when working on tasks related to: |
| 9 | + |
| 10 | +- Eclipse plugins |
| 11 | +- Eclipse RCP applications |
| 12 | +- OSGi bundles |
| 13 | +- extension points |
| 14 | +- plugin metadata |
| 15 | +- target-platform constrained implementation |
| 16 | +- PDE / Tycho based plugin projects |
| 17 | +- SWT / JFace / Eclipse UI integration |
| 18 | + |
| 19 | +## Goal |
| 20 | + |
| 21 | +Produce changes that fit Eclipse plugin development conventions and remain compatible with: |
| 22 | +- the repository's minimum supported Eclipse target-platform |
| 23 | +- the repository's minimum supported JDK version |
| 24 | + |
| 25 | +## Working Approach |
| 26 | + |
| 27 | +### 1. Start from repository constraints |
| 28 | +Before suggesting implementation details, first align with the repository's actual setup if it can be determined from the codebase, build files, or target-platform: |
| 29 | +- minimum supported Eclipse release |
| 30 | +- target-platform definition |
| 31 | +- minimum supported JDK / execution environment |
| 32 | +- Tycho / Maven / PDE build structure |
| 33 | +- current plugin and module layout |
| 34 | +- existing UI framework usage such as SWT, JFace, e4, commands, handlers, views, editors, or wizards |
| 35 | + |
| 36 | +If exact compatibility boundaries are unclear, prefer the most conservative implementation that is likely to work on the currently configured minimum versions. |
| 37 | + |
| 38 | +### 2. Follow Eclipse-native architecture |
| 39 | +Prefer solutions that align with existing Eclipse and OSGi patterns already used by the repository, such as: |
| 40 | +- extension points |
| 41 | +- commands and handlers |
| 42 | +- views, editors, dialogs, and wizards |
| 43 | +- preference pages and preference stores |
| 44 | +- background jobs and progress monitors |
| 45 | +- OSGi services or declarative services if already present |
| 46 | +- Eclipse workspace and resource APIs where appropriate |
| 47 | + |
| 48 | +Do not replace Eclipse-native mechanisms with generic alternatives unless explicitly requested. |
| 49 | + |
| 50 | +### 3. Keep plugin metadata synchronized |
| 51 | +When implementation changes affect plugin wiring, runtime behavior, packaging, or dependencies, check whether related metadata must also be updated. |
| 52 | + |
| 53 | +Common files to inspect: |
| 54 | +- `META-INF/MANIFEST.MF` |
| 55 | +- `plugin.xml` |
| 56 | +- `fragment.xml` |
| 57 | +- `build.properties` |
| 58 | +- `feature.xml` |
| 59 | +- `category.xml` |
| 60 | +- `.target` files |
| 61 | +- `pom.xml` |
| 62 | +- product configuration files |
| 63 | +- service component descriptors |
| 64 | +- preference initializer classes |
| 65 | +- plugin activator or lifecycle related files |
| 66 | + |
| 67 | +Examples: |
| 68 | +- adding a handler, menu contribution, command, view, editor, or preference page may require `plugin.xml` |
| 69 | +- adding or removing bundle dependencies may require `MANIFEST.MF` |
| 70 | +- adding packaged resources may require `build.properties` |
| 71 | +- changing installable content may require `feature.xml`, `category.xml`, or p2-related configuration |
| 72 | +- changing platform assumptions may require updates to `.target` files or Tycho configuration |
| 73 | + |
| 74 | +### 4. Prefer public APIs |
| 75 | +Use stable public Eclipse APIs whenever possible. |
| 76 | + |
| 77 | +Avoid packages containing `.internal.` unless: |
| 78 | +- the repository already intentionally depends on them, and |
| 79 | +- no suitable public API exists |
| 80 | + |
| 81 | +If internal API use is unavoidable, explicitly call out the compatibility and maintenance risk. |
| 82 | + |
| 83 | +### 5. Respect UI and threading constraints |
| 84 | +For SWT/JFace/Eclipse UI work: |
| 85 | +- access UI widgets on the UI thread |
| 86 | +- avoid blocking the UI thread with long-running work |
| 87 | +- use background jobs for expensive operations |
| 88 | +- report progress when appropriate |
| 89 | +- keep handlers, dialogs, wizards, views, and editors consistent with existing repository patterns |
| 90 | + |
| 91 | +Do not introduce Swing, JavaFX, or browser/web UI approaches unless they are already part of the repository or explicitly requested. |
| 92 | + |
| 93 | +### 6. Respect internationalization practices |
| 94 | +If the repository externalizes user-facing strings: |
| 95 | +- do not hardcode visible UI text |
| 96 | +- update the relevant messages or properties files |
| 97 | +- follow the existing NLS pattern consistently |
| 98 | + |
| 99 | +### 7. Use Eclipse-friendly error handling |
| 100 | +When appropriate, prefer patterns already common in Eclipse plugin codebases, such as: |
| 101 | +- `IStatus` |
| 102 | +- `Status` |
| 103 | +- `MultiStatus` |
| 104 | +- `CoreException` |
| 105 | + |
| 106 | +Use the repository's existing logging and status reporting style where available. |
| 107 | +Avoid `printStackTrace` and avoid silent failure paths. |
| 108 | + |
| 109 | +### 8. Preserve stable IDs and contracts |
| 110 | +Unless explicitly requested, do not rename or break the stability of: |
| 111 | +- plugin IDs |
| 112 | +- bundle symbolic names |
| 113 | +- extension point IDs |
| 114 | +- command IDs |
| 115 | +- handler IDs |
| 116 | +- view IDs |
| 117 | +- editor IDs |
| 118 | +- preference keys |
| 119 | +- marker IDs |
| 120 | +- builder IDs |
| 121 | +- nature IDs |
| 122 | +- exported packages |
| 123 | +- public APIs |
| 124 | + |
| 125 | +Backward compatibility is especially important for plugin integrations and workspace metadata. |
| 126 | + |
| 127 | +### 9. Use version-safe Java |
| 128 | +Do not use Java language features, standard library APIs, or build assumptions beyond the repository's minimum supported JDK. |
| 129 | + |
| 130 | +If there is any doubt, prefer the older and more broadly compatible implementation. |
| 131 | + |
| 132 | +Be especially careful with features that are version-sensitive, for example: |
| 133 | +- records |
| 134 | +- sealed classes |
| 135 | +- pattern matching |
| 136 | +- enhanced switch syntax |
| 137 | +- text blocks |
| 138 | +- virtual threads |
| 139 | +- preview features |
| 140 | +- newer collection APIs |
| 141 | + |
| 142 | +### 10. Keep tests aligned with plugin realities |
| 143 | +When adding or updating tests: |
| 144 | +- follow the repository's existing test structure |
| 145 | +- stay consistent with current PDE / Tycho / JUnit / SWTBot usage if present |
| 146 | +- keep tests compatible with the minimum supported platform and JDK |
| 147 | +- avoid fragile UI timing assumptions |
| 148 | +- avoid tests that depend on environment-specific state unless the repository already uses such patterns intentionally |
| 149 | + |
| 150 | +## Eclipse Plugin Task Checklist |
| 151 | + |
| 152 | +Before considering a task complete, check whether the change should also verify or update: |
| 153 | +- API compatibility with the minimum Eclipse target-platform |
| 154 | +- API compatibility with the minimum JDK |
| 155 | +- `META-INF/MANIFEST.MF` |
| 156 | +- `plugin.xml` |
| 157 | +- `build.properties` |
| 158 | +- feature / p2 / category metadata |
| 159 | +- `.target` or Tycho/Maven configuration |
| 160 | +- externalized strings and message bundles |
| 161 | +- background job vs UI thread behavior |
| 162 | +- logging and error reporting consistency |
| 163 | +- public IDs and extension contracts |
| 164 | + |
| 165 | +## Output Expectations |
| 166 | + |
| 167 | +When proposing or implementing changes for Eclipse plugin tasks, include relevant notes about: |
| 168 | +- why the solution is expected to work with the minimum target-platform |
| 169 | +- why the solution is expected to work with the minimum JDK |
| 170 | +- which plugin metadata files may also need to be updated |
| 171 | +- any compatibility risk introduced by API or dependency choices |
0 commit comments