[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [cdt-dev] Applying Multiple Changes with Refactoring
|
I can't tell you exactly what the problem is in your case because I don't know
how the nodes you are using in the modifications are constructed. A common
source for problems is when you use nodes from a existing AST in your new
created nodes. e.g. if you use an existing DelcSpecifier as a child node in a
new Declaration.
I know there is not much documentation available at the moment but we are
working on this.
Emanuel
On Friday 23 May 2008, student08 wrote:
> Hi I've created and been working on a subclass of CRefactoring.
> Unfortunately I can't seem to have multiple changes, with only one change
> (the prototype declaration insertion) showing up on the preview screen and
> being applied.
>
> The others don't show up in the preview and neither are they applied.
> Somehow this only seems to happen when I insert the prototype declaration
> using ASTRewrite.insertBefore. I've been trying for quite awhile now to
> work out why it's breaking the refactoring. Here's the code I have for
> collectModifications:
>
> @Override
> protected void collectModifications(IProgressMonitor pm,
> ModificationCollector collector) throws CoreException,
> OperationCanceledException {
> // TODO Auto-generated method stub
>
> ASTRewrite rewrite =
> collector.rewriterForTranslationUnit(definitionToStatic.getTranslationUnit(
>));
>
> IASTSimpleDeclSpecifier changedSpecifier =
> changeDeclSpecifierStatic(definitionToStatic, collector);
> rewrite.replace(definitionToStatic.getDeclSpecifier(),
> changedSpecifier,
> new TextEditGroup("Changed
> function definition to static"));
>
> if (declToRemove != null) {
> rewrite.remove(declToRemove, new
> TextEditGroup("Function declaration removed"));
> }
>
> IASTSimpleDeclaration prototype =
> createLocalPrototype(definitionToStatic, collector);
>
>
> rewrite.insertBefore(definitionToStatic.getTranslationUnit(),
>
> TranslationUnitHelper.getFirstNode(definitionToStatic.getTranslationUnit())
>, prototype,
> new TextEditGroup("Function
> prototype added")); }
> --
> View this message in context:
> http://www.nabble.com/Applying-Multiple-Changes-with-Refactoring-tp17420423
>p17420423.html Sent from the Eclipse CDT - Development mailing list archive
> at Nabble.com.
>
> _______________________________________________
> cdt-dev mailing list
> cdt-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/cdt-dev
--
Emanuel Graf Dipl. Ing FH
Institut für Software - http://ifs.hsr.ch - +41 55 222 4622
HSR Hochschule für Technik Rapperswil
Oberseestr 10, Postfach 1475, CH-8640 Rapperswil