bug fix in renaming form .pas file

This commit is contained in:
Бондарев Иван 2015-10-11 18:50:08 +02:00
parent f4074e035a
commit f35fe33171
4 changed files with 16 additions and 3 deletions

View file

@ -263,6 +263,7 @@ namespace VisualPascalABCPlugins
void RenameFile(string OldFileName, string NewFileName);
void CloseFile(string FileName);
void ReloadFile(string FileName);
bool SaveAll(bool Question);
void SetFileAsChanged(string FileName);
void OpenTabWithText(string tabName, string Text);
ICodeFileDocument OpenFileForDebug(string FileName);
@ -282,6 +283,7 @@ namespace VisualPascalABCPlugins
void DisableDesigner();
void EnableDesigner();
void GenerateAllDesignersCode();
void SetActiveDesignerDirty();
}
public interface IWorkbenchRunService

View file

@ -391,9 +391,10 @@ namespace VisualPascalABC
{
ProjectFactory.Instance.CurrentProject.MainFile = System.IO.Path.Combine(ProjectFactory.Instance.CurrentProject.ProjectDirectory,e.Label);
}
VisualPABCSingleton.MainForm.RenameFile(oldFileName,fi.Path);
WorkbenchServiceFactory.FileService.RenameFile(oldFileName, fi.Path);
CodeCompletionActionsManager.RenameUnit(fi.Path, Path.GetFileNameWithoutExtension(e.Label));
string oldFileNameWithoutExt = Path.Combine(Path.GetDirectoryName(oldFileName),Path.GetFileNameWithoutExtension(oldFileName));
string newFilePath = Path.Combine(Path.GetDirectoryName(oldFileName), e.Label);
if (File.Exists(oldFileNameWithoutExt+".fmabc"))
{
string fmabcFullName = Path.Combine(Path.GetDirectoryName(oldFileName), oldFileNameWithoutExt + ".fmabc");
@ -401,7 +402,11 @@ namespace VisualPascalABC
File.Delete(fmabcFullName);
}
ProjectFactory.Instance.SaveProject();
VisualPABCSingleton.MainForm.SaveAll(false);
WorkbenchServiceFactory.FileService.SaveAll(false);
WorkbenchServiceFactory.FileService.CloseFile(newFilePath);
WorkbenchServiceFactory.FileService.OpenFile(newFilePath, Path.GetFileName(newFilePath));
WorkbenchServiceFactory.DesignerService.SetActiveDesignerDirty();
WorkbenchServiceFactory.DesignerService.GenerateAllDesignersCode();
/*if (File.Exists(oldFileNameWithoutExt + ".resources"))
{
string fmabcFullName = Path.Combine(Path.GetDirectoryName(oldFileName), oldFileNameWithoutExt + ".fmabc");

View file

@ -26,6 +26,12 @@ namespace VisualPascalABC
}
}
public void SetActiveDesignerDirty()
{
if (_currentCodeFileDocument.Designer != null)
_currentCodeFileDocument.Designer.IsDirty = true;
}
public void UpdateDesignerIsActive()
{
bool active =

View file

@ -398,7 +398,7 @@ namespace VisualPascalABC
}
internal bool SaveAll(bool Question)
public bool SaveAll(bool Question)
{
if (ProjectFactory.Instance.ProjectLoaded && Question)
{