-
Using Eclipse JDT to rename a working copy of a source file
I'm using Eclipse JDT to build a Java refactoring platform, for exploring different refactorings in memory before choosing one and saving it. I can create working copies of the source files and edit them (for example to rename a type, using ASTRewrite), and I also want to rename one or more of the working copies. I'd hoped that the rename would be stored in the working copy's edit buffer somehow, to be applied if I chose to save it, in the same way as the other edits.
However, my attempt to rename a working copy failed, i.e.
ICompilationUnit original = (... find /piffle/Foo.java from the IJavaProject)
ICompilationUnit workingCopy = original.getWorkingCopy(null);
... edit the working copy ...
workingCopy.rename("Baz.java", false, null);
gave error: Java Model Exception: Java Model Status [Operation not supported for specified element type(s):[Working copy] Foo.java [in piffle [in src [in testplugin]]]]
I checked that I can call rename on the original source file; that worked as expected and renamed the file immediately, so I know the rename parameters are ok. Can anyone suggest a way to achieve this rename, without affecting the original file until I commit a working copy?
Similar Threads
-
By null_guy in forum Java
Replies: 27
Last Post: 07-16-2008, 06:33 AM
-
By haran415 in forum VB Classic
Replies: 4
Last Post: 04-15-2007, 10:40 AM
-
By priyavenkat in forum VB Classic
Replies: 3
Last Post: 08-13-2005, 01:55 PM
-
By jase_dukerider in forum C++
Replies: 2
Last Post: 04-14-2005, 07:48 PM
-
By T TADCOCK in forum VB Classic
Replies: 1
Last Post: 09-23-2000, 12:15 PM
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Development Centers
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center
|