X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.db.procore.ui%2Fsrc%2Forg%2Fsimantics%2Fdb%2Fprocore%2Fui%2FProCoreUserAgent.java;fp=bundles%2Forg.simantics.db.procore.ui%2Fsrc%2Forg%2Fsimantics%2Fdb%2Fprocore%2Fui%2FProCoreUserAgent.java;h=acce69ad72c73fac24c0d5e4f4d31037fbc6d4ba;hp=9b0438042adf439991a5ffb939a2458563cedb12;hb=0ae2b770234dfc3cbb18bd38f324125cf0faca07;hpb=24e2b34260f219f0d1644ca7a138894980e25b14 diff --git a/bundles/org.simantics.db.procore.ui/src/org/simantics/db/procore/ui/ProCoreUserAgent.java b/bundles/org.simantics.db.procore.ui/src/org/simantics/db/procore/ui/ProCoreUserAgent.java index 9b0438042..acce69ad7 100644 --- a/bundles/org.simantics.db.procore.ui/src/org/simantics/db/procore/ui/ProCoreUserAgent.java +++ b/bundles/org.simantics.db.procore.ui/src/org/simantics/db/procore/ui/ProCoreUserAgent.java @@ -1,45 +1,45 @@ -package org.simantics.db.procore.ui; - -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Shell; -import org.simantics.db.DatabaseUserAgent; -import org.simantics.db.exception.InternalException; -import org.simantics.db.procore.ProCoreDriver; - -public final class ProCoreUserAgent implements DatabaseUserAgent { - private static Shell getShell() { - Shell shell = null; - Display d = getDisplay(); - if (d == null) - return null; - shell = d.getActiveShell(); - if (null == shell) { - Shell[] shells = d.getShells(); - if (null != shells && shells.length > 0) - shell = shells[0]; - } - return shell; - } - private static Display getDisplay() { - Display d = Display.getCurrent(); - if (d == null) - d = Display.getDefault(); - return d; - } - @Override - public boolean handleStart(InternalException exception) { - Shell shell = getShell(); - if (null == shell) - return false; // no can do - try { - return Auxiliary.handleStart(shell, exception); - } catch (InternalException e) { - return false; // no could do - } - } - - @Override - public String getId() { - return ProCoreDriver.ProCoreDriverName; - } -} +package org.simantics.db.procore.ui; + +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Shell; +import org.simantics.db.DatabaseUserAgent; +import org.simantics.db.exception.InternalException; +import org.simantics.db.procore.ProCoreDriver; + +public final class ProCoreUserAgent implements DatabaseUserAgent { + private static Shell getShell() { + Shell shell = null; + Display d = getDisplay(); + if (d == null) + return null; + shell = d.getActiveShell(); + if (null == shell) { + Shell[] shells = d.getShells(); + if (null != shells && shells.length > 0) + shell = shells[0]; + } + return shell; + } + private static Display getDisplay() { + Display d = Display.getCurrent(); + if (d == null) + d = Display.getDefault(); + return d; + } + @Override + public boolean handleStart(InternalException exception) { + Shell shell = getShell(); + if (null == shell) + return false; // no can do + try { + return Auxiliary.handleStart(shell, exception); + } catch (InternalException e) { + return false; // no could do + } + } + + @Override + public String getId() { + return ProCoreDriver.ProCoreDriverName; + } +}