create new branch webapp
[taxeditor.git] / eu.etaxonomy.taxeditor.webapp / src / main / java / eu / etaxonomy / taxeditor / webapp / handler / ReconnectHandlerE4.java
diff --git a/eu.etaxonomy.taxeditor.webapp/src/main/java/eu/etaxonomy/taxeditor/webapp/handler/ReconnectHandlerE4.java b/eu.etaxonomy.taxeditor.webapp/src/main/java/eu/etaxonomy/taxeditor/webapp/handler/ReconnectHandlerE4.java
new file mode 100755 (executable)
index 0000000..12b4e1d
--- /dev/null
@@ -0,0 +1,43 @@
+/**
+* Copyright (C) 2007 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+
+package eu.etaxonomy.taxeditor.webapp.handler;
+
+import javax.inject.Named;
+
+import org.eclipse.e4.core.di.annotations.Execute;
+import org.eclipse.e4.ui.services.IServiceConstants;
+import org.eclipse.e4.ui.workbench.modeling.ESelectionService;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Shell;
+
+import eu.etaxonomy.taxeditor.event.EventUtility;
+import eu.etaxonomy.taxeditor.event.WorkbenchEventConstants;
+import eu.etaxonomy.taxeditor.remoting.source.ICdmRemoteSource;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+import eu.etaxonomy.taxeditor.webapp.server.RemotingLoginDialogLocal;
+
+/**
+ * @author pplitzner
+ * @date 10.10.2017
+ */
+public class ReconnectHandlerE4 {
+
+    @Execute
+    public void execute(@Named(IServiceConstants.ACTIVE_SHELL)Shell shell, ESelectionService selService) {
+
+               RemotingLoginDialogLocal loginDialog = new RemotingLoginDialogLocal(shell,
+                       SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL);
+
+               loginDialog.open((ICdmRemoteSource) CdmStore.getActiveCdmSource(), true, true);
+               EventUtility.postEvent(WorkbenchEventConstants.RECONNECT, null);
+               selService.setSelection(new StructuredSelection());
+       }
+}