Skip to content

Add "Change IRI" (rename entity) action to hierarchy context menu#830

Open
henliao wants to merge 1 commit into
protegeproject:masterfrom
henliao:feature/change-entity-iri-context-menu
Open

Add "Change IRI" (rename entity) action to hierarchy context menu#830
henliao wants to merge 1 commit into
protegeproject:masterfrom
henliao:feature/change-entity-iri-context-menu

Conversation

@henliao

@henliao henliao commented Jun 6, 2026

Copy link
Copy Markdown

Summary

WebProtégé already ships a fully-implemented server-side rename: ChangeEntityIRIAction and ChangeEntityIRIActionHandler (permission-gated on EDIT_ONTOLOGY). However, nothing in the client ever dispatches it, so there is no way to change an entity's IRI from the UI (desktop Protégé has this under right-click → Refactor → Change IRI; WebProtégé did not).

This PR wires that existing capability into the client. Right-clicking an entity in the class/property hierarchy tree now offers a "Change IRI..." item.

Changes

  • New ChangeEntityIRIUiAction (client): prompts for a new IRI via InputBox, pre-filled with the entity's current IRI; on confirm, dispatches ChangeEntityIRIAction. No-ops on empty/unchanged input. Refreshes the tree on success.
  • EntityHierarchyContextMenuPresenter: adds the menu item (next to Merge), wires a single-selection supplier and a refresh handler, and gates the item on EDIT_ONTOLOGY + a single selection (mirroring the existing actions).
  • Messages: adds the changeEntityIri label ("Change IRI...").

Because the context-menu presenter is @AutoFactory, the new action is injected as a @Provided dependency; existing create(...) call sites are unchanged, so this applies to both the class hierarchy and property hierarchy portlets.

Notes / open questions

  • The server handler has two pre-existing TODOs (mentions of the entity and match-criteria references are not yet rewritten on rename). This PR does not change server behaviour; it only exposes the existing action.
  • Permission gating is enforced both client-side (menu item disabled) and server-side (EDIT_ONTOLOGY).

Test plan

  • mvn compile succeeds (verified locally for the client module + deps).
  • Right-click a class with edit permission → "Change IRI..." is enabled; renaming updates the IRI and refreshes the tree.
  • Item is disabled for users without EDIT_ONTOLOGY and when multiple nodes are selected.
  • Empty or unchanged input is a no-op.
  • Confirm the same works in the property hierarchy.

Wire the existing server-side ChangeEntityIRIAction into the WebProtege
client. Right-clicking an entity in the hierarchy tree now offers a
"Change IRI..." item that prompts for a new IRI (pre-filled with the
current one) and dispatches the rename. The action is gated on the
EDIT_ONTOLOGY permission and enabled only for a single selection, and
the tree is refreshed on success.
@anthonyalayo

Copy link
Copy Markdown

By popular request from BMDS 210 :-)

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