1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-08 11:38:21 +02:00

Added additional error to rename when def is locekd

This commit is contained in:
Brian Fiete 2019-09-07 15:18:32 -07:00
parent f2a2c27513
commit 3616305378
2 changed files with 50 additions and 13 deletions

View file

@ -96,6 +96,28 @@ namespace IDE
mFileDeleted = !File.Exists(mFilePath);
return mFileDeleted;
}
public bool IsLocked()
{
if (mEditWidget != null)
{
if (let sourceEditWidgetContent = mEditWidget.mEditWidgetContent as SourceEditWidgetContent)
{
if (sourceEditWidgetContent.mSourceViewPanel != null)
{
if (sourceEditWidgetContent.mSourceViewPanel.IsReadOnly)
return true;
}
}
}
for (var projectSource in mProjectSources)
{
if (projectSource.mProject.mLocked)
return true;
}
return false;
}
public ~this()
{

View file

@ -219,6 +219,33 @@ namespace IDE.ui
mResolveParams.mTypeGenericParamIdx = int32.Parse(lineDataItr.GetNext().Get());
case "methodGenericParam":
mResolveParams.mMethodGenericParamIdx = int32.Parse(lineDataItr.GetNext().Get());
case "defLoc":
if (mKind == .Rename)
{
StringView filePath = lineDataItr.GetNext().Get();
let editData = gApp.GetEditData(scope String(filePath), false, false);
if (editData != null)
{
for (var projectSource in editData.mProjectSources)
{
if (projectSource.mProject.mLocked)
{
gApp.Fail(scope String()..AppendF("Symbol definition is located in locked project '{}' and cannot be renamed until the lock is removed.", projectSource.mProject.mProjectName));
mFailed = true;
Close();
return;
}
}
if (editData.IsLocked())
{
gApp.Fail(scope String()..AppendF("Symbol definition is located in locked file '{}' and cannot be renamed until the lock is removed.", filePath));
mFailed = true;
Close();
return;
}
}
}
}
}
@ -440,19 +467,7 @@ namespace IDE.ui
if (mKind == .Rename)
{
if (let sourceEditWidgetContent = editData.mEditWidget.mEditWidgetContent as SourceEditWidgetContent)
{
if (sourceEditWidgetContent.mSourceViewPanel != null)
{
replaceSymbolData.mIsLocked = sourceEditWidgetContent.mSourceViewPanel.IsReadOnly;
}
for (var projectSource in editData.mProjectSources)
{
if (projectSource.mProject.mLocked)
replaceSymbolData.mIsLocked = true;
}
}
replaceSymbolData.mIsLocked = editData.IsLocked();
}
var spanData = parserData.GetNext().Get().Split(' ');