mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-24 17:35:35 +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"
|
||||
class="org.eclipse.rse.subsystems.files.ftp.FTPFileSubSystemConfiguration"
|
||||
vendor="Eclipse.org"
|
||||
priority="100"
|
||||
id="ftp.files">
|
||||
</configuration>
|
||||
</extension>
|
||||
|
@ -47,6 +48,7 @@ Martin Oberhuber (Wind River) - initial API and implementation
|
|||
category="daytime"
|
||||
class="org.eclipse.rse.examples.daytime.subsystems.DaytimeSubSystemConfiguration"
|
||||
vendor="Wind River Systems"
|
||||
priority="40000"
|
||||
id="daytime.tcp">
|
||||
</configuration>
|
||||
</extension>
|
||||
|
|
|
@ -64,7 +64,7 @@ Martin Oberhuber (Wind River) - Adapted original tutorial code to Open RSE.
|
|||
description="Example Developer Subsystem"
|
||||
iconlive="icons/systemconnectionlive.gif"
|
||||
icon="icons/systemconnection.gif"
|
||||
>
|
||||
priority="50000">
|
||||
</configuration>
|
||||
</extension>
|
||||
</plugin>
|
||||
|
|
|
@ -29,6 +29,7 @@ Contributors:
|
|||
category="files"
|
||||
class="org.eclipse.rse.subsystems.files.dstore.subsystem.DStoreFileSubSystemConfiguration"
|
||||
vendor="Eclipse.org"
|
||||
priority="100"
|
||||
id="dstore.files">
|
||||
</configuration>
|
||||
|
||||
|
@ -41,6 +42,7 @@ Contributors:
|
|||
category="files"
|
||||
class="org.eclipse.rse.subsystems.files.dstore.subsystem.DStoreWindowsFileSubSystemConfiguration"
|
||||
vendor="Eclipse.org"
|
||||
priority="100"
|
||||
id="dstore.windows.files">
|
||||
</configuration>
|
||||
|
||||
|
|
|
@ -30,6 +30,7 @@ Javier Montalvo Orus (Symbian) - add Windows to list of valid FTP systems
|
|||
category="files"
|
||||
class="org.eclipse.rse.subsystems.files.ftp.FTPFileSubSystemConfiguration"
|
||||
vendor="Eclipse.org"
|
||||
priority="100"
|
||||
id="ftp.files">
|
||||
</configuration>
|
||||
</extension>
|
||||
|
|
|
@ -29,6 +29,7 @@ Contributors:
|
|||
category="files"
|
||||
class="org.eclipse.rse.subsystems.files.local.LocalFileSubSystemConfiguration"
|
||||
vendor="Eclipse.org"
|
||||
priority="100"
|
||||
id="local.files">
|
||||
</configuration>
|
||||
</extension>
|
||||
|
|
|
@ -22,6 +22,7 @@ Martin Oberhuber - initial API and implementation
|
|||
category="files"
|
||||
class="org.eclipse.rse.subsystems.files.ssh.SftpFileSubSystemConfiguration"
|
||||
vendor="%providerName"
|
||||
priority="100"
|
||||
id="ssh.files">
|
||||
</configuration>
|
||||
</extension>
|
||||
|
|
|
@ -33,6 +33,7 @@ Contributors:
|
|||
category="processes"
|
||||
class="org.eclipse.rse.subsystems.processes.dstore.DStoreProcessSubSystemConfiguration"
|
||||
vendor="Eclipse.org"
|
||||
priority="200"
|
||||
id="dstore.processes">
|
||||
</configuration>
|
||||
</extension>
|
||||
|
|
|
@ -33,6 +33,7 @@ Contributors:
|
|||
category="processes"
|
||||
class="org.eclipse.rse.subsystems.processes.local.LocalProcessSubSystemFactory"
|
||||
vendor="Eclipse.org"
|
||||
priority="200"
|
||||
id="local.processes">
|
||||
</factory>
|
||||
</extension>
|
||||
|
|
|
@ -30,6 +30,7 @@ Contributors:
|
|||
category="shells"
|
||||
class="org.eclipse.rse.subsystems.shells.dstore.DStoreShellSubSystemConfiguration"
|
||||
vendor="Eclipse.org"
|
||||
priority="300"
|
||||
id="dstore.shells">
|
||||
</configuration>
|
||||
|
||||
|
|
|
@ -33,6 +33,7 @@ Contributors:
|
|||
category="shells"
|
||||
class="org.eclipse.rse.subsystems.shells.local.LocalShellSubSystemConfiguration"
|
||||
vendor="Eclipse.org"
|
||||
priority="300"
|
||||
id="local.shells">
|
||||
</configuration>
|
||||
</extension>
|
||||
|
|
|
@ -22,6 +22,7 @@ Martin Oberhuber - initial API and implementation
|
|||
category="shells"
|
||||
class="org.eclipse.rse.subsystems.shells.ssh.SshShellSubSystemConfiguration"
|
||||
vendor="%providerName"
|
||||
priority="300"
|
||||
id="ssh.shells">
|
||||
</configuration>
|
||||
</extension>
|
||||
|
|
|
@ -18,6 +18,7 @@ package org.eclipse.rse.ui;
|
|||
|
||||
import java.net.InetAddress;
|
||||
import java.net.URL;
|
||||
import java.util.Arrays;
|
||||
import java.util.Vector;
|
||||
|
||||
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.SystemKeystoreProviderManager;
|
||||
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.ISubSystemConfigurationProxy;
|
||||
import org.eclipse.rse.internal.model.SystemProfileManager;
|
||||
|
@ -1086,6 +1088,9 @@ public class RSEUIPlugin extends SystemBasePlugin implements ISystemMessageProvi
|
|||
subsystemFactories[idx] = (ISubSystemConfigurationProxy)v.elementAt(idx);
|
||||
}
|
||||
}
|
||||
|
||||
Arrays.sort(subsystemFactories, new SubSystemConfigurationProxyComparator());
|
||||
|
||||
return subsystemFactories;
|
||||
}
|
||||
|
||||
|
|
|
@ -157,13 +157,20 @@ category of "database".
|
|||
<attribute name="systemClass" type="string">
|
||||
<annotation>
|
||||
<documentation>
|
||||
Optional.
|
||||
Optional.
|
||||
</documentation>
|
||||
<appInfo>
|
||||
<meta.attribute kind="java" basedOn="org.eclipse.rse.core.subsystems.IConnectorService"/>
|
||||
</appInfo>
|
||||
</annotation>
|
||||
</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>
|
||||
</element>
|
||||
|
||||
|
|
|
@ -42,6 +42,7 @@ import org.osgi.framework.Bundle;
|
|||
public class SubSystemConfigurationProxy implements ISubSystemConfigurationProxy
|
||||
{
|
||||
private String name,description,id,types,vendor, category, systemClassName;
|
||||
private int priority;
|
||||
private String[] systemTypes;
|
||||
private List typesArray;
|
||||
private boolean allTypes = false;
|
||||
|
@ -65,6 +66,21 @@ public class SubSystemConfigurationProxy implements ISubSystemConfigurationProxy
|
|||
this.vendor = element.getAttribute("vendor");
|
||||
this.category = element.getAttribute("category");
|
||||
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");
|
||||
if (vendor == null) vendor = "Unknown";
|
||||
if (category == null) category = "Unknown";
|
||||
|
@ -156,8 +172,16 @@ public class SubSystemConfigurationProxy implements ISubSystemConfigurationProxy
|
|||
return liveImage;
|
||||
else
|
||||
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
|
||||
*/
|
||||
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
|
||||
*/
|
||||
public boolean isSubSystemConfigurationActive();
|
||||
|
||||
/**
|
||||
* Returns the priority of the subsystem configuration.
|
||||
*/
|
||||
public int getPriority();
|
||||
|
||||
/**
|
||||
* Return the subsystem factory singleton instance. Will instantiate if not already.
|
||||
*/
|
||||
|
|
Loading…
Add table
Reference in a new issue