1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-15 13:05:22 +02:00

[252708] Saving Profile Job happens when not changing Property Values on Connections

This commit is contained in:
David McKnight 2008-11-07 13:28:48 +00:00
parent aa98f62c9d
commit d97b8d1ac0
6 changed files with 108 additions and 22 deletions

View file

@ -20,6 +20,7 @@
* David McKnight (IBM) - [216252] [api][nls] Resource Strings specific to subsystems should be moved from rse.ui into files.ui / shells.ui / processes.ui where possible * David McKnight (IBM) - [216252] [api][nls] Resource Strings specific to subsystems should be moved from rse.ui into files.ui / shells.ui / processes.ui where possible
* Martin Oberhuber (Wind River) - [218304] Improve deferred adapter loading * Martin Oberhuber (Wind River) - [218304] Improve deferred adapter loading
* David McKnight (IBM) - [230285] [shells] Remote shells should be restored on quit and re-start of RSE * David McKnight (IBM) - [230285] [shells] Remote shells should be restored on quit and re-start of RSE
* David McKnight (IBM) - [252708] Saving Profile Job happens when not changing Property Values on Connections
*******************************************************************************/ *******************************************************************************/
package org.eclipse.rse.subsystems.shells.core.subsystems; package org.eclipse.rse.subsystems.shells.core.subsystems;
@ -136,6 +137,39 @@ public abstract class RemoteCmdSubSystem extends SubSystem implements IRemoteCmd
return result; return result;
} }
private boolean areVariablesTheSame(String[] names, String[] values)
{
IPropertySet environmentVariables = getPropertySet(ENVIRONMENT_VARS);
if (environmentVariables == null || names == null){
return false;
}
else {
String[] originalNames = environmentVariables.getPropertyKeys();
if (originalNames.length != names.length){
return false;
}
else {
for (int i = 0; i < names.length; i++){
String name = names[i];
String originalName = originalNames[i];
// names should be the same (i.e. in same order)
if (!name.equals(originalName)){
return false;
}
else {
String value = values[i];
String originalValue = environmentVariables.getPropertyValue(name);
if (!value.equals(originalValue)){
return false;
}
}
}
}
}
return true;
}
/** /**
* Set the initial environment variable list entries, all in one shot, using * Set the initial environment variable list entries, all in one shot, using
* a pair of String arrays: the first is the environment variable names, the * a pair of String arrays: the first is the environment variable names, the
@ -144,6 +178,11 @@ public abstract class RemoteCmdSubSystem extends SubSystem implements IRemoteCmd
* @param values the array of string values * @param values the array of string values
*/ */
public void setEnvironmentVariableList(String[] names, String[] values) { public void setEnvironmentVariableList(String[] names, String[] values) {
if (areVariablesTheSame(names, values)){
// unchanged so don't bother doing anything
return;
}
removePropertySet(ENVIRONMENT_VARS); removePropertySet(ENVIRONMENT_VARS);
IPropertySet environmentVariables = getEnvironmentVariables(); IPropertySet environmentVariables = getEnvironmentVariables();
if (names != null) { if (names != null) {

View file

@ -17,6 +17,7 @@
* Martin Oberhuber (Wind River) - [186640] Add IRSESystemType.testProperty() * Martin Oberhuber (Wind River) - [186640] Add IRSESystemType.testProperty()
* Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
* David McKnight (IBM) - [226574] don't show encoding if no subsystem supports it * David McKnight (IBM) - [226574] don't show encoding if no subsystem supports it
* David McKnight (IBM) - [252708] Saving Profile Job happens when not changing Property Values on Connections
********************************************************************************/ ********************************************************************************/
package org.eclipse.rse.internal.ui.propertypages; package org.eclipse.rse.internal.ui.propertypages;
@ -99,6 +100,17 @@ public class SystemConnectionPropertyPage extends SystemBasePropertyPage
return (IHost)getElement(); return (IHost)getElement();
} }
private boolean hasConnectionChanged(IHost conn){
if (!conn.getName().equals(form.getConnectionName()) ||
!conn.getHostName().equals(form.getHostName()) ||
!conn.getDescription().equals(form.getConnectionDescription()) ||
!conn.getDefaultUserId().equals(form.getDefaultUserId())){
return true;
}
return false;
}
/** /**
* Called by parent when user presses OK * Called by parent when user presses OK
*/ */
@ -109,20 +121,25 @@ public class SystemConnectionPropertyPage extends SystemBasePropertyPage
{ {
IHost conn = (IHost)getElement(); IHost conn = (IHost)getElement();
ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry(); ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry();
sr.updateHost( conn, conn.getSystemType(), form.getConnectionName(),form.getHostName(),
form.getConnectionDescription(), form.getDefaultUserId(), if (hasConnectionChanged(conn)){
form.getUserIdLocation() ); sr.updateHost( conn, conn.getSystemType(), form.getConnectionName(),form.getHostName(),
form.getConnectionDescription(), form.getDefaultUserId(),
form.getUserIdLocation() );
}
// update encoding // update encoding
String encoding = form.getDefaultEncoding(); String encoding = form.getDefaultEncoding();
boolean isRemoteEncoding = form.isEncodingRemoteDefault(); boolean isRemoteEncoding = form.isEncodingRemoteDefault();
String currentEncoding = conn.getDefaultEncoding(false);
// user set encoding // user set encoding
if (!isRemoteEncoding) { if (!isRemoteEncoding && encoding != null && !encoding.equals(currentEncoding)) {
conn.setDefaultEncoding(encoding, false); conn.setDefaultEncoding(encoding, false);
} }
// remote default encoding // remote default encoding
else { else if (currentEncoding != null){
// remove user encoding from host property first // remove user encoding from host property first
conn.setDefaultEncoding(null, false); conn.setDefaultEncoding(null, false);
// remove default remote encoding to indicate to get from remote system // remove default remote encoding to indicate to get from remote system

View file

@ -15,6 +15,7 @@
* David Dykstal (IBM) - [226561] add API markup to javadoc * David Dykstal (IBM) - [226561] add API markup to javadoc
* David McKnight(IBM) - [239257] Tooltip for Filter Pool label is incorrect * David McKnight(IBM) - [239257] Tooltip for Filter Pool label is incorrect
* Kevin Doyle (IBM) - [235223] Duplicate Filter Strings * Kevin Doyle (IBM) - [235223] Duplicate Filter Strings
* David McKnight (IBM) - [252708] Saving Profile Job happens when not changing Property Values on Connections
*******************************************************************************/ *******************************************************************************/
package org.eclipse.rse.ui.filters; package org.eclipse.rse.ui.filters;
@ -674,7 +675,25 @@ public class SystemChangeFilterPane extends SystemBaseForm
} }
try { try {
mgr.updateSystemFilter(inputFilter, inputFilter.getName(), filterStrings); // before committing, make sure there has been a change
boolean hasChanged = false;
String[] originalFilterStrings = inputFilter.getFilterStrings();
if (originalFilterStrings.length != filterStrings.length){
hasChanged = true;
}
else {
for (int i = 0; i < originalFilterStrings.length && !hasChanged; i++){
String originalFilterString = originalFilterStrings[i];
String filterString = filterStrings[i];
if (!originalFilterString.equals(filterString)){
hasChanged = true;
}
}
}
if (hasChanged){ // for bug 252708 - don't update unless there really is a change
mgr.updateSystemFilter(inputFilter, inputFilter.getName(), filterStrings);
}
} }
catch (SystemMessageException exc) catch (SystemMessageException exc)
{ {

View file

@ -11,7 +11,7 @@
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
* *
* Contributors: * Contributors:
* {Name} (company) - description of contribution. * David McKnight (IBM) - [252708] Saving Profile Job happens when not changing Property Values on Connections
********************************************************************************/ ********************************************************************************/
package org.eclipse.rse.ui.widgets.services; package org.eclipse.rse.ui.widgets.services;
@ -79,17 +79,20 @@ public class ConnectorServiceElement extends RSEModelServiceElement
public void commit() public void commit()
{ {
super.commit(); // for bug 252708 - should only be doing a commit if a child has changed
ServiceElement[] children = getChildren(); if (_childChanged){
if (children != null) super.commit();
{ ServiceElement[] children = getChildren();
for (int i = 0; i < children.length; i++) if (children != null)
{ {
ServiceElement child = children[i]; for (int i = 0; i < children.length; i++)
child.commit(); {
ServiceElement child = children[i];
child.commit();
}
} }
_connectorService.commit();
} }
_connectorService.commit();
} }
public void revert() public void revert()

View file

@ -12,7 +12,7 @@
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
* *
* Contributors: * Contributors:
* {Name} (company) - description of contribution. * David McKnight (IBM) - [252708] Saving Profile Job happens when not changing Property Values on Connections
*******************************************************************************/ *******************************************************************************/
package org.eclipse.rse.ui.widgets.services; package org.eclipse.rse.ui.widgets.services;
@ -88,10 +88,13 @@ public class RootServiceElement extends ServiceElement
public void commit() public void commit()
{ {
ServiceElement[] children = getChildren(); // for bug 252708 - should only be doing a commit if a child has changed
for (int i = 0; i < children.length; i++) if (_childChanged){
{ ServiceElement[] children = getChildren();
children[i].commit(); for (int i = 0; i < children.length; i++)
{
children[i].commit();
}
} }
} }

View file

@ -11,7 +11,7 @@
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
* *
* Contributors: * Contributors:
* {Name} (company) - description of contribution. * David McKnight (IBM) - [252708] Saving Profile Job happens when not changing Property Values on Connections
********************************************************************************/ ********************************************************************************/
package org.eclipse.rse.ui.widgets.services; package org.eclipse.rse.ui.widgets.services;
@ -28,6 +28,10 @@ public abstract class ServiceElement
protected ServiceElement _parent; protected ServiceElement _parent;
protected boolean _isSelected = false; protected boolean _isSelected = false;
// indicates whether a child of this element has changed
// this is used to determine whether or not a commit is required
protected boolean _childChanged = false;
public ServiceElement(IHost host, ServiceElement parent) public ServiceElement(IHost host, ServiceElement parent)
{ {
_host = host; _host = host;
@ -61,6 +65,7 @@ public abstract class ServiceElement
public void childChanged(ServiceElement element) public void childChanged(ServiceElement element)
{ {
_childChanged = true;
if (_parent != null) if (_parent != null)
{ {
_parent.childChanged(element); _parent.childChanged(element);