how do disable job cancel button for each progress entry in Progress View in eclipse rcp application? - eclipse

could someone please tell me how to disable cancel button in a job's progress entry in Progress View tab in eclipse rcp application. i have not been able to locate any references on the web aside from the ones that suggest the use of ProgressMonitorDialog. using the dialog, however, is not an option, as the Progress View must remain in a form of a view.
i have come upon ProgressMonitorPart, which sounds like something that i can use. if that is the case, how do i go about passing it to Job.run(IProgressMonitor)?
thank you for your time!

You don't. You can call Job#setSystem() on your Job so it's hinted as not to be shown, but you don't get to spin off jobs that the user can't at least ask you to cancel. The stop button does little more than set the progress monitor as having been canceled--it's still up to your running Job to check the progress monitor and behave itself. Or not.
http://help.eclipse.org/mars/index.jsp?topic=%2Forg.eclipse.platform.doc.isv%2Fguide%2Fruntime_jobs_progress.htm

Related

How to close System dialogs that appears on app crash?

I'm using xcuitest framework to automate mac application. I get system dialogs when the app is opened again after it crashes. I want to handle the dialog programmatically. But the dialog appears under the process `UserNotificationCenter' instead of the application under test. How can I handle the alert in such case?
You have two options:
Use InterruptionMonitor (documentation, use-case). This
approach is however kinda old and I found, that it does not work for
all dialogs and situations.
Create a method, which will wait for some regular app's button. If the app's button (or tab bar or other such XCUIElement) is visible and hittable after your app started, you can proceed with your test and if it's not, you can wait for the UserNotificationCenter dialog's button and identify&tap it by its string/position.
I'm using the second approach and its working much better, than the InterruptionMonitor. But it really depends on your app layout and use-case.
You should be able to revent it from appearing in the first place. Something like:
defaults write com.apple.CrashReporter DialogType none

what is the difference between ActivityStack and TaskRecord

I'm studying with AOSP, and I found ActivityStack and TaskRecord in "ActivityStack" Class. There is explanation In https://developer.android.com/guide/components/tasks-and-back-stack , Back-stack(=Activity Stack) And Task seems similar to me... What is the the difference between ActivityStack and TaskRecord?
In this https://developer.android.com/guide/components/tasks-and-back-stack,
Focus on below lines, For Task
A task is a cohesive unit that can move to the "background" when users begin a new task or go to the Home screen, via the Home button. While in the background, all the activities in the task are stopped.
For back stack
The back stack for the task remains intact—the task has simply lost focus while another task takes place. A task can then return to the "foreground" so users can pick up where they left off.
For info you can refer below links:-
What is the relationship between Task and Back stack
https://blog.mindorks.com/android-task-and-back-stack-review-5017f2c18196
https://medium.com/google-developers/tasks-and-the-back-stack-dbb7c3b0f6d4
If you think of activity back stack as two levels, it might be easier to understand the purpose of ActivityStack. Android supports launchMode and taskAffinity to put activities into different TaskRecords. But even activities are put into different TaskRecords, it keeps supporting the back button to switch back to previous activity. So when you launch activity that needs to be in new TaskRecord, then back button is pressed, it switches to top activity of previous TaskRecord. So ActivityStack is more like a TaskRecord stack, and TaskRecord is more like the activity stack inside the TaskRecord, however, general speaking, ActivityStack controls the pop up sequence, and you can say it's an indirect activity stack.
And creating ActivityStack seems to make management easier logically in multiple window environment. If you enable free form in Android, each launched window mode app has its own free form stack, and each stack has its own back stack.
My 2c.

Is it possible to write a custom TouchBar app for an existing application?

I have tried looking for an answer to this but can't seem to see anything about it.
I have a piece of software on my laptop (not written by me), that I want to customise. Some of the tasks I do are very repetitive, and could be simplified by just pressing a button on the Touch Bar that executes a number of commands.
Is it possible to write a Touch Bar app that either:
1) Customises the application's original TouchBar app (for which there is none)
2) Runs only when that application is running, and hides when the application is out of focus
Thanks
I believe BetterTouchTool can do that.
Also in the "App Specific" button you can customise when to hide system touch bar and when to show it again

Eclipse Job disable cancel button

Is it possible to disable the "Cancel" button in the progress dialog
displayed when a job is running?
I still want to maintain the functionality to show to user about progress in the job to the background. Letting the job run or
canceling it has no effect on the GUI, as it starts a task on a remote
server, which does not support cancellation/stopping the task, once started.
I cannot use setSystem(true) since I want to show the progress to the user.
There is bug reported even in Eclipse Bugzilla but there isnt any update
https://bugs.eclipse.org/bugs/show_bug.cgi?id=155479
Trying to figure out if this issue is fixed or not.
If not how do we handle such scenario.
Any help appreciated.Thank you.
That bug is still open and has not been fixed.
I think the nearest you can get is to use ProgressMonitorDialog to run an IRunnableWithProgress class. You can set the cancelable state of ProgressMonitorDialog.
Something like:
ProgressMonitorDialog dialog = new ProgressMonitorDialog(shell);
dialog.setCancelable(false);
dialog.run(true, true, runnableWithProgress);

How do I implement "Cancel" button inside the method building data source in ModelController.m for Page View Controller

I have a Page View Controller that's implemented in 3 files. One of them, the ModelController.m implements "generateData" method, which basically just builds and formats all the pages for this Page View Controller. Inside this method, the first thing I do is I create a Progress Bar popup with "Cancel" button. Then, inside the while() loop, I keep building the pages and at the same time, every 10th page, I update the progress bar for the user to see that the application is still generating the output.
Once the "generateData" method completes, i.e. builds all the pages (and there may be over 1,000 or even 10,000 pages depending on user input), it returns "self" to a method inside RootViewController.m, which in turn passes that generated data in "dataObject" to "viewWillAppear" in DataViewController.m, which finally displays pages in that object to the user.
It all works great, except the "Cancel" button. Because "generateData" method runs on the main thread, it blocks and the "Cancel" button becomes totally unresponsive. By "blocks" I of course mean it takes all CPU cycles, not allowing anyting else to execute, and it may take over a minute to generate 10,000 pages so I really want to allow the user to cancel the operation.
I tried to create a separate thread for the Progress Bar popup which contains Cancel button, but that won't work because all UI operations need to be performed on the application's main thread.
What almost seems to work, is when I put the "generateData" method on a separate thread and keep the Progress Bar on the main thread. This would work just fine, except that now "generateData" is put on another thread to execute in the background and returns immediately, hence returning empty "self" or rather empty "dataObject", causing a crash because there is nothing in that object yet to display.
So how can I check if the "generateData" thread is done, and "return self" ONLY when it's done? I can't really have some BOOL true/false variable and do it in a loop, because that loop on the main thread would be again blocking the "Cancel" button.
Or, alternatively, what is the correct way to implement the "Cancel" button on a lengthy method in iOS? Maybe I'm doing it all wrong, but for the life of me I can't find the right recipe for this.
Thank you in advance for the help, the code is rather extensive and that's why I didn't include any, but I hope my description gives you a good idea of what's going on. I can provide code if that would help.
The correct way to do this is to load the data asynchronously (on a background thread) and update the main (UI) thread to update the progress bar, etc... But you probably don't need a progress bar since you can probably load those pages faster than a user can flip them, so load 100 and let the user play while you continue to load the next 99,900... Except those may not be the exact numbers you should use....
If you continue to use the progress view and cancel button, then you would cancel the background thread when the user presses "Cancel", which would respond since your data generation is on a background thread...
Look into either Grand Central Dispatch or NSInvocationOperations
Here's a good tutorial by Ray Wenderlich to get you started.