]> git.argeo.org Git - gpl/argeo-slc.git/blobdiff - org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/editors/ProcessEditor.java
Start SLC 2 refactoring.
[gpl/argeo-slc.git] / org.argeo.slc.client.ui / src / org / argeo / slc / client / ui / editors / ProcessEditor.java
index f70114fd08ab49def2f9d829887f28f0d8a8ec8e..e0ff7858950ac85fa3537639444dbfff9bad87fa 100644 (file)
@@ -29,14 +29,15 @@ import javax.jcr.Session;
 import org.argeo.eclipse.ui.dialogs.ErrorFeedback;
 import org.argeo.jcr.JcrUtils;
 import org.argeo.slc.SlcException;
+import org.argeo.slc.SlcNames;
+import org.argeo.slc.SlcTypes;
 import org.argeo.slc.client.ui.ClientUiPlugin;
 import org.argeo.slc.client.ui.controllers.ProcessController;
 import org.argeo.slc.execution.ExecutionModulesManager;
 import org.argeo.slc.execution.ExecutionProcess;
 import org.argeo.slc.jcr.SlcJcrUtils;
-import org.argeo.slc.jcr.SlcNames;
-import org.argeo.slc.jcr.SlcTypes;
 import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.rap.rwt.service.ServerPushSession;
 import org.eclipse.ui.IEditorInput;
 import org.eclipse.ui.IEditorSite;
 import org.eclipse.ui.IWorkbenchPage;
@@ -46,11 +47,15 @@ import org.eclipse.ui.forms.editor.FormEditor;
 
 /** Editor for an execution process. */
 public class ProcessEditor extends FormEditor implements SlcTypes, SlcNames {
+       private static final long serialVersionUID = 509589737739132467L;
+
        public final static String ID = ClientUiPlugin.ID + ".processEditor";
 
+       private Repository repository;
        private Session session;
        private Node processNode;
        private ProcessController processController;
+       private ServerPushSession pushSession;
 
        private ProcessBuilderPage builderPage;
 
@@ -60,6 +65,14 @@ public class ProcessEditor extends FormEditor implements SlcTypes, SlcNames {
        public void init(IEditorSite site, IEditorInput input)
                        throws PartInitException {
                super.init(site, input);
+               pushSession = new ServerPushSession();
+               pushSession.start();
+               try {
+                       session = repository.login();
+               } catch (RepositoryException e1) {
+                       throw new SlcException("Cannot log in to repository");
+               }
+
                ProcessEditorInput pei = (ProcessEditorInput) input;
                String processPath = pei.getProcessPath();
                try {
@@ -110,6 +123,8 @@ public class ProcessEditor extends FormEditor implements SlcTypes, SlcNames {
        @Override
        public void dispose() {
                JcrUtils.logoutQuietly(session);
+               if (pushSession != null)
+                       pushSession.stop();
                super.dispose();
        }
 
@@ -250,27 +265,8 @@ public class ProcessEditor extends FormEditor implements SlcTypes, SlcNames {
                return false;
        }
 
-       // public void updateStatus(ExecutionProcess process, String oldStatus,
-       // String newStatus) {
-       // }
-       //
-       // public void addSteps(ExecutionProcess process, List<ExecutionStep> steps)
-       // {
-       // }
-
-       /** Expects one session per editor. */
-       @Deprecated
-       public void setSession(Session session) {
-               this.session = session;
-       }
-
        public void setRepository(Repository repository) {
-               try {
-                       session = repository.login();
-               } catch (RepositoryException re) {
-                       throw new SlcException("Unable to log in Repository " + repository,
-                                       re);
-               }
+               this.repository = repository;
        }
 
        public void setProcessController(ProcessController processController) {