mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-03 23:25:26 +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();
|
||||
}
|
||||
|
||||
public IServerLauncherProperties getServerLauncherProperties()
|
||||
{
|
||||
return _launcherProperties;
|
||||
}
|
||||
}
|
|
@ -41,6 +41,21 @@ public abstract class ServiceElement
|
|||
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@ import org.eclipse.core.runtime.IExtensionRegistry;
|
|||
import org.eclipse.core.runtime.Platform;
|
||||
import org.eclipse.jface.wizard.IWizardPage;
|
||||
import org.eclipse.rse.core.IRSESystemType;
|
||||
import org.eclipse.rse.model.IHost;
|
||||
import org.eclipse.rse.ui.ISystemIconConstants;
|
||||
import org.eclipse.rse.ui.RSEUIPlugin;
|
||||
import org.eclipse.rse.ui.SystemResources;
|
||||
|
@ -278,4 +279,5 @@ public class RSENewConnectionWizard extends AbstractSystemWizard implements IRSE
|
|||
|
||||
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.IServiceSubSystemConfiguration;
|
||||
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.ISubSystemConfiguration;
|
||||
import org.eclipse.rse.model.DummyHost;
|
||||
import org.eclipse.rse.model.IHost;
|
||||
import org.eclipse.rse.model.IPropertySet;
|
||||
import org.eclipse.rse.model.ISystemRegistry;
|
||||
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.PropertyElement;
|
||||
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.ServicesForm;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
|
@ -141,10 +147,40 @@ public class SubSystemServiceWizardPage extends AbstractSystemNewConnectionWizar
|
|||
if (_root != null)
|
||||
{
|
||||
_root.commit();
|
||||
|
||||
_selectedFactory = ((FactoryServiceElement)_form.getSelectedService()).getFactory();
|
||||
}
|
||||
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)
|
||||
{
|
||||
|
@ -153,11 +189,36 @@ public class SubSystemServiceWizardPage extends AbstractSystemNewConnectionWizar
|
|||
IServiceSubSystemConfiguration currentFactory = (IServiceSubSystemConfiguration)ss.getSubSystemConfiguration();
|
||||
if (currentFactory != null)
|
||||
{
|
||||
|
||||
if (_selectedFactory != currentFactory)
|
||||
{
|
||||
((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;
|
||||
|
|
|
@ -44,6 +44,7 @@ import org.eclipse.rse.core.subsystems.util.ISubsystemConfigurationAdapter;
|
|||
import org.eclipse.rse.filters.ISystemFilter;
|
||||
import org.eclipse.rse.filters.ISystemFilterPoolReferenceManager;
|
||||
import org.eclipse.rse.filters.ISystemFilterReference;
|
||||
import org.eclipse.rse.internal.persistence.RSEPersistenceManager;
|
||||
import org.eclipse.rse.model.IHost;
|
||||
import org.eclipse.rse.model.ISubSystemConfigurationCategories;
|
||||
import org.eclipse.rse.model.ISystemContainer;
|
||||
|
@ -2199,6 +2200,8 @@ public class SystemRegistry implements ISystemRegistry, ISystemModelChangeEvents
|
|||
|
||||
}
|
||||
SystemPreferencesManager.getPreferencesManager().setConnectionNamesOrder(); // update preferences order list
|
||||
|
||||
RSEUIPlugin.getThePersistenceManager().commit(conn);
|
||||
return conn;
|
||||
}
|
||||
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";
|
||||
|
||||
/* Metatype names */
|
||||
private static final String MT_ATTRIBUTE_TYPE = "attribute-type";
|
||||
private static final String MT_ATTRIBUTE = "attribute";
|
||||
private static final String MT_ATTRIBUTE_TYPE = "attr-type";
|
||||
private static final String MT_ATTRIBUTE = "attr";
|
||||
private static final String MT_CHILD = "child";
|
||||
private static final String MT_NODE_TYPE = "node-type";
|
||||
private static final String MT_NODE_NAME = "node-name";
|
||||
private static final String MT_REFERENCE = "reference";
|
||||
private static final String MT_NODE_TYPE = "n-type";
|
||||
private static final String MT_NODE_NAME = "n-name";
|
||||
private static final String MT_REFERENCE = "ref";
|
||||
|
||||
/* Type abbreviations */
|
||||
private static final String AB_SUBSYSTEM = "SS";
|
||||
|
@ -252,17 +252,22 @@ public class PropertyFileProvider implements IRSEPersistenceProvider {
|
|||
* @param monitor The progress monitor.
|
||||
*/
|
||||
private void writeProperties(Properties properties, String header, IFile file) {
|
||||
System.out.println("writing "+file.getFullPath()+"...");
|
||||
ByteArrayOutputStream outStream = new ByteArrayOutputStream(500);
|
||||
PrintWriter out = new PrintWriter(outStream);
|
||||
out.println("# " + header);
|
||||
Map map = new TreeMap(properties);
|
||||
Set keys = map.keySet();
|
||||
|
||||
for (Iterator z = keys.iterator(); z.hasNext();) {
|
||||
String key = (String) z.next();
|
||||
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();
|
||||
System.out.println("...wrote "+file.getFullPath());
|
||||
ByteArrayInputStream inStream = new ByteArrayInputStream(outStream.toByteArray());
|
||||
try {
|
||||
if (!file.exists()) {
|
||||
|
@ -623,7 +628,8 @@ public class PropertyFileProvider implements IRSEPersistenceProvider {
|
|||
project.refreshLocal(IResource.DEPTH_INFINITE, null);
|
||||
} 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;
|
||||
}
|
||||
|
||||
|
|
|
@ -193,8 +193,15 @@ public abstract class AbstractConnectorService extends RSEModelObject implements
|
|||
{
|
||||
if (_primarySubSystem == null)
|
||||
{
|
||||
ISubSystem ss = (ISubSystem)_registeredSubSystems.get(0);
|
||||
_primarySubSystem = ss.getPrimarySubSystem();
|
||||
if (_registeredSubSystems.size() == 0)
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
ISubSystem ss = (ISubSystem)_registeredSubSystems.get(0);
|
||||
_primarySubSystem = ss.getPrimarySubSystem();
|
||||
}
|
||||
}
|
||||
return _primarySubSystem;
|
||||
}
|
||||
|
|
|
@ -443,7 +443,14 @@ public class RemoteServerLauncher extends ServerLauncher implements IRemoteServe
|
|||
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