Skip to content

Commit

Permalink
[WIP] Read the Access annotation.
Browse files Browse the repository at this point in the history
If the value is Access.hide then don't show the class in Libraries Browser.
  • Loading branch information
adeas31 committed Nov 29, 2017
1 parent a62a900 commit 88f8ef6
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 1 deletion.
31 changes: 30 additions & 1 deletion OMEdit/OMEditGUI/Modeling/LibraryTreeWidget.cpp
Expand Up @@ -490,6 +490,34 @@ bool LibraryTreeItem::isDocumentationClass()
return mpParentLibraryTreeItem->isDocumentationClass();
}

/*!
* \brief LibraryTreeItem::getAccess
* Returns the Access annotation.
* \return
*/
LibraryTreeItem::Access LibraryTreeItem::getAccess()
{
if (mClassInformation.access.compare("Access.hide") == 0) {
return LibraryTreeItem::hide;
} else if (mClassInformation.access.compare("Access.icon") == 0) {
return LibraryTreeItem::icon;
} else if (mClassInformation.access.compare("Access.documentation") == 0) {
return LibraryTreeItem::documentation;
} else if (mClassInformation.access.compare("Access.diagram") == 0) {
return LibraryTreeItem::diagram;
} else if (mClassInformation.access.compare("Access.nonPackageText") == 0) {
return LibraryTreeItem::nonPackageText;
} else if (mClassInformation.access.compare("Access.nonPackageDuplicate") == 0) {
return LibraryTreeItem::nonPackageDuplicate;
} else if (mClassInformation.access.compare("Access.packageText") == 0) {
return LibraryTreeItem::packageText;
} else if (mClassInformation.access.compare("Access.packageDuplicate") == 0) {
return LibraryTreeItem::packageDuplicate;
} else {
return LibraryTreeItem::none;
}
}

/*!
* \brief LibraryTreeItem::getClassText
* Returns the class text. If the class text is empty then first read it.
Expand Down Expand Up @@ -965,7 +993,8 @@ bool LibraryTreeProxyModel::filterAcceptsRow(int sourceRow, const QModelIndex &s
}
// check current index itself
if (pLibraryTreeItem) {
if (pLibraryTreeItem->isProtected() && !OptionsDialog::instance()->getGeneralSettingsPage()->getShowProtectedClasses()) {
if ((pLibraryTreeItem->getAccess() == LibraryTreeItem::hide)
|| (pLibraryTreeItem->isProtected() && !OptionsDialog::instance()->getGeneralSettingsPage()->getShowProtectedClasses())) {
return false;
} else {
return pLibraryTreeItem->getNameStructure().contains(filterRegExp());
Expand Down
12 changes: 12 additions & 0 deletions OMEdit/OMEditGUI/Modeling/LibraryTreeWidget.h
Expand Up @@ -81,6 +81,17 @@ class LibraryTreeItem : public QObject
Text, /* Used to represent text based files. */
CompositeModel /* Used to represent CompositeModel files. */
};
enum Access {
none, /* OMEdit specific when there is no Access annotation */
hide,
icon,
documentation,
diagram,
nonPackageText,
nonPackageDuplicate,
packageText,
packageDuplicate
};
enum SaveContentsType {
SaveInOneFile,
SaveFolderStructure
Expand Down Expand Up @@ -117,6 +128,7 @@ class LibraryTreeItem : public QObject
bool isConnector() {return (getRestriction() == StringHandler::ExpandableConnector || getRestriction() == StringHandler::Connector);}
bool isPartial() {return mClassInformation.partialPrefix;}
bool isState() {return mClassInformation.state;}
Access getAccess();
void setSaveContentsType(LibraryTreeItem::SaveContentsType saveContentsType) {mSaveContentsType = saveContentsType;}
SaveContentsType getSaveContentsType() {return mSaveContentsType;}
void setPixmap(QPixmap pixmap) {mPixmap = pixmap;}
Expand Down

0 comments on commit 88f8ef6

Please sign in to comment.