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 107964 Details for
Bug 215161
[generate constructor] Generate constructor using fields should respect field order
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Fix
215161_maintenance_patch.txt (text/plain), 2.28 KB, created by
Markus Keller
on 2008-07-21 12:22:20 EDT
(
hide
)
Description:
Fix
Filename:
MIME Type:
Creator:
Markus Keller
Created:
2008-07-21 12:22:20 EDT
Size:
2.28 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.ui >Index: ui/org/eclipse/jdt/ui/actions/GenerateNewConstructorUsingFieldsAction.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/actions/GenerateNewConstructorUsingFieldsAction.java,v >retrieving revision 1.53 >diff -u -r1.53 GenerateNewConstructorUsingFieldsAction.java >--- ui/org/eclipse/jdt/ui/actions/GenerateNewConstructorUsingFieldsAction.java 3 Apr 2008 07:33:46 -0000 1.53 >+++ ui/org/eclipse/jdt/ui/actions/GenerateNewConstructorUsingFieldsAction.java 21 Jul 2008 16:19:37 -0000 >@@ -13,6 +13,7 @@ > import java.lang.reflect.InvocationTargetException; > import java.util.ArrayList; > import java.util.Arrays; >+import java.util.HashMap; > import java.util.List; > > import org.eclipse.core.runtime.CoreException; >@@ -321,7 +322,7 @@ > return; > } > >- ArrayList fields= new ArrayList(); >+ HashMap fieldsToBindings= new HashMap(); > ArrayList selected= new ArrayList(); > > IVariableBinding[] candidates= typeBinding.getDeclaredFields(); >@@ -339,16 +340,27 @@ > continue; // Do not add final fields which have been set in the <clinit> > } > } >- fields.add(curr); >- if (allSelected.contains(curr.getJavaElement())) { >+ IJavaElement javaElement= curr.getJavaElement(); >+ fieldsToBindings.put(javaElement, curr); >+ if (allSelected.contains(javaElement)) { > selected.add(curr); > } > } >- if (fields.isEmpty()) { >+ if (fieldsToBindings.isEmpty()) { > MessageDialog.openInformation(getShell(), ActionMessages.GenerateConstructorUsingFieldsAction_error_title, ActionMessages.GenerateConstructorUsingFieldsAction_typeContainsNoFields_message); > notifyResult(false); > return; > } >+ >+ ArrayList fields= new ArrayList(); >+ IField[] allFields= type.getFields(); >+ for (int i= 0; i < allFields.length; i++) { >+ Object fieldBinding= fieldsToBindings.remove(allFields[i]); >+ if (fieldBinding != null) { >+ fields.add(fieldBinding); >+ } >+ } >+ fields.addAll(fieldsToBindings.values()); // paranoia code, should not happen > > final GenerateConstructorUsingFieldsContentProvider provider= new GenerateConstructorUsingFieldsContentProvider(fields, selected); > IMethodBinding[] bindings= null;
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 215161
: 107964