Code highlighting

Friday, December 08, 2006

A little modification / add-on to Sidax:

I use one of the features of Sidax most of all - it's the recent projects tab. (we have a lot of projects and I have to work with a lot of them at the same time). So performance of this tab is most critical to me.

And what was wrong is that from time to time I would stumble onto project names that didn't exist anymore, but still were up high in the list of recent projects.
So what this modification does is just verify that the project exists before showing it in the list of recent projects.
(this verification is performed only when the recent projects tab is opened, so it won't cause any performance issues)

To add this modification into your sidax installation, you have to do the following:
1. Add a method to Forms\Sidax:
void updateMruProjects()
{
int i;
TreeNode privateProjectTreeNode;
TreeNode sharedProjectTreeNode;
TreeNodeName projectName;

boolean existsProject(TreeNodeName _projectName)
{
TreeNode project;
;
project = privateProjectTreeNode.AOTfindChild(_projectName);
if (project)
return true;
project = sharedProjectTreeNode.AOTfindChild(_projectName);
if (project)
return true;
return false;
}
;
privateProjectTreeNode = SysTreeNode::getPrivateProject();
sharedProjectTreeNode = SysTreeNode::getSharedProject();

for(i = 1; i <= conLen(MruProjects); i++)
{
projectName = conPeek(mruProjects, i);
if (!existsProject(projectName))
{
if (element.openedProjects().exists(projectName))
element.openedProjects().remove(projectName);
MRUProjects = conDel(MRUProjects, conFind(MRUProjects, projectName), 1);
}
}
this.updateHistory();
}


2. Modify an existing method Forms\Sidax\toglleBut, adding 2 lines at the end:
    if (activeTab.id() == historyTab.id() && !collapsed)
element.updateMruProjects();


That's it. Now the next time you open the recent projects tab, the unexistent project won't be shown. Enjoy!

No comments:

Post a Comment

Please don't forget to leave your contact details if you expect a reply from me. Thank you