mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-17 21:25:58 +02:00
Discovery listed in wizard
This commit is contained in:
parent
7b48b49495
commit
07ba899f07
3 changed files with 107 additions and 18 deletions
|
@ -19,8 +19,30 @@ Contributors:
|
||||||
class="org.eclipse.rse.discovery.ServiceDiscoveryWizardDelegate"
|
class="org.eclipse.rse.discovery.ServiceDiscoveryWizardDelegate"
|
||||||
systemType="org.eclipse.rse.systemtype.discovery"/>
|
systemType="org.eclipse.rse.systemtype.discovery"/>
|
||||||
</extension>
|
</extension>
|
||||||
|
|
||||||
|
<extension
|
||||||
|
point="org.eclipse.rse.core.systemTypes">
|
||||||
|
<systemType id="org.eclipse.rse.systemtype.discovery"
|
||||||
|
name="Discovery"
|
||||||
|
description="Discovery"
|
||||||
|
iconLive=""/>
|
||||||
|
</extension>
|
||||||
|
|
||||||
|
<extension
|
||||||
|
point="org.eclipse.rse.ui.subsystemConfigurations">
|
||||||
|
<configuration
|
||||||
|
systemTypes="Discovery"
|
||||||
|
name="Discovery"
|
||||||
|
description="Service Discovery Wizard"
|
||||||
|
iconlive=""
|
||||||
|
icon=""
|
||||||
|
class="org.eclipse.rse.discovery.ServiceDiscoverySubSystemConfiguration"
|
||||||
|
vendor="Eclipse.org"
|
||||||
|
priority="100"
|
||||||
|
id="Discovery">
|
||||||
|
</configuration>
|
||||||
|
</extension>
|
||||||
|
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,60 @@
|
||||||
|
/********************************************************************************
|
||||||
|
* Copyright (c) 2006 Symbian Software Ltd. 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
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* Javier Montalvo Orús (Symbian) - initial API and implementation
|
||||||
|
********************************************************************************/
|
||||||
|
|
||||||
|
package org.eclipse.rse.discovery;
|
||||||
|
|
||||||
|
import org.eclipse.rse.core.filters.ISystemFilterPool;
|
||||||
|
import org.eclipse.rse.core.filters.ISystemFilterPoolManager;
|
||||||
|
import org.eclipse.rse.core.model.IHost;
|
||||||
|
import org.eclipse.rse.core.subsystems.IConnectorService;
|
||||||
|
import org.eclipse.rse.core.subsystems.ISubSystem;
|
||||||
|
import org.eclipse.rse.core.subsystems.SubSystemConfiguration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Configuration for an empty Discovery SubSystemConfiguration
|
||||||
|
* to allow listing discovery in the RSE Wizard
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class ServiceDiscoverySubSystemConfiguration extends SubSystemConfiguration {
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
* @see org.eclipse.rse.core.subsystems.SubSystemConfiguration#createDefaultFilterPool(org.eclipse.rse.core.filters.ISystemFilterPoolManager)
|
||||||
|
*/
|
||||||
|
protected ISystemFilterPool createDefaultFilterPool(
|
||||||
|
ISystemFilterPoolManager mgr) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
* @see org.eclipse.rse.core.subsystems.SubSystemConfiguration#createSubSystemInternal(org.eclipse.rse.core.model.IHost)
|
||||||
|
*/
|
||||||
|
public ISubSystem createSubSystemInternal(IHost conn) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
* @see org.eclipse.rse.core.subsystems.SubSystemConfiguration#supportsServerLaunchProperties(org.eclipse.rse.core.model.IHost)
|
||||||
|
*/
|
||||||
|
public boolean supportsServerLaunchProperties(IHost host) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
* @see org.eclipse.rse.core.subsystems.ISubSystemConfiguration#getConnectorService(org.eclipse.rse.core.model.IHost)
|
||||||
|
*/
|
||||||
|
public IConnectorService getConnectorService(IHost host) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -23,6 +23,7 @@ import org.eclipse.jface.wizard.Wizard;
|
||||||
import org.eclipse.rse.core.model.IHost;
|
import org.eclipse.rse.core.model.IHost;
|
||||||
import org.eclipse.rse.core.model.IPropertySet;
|
import org.eclipse.rse.core.model.IPropertySet;
|
||||||
import org.eclipse.rse.ui.RSEUIPlugin;
|
import org.eclipse.rse.ui.RSEUIPlugin;
|
||||||
|
import org.eclipse.rse.ui.actions.SystemRefreshAllAction;
|
||||||
import org.eclipse.tm.discovery.model.Pair;
|
import org.eclipse.tm.discovery.model.Pair;
|
||||||
import org.eclipse.tm.discovery.model.Service;
|
import org.eclipse.tm.discovery.model.Service;
|
||||||
import org.eclipse.tm.discovery.model.ServiceType;
|
import org.eclipse.tm.discovery.model.ServiceType;
|
||||||
|
@ -78,6 +79,8 @@ public class ServiceDiscoveryWizard extends Wizard {
|
||||||
*/
|
*/
|
||||||
public boolean performFinish() {
|
public boolean performFinish() {
|
||||||
|
|
||||||
|
SystemRefreshAllAction systemRefreshAllAction = new SystemRefreshAllAction(null);
|
||||||
|
|
||||||
String[] addresses = serviceDiscoveryPage.getAddresses();
|
String[] addresses = serviceDiscoveryPage.getAddresses();
|
||||||
for (int i = 0; i < addresses.length; i++) {
|
for (int i = 0; i < addresses.length; i++) {
|
||||||
|
|
||||||
|
@ -94,24 +97,28 @@ public class ServiceDiscoveryWizard extends Wizard {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
conn = RSEUIPlugin.getDefault().getSystemRegistry().createHost(sysTypeString, service.getName() + "@" + hostName, hostName, "Discovered "+sysTypeString+" server in "+hostName); //$NON-NLS-1$ //$NON-NLS-2$
|
conn = RSEUIPlugin.getDefault().getSystemRegistry().createHost(sysTypeString, service.getName() + "@" + hostName, hostName, "Discovered "+sysTypeString+" server in "+hostName); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
if (conn != null) {
|
||||||
}
|
//copy discovered properties to RSE model
|
||||||
|
IPropertySet ps = conn.getConnectorServices()[0].createPropertySet(Messages.ServiceDiscoveryWizard_DiscoveryPropertySet);
|
||||||
if (conn != null) {
|
Iterator pairIterator = service.getPair().iterator();
|
||||||
//copy discovered properties to RSE model
|
while (pairIterator.hasNext()) {
|
||||||
IPropertySet ps = conn.getConnectorServices()[0].createPropertySet(Messages.ServiceDiscoveryWizard_DiscoveryPropertySet);
|
Pair pair = (Pair) pairIterator.next();
|
||||||
Iterator pairIterator = service.getPair().iterator();
|
ps.addProperty(pair.getKey(), pair.getValue());
|
||||||
while (pairIterator.hasNext()) {
|
|
||||||
Pair pair = (Pair) pairIterator.next();
|
//add port to the RSE connection
|
||||||
ps.addProperty(pair.getKey(), pair.getValue());
|
if (pair.getKey().equalsIgnoreCase(Messages.ServiceDiscoveryWizard_Port)) {
|
||||||
|
conn.getConnectorServices()[0].setPort(Integer.parseInt(pair.getValue()));
|
||||||
//add port to the RSE connection
|
}
|
||||||
if (pair.getKey().equalsIgnoreCase(Messages.ServiceDiscoveryWizard_Port)) {
|
|
||||||
conn.getConnectorServices()[0].setPort(Integer.parseInt(pair.getValue()));
|
|
||||||
}
|
}
|
||||||
|
RSEUIPlugin.getDefault().getSystemRegistry().expandHost(conn);
|
||||||
}
|
}
|
||||||
RSEUIPlugin.getDefault().getSystemRegistry().expandHost(conn);
|
} catch (Exception e) {
|
||||||
|
if (conn != null) {
|
||||||
|
RSEUIPlugin.getDefault().getSystemRegistry().deleteHost(conn);
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
systemRefreshAllAction.run();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue