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 1805 Details for
Bug 22196
Quick Fix broken due to bug 21768 [quick fix]
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Updated patch for add parameter (replaces Attachment 1737)
patch-22196.txt (text/plain), 3.83 KB, created by
Martin Aeschlimann
on 2002-08-07 06:07:10 EDT
(
hide
)
Description:
Updated patch for add parameter (replaces Attachment 1737)
Filename:
MIME Type:
Creator:
Martin Aeschlimann
Created:
2002-08-07 06:07:10 EDT
Size:
3.83 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.14 >diff -u -r1.14 NewVariableCompletionProposal.java >--- NewVariableCompletionProposal.java 12 Jun 2002 08:47:45 -0000 1.14 >+++ NewVariableCompletionProposal.java 7 Aug 2002 10:05:40 -0000 >@@ -14,12 +14,16 @@ > import java.util.List; > > import org.eclipse.core.runtime.CoreException; >+import org.eclipse.core.runtime.Status; > > import org.eclipse.jdt.core.ICompilationUnit; > import org.eclipse.jdt.core.IField; > 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; >@@ -28,6 +32,8 @@ > import org.eclipse.jdt.core.dom.SimpleName; > import org.eclipse.jdt.core.dom.SuperConstructorInvocation; > >+import org.eclipse.jdt.ui.JavaUI; >+ > import org.eclipse.jdt.internal.corext.codemanipulation.CodeGenerationSettings; > import org.eclipse.jdt.internal.corext.codemanipulation.ImportEdit; > import org.eclipse.jdt.internal.corext.codemanipulation.MemberEdit; >@@ -41,7 +47,6 @@ > import org.eclipse.jdt.internal.corext.textmanipulation.TextRange; > import org.eclipse.jdt.internal.corext.util.CodeFormatterUtil; > import org.eclipse.jdt.internal.ui.JavaPluginImages; >- > import org.eclipse.jdt.internal.ui.preferences.JavaPreferencesSettings; > > public class NewVariableCompletionProposal extends CUCorrectionProposal { >@@ -106,17 +111,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 +150,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) { >+ throw new CoreException(new Status(Status.ERROR, JavaUI.ID_PLUGIN, Status.ERROR, "Unexpected EOF while scanning", null)); //$NON-NLS-1$ >+ } >+ } >+ offset= scanner.getCurrentTokenEndPosition() + 1; >+ } catch (InvalidInputException e) { >+ throw new CoreException(new Status(Status.ERROR, JavaUI.ID_PLUGIN, Status.ERROR, "Exception while scanning", e)); //$NON-NLS-1$ >+ } > insertString= fContent; > } > } >@@ -196,7 +215,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 22196
:
1801
| 1805