Hi Luke,

 

I'm doing something similar right now:

 

For the class that will trigger the long computation:

gtInspectorPreviewIn: composite

                <gtInspectorPresentationOrder: -10>

                ^ composite fastTable

                                title: 'Matches';

                                display: [ self patterns ];

                                enableElementIndex;

                                column: 'Index' evaluated: [ :val :i | i asString  ] width: 40;

                                column: 'Item' evaluated: [ :val | GTObjectPrinter asTruncatedTextFrom: val ast];

                                send: [:res | res findMatchesWith: matcher. res ].

 

And then in that findMatchesWith: method, the code that performs the long computation displays a progress bar like this:

 

                'Searching in programs'

                                displayProgressFrom: 1 to: programs size

                                during: [:bar |   

                                                                1 to: programs size do: [ :i | | prog |

                                                                                bar current: i.

                                                                                prog := programs at: i.

                                                                                result at: prog key put: (self findMatchesOf: aRCPatternMatch ast in: prog value)]].

 

HTH

 

--

Johan Fabry,  Senior Software Engineer. 

johan@raincode.com | Email too brief? Here's whyhttp://emailcharter.org

 

From: Moose-dev [mailto:moose-dev-bounces@list.inf.unibe.ch] On Behalf Of Luke Gorrie
Sent: Tuesday, March 27, 2018 1:48 PM
To: Moose-related development <moose-dev@list.inf.unibe.ch>
Subject: [Moose-dev] Re: Error dialog?

 

Related question:

 

Is there a simple way to show a progress meter while I am running actions in the inspector? Perhaps with a 'Cancel' button if the user becomes impatient?

 

Some of my inspections can take a long time, either to read a file or to render a visualization, and it would be great to keep users in the loop a bit.

 

 

 

On 26 March 2018 at 12:29, Luke Gorrie <luke@snabb.co> wrote:

Hoi!

 

Suppose that my GTInspector extension method fails for some interesting reason. How should I present an error message to the user?

 

I'm am especially thinking of cases where I am spawning a Unix command behind the scenes and I want to show the (possibly long) output of the command to the user. Could happen either in an inspector extension method or also in a "Go" action of the inspector.

 

Tips would be much appreciated :).