-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Compare multiple objects in Variable View #581
base: master
Are you sure you want to change the base?
Conversation
3db6961
to
368b954
Compare
Hi @jukzi , could you please check this PR when you have time. |
have not looked at the sourcecode, only on the screenshots yet: |
org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/ObjectComparision.java
Outdated
Show resolved
Hide resolved
org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/ObjectComparision.java
Outdated
Show resolved
Hide resolved
it actually extracts contents in list,map,sets and objects and stores it as a string data then compares those data with equals() but if we now select these objects and compare from menu we get "elements contain same data" and it wont go nested extraction for that it simply compares with the object name and id (check reference / identity) |
org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/ObjectComparision.java
Outdated
Show resolved
Hide resolved
org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/ObjectComparision.java
Outdated
Show resolved
Hide resolved
org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/ObjectComparision.java
Outdated
Show resolved
Hide resolved
org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/ObjectComparision.java
Outdated
Show resolved
Hide resolved
if (referenceTypeObject1.equals(referenceTypeObject2)) { | ||
|
||
String selectionReference = selectedObject1.getReferenceTypeName(); | ||
if (selectionReference.equals("java.lang.String")) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you use interface CharSequence instead of String implementation?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
from getReferenceTypeName() and javaType() only "java.lang.String" is getting returned.
org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/actions/CompareObjectsAction.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All messages displayed to user (execept exceptions) should be multi language aware.
It only compares exactly 2 values? Wouldn't it make sense to compare also n values? |
i don't get why #203 (comment) says it should be implemented in platform but this is a jdt.debug only PR |
I understand what it does when i look at the code but i wonder if/how that could be expressed to the user. |
Okay
As of now it compares only 2 according to the #203 , for n comparisons it will be too complex |
If that is supposed to be implemented, it should use diff viewer support for complex types, not dialogs. |
Comparing n elements is only a for-loop of comparing n-1 times 2 values each. |
Yes. Totally agree. I will provide additional msgs like you suggested.
Actually in current implementation there is a reference check provided prior comparison, so SequencedCollection will only be able to compare other SequencedCollection |
Okay |
368b954
to
d163fc3
Compare
I made few more changes and included a custom diff view for custom objects and complex objects as per @iloveeclipse suggested. now it supports n-comparisons and List,Map,Set can be campared to any of its implementations . If selected objects are only 2 then dialog box is only used if its more than 2 then diff is used. Also for Sets comparison I have eliminated its order checking to eliminate confusion. for custom objects fields are compared with each other for nested objects their identity/reference is checked
|
d163fc3
to
711b12c
Compare
org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/actions/CompareObjectsAction.java
Outdated
Show resolved
Hide resolved
org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/actions/CompareObjectsAction.java
Outdated
Show resolved
Hide resolved
org.eclipse.jdt.debug.tests/testprograms/compare/CompareListObjects.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow, that code became really long. Unfortunatly it is hard to read when the declarations are not at the initializing code.
Will clean it further more |
9310506
to
eca21de
Compare
org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/DebugUIMessages.properties
Outdated
Show resolved
Hide resolved
org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/ObjectComparison.java
Outdated
Show resolved
Hide resolved
org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/ObjectComparison.java
Outdated
Show resolved
Hide resolved
org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/ObjectComparison.java
Outdated
Show resolved
Hide resolved
org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/actions/CompareObjectsAction.java
Outdated
Show resolved
Hide resolved
org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/actions/CompareObjectsAction.java
Outdated
Show resolved
Hide resolved
eca21de
to
419ae53
Compare
2b8a74c
to
b2c16b6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks much better now, i don't know when i would have time to test it. maybe meanwhile some one else wants to take a look? @iloveeclipse ?
This commit provides a new feature to compare elements of commonly used objects of similar types like Map, HashMap, LinkedHashMap, ConcurrentHashMap, Hashtable , IdentityHashMap, WeakHashMap, TreeMap, List, ArrayList, Stack, Vector, LinkedList, HashSet, LinkedHashSet, TreeSet, CopyOnWriteArraySet, Arrays, Wrappers and custom objects from Variables view and display differences of both in either diff viewer or dialog box. Fixes eclipse-platform/eclipse.platform#531
b2c16b6
to
e36725a
Compare
This commit provides a new feature to compare elements of commonly used objects of same types like Map, HashMap, LinkedHashMap, ConcurrentHashMap, Hashtable , IdentityHashMap, WeakHashMap, TreeMap, List, ArrayList, Stack, Vector, LinkedList, HashSet, LinkedHashSet, TreeSet, CopyOnWriteArraySet, Arrays, Wrappers and custom objects from Variables view and display differences of both either in diff view or in dialog box.
Fixes eclipse-platform/eclipse.platform#531
How to test
->Select atleast 2 objects of same type (List, Map, Set etc) from Variables view
Result->Choose "Compare" from menu
Author checklist