JDT refactor detele my extra files [message #250470] |
Mon, 07 January 2008 01:21  |
Eclipse User |
|
|
|
Hi,
I gets a trouble with java refactor in my eclipse plugin. My model includes
1 .xml file containing data, with 1 .meta file containing some extra infos.
Copy/Cut/Paste using clipboard works fine, but using Drag N Drop operator
makes my plugins run incorrectly. I hooked into moveDeleteHook extension so
that whenever user copy/move/delete .xml file, its .meta is also
copied/moved/delete. The problem is when I copy .xml file into others
project using Drag n Drop operator, CopyResourceChange runs afterthat. I
discovered that:
ResourceReorgChange (CopyResourceChange):
public final Change perform(IProgressMonitor pm) throws CoreException,
OperationCanceledException {
.......
String newName= getNewResourceName();
IResource resource= getResource();
boolean performReorg= deleteIfAlreadyExists(new SubProgressMonitor(pm,
1), newName);
....
final Change result= doPerformReorg(getDestinationPath(newName), new
SubProgressMonitor(pm, 1));
}
So if destination container contains existed .xml file,
deleteIfAlreadyExistes() will execute. That make Eclipse deletes my .xml and
its .meta file, then only .xml file is copied by doPerformReorg() method -->
missing .meta file.
Is this a bug of JDT ? Any sugguest are welcome.
Regards,
|
|
|
Re: JDT refactor detele my extra files [message #250486 is a reply to message #250470] |
Mon, 07 January 2008 04:41  |
Eclipse User |
|
|
|
Originally posted by: merks.ca.ibm.com
This question doesn't sound related to JDT but more of a question about
the platforms refactoring support, which JDT uses. It might be best to
ask on the platform newsgroup if you don't get an answer here. I've
never used this stuff but reading the problem it seems to me that
deleteIfAlreadyExists might do something or nothing as necessary and
that from what you say, this part works correctly. So it's not clear to
me reading this why doPerformReorg would not copy the .meta only in the
case if it just deleted one. Maybe that will be obvious to someone who
knows about refactoring, but it seems mysterious to me... Are you also
saying that a copy and paste into a folder with a colliding result would
work correctly? Have you traced/debugged the code to see how the paths
they take are different?
Eclipse Community wrote:
> Hi,
> I gets a trouble with java refactor in my eclipse plugin. My model includes
> 1 .xml file containing data, with 1 .meta file containing some extra infos.
> Copy/Cut/Paste using clipboard works fine, but using Drag N Drop operator
> makes my plugins run incorrectly. I hooked into moveDeleteHook extension so
> that whenever user copy/move/delete .xml file, its .meta is also
> copied/moved/delete. The problem is when I copy .xml file into others
> project using Drag n Drop operator, CopyResourceChange runs afterthat. I
> discovered that:
> ResourceReorgChange (CopyResourceChange):
>
> public final Change perform(IProgressMonitor pm) throws CoreException,
> OperationCanceledException {
>
> ......
>
> String newName= getNewResourceName();
>
> IResource resource= getResource();
>
> boolean performReorg= deleteIfAlreadyExists(new SubProgressMonitor(pm,
> 1), newName);
>
> ...
>
> final Change result= doPerformReorg(getDestinationPath(newName), new
> SubProgressMonitor(pm, 1));
>
> }
>
> So if destination container contains existed .xml file,
> deleteIfAlreadyExistes() will execute. That make Eclipse deletes my .xml and
> its .meta file, then only .xml file is copied by doPerformReorg() method -->
> missing .meta file.
>
> Is this a bug of JDT ? Any sugguest are welcome.
>
> Regards,
>
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.02446 seconds