diff --git a/discovery/org.eclipse.rse.discovery/plugin.xml b/discovery/org.eclipse.rse.discovery/plugin.xml index 662782aa97d..be1e673ff61 100644 --- a/discovery/org.eclipse.rse.discovery/plugin.xml +++ b/discovery/org.eclipse.rse.discovery/plugin.xml @@ -31,7 +31,7 @@ Contributors: --> - diff --git a/rse/plugins/org.eclipse.rse.ui/schema/subsystemConfigurations.exsd b/rse/plugins/org.eclipse.rse.ui/schema/subsystemConfigurations.exsd index aceec8db492..64ad2f76a1b 100644 --- a/rse/plugins/org.eclipse.rse.ui/schema/subsystemConfigurations.exsd +++ b/rse/plugins/org.eclipse.rse.ui/schema/subsystemConfigurations.exsd @@ -109,17 +109,13 @@ It is recommended to extend <samp>org.eclipse.rse.core.subsystems.SubSyste - - - - A boolean attribute to mark the subsystem configuration compatible with all contributed system types. - - - - A semicolon separated list of system type ids that subsystems from this configuration support. For example, "org.eclipse.rse.systemtype.unix;org.eclipse.rse.systemtype.linux". The wildcards '*' and '?' are accepted. The attribute will be not considered if the attribute 'supportsAllSystemTypes' is set to 'true'. + A semicolon separated list of system type ids that subsystems from this configuration support. For example, <code>"org.eclipse.rse.systemtype.unix;org.eclipse.rse.systemtype.linux" +</code>. +<p/> +The wildcards '*' and '?' are accepted. Therefore, if a subsystem configuration should be registered against all existing system types, this slot should be set to <code>"*"</code>. @@ -179,8 +175,7 @@ Note that ServiceSubSystems that share the same service should always use the sa <extension point="org.eclipse.rse.ui.subsystemConfigurations"> <configuration - systemTypes="Unix;Linux;Local" - supportsAllSystemTypes="false" + systemTypeIds="org.eclipse.rse.systemtype.unix;*.rse.systemtype.linux" name="Databases" icon="icons/dbsubsys.gif" iconlive="icons/dbsubsyslive.gif" @@ -232,7 +227,7 @@ for examples. - Copyright (c) 2002, 2006 IBM Corporation. All Rights Reserved. + Copyright (c) 2002, 2007 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 diff --git a/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/internal/subsystems/SubSystemConfigurationProxy.java b/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/internal/subsystems/SubSystemConfigurationProxy.java index 6e5226ca78a..42fbc1b3250 100644 --- a/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/internal/subsystems/SubSystemConfigurationProxy.java +++ b/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/internal/subsystems/SubSystemConfigurationProxy.java @@ -59,9 +59,6 @@ public class SubSystemConfigurationProxy implements ISubSystemConfigurationProxy // matching either by name or id. private List resolvedSystemTypes; - // Flag to mark if the subsystem configuration supports all registered system types - private boolean allTypes = false; - // The subsystem configuration vendor private String vendor; // The remote system resource category @@ -90,10 +87,14 @@ public class SubSystemConfigurationProxy implements ISubSystemConfigurationProxy * Checks if the specified system type is matched by this pattern. */ public boolean matches(IRSESystemType systemType); + /** + * @return true if this matcher supports all system types. + */ + public boolean supportsAllSystemTypes(); } private final class SystemTypeMatcher implements ISystemTypeMatcher { - private final class SystemTypeIdPattern implements ISystemTypeMatcher { + private final class SystemTypeIdPattern { private final Pattern pattern; /** @@ -115,6 +116,7 @@ public class SubSystemConfigurationProxy implements ISubSystemConfigurationProxy // List of patterns to match. The order is preserved. Names comes before ids. private final List patterns = new LinkedList(); + private boolean matchAllTypes = false; /** * Constructor. @@ -127,8 +129,15 @@ public class SubSystemConfigurationProxy implements ISubSystemConfigurationProxy String[] ids = declaredSystemTypeIds.split(";"); //$NON-NLS-1$ if (ids != null && ids.length > 0) { for (int i = 0; i < ids.length; i++) { - SystemTypeIdPattern pattern = new SystemTypeIdPattern(Pattern.compile(makeRegex(ids[i]))); - patterns.add(pattern); + String id = ids[i].trim(); + if (id.equals("*")) { //$NON-NLS-1$ + matchAllTypes = true; + patterns.clear(); + return; + } else if(id.length()>0) { + SystemTypeIdPattern pattern = new SystemTypeIdPattern(Pattern.compile(makeRegex(id))); + patterns.add(pattern); + } } } } @@ -138,23 +147,25 @@ public class SubSystemConfigurationProxy implements ISubSystemConfigurationProxy assert pattern != null; String translated = pattern; if (translated.indexOf('.') != -1) translated = translated.replaceAll("\\.", "\\."); //$NON-NLS-1$ //$NON-NLS-2$ - if (translated.indexOf(' ') != -1) translated = translated.replaceAll(" ", "\\ "); //$NON-NLS-1$ //$NON-NLS-2$ if (translated.indexOf('*') != -1) translated = translated.replaceAll("\\*", ".*"); //$NON-NLS-1$ //$NON-NLS-2$ - if (translated.indexOf('?') != -1) translated = translated.replaceAll("\\?", "."); //$NON-NLS-1$ //$NON-NLS-2$ + if (translated.indexOf('?') != -1) translated = translated.replaceAll("\\?", "."); //$NON-NLS-1$ //$NON-NLS-2$ return translated; } + public boolean supportsAllSystemTypes() { + return matchAllTypes; + } + /* (non-Javadoc) * @see org.eclipse.rse.core.internal.subsystems.SubSystemConfigurationProxy.ISystemTypeMatcher#matches(org.eclipse.rse.core.IRSESystemType) */ public boolean matches(IRSESystemType systemType) { assert systemType != null; - if (!patterns.isEmpty()) { - Iterator iterator = patterns.iterator(); - while (iterator.hasNext()) { - ISystemTypeMatcher matcher = (ISystemTypeMatcher)iterator.next(); - if (matcher.matches(systemType)) return true; - } + if (matchAllTypes) return true; + Iterator iterator = patterns.iterator(); + while (iterator.hasNext()) { + ISystemTypeMatcher matcher = (ISystemTypeMatcher)iterator.next(); + if (matcher.matches(systemType)) return true; } return false; } @@ -183,9 +194,6 @@ public class SubSystemConfigurationProxy implements ISubSystemConfigurationProxy SystemBasePlugin.logError("Exception reading priority for subsystem configuration " + name + " defined in plugin " + element.getDeclaringExtension().getNamespaceIdentifier(), e); //$NON-NLS-1$ //$NON-NLS-2$ } - String supportsAllSystemTypes = element.getAttribute("supportsAllSystemTypes"); //$NON-NLS-1$ - if (supportsAllSystemTypes != null) this.allTypes = Boolean.TRUE.equals(Boolean.valueOf(supportsAllSystemTypes)); - if (vendor == null) vendor = "Unknown"; //$NON-NLS-1$ if (category == null) category = "Unknown"; //$NON-NLS-1$ @@ -289,7 +297,7 @@ public class SubSystemConfigurationProxy implements ISubSystemConfigurationProxy * Return true if this factory supports all system types */ public boolean supportsAllSystemTypes() { - return allTypes; + return systemTypeMatcher.supportsAllSystemTypes(); } /** @@ -324,7 +332,7 @@ public class SubSystemConfigurationProxy implements ISubSystemConfigurationProxy */ public boolean appliesToSystemType(String type) { assert type != null; - if (allTypes) return true; + if (systemTypeMatcher.supportsAllSystemTypes()) return true; return Arrays.asList(getSystemTypes()).contains(type); } diff --git a/rse/tests/org.eclipse.rse.tests/plugin.xml b/rse/tests/org.eclipse.rse.tests/plugin.xml index 9450eb44a5c..78300a7f93d 100644 --- a/rse/tests/org.eclipse.rse.tests/plugin.xml +++ b/rse/tests/org.eclipse.rse.tests/plugin.xml @@ -20,7 +20,6 @@