mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-10 17:55:39 +02:00
Bug 149280: Provide a "priority" attribute to be able to order subsystem configurations.
This commit is contained in:
parent
256a25a206
commit
c0d3e5773d
16 changed files with 95 additions and 3 deletions
|
@ -32,6 +32,7 @@ Martin Oberhuber (Wind River) - initial API and implementation
|
||||||
category="files"
|
category="files"
|
||||||
class="org.eclipse.rse.subsystems.files.ftp.FTPFileSubSystemConfiguration"
|
class="org.eclipse.rse.subsystems.files.ftp.FTPFileSubSystemConfiguration"
|
||||||
vendor="Eclipse.org"
|
vendor="Eclipse.org"
|
||||||
|
priority="100"
|
||||||
id="ftp.files">
|
id="ftp.files">
|
||||||
</configuration>
|
</configuration>
|
||||||
</extension>
|
</extension>
|
||||||
|
@ -47,6 +48,7 @@ Martin Oberhuber (Wind River) - initial API and implementation
|
||||||
category="daytime"
|
category="daytime"
|
||||||
class="org.eclipse.rse.examples.daytime.subsystems.DaytimeSubSystemConfiguration"
|
class="org.eclipse.rse.examples.daytime.subsystems.DaytimeSubSystemConfiguration"
|
||||||
vendor="Wind River Systems"
|
vendor="Wind River Systems"
|
||||||
|
priority="40000"
|
||||||
id="daytime.tcp">
|
id="daytime.tcp">
|
||||||
</configuration>
|
</configuration>
|
||||||
</extension>
|
</extension>
|
||||||
|
|
|
@ -64,7 +64,7 @@ Martin Oberhuber (Wind River) - Adapted original tutorial code to Open RSE.
|
||||||
description="Example Developer Subsystem"
|
description="Example Developer Subsystem"
|
||||||
iconlive="icons/systemconnectionlive.gif"
|
iconlive="icons/systemconnectionlive.gif"
|
||||||
icon="icons/systemconnection.gif"
|
icon="icons/systemconnection.gif"
|
||||||
>
|
priority="50000">
|
||||||
</configuration>
|
</configuration>
|
||||||
</extension>
|
</extension>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
|
@ -29,6 +29,7 @@ Contributors:
|
||||||
category="files"
|
category="files"
|
||||||
class="org.eclipse.rse.subsystems.files.dstore.subsystem.DStoreFileSubSystemConfiguration"
|
class="org.eclipse.rse.subsystems.files.dstore.subsystem.DStoreFileSubSystemConfiguration"
|
||||||
vendor="Eclipse.org"
|
vendor="Eclipse.org"
|
||||||
|
priority="100"
|
||||||
id="dstore.files">
|
id="dstore.files">
|
||||||
</configuration>
|
</configuration>
|
||||||
|
|
||||||
|
@ -41,6 +42,7 @@ Contributors:
|
||||||
category="files"
|
category="files"
|
||||||
class="org.eclipse.rse.subsystems.files.dstore.subsystem.DStoreWindowsFileSubSystemConfiguration"
|
class="org.eclipse.rse.subsystems.files.dstore.subsystem.DStoreWindowsFileSubSystemConfiguration"
|
||||||
vendor="Eclipse.org"
|
vendor="Eclipse.org"
|
||||||
|
priority="100"
|
||||||
id="dstore.windows.files">
|
id="dstore.windows.files">
|
||||||
</configuration>
|
</configuration>
|
||||||
|
|
||||||
|
|
|
@ -30,6 +30,7 @@ Javier Montalvo Orus (Symbian) - add Windows to list of valid FTP systems
|
||||||
category="files"
|
category="files"
|
||||||
class="org.eclipse.rse.subsystems.files.ftp.FTPFileSubSystemConfiguration"
|
class="org.eclipse.rse.subsystems.files.ftp.FTPFileSubSystemConfiguration"
|
||||||
vendor="Eclipse.org"
|
vendor="Eclipse.org"
|
||||||
|
priority="100"
|
||||||
id="ftp.files">
|
id="ftp.files">
|
||||||
</configuration>
|
</configuration>
|
||||||
</extension>
|
</extension>
|
||||||
|
|
|
@ -29,6 +29,7 @@ Contributors:
|
||||||
category="files"
|
category="files"
|
||||||
class="org.eclipse.rse.subsystems.files.local.LocalFileSubSystemConfiguration"
|
class="org.eclipse.rse.subsystems.files.local.LocalFileSubSystemConfiguration"
|
||||||
vendor="Eclipse.org"
|
vendor="Eclipse.org"
|
||||||
|
priority="100"
|
||||||
id="local.files">
|
id="local.files">
|
||||||
</configuration>
|
</configuration>
|
||||||
</extension>
|
</extension>
|
||||||
|
|
|
@ -22,6 +22,7 @@ Martin Oberhuber - initial API and implementation
|
||||||
category="files"
|
category="files"
|
||||||
class="org.eclipse.rse.subsystems.files.ssh.SftpFileSubSystemConfiguration"
|
class="org.eclipse.rse.subsystems.files.ssh.SftpFileSubSystemConfiguration"
|
||||||
vendor="%providerName"
|
vendor="%providerName"
|
||||||
|
priority="100"
|
||||||
id="ssh.files">
|
id="ssh.files">
|
||||||
</configuration>
|
</configuration>
|
||||||
</extension>
|
</extension>
|
||||||
|
|
|
@ -33,6 +33,7 @@ Contributors:
|
||||||
category="processes"
|
category="processes"
|
||||||
class="org.eclipse.rse.subsystems.processes.dstore.DStoreProcessSubSystemConfiguration"
|
class="org.eclipse.rse.subsystems.processes.dstore.DStoreProcessSubSystemConfiguration"
|
||||||
vendor="Eclipse.org"
|
vendor="Eclipse.org"
|
||||||
|
priority="200"
|
||||||
id="dstore.processes">
|
id="dstore.processes">
|
||||||
</configuration>
|
</configuration>
|
||||||
</extension>
|
</extension>
|
||||||
|
|
|
@ -33,6 +33,7 @@ Contributors:
|
||||||
category="processes"
|
category="processes"
|
||||||
class="org.eclipse.rse.subsystems.processes.local.LocalProcessSubSystemFactory"
|
class="org.eclipse.rse.subsystems.processes.local.LocalProcessSubSystemFactory"
|
||||||
vendor="Eclipse.org"
|
vendor="Eclipse.org"
|
||||||
|
priority="200"
|
||||||
id="local.processes">
|
id="local.processes">
|
||||||
</factory>
|
</factory>
|
||||||
</extension>
|
</extension>
|
||||||
|
|
|
@ -30,6 +30,7 @@ Contributors:
|
||||||
category="shells"
|
category="shells"
|
||||||
class="org.eclipse.rse.subsystems.shells.dstore.DStoreShellSubSystemConfiguration"
|
class="org.eclipse.rse.subsystems.shells.dstore.DStoreShellSubSystemConfiguration"
|
||||||
vendor="Eclipse.org"
|
vendor="Eclipse.org"
|
||||||
|
priority="300"
|
||||||
id="dstore.shells">
|
id="dstore.shells">
|
||||||
</configuration>
|
</configuration>
|
||||||
|
|
||||||
|
|
|
@ -33,6 +33,7 @@ Contributors:
|
||||||
category="shells"
|
category="shells"
|
||||||
class="org.eclipse.rse.subsystems.shells.local.LocalShellSubSystemConfiguration"
|
class="org.eclipse.rse.subsystems.shells.local.LocalShellSubSystemConfiguration"
|
||||||
vendor="Eclipse.org"
|
vendor="Eclipse.org"
|
||||||
|
priority="300"
|
||||||
id="local.shells">
|
id="local.shells">
|
||||||
</configuration>
|
</configuration>
|
||||||
</extension>
|
</extension>
|
||||||
|
|
|
@ -22,6 +22,7 @@ Martin Oberhuber - initial API and implementation
|
||||||
category="shells"
|
category="shells"
|
||||||
class="org.eclipse.rse.subsystems.shells.ssh.SshShellSubSystemConfiguration"
|
class="org.eclipse.rse.subsystems.shells.ssh.SshShellSubSystemConfiguration"
|
||||||
vendor="%providerName"
|
vendor="%providerName"
|
||||||
|
priority="300"
|
||||||
id="ssh.shells">
|
id="ssh.shells">
|
||||||
</configuration>
|
</configuration>
|
||||||
</extension>
|
</extension>
|
||||||
|
|
|
@ -18,6 +18,7 @@ package org.eclipse.rse.ui;
|
||||||
|
|
||||||
import java.net.InetAddress;
|
import java.net.InetAddress;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.Vector;
|
import java.util.Vector;
|
||||||
|
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
|
@ -36,6 +37,7 @@ import org.eclipse.rse.core.comm.ISystemKeystoreProvider;
|
||||||
import org.eclipse.rse.core.comm.SystemCommunicationsDaemon;
|
import org.eclipse.rse.core.comm.SystemCommunicationsDaemon;
|
||||||
import org.eclipse.rse.core.comm.SystemKeystoreProviderManager;
|
import org.eclipse.rse.core.comm.SystemKeystoreProviderManager;
|
||||||
import org.eclipse.rse.core.internal.subsystems.SubSystemConfigurationProxy;
|
import org.eclipse.rse.core.internal.subsystems.SubSystemConfigurationProxy;
|
||||||
|
import org.eclipse.rse.core.internal.subsystems.SubSystemConfigurationProxyComparator;
|
||||||
import org.eclipse.rse.core.subsystems.ISubSystemConfiguration;
|
import org.eclipse.rse.core.subsystems.ISubSystemConfiguration;
|
||||||
import org.eclipse.rse.core.subsystems.ISubSystemConfigurationProxy;
|
import org.eclipse.rse.core.subsystems.ISubSystemConfigurationProxy;
|
||||||
import org.eclipse.rse.internal.model.SystemProfileManager;
|
import org.eclipse.rse.internal.model.SystemProfileManager;
|
||||||
|
@ -1086,6 +1088,9 @@ public class RSEUIPlugin extends SystemBasePlugin implements ISystemMessageProvi
|
||||||
subsystemFactories[idx] = (ISubSystemConfigurationProxy)v.elementAt(idx);
|
subsystemFactories[idx] = (ISubSystemConfigurationProxy)v.elementAt(idx);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Arrays.sort(subsystemFactories, new SubSystemConfigurationProxyComparator());
|
||||||
|
|
||||||
return subsystemFactories;
|
return subsystemFactories;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -157,13 +157,20 @@ category of "database".
|
||||||
<attribute name="systemClass" type="string">
|
<attribute name="systemClass" type="string">
|
||||||
<annotation>
|
<annotation>
|
||||||
<documentation>
|
<documentation>
|
||||||
Optional.
|
Optional.
|
||||||
</documentation>
|
</documentation>
|
||||||
<appInfo>
|
<appInfo>
|
||||||
<meta.attribute kind="java" basedOn="org.eclipse.rse.core.subsystems.IConnectorService"/>
|
<meta.attribute kind="java" basedOn="org.eclipse.rse.core.subsystems.IConnectorService"/>
|
||||||
</appInfo>
|
</appInfo>
|
||||||
</annotation>
|
</annotation>
|
||||||
</attribute>
|
</attribute>
|
||||||
|
<attribute name="priority" type="string">
|
||||||
|
<annotation>
|
||||||
|
<documentation>
|
||||||
|
This optional attribute determines the order in which subsystems appear in the New Connection wizard and RSE views. The lower the number, the higher the priority.
|
||||||
|
</documentation>
|
||||||
|
</annotation>
|
||||||
|
</attribute>
|
||||||
</complexType>
|
</complexType>
|
||||||
</element>
|
</element>
|
||||||
|
|
||||||
|
|
|
@ -42,6 +42,7 @@ import org.osgi.framework.Bundle;
|
||||||
public class SubSystemConfigurationProxy implements ISubSystemConfigurationProxy
|
public class SubSystemConfigurationProxy implements ISubSystemConfigurationProxy
|
||||||
{
|
{
|
||||||
private String name,description,id,types,vendor, category, systemClassName;
|
private String name,description,id,types,vendor, category, systemClassName;
|
||||||
|
private int priority;
|
||||||
private String[] systemTypes;
|
private String[] systemTypes;
|
||||||
private List typesArray;
|
private List typesArray;
|
||||||
private boolean allTypes = false;
|
private boolean allTypes = false;
|
||||||
|
@ -65,6 +66,21 @@ public class SubSystemConfigurationProxy implements ISubSystemConfigurationProxy
|
||||||
this.vendor = element.getAttribute("vendor");
|
this.vendor = element.getAttribute("vendor");
|
||||||
this.category = element.getAttribute("category");
|
this.category = element.getAttribute("category");
|
||||||
this.systemClassName = element.getAttribute("systemClass");
|
this.systemClassName = element.getAttribute("systemClass");
|
||||||
|
this.priority = Integer.MAX_VALUE;
|
||||||
|
|
||||||
|
String priorityStr = element.getAttribute("priority");
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
if (priorityStr != null) {
|
||||||
|
priority = Integer.parseInt(priorityStr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (NumberFormatException e) {
|
||||||
|
priority = Integer.MAX_VALUE;
|
||||||
|
RSEUIPlugin.logError("Exception reading priority for subsystem configuration " + name + " defined in plugin " + element.getDeclaringExtension().getNamespaceIdentifier(), e);
|
||||||
|
}
|
||||||
|
|
||||||
String className = element.getAttribute("class");
|
String className = element.getAttribute("class");
|
||||||
if (vendor == null) vendor = "Unknown";
|
if (vendor == null) vendor = "Unknown";
|
||||||
if (category == null) category = "Unknown";
|
if (category == null) category = "Unknown";
|
||||||
|
@ -156,8 +172,16 @@ public class SubSystemConfigurationProxy implements ISubSystemConfigurationProxy
|
||||||
return liveImage;
|
return liveImage;
|
||||||
else
|
else
|
||||||
return image;
|
return image;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* @see org.eclipse.rse.core.subsystems.ISubSystemConfigurationProxy#getPriority()
|
||||||
|
*/
|
||||||
|
public int getPriority() {
|
||||||
|
return priority;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
* Return true if this extension's systemTypes attribute matches the given system type
|
* Return true if this extension's systemTypes attribute matches the given system type
|
||||||
*/
|
*/
|
||||||
public boolean appliesToSystemType(String type)
|
public boolean appliesToSystemType(String type)
|
||||||
|
|
|
@ -0,0 +1,38 @@
|
||||||
|
package org.eclipse.rse.core.internal.subsystems;
|
||||||
|
|
||||||
|
import java.util.Comparator;
|
||||||
|
|
||||||
|
import org.eclipse.rse.core.subsystems.ISubSystemConfigurationProxy;
|
||||||
|
|
||||||
|
public class SubSystemConfigurationProxyComparator implements Comparator {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor.
|
||||||
|
*/
|
||||||
|
public SubSystemConfigurationProxyComparator() {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Compares priorities of subsystem configuration proxies.
|
||||||
|
*/
|
||||||
|
public int compare(Object o1, Object o2) {
|
||||||
|
|
||||||
|
if (o1 instanceof ISubSystemConfigurationProxy && o2 instanceof ISubSystemConfigurationProxy) {
|
||||||
|
ISubSystemConfigurationProxy proxy1 = (ISubSystemConfigurationProxy)o1;
|
||||||
|
ISubSystemConfigurationProxy proxy2 = (ISubSystemConfigurationProxy)o2;
|
||||||
|
|
||||||
|
if (proxy1.getPriority() < proxy2.getPriority()) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
else if (proxy1.getPriority() > proxy2.getPriority()) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -74,6 +74,12 @@ public interface ISubSystemConfigurationProxy
|
||||||
* Return true if the subsystem factory has been instantiated yet
|
* Return true if the subsystem factory has been instantiated yet
|
||||||
*/
|
*/
|
||||||
public boolean isSubSystemConfigurationActive();
|
public boolean isSubSystemConfigurationActive();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the priority of the subsystem configuration.
|
||||||
|
*/
|
||||||
|
public int getPriority();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the subsystem factory singleton instance. Will instantiate if not already.
|
* Return the subsystem factory singleton instance. Will instantiate if not already.
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Add table
Reference in a new issue