1 package org.simantics.db.procore.ui;
\r
3 import org.eclipse.swt.widgets.Display;
\r
4 import org.eclipse.swt.widgets.Shell;
\r
5 import org.simantics.db.DatabaseUserAgent;
\r
6 import org.simantics.db.exception.InternalException;
\r
7 import org.simantics.db.procore.ProCoreDriver;
\r
9 public final class ProCoreUserAgent implements DatabaseUserAgent {
\r
10 private static Shell getShell() {
\r
12 Display d = getDisplay();
\r
15 shell = d.getActiveShell();
\r
16 if (null == shell) {
\r
17 Shell[] shells = d.getShells();
\r
18 if (null != shells && shells.length > 0)
\r
23 private static Display getDisplay() {
\r
24 Display d = Display.getCurrent();
\r
26 d = Display.getDefault();
\r
30 public boolean handleStart(InternalException exception) {
\r
31 Shell shell = getShell();
\r
33 return false; // no can do
\r
35 return Auxiliary.handleStart(shell, exception);
\r
36 } catch (InternalException e) {
\r
37 return false; // no could do
\r
42 public String getId() {
\r
43 return ProCoreDriver.ProCoreDriverName;
\r