Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 1737 Details for
Bug 21768
ast: incorrect length of SimpleName in MethodDeclaration
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Fix for 'Add parameter' quick fix
patch-addparameter21768.txt (text/plain), 2.65 KB, created by
Martin Aeschlimann
on 2002-07-25 09:26:40 EDT
(
hide
)
Description:
Fix for 'Add parameter' quick fix
Filename:
MIME Type:
Creator:
Martin Aeschlimann
Created:
2002-07-25 09:26:40 EDT
Size:
2.65 KB
patch
obsolete
>Index: NewVariableCompletionProposal.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/correction/NewVariableCompletionProposal.java,v >retrieving revision 1.15 >diff -u -r1.15 NewVariableCompletionProposal.java >--- NewVariableCompletionProposal.java 4 Jul 2002 12:15:55 -0000 1.15 >+++ NewVariableCompletionProposal.java 25 Jul 2002 13:25:12 -0000 >@@ -20,6 +20,9 @@ > import org.eclipse.jdt.core.IJavaElement; > import org.eclipse.jdt.core.IMember; > import org.eclipse.jdt.core.IType; >+import org.eclipse.jdt.core.compiler.IScanner; >+import org.eclipse.jdt.core.compiler.ITerminalSymbols; >+import org.eclipse.jdt.core.compiler.InvalidInputException; > import org.eclipse.jdt.core.dom.ASTNode; > import org.eclipse.jdt.core.dom.Block; > import org.eclipse.jdt.core.dom.ConstructorInvocation; >@@ -106,17 +109,19 @@ > private static class AddParameterEdit extends SimpleTextEdit { > private String fContent; > private ASTNode fAstRoot; >+ private ICompilationUnit fCompilationUnit; > >- public AddParameterEdit(ASTNode astRoot, String content) { >+ public AddParameterEdit(ICompilationUnit cu, ASTNode astRoot, String content) { > fAstRoot= astRoot; > fContent= content; >+ fCompilationUnit= cu; > } > > /* non Java-doc > * @see TextEdit#getCopy > */ > public TextEdit copy() { >- return new AddParameterEdit(fAstRoot, fContent); >+ return new AddParameterEdit(fCompilationUnit, fAstRoot, fContent); > } > > /* non Java-doc >@@ -143,7 +148,19 @@ > insertString= ", " + fContent; //$NON-NLS-1$ > } else { > SimpleName name= declaration.getName(); >- offset= name.getStartPosition() + name.getLength() - 1; >+ try { >+ IScanner scanner= ASTResolving.createScanner(fCompilationUnit, name.getStartPosition()); >+ int nextNoken= scanner.getNextToken(); >+ while (nextNoken != ITerminalSymbols.TokenNameLPAREN) { >+ nextNoken= scanner.getNextToken(); >+ if (nextNoken == ITerminalSymbols.TokenNameEOF) { >+ return; >+ } >+ } >+ offset= scanner.getCurrentTokenEndPosition() + 1; >+ } catch (InvalidInputException e) { >+ return; >+ } > insertString= fContent; > } > } >@@ -196,7 +213,7 @@ > changeElement.addTextEdit("field", createFieldEdit(content, settings.tabWidth)); //$NON-NLS-1$ > } else if (fVariableKind == PARAM) { > // new parameter >- changeElement.addTextEdit("parameter", new AddParameterEdit(fNode, content)); //$NON-NLS-1$ >+ changeElement.addTextEdit("parameter", new AddParameterEdit(cu, fNode, content)); //$NON-NLS-1$ > } > } >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 21768
:
1735
| 1737