24 #include "internal/berryWorkbenchPlugin.h"
32 class PropChangedRunnable :
public SafeRunnable
38 IPropertyChangeListener::Events::EventType::AbstractDelegate* delegate;
40 PropChangedRunnable(PropertyChangeEvent::
Pointer event)
46 delegate->Execute(event);
54 WorkbenchPart::~WorkbenchPart()
62 m_ContentDescription(
"")
67 void WorkbenchPart::InternalSetContentDescription(
68 const QString& description)
73 if (this->m_ContentDescription == description)
77 this->m_ContentDescription = description;
82 void WorkbenchPart::InternalSetPartName(
const QString& partName)
89 if (this->m_PartName == partName)
93 this->m_PartName = partName;
113 this->m_PartSite = site;
125 if (this->m_TitleImage.cacheKey() == titleImage.cacheKey())
129 this->m_TitleImage = titleImage;
137 if (this->m_ToolTip == toolTip)
141 this->m_ToolTip = toolTip;
148 InternalSetPartName(partName);
155 InternalSetContentDescription(description);
161 const QString& oldValue,
const QString& newValue)
171 const ListenerList& listeners =
173 for (
auto iter = listeners.begin(); iter
174 != listeners.end(); ++iter)
176 runnable->delegate = *iter;
191 const ListenerList& listeners =
193 for (
auto iter = listeners.begin(); iter
194 != listeners.end(); ++iter)
196 runnable->delegate = *iter;
212 const QString& value)
214 QHash<QString, QString>::iterator iter = partProperties.find(key);
216 if (iter != partProperties.end())
217 oldValue = iter.value();
221 partProperties.remove(key);
225 partProperties.insert(key, value);
232 QHash<QString, QString>::const_iterator itr = partProperties.find(key);
233 if (itr == partProperties.end())
return "";
240 return partProperties;
245 return this->m_PartSite;
250 return this->m_PartName;
255 return this->m_ContentDescription;
260 return this->m_TitleImage;
266 return this->m_ToolTip;
273 m_ConfigElement = cfig;
276 m_PartName = cfig->GetAttribute(
"name");
277 m_Title = m_PartName;
280 QString strIcon = cfig->GetAttribute(
"icon");
281 if (strIcon.isEmpty())
287 m_ConfigElement->GetContributor()->GetName(), strIcon);
void RemoveListener(IPropertyChangeListener *listener)
DelegateList< AbstractDelegate >::ListType ListenerList
itk::SmartPointer< Self > Pointer
static void Run(ISafeRunnable::Pointer code)
virtual void SetPartName(const QString &partName)
void SetInitializationData(const IConfigurationElement::Pointer &cfig, const QString &propertyName, const Object::Pointer &data) override
static const int PROP_PART_NAME
void SetSite(IWorkbenchPartSite::Pointer site)
void SetPartProperty(const QString &key, const QString &value) override
berry::SmartPointer< Self > Pointer
QIcon GetTitleImage() const override
#define berryObjectMacro(...)
void AddPropertyListener(IPropertyChangeListener *l) override
static const int PROP_TITLE
static const int PROP_CONTENT_DESCRIPTION
const QHash< QString, QString > & GetPartProperties() const override
void FirePropertyChanged(const QString &key, const QString &oldValue, const QString &newValue)
virtual void CheckSite(IWorkbenchPartSite::Pointer site)
void AddListener(IPropertyChangeListener *listener)
QString GetPartName() const override
virtual void SetTitleToolTip(const QString &toolTip)
ListenerList GetListeners() const
virtual void SetContentDescription(const QString &description)
void FirePropertyChange(int propertyId)
static void Run(ISafeRunnable::Pointer runnable)
static const QString INTEGER_PROPERTY
void RemovePropertyListener(IPropertyChangeListener *l) override
QString GetContentDescription() const override
virtual void SetTitleImage(const QIcon &titleImage)
static QIcon ImageDescriptorFromPlugin(const QString &pluginId, const QString &imageFilePath)
QString GetTitleToolTip() const override
QString GetPartProperty(const QString &key) const override
IWorkbenchPartSite::Pointer GetSite() const override