-
Notifications
You must be signed in to change notification settings - Fork 117
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
Show progress indicator of "Run configurations..." after delay #591
Show progress indicator of "Run configurations..." after delay #591
Conversation
Test Results 42 files ±0 42 suites ±0 57m 2s ⏱️ ±0s For more details on these failures, see this check. Results for commit c0b72e9. ± Comparison against base commit 7ed493c. ♻️ This comment has been updated with latest results. |
3a9124c
to
f830a3f
Compare
f830a3f
to
843f79f
Compare
...bug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsDialog.java
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.
Looks reasonable.
If nobody else does in the meantime, I'll try to review this in detail and try it out at the weekend.
fActiveRunningOperations++; | ||
|
||
UIJob showProgressMonitorPart = createJobToShowProgressMonitorPart(); | ||
// only show the progress bar if necessary after 1 second | ||
showProgressMonitorPart.schedule(1_000); |
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.
Since potentially not everybody wants a delay, maybe the delay should be configurable in the context?
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.
Do you mean like DebugUIPlugin.getDefault().getPreferenceStore().getLong("somelong");
? That would also mean that there needs to be a new preference in the Preferences dialog under Run/Debug > Launching > Launch configurations, right?
Or did you mean something else?
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.
Since potentially not everybody wants a delay, maybe the delay should be configurable in the context?
I was thinking again about making it configurable and it still doesn't feel right.
Don't get me wrong, I'm all for customizing the user experience but in this particular case, a low value would mean that the progress bar might flicker and a high value would mean the UI might freeze. Letting the user set this value feels like giving him/her the choice between bad and worse 😅
Maybe you and I can settle for a value and let it hard-coded. Say 500 ms?
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.
There is definitely a tradeoff with configuration preferences that users are unlikely to find and as there are more and more, the user is even less likely to find and understand such things...
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.
Sorry for the late reply.
I meant not configurable for the user but for developers calling this code.
If a dev knows that an operation will definitvly take some time, it would be good to show i immediatly.
Furthermore If we could somehow estimate the remaining runtime(e.g. from a ProgressMonitor, it would be good to consider if it is worth to show it.
E.g. for a 501ms running Task showing Progress after 500ms is pointless.
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 meant not configurable for the user but for developers calling this code.
Thank you for clarifying it :-) . Do you have any suggestion (code) on how to achieve that?
Not really, I would guess that this should somehow be stored in the context? But this is just a simple guess, there might be better places.
Furthermore If we could somehow estimate the remaining runtime(e.g. from a ProgressMonitor, it would be good to consider if it is worth to show it.
Hm, the problem is that the progress monitor does not have any method to see how much work is still to be done so there is no basis to estimate if it's worth showing it.
E.g. for a 501ms running Task showing Progress after 500ms is pointless.
I agree and I'm convinced pretty much any value someone selects will end up provoking either a flickering or a UI freeze. The timeout is just a simple way of catching all jobs that run in under X ms. I have no way of knowing how long a job is going to take, but In my experience if the job takes > 1s then it will probably take >2 s (i.e. the progress bar will appear for at least a second). Again, this is a very simplistic approach based on my experience. I wanted to provide a solution without burdening the user (or programmer) with a new setting/parameter that needs to be understood and set correctly.
Makes sense. So my suggestion is for now to just a threshold a developer can add and maybe later enhance the progress-manager to get an (probably quickly outdated) estimation about the done work later and with that enhance this further.
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.
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.
Ah, you probably meant the BundleContext
right? I'll look into it on Monday.
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.
Ah, you probably meant the
BundleContext
right? I'll look into it on Monday.
I think it should be a org.eclipse.jface.operation.IRunnableContext
, as you are using that in eclipse-pde/eclipse.pde#674 to show the pop-up that shows the progress indication.
Unfortunately the progress-indicator is not created directly so have to pass trough the threshold value.
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.
Btw. Monday is the last day of development for the upcomming 2023-09 release and I probably won't have the time to review/try this Monday evening (if another Committer does it is of course welcome).
I'll try to review your PR in PDE over the weekend, but cannot promise it.
The topic of "deferred progress reporting" is also handled within org.eclipse.ui.internal.operations.TimeTriggeredProgressMonitorDialog (which is probably a copy of org.eclipse.debug.internal.ui.viewers.model.TimeTriggeredProgressMonitorDialog). Not sure if you could reuse the first one in your implementation maybe. |
Good hint @Bananeweizen, I didn't know about that one, thank you! This could be a good compromise since the concept of delayed progress reporting has already been tackled and it seems a delay of 800 ms is the accepted norm. I changed the code to simply use this threshold in a21c1d7. What do you say if we just take this implementation out for a spin in the upcoming release and see how this works, @HannesWell? Maybe this simple solution is better than letting the user/programmer set a value that will probably be quickly outdated anyway? |
843f79f
to
a21c1d7
Compare
Hello all, |
a21c1d7
to
52070f1
Compare
As build log mentions, a version bump seems necessary:
|
77899f2
to
3229184
Compare
Thank you for the hint. It's odd, I just bumped the version and I get this error in Eclipse: Any hint on how to get rid of it? |
You should set API baseline to 4.29 RC2a. I assume you are still using 4.28 in the IDE. |
FYI, the Oomph setups won't be correct (correct baseline and TP) until Wednesday morning... |
As a workaround, you can do this. Use Navigate -> Open Setup -> Workspace and copy (select text below) and paste (onto the root Workspace object) these two redirection tasks
Then the baseline task will use the 4.29 release and the target platform will use 4.30 I builds... |
Sounds good. I'm still thinking about if it would be good to add means to IProgressMonitor to get the percentage of work done (or at least an Approximation since the value can be outdated quickly)? This would allow to estimate if it is worth to open the progress indicator. |
the implementation of the monitor should/must handle this so there is no need for an public API at all, so for example ProgressMonitorDialog could have something similar to what Swing uses here: |
3229184
to
1112f1e
Compare
@@ -1409,6 +1416,20 @@ public void run(boolean fork, boolean cancelable, IRunnableWithProgress runnable | |||
} | |||
} | |||
|
|||
private UIJob createJobToShowProgressMonitorPart() { | |||
return new UIJob(IInternalDebugCoreConstants.EMPTY_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.
Besides UIJob.create() I think we can just use an empty string literal here.
IMHO it does not make sense to get that from a constant.
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.
Done in 6c443cc
But the ProgressMonitor is designed differently and does not handle the context, so there must be at least and internal method to get that value. Any way, since everything additionally seems to be more complex, I think this is fine as a first step, with the two minor points (using the UIJob-factory and the empty string) fixed I would be fine to submit this. |
694a2e4
to
f50e586
Compare
The value should be passed to the dialog and then it could handle it internally, but users of that Interface must not care nor do we need to store such values in general... |
f50e586
to
6c443cc
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 good to me.
Does anybody else plan to review this?
@fedejeanne you need to bump the Micro version segment in in the Manifest order to fix the build failure:
[ERROR] Failed to execute goal org.eclipse.tycho.extras:tycho-p2-extras-plugin:4.0.2:compare-version-with-baselines (compare-attached-artifacts-with-release) on project org.eclipse.debug.ui: Only qualifier changed for (org.eclipse.debug.ui/3.18.100.v20230913-0532). Expected to have bigger x.y.z than what is available in baseline (3.18.100.v20230802-1257) -> [Help 1]
I think we have a missunderstanding here. The amount of work done is interesting do help deside if after the Initial delay it is worth for the remaining time to show the Pop-up. Making the initial delay configurable is an orthogonal issue. |
6c443cc
to
d2a2ce2
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.
Changes look good to me. I only have a minor remark w.r.t. to a code comment.
...bug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsDialog.java
Outdated
Show resolved
Hide resolved
Wait a while before showing the progress indicator in the dialog "Run configurations...". This avoids the flickering that happens when the task is completed in under 800 ms (which is the current norm in PlatformUI.getWorkbench().getProgressService().getLongOperationTime()) Contributes to eclipse-pde/eclipse.pde#679
* org.eclipse.debug.ui --> 3.18.200
d2a2ce2
to
c0b72e9
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.
Thank you @fedejeanne for this PR and your patience.
On the last pass I thought about if fActiveRunningOperations
should be turned into a AtomicLong
, but since the code is running in the UI thread in both cases (just later) that's fine.
Submitting.
I'll have a look at the PDE pendant in the next days.
Thank you for reviewing!
Looking forward to it :-) |
Just to make sure was this meant to be 13.09.2023? The setup still fails for me and I can't use the baseline... |
It seems that Oomph was confused by the pre-req-target project imported as a project in my workspace somehow :- |
Yes, there was a problem caused by the two occurrences and the "wrong" one winning. That should no longer happen because of the filter in the .project file. |
Alright it seems I was now able to get the API error (hurray!): |
Wait 1 second before showing the progress indicator in the dialog "Run configurations...". This avoids the flickering that happens when the task is completed in under 1 second.
Contributes to eclipse-pde/eclipse.pde#679