void CParticleEditor::saveWorkspaceContent()
{
	TPWNodeItr itr = _PW->getNodeList().begin();
	while(itr != _PW->getNodeList().end())
	{
		CWorkspaceNode *node = (*itr);
		if (node->isModified())
			node->savePS();
		node->setModified(false);
		itr++;
	}
}
void CWorkspacePage::createPS()
{
	QString fileName = QFileDialog::getSaveFileName(this, tr("Create new particle system file"),
					   ".",
					   tr("ps files (*.ps)"));
	if (!fileName.isEmpty())
	{

		// TODO: create method particle editor createNewPS
		if (Modules::psEdit().getParticleWorkspace()->containsFile(NLMISC::CFile::getFilename(fileName.toUtf8().constData())))
		{
			QMessageBox::critical(this, tr("NeL particle system editor"),
								  tr("Failed to create new particle system"),
								  QMessageBox::Ok);
			return;
		}
		CWorkspaceNode *node = Modules::psEdit().getParticleWorkspace()->addNode(NLMISC::CFile::getFilename(fileName.toUtf8().constData()));
		// should always succeed because we tested if file already exists
		nlassert(node);
		node->createEmptyPS();
		try
		{
			node->savePS();
			node->setModified(false);
		}
		catch (NLMISC::Exception &e)
		{
			QMessageBox::critical(this, tr("NeL particle system editor"),
								  QString(e.what()),
								  QMessageBox::Ok);
			return;
		}
		QModelIndex index = _treeModel->index(0, 0);
		_treeModel->insertRows(node, static_cast<CParticleTreeItem *>(index.internalPointer())->childCount(), index);
	}
}