Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.pnfsoftware.jeb.rcpclient.extensions.p002ui;
- /* loaded from: jeb.apk:com/pnfsoftware/rcpclient/extensions/ui/TaskMonitorDialog.class */
- public class TaskMonitorDialog extends com.pnfsoftware.jeb.rcpclient.dialogs.JebDialog {
- private static final com.pnfsoftware.jeb.util.logging.ILogger logger = com.pnfsoftware.jeb.util.logging.GlobalLog.getLogger(com.pnfsoftware.jeb.rcpclient.extensions.p002ui.TaskMonitorDialog.class);
- private java.lang.String[] labels;
- private org.eclipse.swt.widgets.Label[] wLabels;
- /* renamed from: t */
- private java.lang.Thread f4144t;
- /* renamed from: ex */
- private java.lang.Exception f4145ex;
- private long popupTimeout;
- private volatile boolean canceled;
- com.pnfsoftware.jeb.rcpclient.extensions.p002ui.ITaskProgressMonitor monitor;
- public TaskMonitorDialog(org.eclipse.swt.widgets.Shell parent) {
- this(parent, 0L);
- }
- public TaskMonitorDialog(org.eclipse.swt.widgets.Shell parent, long popupTimeout) {
- super(parent, 67616, "Task", (java.lang.String) null);
- this.labels = new java.lang.String[]{"Please wait...", "", "", ""};
- this.wLabels = new org.eclipse.swt.widgets.Label[this.labels.length];
- this.monitor = new com.pnfsoftware.jeb.rcpclient.extensions.p002ui.TaskMonitorDialog$Monitor(this);
- this.doNotCloseOnEscape = true;
- this.boundsRestorationType = com.pnfsoftware.jeb.rcpclient.extensions.ShellWrapper$BoundsRestorationType.NONE;
- this.doNotOpenShell = true;
- this.doNotDispatchEvents = true;
- this.popupTimeout = popupTimeout;
- }
- @Override // com.pnfsoftware.jeb.rcpclient.dialogs.JebDialog
- protected void createContents(org.eclipse.swt.widgets.Composite parent) {
- com.pnfsoftware.jeb.rcpclient.extensions.UIUtil.setStandardLayout(parent, 1);
- org.eclipse.swt.widgets.Composite c = new org.eclipse.swt.widgets.Composite(parent, 0);
- org.eclipse.swt.layout.GridData data = new org.eclipse.swt.layout.GridData();
- data.grabExcessHorizontalSpace = true;
- data.minimumWidth = 680;
- data.grabExcessVerticalSpace = true;
- data.minimumHeight = 140;
- c.setLayoutData(data);
- com.pnfsoftware.jeb.rcpclient.extensions.UIUtil.setStandardLayout(c, 1);
- for (int i = 0; i < this.wLabels.length; i++) {
- this.wLabels[i] = new org.eclipse.swt.widgets.Label(c, 0);
- this.wLabels[i].setText(com.pnfsoftware.jeb.util.format.Strings.safe(this.labels[i]));
- this.wLabels[i].setLayoutData(com.pnfsoftware.jeb.rcpclient.extensions.UIUtil.createGridDataFillHorizontally());
- }
- createButtons(parent, 256, 256);
- }
- /* JADX INFO: Access modifiers changed from: protected */
- @Override // com.pnfsoftware.jeb.rcpclient.dialogs.JebDialog
- public void onButtonClick(int style) {
- if (style == 256) {
- this.monitor.setCanceled(true);
- getButtonByStyle(256).setEnabled(false);
- } else {
- super.onButtonClick(style);
- }
- }
- public void run(com.pnfsoftware.jeb.rcpclient.extensions.p002ui.UITask<?> task) throws java.lang.reflect.InvocationTargetException, java.lang.InterruptedException {
- if (org.eclipse.swt.widgets.Display.getCurrent() == null) {
- throw new java.lang.RuntimeException("TaskMonitorDialog.run() must be called from the UI thread");
- }
- this.f4144t = com.pnfsoftware.jeb.util.concurrent.ThreadUtil.start(new com.pnfsoftware.jeb.rcpclient.extensions.p002ui.TaskMonitorDialog$1(this, task));
- super.open();
- long t0 = java.lang.System.currentTimeMillis();
- org.eclipse.swt.graphics.Rectangle bounds0 = this.shell.getBounds();
- this.shell.setBounds(0, -50, 1, 1);
- boolean hiddenShell = true;
- this.shell.open();
- org.eclipse.swt.widgets.Display display = this.shell.getDisplay();
- while (true) {
- if (this.shell.isDisposed()) {
- break;
- }
- if (!display.readAndDispatch()) {
- this.f4144t.join(20L);
- if (this.monitor.isCanceled()) {
- this.f4144t.interrupt();
- }
- if (!this.f4144t.isAlive()) {
- this.shell.close();
- break;
- }
- if (hiddenShell && java.lang.System.currentTimeMillis() - t0 >= this.popupTimeout) {
- org.eclipse.swt.graphics.Rectangle displaybounds = this.shell.getDisplay().getClientArea();
- int offx = 0;
- int offy = 0;
- org.eclipse.swt.widgets.Composite parent = this.shell.getParent();
- if (parent != null) {
- org.eclipse.swt.graphics.Rectangle r = parent.getBounds();
- offx = (r.x + (r.width / 2)) - (displaybounds.x + (displaybounds.width / 2));
- offy = (r.y + (r.height / 2)) - (displaybounds.y + (displaybounds.height / 2));
- }
- this.shell.setBounds(displaybounds.x + ((displaybounds.width - bounds0.width) / 2) + offx, displaybounds.y + ((displaybounds.height - bounds0.height) / 2) + offy, bounds0.width, bounds0.height);
- hiddenShell = false;
- }
- }
- }
- if (this.f4145ex instanceof java.lang.reflect.InvocationTargetException) {
- throw ((java.lang.reflect.InvocationTargetException) this.f4145ex);
- }
- if (this.f4145ex instanceof java.lang.InterruptedException) {
- throw ((java.lang.InterruptedException) this.f4145ex);
- }
- if (this.f4145ex != null) {
- com.pnfsoftware.jeb.util.base.Throwables.rethrowUnchecked(this.f4145ex);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement