forked from qt-creator/qt-creator
ClearCase: Give warning if editing a Derived Object
Derived objects (DO) are created during builds with ClearCase build tools (e.g., clearmake). They are used for build avoidance and derived object sharing. DOs are typically object files, but can also be source code generated from code generation tools. It is probably never a good idea to edit such a file. Change-Id: If4248f09409424ee771aab720851bb6ce1aa40c9 Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
@@ -48,6 +48,7 @@
|
||||
#include <coreplugin/documentmanager.h>
|
||||
#include <coreplugin/editormanager/editormanager.h>
|
||||
#include <coreplugin/icore.h>
|
||||
#include <coreplugin/infobar.h>
|
||||
#include <coreplugin/messagemanager.h>
|
||||
#include <coreplugin/mimedatabase.h>
|
||||
#include <coreplugin/progressmanager/progressmanager.h>
|
||||
@@ -244,6 +245,32 @@ void ClearCasePlugin::updateStatusForFile(const QString &absFile)
|
||||
setStatus(absFile, getFileStatus(absFile), false);
|
||||
}
|
||||
|
||||
/// Give warning if a derived object is edited
|
||||
void ClearCasePlugin::updateEditDerivedObjectWarning(const QString &fileName,
|
||||
const FileStatus::Status status)
|
||||
{
|
||||
if (!isDynamic())
|
||||
return;
|
||||
|
||||
Core::IDocument *curDocument = Core::EditorManager::currentDocument();
|
||||
if (!curDocument)
|
||||
return;
|
||||
|
||||
Core::InfoBar *infoBar = curDocument->infoBar();
|
||||
const Core::Id derivedObjectWarning("ClearCase.DerivedObjectWarning");
|
||||
|
||||
if (status == FileStatus::Derived) {
|
||||
if (!infoBar->canInfoBeAdded(derivedObjectWarning))
|
||||
return;
|
||||
|
||||
infoBar->addInfo(Core::InfoBarEntry(derivedObjectWarning,
|
||||
tr("Editing Derived Object: %1")
|
||||
.arg(fileName)));
|
||||
} else {
|
||||
infoBar->removeInfo(derivedObjectWarning);
|
||||
}
|
||||
}
|
||||
|
||||
FileStatus::Status ClearCasePlugin::getFileStatus(const QString &fileName) const
|
||||
{
|
||||
QTC_CHECK(!fileName.isEmpty());
|
||||
@@ -788,6 +815,8 @@ void ClearCasePlugin::updateStatusActions()
|
||||
checkAndReIndexUnknownFile(absoluteFileName);
|
||||
fileStatus = vcsStatus(absoluteFileName);
|
||||
|
||||
updateEditDerivedObjectWarning(absoluteFileName, fileStatus.status);
|
||||
|
||||
if (Constants::debug)
|
||||
qDebug() << Q_FUNC_INFO << absoluteFileName << ", status = "
|
||||
<< fileStatusToText(fileStatus.status) << "(" << fileStatus.status << ")";
|
||||
|
||||
Reference in New Issue
Block a user