From 0f47ce8874eeff7b7f1552bca371e88481abc06f Mon Sep 17 00:00:00 2001 From: David Dykstal Date: Thu, 2 Nov 2006 21:22:51 +0000 Subject: [PATCH] Bug 162489 - subsystem port number not being persisted --- .../internal/persistence/dom/RSEDOMExporter.java | 1 + .../internal/persistence/dom/RSEDOMImporter.java | 16 ++++++++++++++-- .../UI/org/eclipse/rse/ui/SystemResources.java | 3 +++ .../eclipse/rse/ui/SystemResources.properties | 3 +++ .../SystemSubSystemPropertyPageCoreForm.java | 1 + .../core/subsystems/SubSystemConfiguration.java | 4 ++++ 6 files changed, 26 insertions(+), 2 deletions(-) diff --git a/rse/plugins/org.eclipse.rse.core/persistence/org/eclipse/rse/internal/persistence/dom/RSEDOMExporter.java b/rse/plugins/org.eclipse.rse.core/persistence/org/eclipse/rse/internal/persistence/dom/RSEDOMExporter.java index d6aa18949ee..1c727210bf1 100644 --- a/rse/plugins/org.eclipse.rse.core/persistence/org/eclipse/rse/internal/persistence/dom/RSEDOMExporter.java +++ b/rse/plugins/org.eclipse.rse.core/persistence/org/eclipse/rse/internal/persistence/dom/RSEDOMExporter.java @@ -323,6 +323,7 @@ public class RSEDOMExporter implements IRSEDOMExporter { // can't do this til connector service owns the properties (right now it's still subsystem) node.addAttribute(IRSEDOMConstants.ATTRIBUTE_GROUP, connectorService.getName()); node.addAttribute(IRSEDOMConstants.ATTRIBUTE_USE_SSL, getBooleanString(connectorService.isUsingSSL())); + node.addAttribute(IRSEDOMConstants.ATTRIBUTE_PORT, Integer.toString(connectorService.getPort())); } // store the server launcher // right now subsystem still owns the server launchers diff --git a/rse/plugins/org.eclipse.rse.core/persistence/org/eclipse/rse/internal/persistence/dom/RSEDOMImporter.java b/rse/plugins/org.eclipse.rse.core/persistence/org/eclipse/rse/internal/persistence/dom/RSEDOMImporter.java index d98e0d79258..0a107396d12 100644 --- a/rse/plugins/org.eclipse.rse.core/persistence/org/eclipse/rse/internal/persistence/dom/RSEDOMImporter.java +++ b/rse/plugins/org.eclipse.rse.core/persistence/org/eclipse/rse/internal/persistence/dom/RSEDOMImporter.java @@ -172,6 +172,11 @@ public class RSEDOMImporter implements IRSEDOMImporter // String type = connectorServiceNode.getAttribute(IRSEDOMConstants.ATTRIBUTE_TYPE).getValue(); // String group = connectorServiceNode.getAttribute(IRSEDOMConstants.ATTRIBUTE_GROUP).getValue(); boolean useSSL = getBooleanValue(connectorServiceNode.getAttribute(IRSEDOMConstants.ATTRIBUTE_USE_SSL).getValue()); + RSEDOMNodeAttribute att = connectorServiceNode.getAttribute(IRSEDOMConstants.ATTRIBUTE_PORT); + int port = 0; + if (att != null) { + port = getIntegerValue(att.getValue()); + } // first restore subsystems (since right now we need subsystem to get at service RSEDOMNode[] ssChildren = connectorServiceNode.getChildren(IRSEDOMConstants.TYPE_SUBSYSTEM); @@ -201,7 +206,7 @@ public class RSEDOMImporter implements IRSEDOMImporter } } } - + service.setPort(port); service.setIsUsingSSL(useSSL); } } @@ -532,7 +537,14 @@ public class RSEDOMImporter implements IRSEDOMImporter private int getIntegerValue(String integerString) { - return Integer.parseInt(integerString); + int result = 0; + if (integerString != null) { + try { + result = Integer.parseInt(integerString); + } catch (NumberFormatException e) { + } + } + return result; } /** diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/SystemResources.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/SystemResources.java index da38d04cef9..bfa521c7ef9 100644 --- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/SystemResources.java +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/SystemResources.java @@ -223,6 +223,9 @@ public class SystemResources extends NLS public static String RESID_CONNECTION_DEFAULTUSERID_TIP; public static String RESID_CONNECTION_DEFAULTUSERID_INHERITBUTTON_TIP; + public static String RESID_CONNECTION_RUNNING_PORT_LABEL; + public static String RESID_CONNECTION_RUNNING_PORT_TIP; + public static String RESID_CONNECTION_PORT_LABEL; public static String RESID_CONNECTION_PORT_TIP; diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/SystemResources.properties b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/SystemResources.properties index 7c100f8a9cf..38165e98440 100644 --- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/SystemResources.properties +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/SystemResources.properties @@ -315,6 +315,9 @@ RESID_CONNECTION_DEFAULTUSERID_LABEL=Default User ID RESID_CONNECTION_DEFAULTUSERID_TIP=Default user ID for subsystems that don't specify a user ID RESID_CONNECTION_DEFAULTUSERID_INHERITBUTTON_TIP=Inherit from preferences, or set locally for this connection +RESID_CONNECTION_RUNNING_PORT_LABEL=Running Server Port +RESID_CONNECTION_RUNNING_PORT_TIP=Port number used by a running server + RESID_CONNECTION_PORT_LABEL=Port RESID_CONNECTION_PORT_TIP=Port number used to do the connection diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemSubSystemPropertyPageCoreForm.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemSubSystemPropertyPageCoreForm.java index 5a52a473335..dd1317a910b 100644 --- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemSubSystemPropertyPageCoreForm.java +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemSubSystemPropertyPageCoreForm.java @@ -348,6 +348,7 @@ public class SystemSubSystemPropertyPageCoreForm extends AbstractSystemSubSystem String userId = getUserId(); updateUserId(ss); } + ss.commit(); } return ok; } diff --git a/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/subsystems/SubSystemConfiguration.java b/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/subsystems/SubSystemConfiguration.java index e998fb59c2a..afce6cc3998 100644 --- a/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/subsystems/SubSystemConfiguration.java +++ b/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/subsystems/SubSystemConfiguration.java @@ -1487,6 +1487,10 @@ public abstract class SubSystemConfiguration implements ISubSystemConfiguration { connectorService.setPort(port); } + if (connectorService.isDirty()) { + setDirty(true); + subsystem.setDirty(true); + } } else {