Author: rob.stryker(a)jboss.com
Date: 2007-09-26 23:03:22 -0400 (Wed, 26 Sep 2007)
New Revision: 3841
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/server/ExtensionTableViewer.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/server/providers/ModuleViewProvider.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/server/providers/jmx/JMXViewProvider.java
Log:
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/server/ExtensionTableViewer.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/server/ExtensionTableViewer.java 2007-09-27
03:03:19 UTC (rev 3840)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/server/ExtensionTableViewer.java 2007-09-27
03:03:22 UTC (rev 3841)
@@ -28,6 +28,8 @@
import org.eclipse.wst.server.core.IServerLifecycleListener;
import org.eclipse.wst.server.core.ServerCore;
import org.eclipse.wst.server.ui.ServerUICore;
+import org.jboss.ide.eclipse.as.core.server.UnitedServerListener;
+import org.jboss.ide.eclipse.as.core.server.UnitedServerListenerManager;
import org.jboss.ide.eclipse.as.core.server.internal.JBossServer;
import org.jboss.ide.eclipse.as.ui.JBossServerUIPlugin;
import org.jboss.ide.eclipse.as.ui.Messages;
@@ -47,14 +49,8 @@
setLabelProvider(new LabelProviderDelegator());
propertySheet = new TableViewerPropertySheet();
createActions();
- ServerCore.addServerLifecycleListener(new IServerLifecycleListener() {
-
- public void serverAdded(IServer server) {
- }
-
- public void serverChanged(IServer server) {
- }
-
+
+ UnitedServerListenerManager.getDefault().addListener(new UnitedServerListener() {
public void serverRemoved(IServer server) {
final IServer server2 = server;
Display.getDefault().asyncExec(new Runnable() {
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/server/providers/ModuleViewProvider.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/server/providers/ModuleViewProvider.java 2007-09-27
03:03:19 UTC (rev 3840)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/server/providers/ModuleViewProvider.java 2007-09-27
03:03:22 UTC (rev 3841)
@@ -42,14 +42,14 @@
import org.eclipse.wst.server.core.IServerLifecycleListener;
import org.eclipse.wst.server.core.IServerListener;
import org.eclipse.wst.server.core.IServerWorkingCopy;
-import org.eclipse.wst.server.core.ServerCore;
import org.eclipse.wst.server.core.ServerEvent;
import org.eclipse.wst.server.core.ServerUtil;
import org.eclipse.wst.server.core.internal.PublishServerJob;
import org.eclipse.wst.server.core.model.ServerBehaviourDelegate;
import org.eclipse.wst.server.ui.ServerUICore;
import org.eclipse.wst.server.ui.internal.view.servers.ModuleServer;
-import org.jboss.ide.eclipse.as.core.server.internal.JBossServer;
+import org.jboss.ide.eclipse.as.core.server.UnitedServerListener;
+import org.jboss.ide.eclipse.as.core.server.UnitedServerListenerManager;
import org.jboss.ide.eclipse.as.core.util.ServerConverter;
import org.jboss.ide.eclipse.as.ui.JBossServerUISharedImages;
import org.jboss.ide.eclipse.as.ui.Messages;
@@ -275,21 +275,7 @@
}
private void addListeners() {
- serverResourceListener = new IServerLifecycleListener() {
- public void serverAdded(IServer server) {
- if( ServerConverter.getJBossServer(server) != null )
- server.addServerListener(serverListener);
- }
- public void serverChanged(IServer server) {
- }
- public void serverRemoved(IServer server) {
- if( ServerConverter.getJBossServer(server) != null )
- server.removeServerListener(serverListener);
- }
- };
- ServerCore.addServerLifecycleListener(serverResourceListener);
-
- serverListener = new IServerListener() {
+ UnitedServerListenerManager.getDefault().addListener(new UnitedServerListener() {
public void serverChanged(ServerEvent event) {
int eventKind = event.getKind();
if ((eventKind & ServerEvent.MODULE_CHANGE) != 0) {
@@ -298,15 +284,7 @@
refreshViewer();
}
}
- }
- };
- // add listeners to servers
- JBossServer[] servers = ServerConverter.getAllJBossServers();
- if (servers != null) {
- int size = servers.length;
- for (int i = 0; i < size; i++) {
- servers[i].getServer().addServerListener(serverListener);
- }
- }
+ }
+ });
}
}
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/server/providers/jmx/JMXViewProvider.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/server/providers/jmx/JMXViewProvider.java 2007-09-27
03:03:19 UTC (rev 3840)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/server/providers/jmx/JMXViewProvider.java 2007-09-27
03:03:22 UTC (rev 3841)
@@ -9,17 +9,15 @@
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Group;
-import org.eclipse.ui.ISelectionListener;
import org.eclipse.ui.views.properties.IPropertySheetPage;
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.jboss.ide.eclipse.as.core.extensions.jmx.JMXClassLoaderRepository;
import org.jboss.ide.eclipse.as.core.extensions.jmx.JMXModel;
import org.jboss.ide.eclipse.as.core.extensions.jmx.JMXModel.JMXBean;
import org.jboss.ide.eclipse.as.core.extensions.jmx.JMXModel.JMXDomain;
+import org.jboss.ide.eclipse.as.core.server.UnitedServerListener;
+import org.jboss.ide.eclipse.as.core.server.UnitedServerListenerManager;
import org.jboss.ide.eclipse.as.ui.views.server.JBossServerView;
import org.jboss.ide.eclipse.as.ui.views.server.ExtensionTableViewer.ContentWrapper;
import org.jboss.ide.eclipse.as.ui.views.server.extensions.JBossServerViewExtension;
@@ -34,7 +32,6 @@
public static final Object CLASSLOADING_TOKEN = new Object();
protected JMXPropertySheetPage propertyPage;
- protected JMXServerLifecycleListener lcListener;
protected JMXServerListener serverListener;
protected ISelectionChangedListener jbossServerViewSelectionListener;
protected JMXTreeContentProvider contentProvider;
@@ -78,45 +75,25 @@
// make sure we know about server events
serverListener = new JMXServerListener();
- lcListener = new JMXServerLifecycleListener();
- ServerCore.addServerLifecycleListener(lcListener);
- IServer[] servers = ServerCore.getServers();
- for (int i = 0; i < servers.length; i++) {
- servers[i].addServerListener(serverListener);
- if( servers[i].getServerState() == IServer.STATE_STARTED )
- JMXClassLoaderRepository.getDefault().addConcerned(
- servers[i], CLASSLOADING_TOKEN);
- }
+ UnitedServerListenerManager.getDefault().addListener(serverListener);
}
protected void removeListeners() {
- ServerCore.removeServerLifecycleListener(lcListener);
- IServer[] servers = ServerCore.getServers();
- for (int i = 0; i < servers.length; i++) {
- servers[i].removeServerListener(serverListener);
- JMXClassLoaderRepository.getDefault().removeConcerned(
- servers[i], CLASSLOADING_TOKEN);
- }
+ UnitedServerListenerManager.getDefault().removeListener(serverListener);
JBossServerView.removeExtensionFrameListener(jbossServerViewSelectionListener);
}
- protected class JMXServerLifecycleListener implements
- IServerLifecycleListener {
- public void serverAdded(IServer server) {
- server.addServerListener(serverListener);
+ protected class JMXServerListener extends UnitedServerListener {
+ public void init(IServer server) {
+ if( server.getServerState() == IServer.STATE_STARTED )
+ JMXClassLoaderRepository.getDefault().addConcerned(
+ server, CLASSLOADING_TOKEN);
+
}
-
- public void serverChanged(IServer server) {
- }
-
public void serverRemoved(IServer server) {
- server.removeServerListener(serverListener);
JMXClassLoaderRepository.getDefault()
.removeConcerned(server, JMXModel.getDefault());
}
- }
-
- protected class JMXServerListener implements IServerListener {
public void serverChanged(ServerEvent event) {
if ((event.getKind() & ServerEvent.SERVER_CHANGE) != 0) {
if ((event.getKind() & ServerEvent.STATE_CHANGE) != 0) {
@@ -130,6 +107,10 @@
}
}
}
+ public void cleanUp(IServer server) {
+ JMXClassLoaderRepository.getDefault().removeConcerned(
+ server, CLASSLOADING_TOKEN);
+ }
}
public IPropertySheetPage getPropertySheetPage() {
Show replies by date