Skip to content

Add copy refactoring infrastructure to LTK#4047

Open
Felix-Schmid wants to merge 6 commits into
eclipse-platform:masterfrom
Felix-Schmid:copy-refactoring
Open

Add copy refactoring infrastructure to LTK#4047
Felix-Schmid wants to merge 6 commits into
eclipse-platform:masterfrom
Felix-Schmid:copy-refactoring

Conversation

@Felix-Schmid
Copy link
Copy Markdown

LTK is missing infrastructure for copy refactoring, e.g., a CopyResourcesProcessor. Eclipse RCP developers can define their own copy participants (similar to move/delete/rename participants), but they are never called.

This PR adds copy refactoring to LTK based on the existing implementation of move/delete refactoring, the existing refactoring for copying projects, and the copy processor implementation of JDT.

The changes were tested in Eclipse 4diac, where we could now perform refactoring operations (via participants) during copying of resources.

@vogella
Copy link
Copy Markdown
Contributor

vogella commented Jun 1, 2026

I see no tests, please add them.

@eclipse-platform-bot
Copy link
Copy Markdown
Contributor

This pull request changes some projects for the first time in this development cycle.
Therefore the following files need a version increment:

bundles/org.eclipse.ltk.core.refactoring/META-INF/MANIFEST.MF
bundles/org.eclipse.ltk.ui.refactoring/META-INF/MANIFEST.MF

An additional commit containing all the necessary changes was pushed to the top of this PR's branch. To obtain these changes (for example if you want to push more changes) either fetch from your fork or apply the git patch.

Git patch
From f274e2b6b5aaa22194d573806ad9e2f060564129 Mon Sep 17 00:00:00 2001
From: Eclipse Platform Bot <platform-bot@eclipse.org>
Date: Mon, 1 Jun 2026 14:38:55 +0000
Subject: [PATCH] Version bump(s) for 4.41 stream


diff --git a/bundles/org.eclipse.ltk.core.refactoring/META-INF/MANIFEST.MF b/bundles/org.eclipse.ltk.core.refactoring/META-INF/MANIFEST.MF
index 9f0f659919..0933dc953b 100644
--- a/bundles/org.eclipse.ltk.core.refactoring/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.ltk.core.refactoring/META-INF/MANIFEST.MF
@@ -3,7 +3,7 @@ Automatic-Module-Name: org.eclipse.ltk.core.refactoring
 Bundle-ManifestVersion: 2
 Bundle-Name: %pluginName
 Bundle-SymbolicName: org.eclipse.ltk.core.refactoring; singleton:=true
-Bundle-Version: 3.15.200.qualifier
+Bundle-Version: 3.15.300.qualifier
 Bundle-Activator: org.eclipse.ltk.internal.core.refactoring.RefactoringCorePlugin
 Bundle-ActivationPolicy: lazy
 Bundle-Vendor: %providerName
diff --git a/bundles/org.eclipse.ltk.ui.refactoring/META-INF/MANIFEST.MF b/bundles/org.eclipse.ltk.ui.refactoring/META-INF/MANIFEST.MF
index dea006509a..ae7f9a413c 100644
--- a/bundles/org.eclipse.ltk.ui.refactoring/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.ltk.ui.refactoring/META-INF/MANIFEST.MF
@@ -3,7 +3,7 @@ Automatic-Module-Name: org.eclipse.ltk.ui.refactoring
 Bundle-ManifestVersion: 2
 Bundle-Name: %pluginName
 Bundle-SymbolicName: org.eclipse.ltk.ui.refactoring; singleton:=true
-Bundle-Version: 3.14.100.qualifier
+Bundle-Version: 3.14.200.qualifier
 Bundle-Activator: org.eclipse.ltk.internal.ui.refactoring.RefactoringUIPlugin
 Bundle-ActivationPolicy: lazy
 Bundle-Vendor: %providerName
-- 
2.54.0

Further information are available in Common Build Issues - Missing version increments.

* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* IBM Corporation - initial API and implementation
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* IBM Corporation - initial API and implementation

I assume the header is copied from somewhere. I did you put IBM in here by intention?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This class needed to be very similar to the DeleteResourcesDescriptor, so I copied the file and made the necessary changes. I kept the original header to show that this was not all my creation. The same principle also applies to CopyResourcesHandler & CopyResourcesRefactoringContribution.
I can change the headers if this was incorrect or if there is a better way to do it.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That’s okay. Increase the upper year to the current year.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

import org.eclipse.ltk.internal.core.refactoring.BasicElementLabels;
import org.eclipse.ltk.internal.core.refactoring.RefactoringCoreMessages;

public class CopyResourceChange extends ResourceChange {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this is supposed to be a public API, you must bump bundle version to 3.16.0 and add since 3.16 javadoc tags on every new API type

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the heads-up, done.
Everything that was made public was done to align in with how the move/delete classes do it, a discussion about this was also had here #2262 (comment).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

API tooling complains, and I see now the package is not exported as API. Is this intentional?

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.

6 participants