/**
* <p>Copyright: Copyright (c) 2009</p>
* <p>Company: �������ӹɷ�����˾</p>
*/
package com.hundsun.ares.studio.internal.ui.refactoring;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.ltk.core.refactoring.Change;
import org.eclipse.ltk.core.refactoring.resource.ResourceChange;
import com.hundsun.ares.studio.core.IARESModule;
/**
*
* @author sundl
*/
public class RenameModuleChange extends ResourceChange {
private IARESModule module;
private String newName;
public RenameModuleChange(IARESModule module, String newName) {
this.module = module;
this.newName = newName;
}
/* (non-Javadoc)
* @see org.eclipse.ltk.core.refactoring.resource.ResourceChange#getModifiedResource()
*/
@Override
protected IResource getModifiedResource() {
return module.getResource();
}
/* (non-Javadoc)
* @see org.eclipse.ltk.core.refactoring.Change#getName()
*/
@Override
public String getName() {
return "ģ��" + module.getShortName() + "������Ϊ" + newName;
}
/* (non-Javadoc)
* @see org.eclipse.ltk.core.refactoring.Change#perform(org.eclipse.core.runtime.IProgressMonitor)
*/
@Override
public Change perform(IProgressMonitor pm) throws CoreException {
module.rename(newName, true, null);
return new RenameModuleChange(module, module.getShortName());
}
}