From a9dcca01fd4f5df1e0ebcc07779fcee576cf3075 Mon Sep 17 00:00:00 2001 From: Andrew Ferguson Date: Wed, 21 May 2008 13:58:58 +0000 Subject: [PATCH] 232988: apply fix --- .../DoxygenCCommentAutoEditStrategyTest.java | 105 ++++++++++++++++++ .../DoxygenMultilineAutoEditStrategy.java | 10 +- 2 files changed, 111 insertions(+), 4 deletions(-) diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/doctools/doxygen/DoxygenCCommentAutoEditStrategyTest.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/doctools/doxygen/DoxygenCCommentAutoEditStrategyTest.java index 3818e2bc7f1..1465f15068d 100644 --- a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/doctools/doxygen/DoxygenCCommentAutoEditStrategyTest.java +++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/doctools/doxygen/DoxygenCCommentAutoEditStrategyTest.java @@ -413,6 +413,7 @@ public class DoxygenCCommentAutoEditStrategyTest extends DefaultCCommentAutoEdit // public: // /** // * X + // * @param x // */ // virtual void foo(D x); // }; @@ -420,6 +421,110 @@ public class DoxygenCCommentAutoEditStrategyTest extends DefaultCCommentAutoEdit assertAutoEditBehaviour(); } + // class A {}; + // /**X + // A baz; + + // class A {}; + // /** + // * X + // */ + // A baz; + public void testAutoDocCommentContent20() throws CoreException { + assertAutoEditBehaviour(); + } + + /** Declarations **/ + + // /**X + // int foo_bar(); + + // /** + // * X + // * @return + // */ + // int foo_bar(); + public void testAutoDocCommentContent3_Dec() throws CoreException { + assertAutoEditBehaviour(); + } + + // /** X + // int foo_bar(); + + // /** + // * X + // * @return + // */ + // int foo_bar(); + public void testAutoDocCommentContent4_Dec() throws CoreException { + assertAutoEditBehaviour(); + } + + // /**X + // * + // */ + // int foo_bar(); + + // /** + // * X + // * + // */ + // int foo_bar(); + public void testAutoDocCommentContent5_Dec() throws CoreException { + assertAutoEditBehaviour(); + } + + // /**X + // void foo_bar(int x); + + // /** + // * X + // * @param x + // */ + // void foo_bar(int x); + public void testAutoDocCommentContent6_Dec() throws CoreException { + assertAutoEditBehaviour(); + } + + // class A {}; class B {}; + // /**X + // C* bar_baz(A a, B b, int c); + + // class A {}; class B {}; + // /** + // * X + // * @param a + // * @param b + // * @param c + // * @return + // */ + // C* bar_baz(A a, B b, int c); + public void testAutoDocCommentContent7_Dec() throws CoreException { + assertAutoEditBehaviour(); + } + + // #define STATIC static + // + // class D { + // public: + // /**X + // STATIC void D::foo(int x); + // }; + + // #define STATIC static + // + // class D { + // public: + // /** + // * X + // * @param x + // */ + // STATIC void D::foo(int x); + // }; + public void testAutoDocCommentContent17_Dec() throws CoreException { + assertAutoEditBehaviour(); + } + protected void assertAutoEditBehaviour() throws CoreException { CTextTools textTools = CUIPlugin.getDefault().getTextTools(); final IDocument doc = new Document(); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/text/doctools/doxygen/DoxygenMultilineAutoEditStrategy.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/text/doctools/doxygen/DoxygenMultilineAutoEditStrategy.java index 1805f27e0b3..15b881dec2a 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/text/doctools/doxygen/DoxygenMultilineAutoEditStrategy.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/text/doctools/doxygen/DoxygenMultilineAutoEditStrategy.java @@ -48,6 +48,7 @@ public class DoxygenMultilineAutoEditStrategy extends DefaultMultilineCommentAut private static final String RETURN = "@return\n"; //$NON-NLS-1$ protected boolean documentPureVirtuals= true; + protected boolean documentDeclarations= true; public DoxygenMultilineAutoEditStrategy() { } @@ -136,11 +137,12 @@ public class DoxygenMultilineAutoEditStrategy extends DefaultMultilineCommentAut if(sdec.getDeclSpecifier() instanceof IASTCompositeTypeSpecifier) { return result; - } else if(documentPureVirtuals && sdec.getDeclSpecifier() instanceof ICPPASTDeclSpecifier) { + } else if(sdec.getDeclSpecifier() instanceof ICPPASTDeclSpecifier) { IASTDeclarator[] dcs= sdec.getDeclarators(); - if(dcs.length == 1) { - ICPPASTFunctionDeclarator fdecl= (ICPPASTFunctionDeclarator) sdec.getDeclarators()[0]; - if(fdecl.isPureVirtual()) { + if(dcs.length == 1 && dcs[0] instanceof ICPPASTFunctionDeclarator) { + ICPPASTFunctionDeclarator fdecl= (ICPPASTFunctionDeclarator) dcs[0]; + boolean shouldDocument= documentDeclarations || (documentPureVirtuals && fdecl.isPureVirtual()); + if(shouldDocument) { return documentFunction(fdecl, sdec.getDeclSpecifier()); } }