| import org.eclipse.emf.ecore.resource.Resource |
| import org.eclipse.emf.parsley.examples.mail.Folder |
| import org.eclipse.emf.parsley.examples.mail.accountsview.AccountsviewEmfParsleyGuiceModule |
| import org.eclipse.emf.parsley.examples.mail.accountsview.ui.provider.AccountsviewLabelProvider |
| import org.eclipse.emf.parsley.examples.mail.accountsview.unifiedfolders.UnifiedFolderContainer |
| import org.eclipse.emf.parsley.examples.mail.accountsview.unifiedfolders.UnifiedFoldersView |
| |
| /* org.eclipse.emf.parsley.examples.mail.unifiedfoldersview EMF Parsley Dsl Module file */ |
| module org.eclipse.emf.parsley.examples.mail.unifiedfoldersview extends AccountsviewEmfParsleyGuiceModule { |
| |
| parts { |
| viewpart org.eclipse.emf.parsley.examples.mail.unifiedfoldersview { |
| viewname "Unified Folders" |
| viewclass UnifiedFoldersView |
| viewcategory org.eclipse.emf.parsley.examples.mail.accountsview |
| } |
| } |
| |
| labelProvider extends AccountsviewLabelProvider { |
| text { |
| UnifiedFolderContainer -> containerName |
| // instead of |
| // Folder -> (eContainer as Account).email |
| // we can rely on the label provider we inherit from |
| // and take the text of the container |
| Folder -> getText(eContainer) |
| } |
| image { |
| UnifiedFolderContainer -> containerName.toFirstLower + ".gif" |
| Folder -> "account.gif" |
| } |
| } |
| |
| viewerContentProvider { |
| elements { |
| Resource resource -> { |
| newArrayList( |
| new UnifiedFolderContainer("Inbox", resource), |
| new UnifiedFolderContainer("Sent", resource), |
| new UnifiedFolderContainer("Trash", resource)) |
| } |
| } |
| |
| children { |
| UnifiedFolderContainer c -> { |
| c.resource.allContents. |
| filter(Folder). |
| filter[name == c.containerName] |
| } |
| Folder -> { emptyList } |
| } |
| } |
| |
| } |