1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-17 21:25:58 +02:00

fix for a rename problem while investigating [170728]

This commit is contained in:
David McKnight 2007-01-26 16:48:16 +00:00
parent 281e9cad54
commit 6cd80af8ef
3 changed files with 21 additions and 16 deletions

View file

@ -324,18 +324,21 @@ public class DStoreHostFile implements IHostFile
public void renameTo(String newAbsolutePath) public void renameTo(String newAbsolutePath)
{ {
String current = getName(); String current = getName();
if (newAbsolutePath.endsWith(current))
{
// data element already updated
}
else
{
int lastSep = newAbsolutePath.lastIndexOf('/'); int lastSep = newAbsolutePath.lastIndexOf('/');
if (lastSep == -1) if (lastSep == -1)
lastSep = newAbsolutePath.lastIndexOf('\\'); lastSep = newAbsolutePath.lastIndexOf('\\');
String newName = newAbsolutePath.substring(lastSep + 1); String newName = newAbsolutePath.substring(lastSep + 1);
if (newName.equals(current))
{
// data element already updated
}
else
{
_element.setAttribute(DE.A_NAME, newName); _element.setAttribute(DE.A_NAME, newName);
} }

View file

@ -2611,14 +2611,15 @@ public class SystemView extends TreeViewer implements ISystemTree, ISystemResour
Vector matches = null; Vector matches = null;
// STEP 1: get the object's remote adapter and subsystem // STEP 1: get the object's remote adapter and subsystem
//String newElementName = null; String newElementName = null;
ISystemRemoteElementAdapter rmtAdapter = null; ISystemRemoteElementAdapter rmtAdapter = null;
if (renameObject instanceof String) { if (renameObject instanceof String) {
//FIXME How to get the adapter based on the String name? //FIXME How to get the adapter based on the String name?
//newElementName = (String)renameObject; newElementName = (String)renameObject;
} else { } else {
rmtAdapter = getRemoteAdapter(renameObject); rmtAdapter = getRemoteAdapter(renameObject);
subsystem = rmtAdapter.getSubSystem(renameObject); subsystem = rmtAdapter.getSubSystem(renameObject);
newElementName = rmtAdapter.getName(renameObject);
} }
// STEP 2: find all references to the old name object // STEP 2: find all references to the old name object
@ -2645,10 +2646,10 @@ public class SystemView extends TreeViewer implements ISystemTree, ISystemResour
} }
// rename explicitly here (since internalUpdate doesn't seem to have an effect // rename explicitly here (since internalUpdate doesn't seem to have an effect
String newName = rmtAdapter.getName(data); System.out.println("setting name to "+newElementName);
match.setText(newName); match.setText(newElementName);
internalUpdate(match, data, properties); //internalUpdate(match, data, properties);
//update(data, properties); // for refreshing non-structural properties in viewer when model changes //update(data, properties); // for refreshing non-structural properties in viewer when model changes
//System.out.println("Match found. refresh required? " + refresh); //System.out.println("Match found. refresh required? " + refresh);

View file

@ -2611,14 +2611,15 @@ public class SystemView extends TreeViewer implements ISystemTree, ISystemResour
Vector matches = null; Vector matches = null;
// STEP 1: get the object's remote adapter and subsystem // STEP 1: get the object's remote adapter and subsystem
//String newElementName = null; String newElementName = null;
ISystemRemoteElementAdapter rmtAdapter = null; ISystemRemoteElementAdapter rmtAdapter = null;
if (renameObject instanceof String) { if (renameObject instanceof String) {
//FIXME How to get the adapter based on the String name? //FIXME How to get the adapter based on the String name?
//newElementName = (String)renameObject; newElementName = (String)renameObject;
} else { } else {
rmtAdapter = getRemoteAdapter(renameObject); rmtAdapter = getRemoteAdapter(renameObject);
subsystem = rmtAdapter.getSubSystem(renameObject); subsystem = rmtAdapter.getSubSystem(renameObject);
newElementName = rmtAdapter.getName(renameObject);
} }
// STEP 2: find all references to the old name object // STEP 2: find all references to the old name object
@ -2645,10 +2646,10 @@ public class SystemView extends TreeViewer implements ISystemTree, ISystemResour
} }
// rename explicitly here (since internalUpdate doesn't seem to have an effect // rename explicitly here (since internalUpdate doesn't seem to have an effect
String newName = rmtAdapter.getName(data); System.out.println("setting name to "+newElementName);
match.setText(newName); match.setText(newElementName);
internalUpdate(match, data, properties); //internalUpdate(match, data, properties);
//update(data, properties); // for refreshing non-structural properties in viewer when model changes //update(data, properties); // for refreshing non-structural properties in viewer when model changes
//System.out.println("Match found. refresh required? " + refresh); //System.out.println("Match found. refresh required? " + refresh);