eclipse-xtext / eclipse-xtext/xtext

XtextRenameResourceParticipant is unnecessarily loaded for rename actions

Open Beginner friendly
#3,668 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
831
Forks
330
Avg merge
3d 7h
Merged PRs (30d)
12

Description

XtextRenameResourceParticipant.initialize(..) returns true by default, without checking if the renamed element is relevant for this participant. That causes unnecessary appearances of a refactoring dialog within our Eclipse-based application.

The participant should at least consider the if checks from the addElement(..) method for its return value.
So instead of:

@Override
	protected boolean initialize(Object element) {
		addElement(element, getArguments());
		return true;
	}

It should be something like:

@Override
  	protected boolean initialize(Object element) {
          if (arguments instanceof RenameArguments && element instanceof IResource) {
              addElement(element, getArguments());
              return true;
          }
          return false; 
       }

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Locate XtextRenameResourceParticipant and inspect initialize(..) alongside addElement(..), especially the checks involving RenameArguments and IResource. Adjust the initialization decision so irrelevant elements are rejected, then verify that rename actions for those elements no longer open the refactoring dialog while relevant resource renames still do.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
tooling
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.