geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ga...@apache.org
Subject svn commit: r1151856 - in /geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core: Activator.java GeronimoServerBehaviourDelegate.java
Date Thu, 28 Jul 2011 14:11:12 GMT
Author: gawor
Date: Thu Jul 28 14:11:11 2011
New Revision: 1151856

URL: http://svn.apache.org/viewvc?rev=1151856&view=rev
Log:
simplify staring and stopping SynchronizeProjectOnServerTask

Modified:
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/Activator.java
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/GeronimoServerBehaviourDelegate.java

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/Activator.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/Activator.java?rev=1151856&r1=1151855&r2=1151856&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/Activator.java
(original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/Activator.java
Thu Jul 28 14:11:11 2011
@@ -22,9 +22,7 @@ import org.eclipse.core.runtime.Plugin;
 import org.eclipse.core.runtime.Status;
 import org.eclipse.wst.server.core.IServer;
 import org.eclipse.wst.server.core.IServerLifecycleListener;
-import org.eclipse.wst.server.core.IServerListener;
 import org.eclipse.wst.server.core.ServerCore;
-import org.eclipse.wst.server.core.ServerEvent;
 import org.osgi.framework.BundleContext;
 
 /**
@@ -109,7 +107,6 @@ public class Activator extends Plugin {
         ServerCore.addServerLifecycleListener(new IServerLifecycleListener() {
             public void serverAdded(IServer server) {
                 triggerStartUpdateServerTask(server);
-                triggerSynchronizeProjectOnServerTask(server);
             }
 
             public void serverChanged(IServer server) {
@@ -122,38 +119,8 @@ public class Activator extends Plugin {
         IServer[] servers = ServerCore.getServers();
         for(int i = 0; i < servers.length; i++) {
             triggerStartUpdateServerTask(servers[i]);
-            triggerSynchronizeProjectOnServerTask(servers[i]);
         }
     }
-
-    /**
-     * 
-     * @param server
-     */
-    protected void triggerSynchronizeProjectOnServerTask(IServer server) {
-      
-        IServerListener listener = new IServerListener() {
-            public void serverChanged(ServerEvent event) {
-                int eventKind = event.getKind();
-                if ((eventKind & ServerEvent.STATE_CHANGE) != 0) {
-                    int state = event.getServer().getServerState();
-                    if (state == IServer.STATE_STARTED) {
-                        GeronimoServerBehaviourDelegate delegate = getGeronimoServerBehaviourDelegate(event.getServer());
-                        if (delegate != null) {
-                            delegate.startSynchronizeProjectOnServerTask();
-                        }                        
-                    } else if (state == IServer.STATE_STOPPED) {
-                        GeronimoServerBehaviourDelegate delegate = getGeronimoServerBehaviourDelegate(event.getServer());
-                        if (delegate != null) {
-                            delegate.stopSynchronizeProjectOnServerTask();
-                        }                        
-                    }
-                }
-            }
-        }; 
-        
-        server.addServerListener(listener);
-    }
     
     final protected GeronimoServerBehaviourDelegate getGeronimoServerBehaviourDelegate (IServer
server) {
         GeronimoServerBehaviourDelegate delegate = (GeronimoServerBehaviourDelegate) server.getAdapter(GeronimoServerBehaviourDelegate.class);

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/GeronimoServerBehaviourDelegate.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/GeronimoServerBehaviourDelegate.java?rev=1151856&r1=1151855&r2=1151856&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/GeronimoServerBehaviourDelegate.java
(original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/GeronimoServerBehaviourDelegate.java
Thu Jul 28 14:11:11 2011
@@ -860,6 +860,7 @@ public class GeronimoServerBehaviourDele
 
     public void setServerStarted() {
         setServerState(IServer.STATE_STARTED);
+        startSynchronizeProjectOnServerTask();
     }
 
     public void setServerStopped() {
@@ -1319,8 +1320,10 @@ public class GeronimoServerBehaviourDele
     public void stopUpdateServerStateTask() {
         Trace.tracePoint("Entry", "GeronimoServerBehaviourDelegate.stopUpdateServerStateTask",
Activator.traceCore);
 
-        if (stateTimer != null)
+        if (stateTimer != null) {
             stateTimer.cancel();
+            stateTimer = null;
+        }
 
         Trace.tracePoint("Exit ", "GeronimoServerBehaviourDelegate.stopUpdateServerStateTask",
Activator.traceCore);
     }
@@ -1328,8 +1331,10 @@ public class GeronimoServerBehaviourDele
     public void stopSynchronizeProjectOnServerTask() {
         Trace.tracePoint("Entry", "GeronimoServerBehaviourDelegate.stopSynchronizeProjectOnServerTask",
Activator.traceCore);
         
-        if (synchronizerTimer != null)
-            synchronizerTimer.cancel(); 
+        if (synchronizerTimer != null) {
+            synchronizerTimer.cancel();
+            synchronizerTimer = null;
+        }
 
         Trace.tracePoint("Exit ", "GeronimoServerBehaviourDelegate.stopSynchronizeProjectOnServerTask",
Activator.traceCore);
     }



Mime
View raw message