-
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
Implement grouping of the stack frames #583
base: master
Are you sure you want to change the base?
Conversation
c4172ac
to
a1db2c3
Compare
@jukzi : Could you please have a look on this when you have time and check what needs to be done to be merged? |
unfortunately i am very limited in time. @SougandhS can you test/review this PR? |
will check this |
org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/JDIModelPresentation.java
Show resolved
Hide resolved
org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/JDIModelPresentation.java
Show resolved
Hide resolved
...clipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/StackFramePresentationProvider.java
Show resolved
Hide resolved
...clipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/StackFramePresentationProvider.java
Outdated
Show resolved
Hide resolved
...clipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/StackFramePresentationProvider.java
Outdated
Show resolved
Hide resolved
...se.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/monitors/JavaThreadContentProvider.java
Outdated
Show resolved
Hide resolved
...se.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/monitors/JavaThreadContentProvider.java
Outdated
Show resolved
Hide resolved
...se.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/monitors/JavaThreadContentProvider.java
Show resolved
Hide resolved
@@ -40,7 +41,7 @@ public class MonitorsAdapterFactory implements IAdapterFactory { | |||
public <T> T getAdapter(Object adaptableObject, Class<T> adapterType) { | |||
|
|||
if (IElementContentProvider.class.equals(adapterType)) { | |||
if (adaptableObject instanceof IJavaThread) { | |||
if (adaptableObject instanceof IJavaThread || adaptableObject instanceof GroupedStackFrame) { |
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.
Some additional space was added here
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.
Yeah, sorry. Files with mixed tabs and spaces are very confusing and it is easy to mess up them even more!
org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/model/GroupedStackFrame.java
Show resolved
Hide resolved
store.setDefault(IJDIPreferencesConstants.PREF_ACTIVE_CUSTOM_FRAME_FILTER_LIST, ""); //$NON-NLS-1$ | ||
store.setDefault(IJDIPreferencesConstants.PREF_INACTIVE_CUSTOM_FRAME_FILTER_LIST, ""); //$NON-NLS-1$ | ||
store.setDefault(IJDIPreferencesConstants.PREF_COLLAPSE_STACK_FRAMES, true); | ||
|
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.
Try using org.eclipse.jface.util.Util.ZERO_LENGTH_STRING
for empty string declarations, so you can avoid NON-NLS
comments
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.
Thanks, I didn't know about this class!
Hi @gzsombor , could pls take the latest pull and squash everything to one commit only and push, so we can get rid of the build errors |
7d7e88a
to
3eed15a
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.
LGTM 👍
@gzsombor can you please update the pr description to include before/after screenshot to fatsly see what to expect? |
} catch (DebugException e) { | ||
JDIDebugUIPlugin.log(e); | ||
} | ||
frame.setCategory(result); |
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.
why does a getter getCategory set something? that is unexpected
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.
I add more description to the javadoc, but essentially, we don't want to always re-evaluate the rules, so we store the calculated category in that frame.
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.
so if setCategory is only used as cache please move the caching implementation into the getter to avoid the setter. However it feels like the implementation is wrong in means of it will not update the cached value if the options change.
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.
The setter was there, because all the settings were managed by JDIDebugUIPlugin, not by JDIDebugPlugin, partially because managing class/package filter lists are a bit easier with org.eclipse.jface.preference.IPreferenceStore and org.eclipse.jdt.internal.ui.filtertable.FilterManager - those are UI classes, not reachable from the backend.
But I could rewrote it, the base functionality seems to be working - I still have to refactor the settings page and the couple of tests, but that will come in the other PR.
...clipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/StackFramePresentationProvider.java
Outdated
Show resolved
Hide resolved
* @param category | ||
* the new category of the stack frame. | ||
*/ | ||
public void setCategory(Category category); |
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 it somehow avoided to have such setter? it is not obvious to me if such setter should fireChangeEvent(DebugEvent.STATE);
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.
Somehow we need to store the information how that frame was categorized - even if the process is not slow, it needs to lookup the source, and check which classpath entry contains that, etc.
In theory, we could have a map from IJavaStackFrame -> Category in some singleton, but it's unclear how we can detect, if that stack frame was not accessible anymore, so maybe a WeakHashMap could work, but it felt too complicated and error prone.
This setter is only called once - when we first want to display the frame, so firing a change event should not needed - at least it seems to work fine without it.
...clipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/StackFramePresentationProvider.java
Outdated
Show resolved
Hide resolved
9eb4199
to
84bc37e
Compare
...se.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/monitors/JavaThreadContentProvider.java
Outdated
Show resolved
Hide resolved
...se.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/monitors/JavaThreadContentProvider.java
Outdated
Show resolved
Hide resolved
* @since 3.22 | ||
* | ||
*/ | ||
enum Category { |
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.
It feels wrong to publish this enum as API as it may be subject to change. Especially "platform" may be usefull but has no clear definition. Also those categories may not be disjunct. code could be synthetic platform test and library at once. One could either use plain Strings as Category or have a CategoryRegistry where new Categories could be added at runtime.
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.
Yes, the categories are not exact and there could be frames that could belong to multiple categories.
However, I don't think that adding new categories is a feasible - and useful feature ever. Main problem is that a single category needs to be handled in multiple places and going for a very general solution would be hard. For example, to have a foreground and background colors we have to declare them in the plugin.xml, otherwise it can't be set in the color editing preference page.
Maybe, we could have Category as a 'record' and have them declared as a fixed constant in the JDIDebugPlugin.
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.
As long as the solution does not make the categories public API, it may be ok.
org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/model/JDIStackFrame.java
Show resolved
Hide resolved
5154e9e
to
b62f599
Compare
Hi @gzsombor, pls squash all commits into one |
The rules how the frames are categorized are not editable as of now, just a single action is visible to switch on-off the behaviour, with enough javadocs
b62f599
to
25f285a
Compare
Done and also the build is green now! |
The rules how the frames are categorized are not editable as of now, just a single action is visible to switch on-off the behaviour
What it does
Groups - and hides - the supposedly not relevant stack frames from the debug views.
After
Expanding the group:
How to test
Start debugging, and notice that instead of having hundreds of frames only a couple are visible
Author checklist