1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-02 06:35:28 +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
* 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) - [252708] Saving Profile Job happens when not changing Property Values on Connections
*******************************************************************************/
package org.eclipse.rse.subsystems.shells.core.subsystems;
@ -136,6 +137,39 @@ public abstract class RemoteCmdSubSystem extends SubSystem implements IRemoteCmd
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
* 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
*/
public void setEnvironmentVariableList(String[] names, String[] values) {
if (areVariablesTheSame(names, values)){
// unchanged so don't bother doing anything
return;
}
removePropertySet(ENVIRONMENT_VARS);
IPropertySet environmentVariables = getEnvironmentVariables();
if (names != null) {

View file

@ -17,6 +17,7 @@
* Martin Oberhuber (Wind River) - [186640] Add IRSESystemType.testProperty()
* 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) - [252708] Saving Profile Job happens when not changing Property Values on Connections
********************************************************************************/
package org.eclipse.rse.internal.ui.propertypages;
@ -99,6 +100,17 @@ public class SystemConnectionPropertyPage extends SystemBasePropertyPage
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
*/
@ -109,20 +121,25 @@ public class SystemConnectionPropertyPage extends SystemBasePropertyPage
{
IHost conn = (IHost)getElement();
ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry();
sr.updateHost( conn, conn.getSystemType(), form.getConnectionName(),form.getHostName(),
form.getConnectionDescription(), form.getDefaultUserId(),
form.getUserIdLocation() );
if (hasConnectionChanged(conn)){
sr.updateHost( conn, conn.getSystemType(), form.getConnectionName(),form.getHostName(),
form.getConnectionDescription(), form.getDefaultUserId(),
form.getUserIdLocation() );
}
// update encoding
String encoding = form.getDefaultEncoding();
boolean isRemoteEncoding = form.isEncodingRemoteDefault();
String currentEncoding = conn.getDefaultEncoding(false);
// user set encoding
if (!isRemoteEncoding) {
if (!isRemoteEncoding && encoding != null && !encoding.equals(currentEncoding)) {
conn.setDefaultEncoding(encoding, false);
}
// remote default encoding
else {
else if (currentEncoding != null){
// remove user encoding from host property first
conn.setDefaultEncoding(null, false);
// 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 McKnight(IBM) - [239257] Tooltip for Filter Pool label is incorrect
* 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;
@ -674,7 +675,25 @@ public class SystemChangeFilterPane extends SystemBaseForm
}
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)
{

View file

@ -11,7 +11,7 @@
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
*
* 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;
@ -79,17 +79,20 @@ public class ConnectorServiceElement extends RSEModelServiceElement
public void commit()
{
super.commit();
ServiceElement[] children = getChildren();
if (children != null)
{
for (int i = 0; i < children.length; i++)
// for bug 252708 - should only be doing a commit if a child has changed
if (_childChanged){
super.commit();
ServiceElement[] children = getChildren();
if (children != null)
{
ServiceElement child = children[i];
child.commit();
for (int i = 0; i < children.length; i++)
{
ServiceElement child = children[i];
child.commit();
}
}
_connectorService.commit();
}
_connectorService.commit();
}
public void revert()

View file

@ -12,7 +12,7 @@
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
*
* 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;
@ -84,14 +84,17 @@ public class RootServiceElement extends ServiceElement
{
// TODO Auto-generated method stub
return null;
}
}
public void commit()
{
ServiceElement[] children = getChildren();
for (int i = 0; i < children.length; i++)
{
children[i].commit();
// for bug 252708 - should only be doing a commit if a child has changed
if (_childChanged){
ServiceElement[] children = getChildren();
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.
*
* 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;
@ -28,6 +28,10 @@ public abstract class ServiceElement
protected ServiceElement _parent;
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)
{
_host = host;
@ -61,6 +65,7 @@ public abstract class ServiceElement
public void childChanged(ServiceElement element)
{
_childChanged = true;
if (_parent != null)
{
_parent.childChanged(element);