Commit c5a8e15b authored by Knut Petter Svendsen's avatar Knut Petter Svendsen

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's avatarOrgad Shaneh <orgads@gmail.com>
parent 48fdbe24
......@@ -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 << ")";
......
......@@ -264,6 +264,7 @@ private:
FileStatus::Status getFileStatus(const QString &fileName) const;
void updateStatusForFile(const QString &absFile);
void updateEditDerivedObjectWarning(const QString &fileName, const FileStatus::Status status);
ClearCaseSettings m_settings;
......
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