| Summary: | [ltk] CopyDescriptor doesn't have enough arguments to handle copying | ||
|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Yuri Strot <yuri> |
| Component: | UI | Assignee: | JDT-UI-Inbox <jdt-ui-inbox> |
| Status: | CLOSED WONTFIX | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | markus.kell.r, Olivier_Thomann |
| Version: | 3.5.2 | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Windows XP | ||
| Whiteboard: | stalebug | ||
Move to JDT/UI Reproduced. The problem is that ReorgPolicyFactory$CopyFilesFoldersAndCusPolicy.createRefactoringDescriptor(JDTRefactoringDescriptorComment, Map, String, String, int) line: 295
calls storeReorgExecutionLog(..) at a time when the new names are not yet known (they are only queried in CreateCopyOfCompilationUnitChange#getOldFile(IProgressMonitor)).
I think they only way you can get at this information is by contributing a CopyParticipant: Override getChange(..) and return a dummy change whose perform(..) method does something like this:
public Change perform(IProgressMonitor pm) throws CoreException {
CopyArguments arguments = getArguments();
ReorgExecutionLog executionLog = arguments.getExecutionLog();
Object[] processedElements = executionLog.getProcessedElements();
for (int i = 0; i < processedElements.length; i++) {
String newName= executionLog.getNewName(processedElements[i]);
// store newName
}
return super.perform(pm);
}
Hint: To hide your change in the preview, wrap it into a CompositeChange and call markAsSynthetic() on it.
Hi Markus, Thank you very much! This workaround works for me. This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. As such, we're closing this bug. If you have further information on the current state of the bug, please add it and reopen this bug. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant. -- The automated Eclipse Genie. |
Hi, I'm working on the Annotation Framework in the Tigerstripe project and I need to handle java elements changes. I've already added this support for renaming, moving and deleting but have a problem with copying. If I copy class to the same package I can enter new name for copied class. For example I can copy TestClass to TestClass2. I'm using IRefactoringExecutionListener and getting CopyDescriptor from the refactoring event. But this descriptor contains only following arguments: {files=0, folders=0, policy=org.eclipse.jdt.ui.copyResources, element1=/src<pack{TestClass.java, units=1, version=1.0, destination=/src<pack} So there are no information about new class name. Is there any way to take it?