mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-13 03:55:22 +02:00
make sure server launcher properties are stored when modified from wizard
This commit is contained in:
parent
b5e8fe024d
commit
d8e53e6b2f
8 changed files with 116 additions and 11 deletions
|
@ -72,4 +72,8 @@ public class ServerLauncherPropertiesServiceElement extends RSEModelServiceEleme
|
||||||
super.revert();
|
super.revert();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public IServerLauncherProperties getServerLauncherProperties()
|
||||||
|
{
|
||||||
|
return _launcherProperties;
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -41,6 +41,21 @@ public abstract class ServiceElement
|
||||||
|
|
||||||
public IHost getHost()
|
public IHost getHost()
|
||||||
{
|
{
|
||||||
|
if (_host == null)
|
||||||
|
{
|
||||||
|
ServiceElement[] elements = getChildren();
|
||||||
|
if (elements != null)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < elements.length; i++)
|
||||||
|
{
|
||||||
|
ServiceElement el = elements[i];
|
||||||
|
if (el.isSelected())
|
||||||
|
{
|
||||||
|
return el.getHost();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
return _host;
|
return _host;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,7 @@ import org.eclipse.core.runtime.IExtensionRegistry;
|
||||||
import org.eclipse.core.runtime.Platform;
|
import org.eclipse.core.runtime.Platform;
|
||||||
import org.eclipse.jface.wizard.IWizardPage;
|
import org.eclipse.jface.wizard.IWizardPage;
|
||||||
import org.eclipse.rse.core.IRSESystemType;
|
import org.eclipse.rse.core.IRSESystemType;
|
||||||
|
import org.eclipse.rse.model.IHost;
|
||||||
import org.eclipse.rse.ui.ISystemIconConstants;
|
import org.eclipse.rse.ui.ISystemIconConstants;
|
||||||
import org.eclipse.rse.ui.RSEUIPlugin;
|
import org.eclipse.rse.ui.RSEUIPlugin;
|
||||||
import org.eclipse.rse.ui.SystemResources;
|
import org.eclipse.rse.ui.SystemResources;
|
||||||
|
@ -278,4 +279,5 @@ public class RSENewConnectionWizard extends AbstractSystemWizard implements IRSE
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -25,13 +25,19 @@ import org.eclipse.rse.core.RSECorePlugin;
|
||||||
import org.eclipse.rse.core.servicesubsystem.IServiceSubSystem;
|
import org.eclipse.rse.core.servicesubsystem.IServiceSubSystem;
|
||||||
import org.eclipse.rse.core.servicesubsystem.IServiceSubSystemConfiguration;
|
import org.eclipse.rse.core.servicesubsystem.IServiceSubSystemConfiguration;
|
||||||
import org.eclipse.rse.core.subsystems.IConnectorService;
|
import org.eclipse.rse.core.subsystems.IConnectorService;
|
||||||
|
import org.eclipse.rse.core.subsystems.IServerLauncherProperties;
|
||||||
import org.eclipse.rse.core.subsystems.ISubSystem;
|
import org.eclipse.rse.core.subsystems.ISubSystem;
|
||||||
import org.eclipse.rse.core.subsystems.ISubSystemConfiguration;
|
import org.eclipse.rse.core.subsystems.ISubSystemConfiguration;
|
||||||
|
import org.eclipse.rse.model.DummyHost;
|
||||||
import org.eclipse.rse.model.IHost;
|
import org.eclipse.rse.model.IHost;
|
||||||
|
import org.eclipse.rse.model.IPropertySet;
|
||||||
import org.eclipse.rse.model.ISystemRegistry;
|
import org.eclipse.rse.model.ISystemRegistry;
|
||||||
import org.eclipse.rse.ui.RSEUIPlugin;
|
import org.eclipse.rse.ui.RSEUIPlugin;
|
||||||
|
import org.eclipse.rse.ui.widgets.services.ConnectorServiceElement;
|
||||||
import org.eclipse.rse.ui.widgets.services.FactoryServiceElement;
|
import org.eclipse.rse.ui.widgets.services.FactoryServiceElement;
|
||||||
|
import org.eclipse.rse.ui.widgets.services.PropertyElement;
|
||||||
import org.eclipse.rse.ui.widgets.services.RootServiceElement;
|
import org.eclipse.rse.ui.widgets.services.RootServiceElement;
|
||||||
|
import org.eclipse.rse.ui.widgets.services.ServerLauncherPropertiesServiceElement;
|
||||||
import org.eclipse.rse.ui.widgets.services.ServiceElement;
|
import org.eclipse.rse.ui.widgets.services.ServiceElement;
|
||||||
import org.eclipse.rse.ui.widgets.services.ServicesForm;
|
import org.eclipse.rse.ui.widgets.services.ServicesForm;
|
||||||
import org.eclipse.swt.widgets.Composite;
|
import org.eclipse.swt.widgets.Composite;
|
||||||
|
@ -141,11 +147,41 @@ public class SubSystemServiceWizardPage extends AbstractSystemNewConnectionWizar
|
||||||
if (_root != null)
|
if (_root != null)
|
||||||
{
|
{
|
||||||
_root.commit();
|
_root.commit();
|
||||||
|
|
||||||
_selectedFactory = ((FactoryServiceElement)_form.getSelectedService()).getFactory();
|
_selectedFactory = ((FactoryServiceElement)_form.getSelectedService()).getFactory();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected ServerLauncherPropertiesServiceElement[] getPropertiesServiceElement()
|
||||||
|
{
|
||||||
|
List results = new ArrayList();
|
||||||
|
for (int i = 0; i < _serviceElements.length; i++)
|
||||||
|
{
|
||||||
|
{
|
||||||
|
ServiceElement el = _serviceElements[i];
|
||||||
|
ServiceElement[] children = el.getChildren();
|
||||||
|
if (children != null)
|
||||||
|
{
|
||||||
|
for (int c = 0; c < children.length; c++)
|
||||||
|
{
|
||||||
|
ServiceElement child = children[c];
|
||||||
|
if (child instanceof ConnectorServiceElement)
|
||||||
|
{
|
||||||
|
ServiceElement[] cch = child.getChildren();
|
||||||
|
if (cch != null && cch.length > 0)
|
||||||
|
{
|
||||||
|
ServerLauncherPropertiesServiceElement result = (ServerLauncherPropertiesServiceElement)cch[0];
|
||||||
|
results.add(result);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return (ServerLauncherPropertiesServiceElement[])results.toArray(new ServerLauncherPropertiesServiceElement[results.size()]);
|
||||||
|
}
|
||||||
|
|
||||||
public boolean applyValues(ISubSystem ss)
|
public boolean applyValues(ISubSystem ss)
|
||||||
{
|
{
|
||||||
if (_selectedFactory != null)
|
if (_selectedFactory != null)
|
||||||
|
@ -153,11 +189,36 @@ public class SubSystemServiceWizardPage extends AbstractSystemNewConnectionWizar
|
||||||
IServiceSubSystemConfiguration currentFactory = (IServiceSubSystemConfiguration)ss.getSubSystemConfiguration();
|
IServiceSubSystemConfiguration currentFactory = (IServiceSubSystemConfiguration)ss.getSubSystemConfiguration();
|
||||||
if (currentFactory != null)
|
if (currentFactory != null)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (_selectedFactory != currentFactory)
|
if (_selectedFactory != currentFactory)
|
||||||
{
|
{
|
||||||
((IServiceSubSystem)ss).switchServiceFactory(_selectedFactory);
|
((IServiceSubSystem)ss).switchServiceFactory(_selectedFactory);
|
||||||
}
|
}
|
||||||
|
IHost realHost = ss.getHost();
|
||||||
|
if (_root != null)
|
||||||
|
{
|
||||||
|
{
|
||||||
|
ServerLauncherPropertiesServiceElement[] elements = getPropertiesServiceElement();
|
||||||
|
if (elements.length > 0)
|
||||||
|
{
|
||||||
|
IServerLauncherProperties properties = elements[0].getServerLauncherProperties();
|
||||||
|
|
||||||
|
IConnectorService rserv = ss.getConnectorService();
|
||||||
|
properties.saveToProperties();
|
||||||
|
rserv.setRemoteServerLauncherProperties(properties);
|
||||||
|
/*
|
||||||
|
PropertyElement[] properties = elements[i].getProperties();
|
||||||
|
for (int p = 0; p < properties.length; p++)
|
||||||
|
{
|
||||||
|
PropertyElement pel = properties[p];
|
||||||
|
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
//rserv.addPropertySets(sets);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -44,6 +44,7 @@ import org.eclipse.rse.core.subsystems.util.ISubsystemConfigurationAdapter;
|
||||||
import org.eclipse.rse.filters.ISystemFilter;
|
import org.eclipse.rse.filters.ISystemFilter;
|
||||||
import org.eclipse.rse.filters.ISystemFilterPoolReferenceManager;
|
import org.eclipse.rse.filters.ISystemFilterPoolReferenceManager;
|
||||||
import org.eclipse.rse.filters.ISystemFilterReference;
|
import org.eclipse.rse.filters.ISystemFilterReference;
|
||||||
|
import org.eclipse.rse.internal.persistence.RSEPersistenceManager;
|
||||||
import org.eclipse.rse.model.IHost;
|
import org.eclipse.rse.model.IHost;
|
||||||
import org.eclipse.rse.model.ISubSystemConfigurationCategories;
|
import org.eclipse.rse.model.ISubSystemConfigurationCategories;
|
||||||
import org.eclipse.rse.model.ISystemContainer;
|
import org.eclipse.rse.model.ISystemContainer;
|
||||||
|
@ -2199,6 +2200,8 @@ public class SystemRegistry implements ISystemRegistry, ISystemModelChangeEvents
|
||||||
|
|
||||||
}
|
}
|
||||||
SystemPreferencesManager.getPreferencesManager().setConnectionNamesOrder(); // update preferences order list
|
SystemPreferencesManager.getPreferencesManager().setConnectionNamesOrder(); // update preferences order list
|
||||||
|
|
||||||
|
RSEUIPlugin.getThePersistenceManager().commit(conn);
|
||||||
return conn;
|
return conn;
|
||||||
}
|
}
|
||||||
private ISystemNewConnectionWizardPage[] getApplicableWizardPages(ISubSystemConfiguration ssf, ISystemNewConnectionWizardPage[] allPages)
|
private ISystemNewConnectionWizardPage[] getApplicableWizardPages(ISubSystemConfiguration ssf, ISystemNewConnectionWizardPage[] allPages)
|
||||||
|
|
|
@ -56,12 +56,12 @@ public class PropertyFileProvider implements IRSEPersistenceProvider {
|
||||||
private static final String PROPERTIES_FILE_NAME = "node.properties";
|
private static final String PROPERTIES_FILE_NAME = "node.properties";
|
||||||
|
|
||||||
/* Metatype names */
|
/* Metatype names */
|
||||||
private static final String MT_ATTRIBUTE_TYPE = "attribute-type";
|
private static final String MT_ATTRIBUTE_TYPE = "attr-type";
|
||||||
private static final String MT_ATTRIBUTE = "attribute";
|
private static final String MT_ATTRIBUTE = "attr";
|
||||||
private static final String MT_CHILD = "child";
|
private static final String MT_CHILD = "child";
|
||||||
private static final String MT_NODE_TYPE = "node-type";
|
private static final String MT_NODE_TYPE = "n-type";
|
||||||
private static final String MT_NODE_NAME = "node-name";
|
private static final String MT_NODE_NAME = "n-name";
|
||||||
private static final String MT_REFERENCE = "reference";
|
private static final String MT_REFERENCE = "ref";
|
||||||
|
|
||||||
/* Type abbreviations */
|
/* Type abbreviations */
|
||||||
private static final String AB_SUBSYSTEM = "SS";
|
private static final String AB_SUBSYSTEM = "SS";
|
||||||
|
@ -252,17 +252,22 @@ public class PropertyFileProvider implements IRSEPersistenceProvider {
|
||||||
* @param monitor The progress monitor.
|
* @param monitor The progress monitor.
|
||||||
*/
|
*/
|
||||||
private void writeProperties(Properties properties, String header, IFile file) {
|
private void writeProperties(Properties properties, String header, IFile file) {
|
||||||
|
System.out.println("writing "+file.getFullPath()+"...");
|
||||||
ByteArrayOutputStream outStream = new ByteArrayOutputStream(500);
|
ByteArrayOutputStream outStream = new ByteArrayOutputStream(500);
|
||||||
PrintWriter out = new PrintWriter(outStream);
|
PrintWriter out = new PrintWriter(outStream);
|
||||||
out.println("# " + header);
|
out.println("# " + header);
|
||||||
Map map = new TreeMap(properties);
|
Map map = new TreeMap(properties);
|
||||||
Set keys = map.keySet();
|
Set keys = map.keySet();
|
||||||
|
|
||||||
for (Iterator z = keys.iterator(); z.hasNext();) {
|
for (Iterator z = keys.iterator(); z.hasNext();) {
|
||||||
String key = (String) z.next();
|
String key = (String) z.next();
|
||||||
String value = (String)map.get(key);
|
String value = (String)map.get(key);
|
||||||
out.println(key + "=" + escapeValue(value));
|
String keyvalue = key + "=" + escapeValue(value);
|
||||||
|
System.out.println("writing "+keyvalue);
|
||||||
|
out.println(keyvalue);
|
||||||
}
|
}
|
||||||
out.close();
|
out.close();
|
||||||
|
System.out.println("...wrote "+file.getFullPath());
|
||||||
ByteArrayInputStream inStream = new ByteArrayInputStream(outStream.toByteArray());
|
ByteArrayInputStream inStream = new ByteArrayInputStream(outStream.toByteArray());
|
||||||
try {
|
try {
|
||||||
if (!file.exists()) {
|
if (!file.exists()) {
|
||||||
|
@ -623,7 +628,8 @@ public class PropertyFileProvider implements IRSEPersistenceProvider {
|
||||||
project.refreshLocal(IResource.DEPTH_INFINITE, null);
|
project.refreshLocal(IResource.DEPTH_INFINITE, null);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
}
|
}
|
||||||
IFolder providerFolder = getFolder(project, "org.eclipse.rse.dom.properties");
|
//IFolder providerFolder = getFolder(project, "org.eclipse.rse.dom.properties");
|
||||||
|
IFolder providerFolder = getFolder(project, "dom.properties");
|
||||||
return providerFolder;
|
return providerFolder;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -193,8 +193,15 @@ public abstract class AbstractConnectorService extends RSEModelObject implements
|
||||||
{
|
{
|
||||||
if (_primarySubSystem == null)
|
if (_primarySubSystem == null)
|
||||||
{
|
{
|
||||||
ISubSystem ss = (ISubSystem)_registeredSubSystems.get(0);
|
if (_registeredSubSystems.size() == 0)
|
||||||
_primarySubSystem = ss.getPrimarySubSystem();
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ISubSystem ss = (ISubSystem)_registeredSubSystems.get(0);
|
||||||
|
_primarySubSystem = ss.getPrimarySubSystem();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return _primarySubSystem;
|
return _primarySubSystem;
|
||||||
}
|
}
|
||||||
|
|
|
@ -443,7 +443,14 @@ public class RemoteServerLauncher extends ServerLauncher implements IRemoteServe
|
||||||
return value.equals("true");
|
return value.equals("true");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return getConnectorService().getPrimarySubSystem().getSubSystemConfiguration().supportsServerLaunchType(serverLaunchType);
|
|
||||||
|
ISubSystem primarySS = getConnectorService().getPrimarySubSystem();
|
||||||
|
if (primarySS != null)
|
||||||
|
{
|
||||||
|
return primarySS.getSubSystemConfiguration().supportsServerLaunchType(serverLaunchType);
|
||||||
|
|
||||||
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue