Commit 529ac8d8 authored by amccaskey's avatar amccaskey
Browse files

Committing first pass at rename persistence support.


Signed-off-by: default avataramccaskey <mccaskeyaj@ornl.gov>
parent 057ca647
......@@ -79,7 +79,6 @@ public interface IProcessEventListener {
logger.error("Extension Point " + id + "does not exist");
}
System.out.println("Returning a valid IProcessEventListener");
return listener;
}
}
\ No newline at end of file
......@@ -67,7 +67,6 @@ public interface ISimpleResourceProvider {
logger.error("Extension Point " + id + "does not exist");
}
System.out.println("Returning a valid ISimpleResourceProvider");
return provider;
}
}
\ No newline at end of file
......@@ -63,7 +63,6 @@ public interface IUpdateEventListener {
logger.error("Extension Point " + id + "does not exist");
}
System.out.println("Returning a valid IUpdateEventListener");
return listener;
}
}
\ No newline at end of file
......@@ -230,4 +230,10 @@ public class FakePersistenceProvider implements IPersistenceProvider {
// TODO Auto-generated method stub
return null;
}
@Override
public boolean renameItem(Item item, String newName) {
// TODO Auto-generated method stub
return false;
}
}
\ No newline at end of file
......@@ -1044,6 +1044,7 @@ public class ItemManager implements ItemListener {
*/
public void renameItem(int itemID, String name) {
itemList.get(itemID).setName(name);
provider.renameItem(itemList.get(itemID), name);
}
/**
......
......@@ -94,6 +94,14 @@ public interface IPersistenceProvider {
*/
public boolean updateItem(Item item);
/**
*
* @param item
* @param newName
* @return
*/
public boolean renameItem(Item item, String newName);
/**
* Returns all the Items in the persistence piece.
*
......
......@@ -479,6 +479,8 @@ public class XMLPersistenceProvider
// Deal with simple Form write requests from the IWriter
// interface.
writeFile(currentTask.form, currentTask.file);
} else if("rename".equals(currentTask.task)) {
itemIdMap.put(currentTask.item.getId(), currentTask.file.getName());
}
} else {
// Otherwise sleep for a bit
......@@ -520,6 +522,12 @@ public class XMLPersistenceProvider
}
@Override
public boolean renameItem(Item item, String newName) {
IFile newFile = item.getProject().getFile(newName);
return submitTask(item, "rename", item.getForm(), newFile);
}
/**
* A private utility operation that submits a persistence task to the queue.
*
......@@ -545,6 +553,10 @@ public class XMLPersistenceProvider
// Setup the task
task.item = item;
task.task = taskName;
if (file != null) {
task.file = file;
}
// Submit the task
try {
taskQueue.add(task);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment