Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-dev] Refactoring in CDT

Hi!

I hope I'm posting to the right place :). I am currently working on an
Eclipse RCP plugin which needs to refactor some C code patterns.

I am already using CDT (cdt.core) for the parsing in another part of the
project, so I know how to retrieve the ICElement/IBinding to call my
refactoring on.


Currently, all refactoring actions I call are meant to be unattended (no
user input -- the refactoring is called at some point without displaying
a refactoring popup and the scope of the refactoring is to be defined
programmatically).

The refactoring actions I need are:
 - global function rename
 - change function signature (breaks type soundness for calls to that
function and variable bounds in function body -- the broken expressions
are to be commented out and a TODO marker put for the programmer to fix
the code manually)
 - change comments preceding a function (doxygen-like comments)
 - delete a global function
 - create a global function (given a signature and a comment)
 - probably change some global variables/structs

Some of these refactoring actions are already available in CDT so I
would have liked to use them.

Unfortunately, it is my understanding that in both CDT 5.0.2 and 6 those
are in the UI plugin and thus using them imply having cdt.ui as a
dependency and the code seems to be bound to UI concepts & objects
(IShellProvider, ISelection, IWorkbench, ...). Since my plugin does
unattended refactoring it may be ran headless (no dependency on
eclipse.UI) so I'm a bit stuck.

It seems to me that the refactoring support and most of the business
logic of refactoring could be in another plugin (cdt.core or
cdt.refactoring) with some API to provide the same level of user
interaction with the user when called from the UI plugin. In fact, the
LTK refactoring itself is independent from UI concerns.


Hence my questions:
 - Was there a reason to explain the current design to have the
refactoring actions within the cdt.UI plugin?
 - Any thoughts to how I could solve it without adding the dependency on
cdt.UI or copying the code?
 - Are there any plans to refactor the refactoring into another plugin? ;)
 - Would CDT developers be interested in the other refactoring actions
I'm developing? (even if it doesn't really make sense to propose them
from the refactoring pop-up menu, but they could be interesting for
other purposes such as "smart" code (re)generation)


Thanks for your help!


Greetings,

-- 
Simon Chemouil
Anyware Technologies


Back to the top