Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 462950 - Newly opened Console does not scroll
Summary: Newly opened Console does not scroll
Status: CLOSED WORKSFORME
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Debug (show other bugs)
Version: 4.5   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Sarika Sinha CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-03-24 08:30 EDT by Dani Megert CLA
Modified: 2017-09-14 02:57 EDT (History)
2 users (show)

See Also:


Attachments
No auto scroll lock for terminated process (3.86 KB, patch)
2015-04-02 07:32 EDT, Sarika Sinha CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dani Megert CLA 2015-03-24 08:30:41 EDT
3.8.

1. start a new workspace
2. paste this into the Package Explorer:
---%<---
	public static void main(String[] args) {
		int count= 100;
		for (int i = 0; i < count; i++) {
			System.out.println(i);
		}
	}
---%<---
3. launch it
==> Console view opens and shows output but does not scroll.

It scrolls for all future launches. If the Console view gets closed, the problem surfaces again.
Comment 1 Dani Megert CLA 2015-03-24 11:02:21 EDT
Using a delay in org.eclipse.ui.internal.console.ConsoleManager.showConsoleView(IConsole)
seems wrong to me. Replacing #schedule(long) with #schedule() fixes the problem.

Sarika, please verify the proposed fix. Also check whether there was a special reason to use the delay.
Comment 2 Sarika Sinha CLA 2015-03-25 04:15:25 EDT
The delay was added as a fix to Bug 130431
Comment 3 Dani Megert CLA 2015-03-27 09:53:57 EDT
(In reply to Sarika Sinha from comment #2)
> The delay was added as a fix to Bug 130431

OK, it looks like #showConsoleView is called many times, not just when necessary to show it.

Sarika, we should try to treat the case where the console isn't visible/active yet from the other case.
Comment 4 Sarika Sinha CLA 2015-04-02 01:02:00 EDT
I tried breaking showConsoleView method in two parts where consoleFound can be done first and if required we can do the update on console with a delay if required.

To find if console is there or not we use 
IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();

This works only in a UI thread otherwise it returns null. The getActiveWorkbenchWindow method is specially made to behave like that.

And breaking this into two separate threads does not appeal as it can be source of other threading issues.
Comment 5 Dani Megert CLA 2015-04-02 03:21:06 EDT
(In reply to Sarika Sinha from comment #4)
> I tried breaking showConsoleView method in two parts where consoleFound can
> be done first and if required we can do the update on console with a delay
> if required.
> 
> To find if console is there or not we use 
> IWorkbenchWindow window =
> PlatformUI.getWorkbench().getActiveWorkbenchWindow();
> 
> This works only in a UI thread otherwise it returns null. The
> getActiveWorkbenchWindow method is specially made to behave like that.

You could try to find another way to know whether a Console is already open, e.g. remember sate in the console manager.


> And breaking this into two separate threads does not appeal as it can be
> source of other threading issues.

I agree.


I'm also fine deferring that bug if we can't find a simple solution.
Comment 6 Sarika Sinha CLA 2015-04-02 07:32:44 EDT
Created attachment 252129 [details]
No auto scroll lock for terminated process

Added a Check for terminated Console to disable Auto scroll lock feature
Comment 7 Dani Megert CLA 2015-04-07 11:40:11 EDT
(In reply to Sarika Sinha from comment #6)
> Created attachment 252129 [details] [diff]
> No auto scroll lock for terminated process
> 
> Added a Check for terminated Console to disable Auto scroll lock feature

I assume this patch is for bug 459494.
Comment 8 Sarika Sinha CLA 2015-04-09 04:04:30 EDT
Deferring it for now!!
Comment 9 Andrey Loskutov CLA 2017-09-14 02:57:29 EDT
I can't reproduce it anymore with 4.6.3 and 4.8 head. Could be a side effect of the fix for bug 484329.