Eclipse Job disable cancel button - eclipse

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);

Related

Issue with setting AutomationElement value

I have an issue with setting value of AutomationElement by using method ValuePattern.SetValue().
Everything works just fine until some dialog appears. When the dialog appears the code execution got stuck. No exception is thrown. After the dialog is confirmed, the code exection continues. Bellow is a sample of the code:
BasePattern basePattern = null;
ValuePattern valuePattern = null;
AutomationElement elementA = Window.GetElement(SearchCriteria.ByText(propertyName));
object patternObjectA = null;
elementA.TryGetCurrentPattern(ValuePattern.Pattern, out patternObjectA);
basePattern = (BasePattern)patternObjectA;
valuePattern = (ValuePattern)patternObjectA;
valuePattern.SetValue(optionToSet);
// Window.GetElement() is a method from TestStack.White framework
// The code execution got stuck on the last line until the dialog is confirmed
Is there any other way to set AutomationElement value?
Is somehow possible to avoid of getting stuck by dialog?
I'll by grateful for any help.
Thanks advance.
It could be that this dialog is not supporting UI Automation correctly or that you simply target the wrong element.
To verify that you may use Inspect.exe from Microsoft or similiar tools.
If it works, check if you really target the correct component with your code again.
If it does not work and:
if you are able to change the application
you can change the so called AutomationPeer of the UI component - here is a link for more infos
Or simply use another UI component that supports UI Automation correctly.
if you are not able to change the application, and also do not need to run in background, parallel, etc.. you might just focus the component (call setFocus() onto the AutomationElement, or expand it (via IsExpandCollapsePatternAvailable or simulated MouseClick onto the components coordinates)) and then use the SendKeys.SendWait("test") method.
EDIT: There is one more thing you should have a look at, and I wonder why I didn't mentioned it in the first place: Register to UI Automation Events
For example you could register a callback for the Structure change event type, and check if the dialog you talk about appeared.
If so --> click the confirmed button of the dialog.
Probably you will have to synchronize your execution, so that every further action in the UI Automation script waits until the registered callback got executed and the confirmed button got clicked.

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

display progress doesn't work install4j

I want the change Display Progress highlighted steps when proceeding to next actions within the same screen.
I tried the following java scripts to run after each action:
context.goForward(1, true, true);
or
context.getWizardContext().setWizardIndexKey("2");
But the steps wouldn't change. They change only when next screen is displayed.
Up to install4j 7.0.3, wizard steps can only change when the screen changes.
Thanks to your feedback, it will be possible in install4j 7.0.4 to call WizardContext#setWizardIndexKey and WizardContext#setWizardIndex in actions or form component event handlers with the intended effect.

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

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

Dynamically Change HTA Window Properties

In my HTA, I hold it it open if an error occurred, and close it if everything was successful. At the start, I have the sysmenu property set to no because I do not want the user to close the HTA until it's finished. At the end, I want them to be able to click on the close button. Here's what I typed up to try to achieve this, but it doesn't seem to work? I suspect there is something I need to do to get the HTA to refresh it's windows properties?
Please note that any solution that completely reloads the window and/or makes the script execute again is not acceptable
If Not bHoldOpen Then
Call window.close
Else
Dim tagHTA
Set tagHTA = document.getElementsByTagName("hta:application").item(0)
Call tagHTA.setAttribute("sysmenu","yes")
End If
You cannot change it at runtime, its only available in the HTA: block as its value is used to determine how the physical window is to be initially created.
I thought you could produce a warning using the onBeforeUnload event & call cancelBubble to abort the close, but I tried it in IE8 and it still seems bugged; http://support.microsoft.com/kb/946214.
It would probably be simpler and easier for the user to comprehend if you were yo just unhide a "Close" button when the process completed.