Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jdt-dev] Source modification plugins [e.g. Refactors]



Tim,

the refactoring code is currently internal API. This will change for 3.0.
If you want ot experiment with
the internal API feel free to do so. But there will be some breakage when
we are going to make it
API.

Regarding your questions:

- you can use normal workbench contribution mechanism to contribute actions
to the editor's and
view's context menu. The path to the refactoring sub menu is:
org.eclipse.jdt.ui.refactoring.menu

- to retrieve the compilation unit from the editor part you have to use
internal
  API. Here a snippet:

            if (!(part instanceof JavaEditor)
                  return null;
            JavaEditor editor= (JavaEditor)part;
            IEditorInput input= editor.getEditorInput();
            if (input instanceof IClassFileEditorInput)
                  return ((IClassFileEditorInput)input).getClassFile();
            IWorkingCopyManager manager=
JavaPlugin.getDefault().getWorkingCopyManager();
            return manager.getWorkingCopy(input);

One last thing: the mailing list is reserved for Eclipse developers.
Questions like yours are better
asked on the news group.

Dirk


                                                                           
             Tim Vernum                                                    
             <Tim.Vernum@macqu                                             
             arie.com>                                                  To 
             Sent by:                  "'jdt-dev@xxxxxxxxxxx'"             
             jdt-dev-admin@ecl         <jdt-dev@xxxxxxxxxxx>               
             ipse.org                                                   cc 
                                                                           
                                                                   Subject 
             07/29/2003 05:57          [jdt-dev] Source modification       
             AM                        plugins [e.g. Refactors]            
                                                                           
                                                                           
             Please respond to                                             
             jdt-dev@eclipse.o                                             
                    rg                                                     
                                                                           
                                                                           




I'm hoping to write a plugin (or two) to perform some source modification
tasks, e.g. I have a few refactors I want to create.


I'm been reading through the JDT plugin guide and there doesn't seem to be
any extension points that are suitable.


I could add an standard plugin action targeted at the Java editor, but I
couldn't find a way to get a CompilationUnit out of an EditorPart.


Is it possible to write new refactors as plugins?
Are there any examples out there?





NOTICE
This e-mail and any attachments are confidential and may contain copyright
material of Macquarie Bank or third parties. If you are not the intended
recipient of this email you should not read, print, re-transmit, store or
act in reliance on this e-mail or any attachments, and should destroy all
copies of them. Macquarie Bank does not guarantee the integrity of any
emails or any attached files. The views or opinions expressed are the
author's own and may not reflect the views or opinions of Macquarie Bank.





Back to the top