1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 14:42:11 +02:00

[162081] Get rid of subsystemConfigurations attribute "supportsAllSystemTypes". Fix Discovery usage of systemTypeIds.

This commit is contained in:
Martin Oberhuber 2007-02-12 12:01:36 +00:00
parent 3a88b76ae0
commit ab3919c38a
16 changed files with 34 additions and 48 deletions

View file

@ -31,7 +31,7 @@ Contributors:
<extension
point="org.eclipse.rse.ui.subsystemConfigurations">
<configuration
systemTypes="Discovery"
systemTypeIds="org.eclipse.rse.systemtype.discovery"
name="Discovery"
description="Service Discovery Wizard"
iconlive=""

View file

@ -25,7 +25,6 @@ Martin Oberhuber (Wind River) - initial API and implementation
point="org.eclipse.rse.ui.subsystemConfigurations">
<configuration
systemTypeIds="org.eclipse.rse.examples.daytime.systemtype"
supportsAllSystemTypes="false"
name="%Files"
description="%FilesDescription"
iconlive="icons/full/obj16/systemfileslive_obj.gif"
@ -43,7 +42,6 @@ Martin Oberhuber (Wind River) - initial API and implementation
point="org.eclipse.rse.ui.subsystemConfigurations">
<configuration
systemTypeIds="org.eclipse.rse.examples.daytime.systemtype;org.eclipse.rse.systemtype.unix"
supportsAllSystemTypes="false"
name="%DaytimeSubsystemName"
description="%DaytimeDescription"
iconlive="icons/full/obj16/daytimelive_obj.gif"

View file

@ -63,7 +63,6 @@ Martin Oberhuber (Wind River) - Adapted original tutorial code to Open RSE.
<configuration
id="samples.subsystems.factory"
systemTypeIds="org.eclipse.rse.systemtype.linux;org.eclipse.rse.systemtype.unix;org.eclipse.rse.systemtype.windows"
supportsAllSystemTypes="false"
name="Teams"
class="samples.subsystems.DeveloperSubSystemConfiguration"
category="users"

View file

@ -25,7 +25,6 @@ Contributors:
point="org.eclipse.rse.ui.subsystemConfigurations">
<factory
systemTypeIds="org.eclipse.rse.systemtype.local"
supportsAllSystemTypes="false"
name="%Factory.LocalProcesses"
iconlive="icons/full/obj16/activeprocess.gif"
icon="icons/full/obj16/activeprocess.gif"

View file

@ -22,7 +22,6 @@ Contributors:
point="org.eclipse.rse.ui.subsystemConfigurations">
<configuration
systemTypeIds="org.eclipse.rse.systemtype.linux;org.eclipse.rse.systemtype.unix"
supportsAllSystemTypes="false"
name="%Files"
description="%FilesDescription"
iconlive="icons/full/obj16/systemfileslive_obj.gif"
@ -36,7 +35,6 @@ Contributors:
<configuration
systemTypeIds="org.eclipse.rse.systemtype.windows"
supportsAllSystemTypes="false"
name="%Files"
description="%FilesDescription"
iconlive="icons/full/obj16/systemfileslive_obj.gif"

View file

@ -28,7 +28,6 @@ Martin Oberhuber (Wind River) - add FTP Only system type
<extension point="org.eclipse.rse.ui.subsystemConfigurations">
<configuration
systemTypeIds="org.eclipse.rse.systemtype.linux;org.eclipse.rse.systemtype.unix;org.eclipse.rse.systemtype.windows;org.eclipse.rse.systemtype.ftp"
supportsAllSystemTypes="false"
name="%Files"
description="%FilesDescription"
iconlive="icons/full/obj16/systemfileslive_obj.gif"

View file

@ -22,7 +22,6 @@ Contributors:
point="org.eclipse.rse.ui.subsystemConfigurations">
<configuration
systemTypeIds="org.eclipse.rse.systemtype.local"
supportsAllSystemTypes="false"
name="%Files"
description="%FilesDescription"
iconlive="icons/full/obj16/systemfileslive_obj.gif"

View file

@ -15,7 +15,6 @@ Martin Oberhuber - initial API and implementation
point="org.eclipse.rse.ui.subsystemConfigurations">
<configuration
systemTypeIds="org.eclipse.rse.systemtype.linux;org.eclipse.rse.systemtype.unix;org.eclipse.rse.systemtype.aix;org.eclipse.rse.systemtype.ssh"
supportsAllSystemTypes="false"
name="%SshFileSubsystemName"
description="%SshFileSubsystemDescription"
iconlive="icons/full/obj16/systemfileslive_obj.gif"

View file

@ -26,7 +26,6 @@ Contributors:
point="org.eclipse.rse.ui.subsystemConfigurations">
<configuration
systemTypeIds="org.eclipse.rse.systemtype.linux;org.eclipse.rse.systemtype.unix"
supportsAllSystemTypes="false"
name="%Processes"
description="%ProcessesDescription"
iconlive="icons/full/obj16/processsubsystemlive_obj.gif"

View file

@ -23,7 +23,6 @@ Contributors:
point="org.eclipse.rse.ui.subsystemConfigurations">
<configuration
systemTypeIds="org.eclipse.rse.systemtype.linux;org.eclipse.rse.systemtype.unix;org.eclipse.rse.systemtype.windows"
supportsAllSystemTypes="false"
name="%Shells"
description="%ShellsDescription"
iconlive="icons/full/obj16/systemcommandslive_obj.gif"

View file

@ -26,7 +26,6 @@ Contributors:
point="org.eclipse.rse.ui.subsystemConfigurations">
<configuration
systemTypeIds="org.eclipse.rse.systemtype.local"
supportsAllSystemTypes="false"
name="%Shells"
description="%ShellsDescription"
iconlive="icons/full/obj16/systemcommandslive_obj.gif"

View file

@ -15,7 +15,6 @@ Martin Oberhuber - initial API and implementation
point="org.eclipse.rse.ui.subsystemConfigurations">
<configuration
systemTypeIds="org.eclipse.rse.systemtype.linux;org.eclipse.rse.systemtype.unix;org.eclipse.rse.systemtype.aix;org.eclipse.rse.systemtype.ssh"
supportsAllSystemTypes="false"
name="%SshShellSubsystemName"
description="%SshShellSubsystemDescription"
iconlive="icons/full/obj16/systemcommandslive_obj.gif"

View file

@ -28,7 +28,6 @@ Contributors:
<!-- point="org.eclipse.rse.ui.subsystemConfigurations"> -->
<!-- <configuration -->
<!-- systemTypeIds="org.eclipse.rse.systemtype.local;org.eclipse.rse.systemtype.unix"-->
<!-- supportsAllSystemTypes="false" -->
<!-- name="Files" -->
<!-- description="This subsystem allows you to work with files on local or remote systems."-->
<!-- icon="icons/filesubsys.gif" -->

View file

@ -109,17 +109,13 @@ It is recommended to extend &lt;samp&gt;org.eclipse.rse.core.subsystems.SubSyste
</appInfo>
</annotation>
</attribute>
<attribute name="supportsAllSystemTypes" type="boolean" use="required">
<annotation>
<documentation>
A boolean attribute to mark the subsystem configuration compatible with all contributed system types.
</documentation>
</annotation>
</attribute>
<attribute name="systemTypeIds" type="string">
<annotation>
<documentation>
A semicolon separated list of system type ids that subsystems from this configuration support. For example, &quot;org.eclipse.rse.systemtype.unix;org.eclipse.rse.systemtype.linux&quot;. The wildcards &apos;*&apos; and &apos;?&apos; are accepted. The attribute will be not considered if the attribute &apos;supportsAllSystemTypes&apos; is set to &apos;true&apos;.
A semicolon separated list of system type ids that subsystems from this configuration support. For example, &lt;code&gt;&quot;org.eclipse.rse.systemtype.unix;org.eclipse.rse.systemtype.linux&quot;
&lt;/code&gt;.
&lt;p/&gt;
The wildcards &apos;*&apos; and &apos;?&apos; are accepted. Therefore, if a subsystem configuration should be registered against all existing system types, this slot should be set to &lt;code&gt;&quot;*&quot;&lt;/code&gt;.
</documentation>
</annotation>
</attribute>
@ -179,8 +175,7 @@ Note that ServiceSubSystems that share the same service should always use the sa
&lt;extension
point=&quot;org.eclipse.rse.ui.subsystemConfigurations&quot;&gt;
&lt;configuration
systemTypes=&quot;Unix;Linux;Local&quot;
supportsAllSystemTypes=&quot;false&quot;
systemTypeIds=&quot;org.eclipse.rse.systemtype.unix;*.rse.systemtype.linux&quot;
name=&quot;Databases&quot;
icon=&quot;icons/dbsubsys.gif&quot;
iconlive=&quot;icons/dbsubsyslive.gif&quot;
@ -232,7 +227,7 @@ for examples.
<meta.section type="copyright"/>
</appInfo>
<documentation>
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

View file

@ -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);
}

View file

@ -20,7 +20,6 @@
<configuration
id="org.eclipse.rse.tests.subsystems.TestSubSystem"
systemTypeIds="org.eclipse.rse.systemtype.local;org.eclipse.rse.systemtype.windows"
supportsAllSystemTypes="false"
name="%testSubSystemName"
class="org.eclipse.rse.tests.internal.testsubsystem.TestSubSystemConfiguration"
category="users"
@ -34,7 +33,6 @@
<configuration
id="org.eclipse.rse.tests.subsystems.TestSubSystem2"
systemTypeIds="org.eclipse.rse.tests.*"
supportsAllSystemTypes="false"
name="%testSubSystem2Name"
class="org.eclipse.rse.tests.internal.testsubsystem.TestSubSystemConfiguration"
category="users"
@ -49,7 +47,6 @@
<configuration
id="org.eclipse.rse.tests.subsystems.TestSubSystem3"
systemTypeIds="org.eclipse.rse.systemtype.*n?x"
supportsAllSystemTypes="false"
name="%testSubSystem3Name"
class="org.eclipse.rse.tests.internal.testsubsystem.TestSubSystemConfiguration"
category="users"