From 0509ec1b0f6953563704a20762d101081037018f Mon Sep 17 00:00:00 2001 From: Martin Oberhuber < martin.oberhuber@windriver.com> Date: Thu, 19 Mar 2009 23:37:51 +0000 Subject: [PATCH] [245154][api] add getSubSystemConfigurationProxiesBySystemType() --- .../rse/core/model/ISystemRegistry.java | 36 +++++++++++++++---- .../internal/core/model/SystemRegistry.java | 33 ++++++++++++----- 2 files changed, 54 insertions(+), 15 deletions(-) diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/ISystemRegistry.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/ISystemRegistry.java index 73994bb6a26..ae8996feae4 100644 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/ISystemRegistry.java +++ b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/ISystemRegistry.java @@ -31,6 +31,7 @@ * David Dykstal (IBM) - [235800] Document naming restriction for profiles and filter pools * David Dykstal (IBM) - [236516] Bug in user code causes failure in RSE initialization * Martin Oberhuber (Wind River) - [261486][api][cleanup] Mark @noimplement interfaces as @noextend + * Martin Oberhuber (Wind River) - [245154][api] add getSubSystemConfigurationProxiesBySystemType() ********************************************************************************/ package org.eclipse.rse.core.model; @@ -84,23 +85,44 @@ public interface ISystemRegistry extends ISchedulingRule, IAdaptable, ISystemVie // ---------------------------- /** - * Public method to retrieve list of subsystem factory proxies registered by extension points. + * Public method to retrieve list of subsystem configuration proxies + * registered by extension points. + * + * @return all subsystem configuration proxies. */ public ISubSystemConfigurationProxy[] getSubSystemConfigurationProxies(); /** - * Return all subsystem factory proxies matching a subsystem factory category. + * Return all subsystem configuration proxies matching a subsystem + * configuration category. + * + * @param configurationCategory a subsystem configuration category. + * @return all subsystem configuration proxies matching the given category, + * or an empty array if none matches. * @see ISubSystemConfigurationCategories */ - public ISubSystemConfigurationProxy[] getSubSystemConfigurationProxiesByCategory(String factoryCategory); + public ISubSystemConfigurationProxy[] getSubSystemConfigurationProxiesByCategory(String configurationCategory); + + /** + * Return all subsystem configuration proxies that are registered against + * the given system type. + * + * @param systemType system type to filter + * @return all subsystem configuration proxies matching the given system + * type, or an empty array if none matches. + * @since 3.1 + */ + public ISubSystemConfigurationProxy[] getSubSystemConfigurationProxiesBySystemType(IRSESystemType systemType); /** * Return all subsystem factories. * - * Be careful when you call this, as it activates all subsystem configurations. - * @deprecated use {@link #getSubSystemConfigurationProxies()} and filter the - * list of needed subsystem configurations in order to activate only those - * that are really needed. + * Be careful when you call this, as it activates all subsystem + * configurations. + * + * @deprecated use {@link #getSubSystemConfigurationProxies()} and filter + * the list of needed subsystem configurations in order to + * activate only those that are really needed. */ public ISubSystemConfiguration[] getSubSystemConfigurations(); diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/model/SystemRegistry.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/model/SystemRegistry.java index fa8fa79ee25..5b09d50d08c 100644 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/model/SystemRegistry.java +++ b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/model/SystemRegistry.java @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (c) 2006, 2008 IBM Corporation and others. All rights reserved. + * Copyright (c) 2006, 2009 IBM Corporation and others. All rights reserved. * This program and the accompanying materials are made available under the terms * of the Eclipse Public License v1.0 which accompanies this distribution, and is * available at http://www.eclipse.org/legal/epl-v10.html @@ -57,7 +57,8 @@ * David McKnight (IBM) - [240991] RSE startup creates display on worker thread before workbench. * David Dykstal (IBM) - [236516] Bug in user code causes failure in RSE initialization * David McKnight (IBM) - [249247] Expand New Connections - * David McKnight (IBM( - [254590] When disconnecting a subsystem with COLLAPSE option, subsystems of other connector services also get collapsed + * David McKnight (IBM) - [254590] When disconnecting a subsystem with COLLAPSE option, subsystems of other connector services also get collapsed + * Martin Oberhuber (Wind River) - [245154][api] add getSubSystemConfigurationProxiesBySystemType() ********************************************************************************/ package org.eclipse.rse.internal.core.model; @@ -301,6 +302,22 @@ public class SystemRegistry implements ISystemRegistry return proxies; } + /* + * (non-Javadoc) + * @see org.eclipse.rse.core.model.ISystemRegistry#getSubSystemConfigurationProxiesBySystemType(org.eclipse.rse.core.IRSESystemType) + */ + public ISubSystemConfigurationProxy[] getSubSystemConfigurationProxiesBySystemType(IRSESystemType systemType) + { + List l = new ArrayList(); + if (subsystemConfigurationProxies != null) + { + for (int idx = 0; idx < subsystemConfigurationProxies.length; idx++) + if (Arrays.asList(subsystemConfigurationProxies[idx].getSystemTypes()).contains(systemType)) + l.add(subsystemConfigurationProxies[idx]); + } + return (ISubSystemConfigurationProxy[]) l.toArray(new ISubSystemConfigurationProxy[l.size()]); + } + /** * Return the subsystem configuration, given its plugin.xml-declared id. */ @@ -1814,7 +1831,7 @@ public class SystemRegistry implements ISystemRegistry ISubSystem ss = subSystems[s]; fireModelChangeEvent(ISystemModelChangeEvents.SYSTEM_RESOURCE_ADDED, ISystemModelChangeEvents.SYSTEM_RESOURCETYPE_SUBSYSTEM, ss, null); } - + // for bug 249247 - expand the connection after completing the wizard if (expandHost){ SystemResourceChangeEvent expandEvent = new SystemResourceChangeEvent(conn, ISystemResourceChangeEvents.EVENT_SELECT_EXPAND, reg); @@ -2321,9 +2338,9 @@ public class SystemRegistry implements ISystemRegistry public void connectedStatusChange(ISubSystem subsystem, boolean connected, boolean wasConnected, boolean collapseTree) { IHost conn = subsystem.getHost(); - + IConnectorService effectedConnectorService = subsystem.getConnectorService(); - + if (connected != wasConnected) { int eventId = ISystemResourceChangeEvents.EVENT_ICON_CHANGE; @@ -2332,13 +2349,13 @@ public class SystemRegistry implements ISystemRegistry SystemResourceChangeEvent event = new SystemResourceChangeEvent(subsystem, eventId, conn); fireEvent(event); - + // fire for each subsystem ISubSystem[] sses = getSubSystems(conn); for (int i = 0; i < sses.length; i++) { ISubSystem ss = sses[i]; - + // only fire the event for subsystems that share the effected connector service if (ss != subsystem && ss.getConnectorService().equals(effectedConnectorService)) { @@ -2367,7 +2384,7 @@ public class SystemRegistry implements ISystemRegistry for (int i = 0; i < sses.length; i++) { ISubSystem ss = sses[i]; - + // only fire the event for subsystems that share the effected connector service if (ss != subsystem && ss.getConnectorService().equals(effectedConnectorService) && !ss.isConnected()) {