Example #1
0
func (p *ProjectAdder) Exec(element interface{}) (executed, consume bool) {
	if projects, ok := element.(projectPane); ok {
		project := p.Project()
		settings.AddProject(project)
		projects.Add(project)
		return true, true
	}
	return false, false
}
Example #2
0
func (p *ProjectAdder) Exec(element interface{}) (executed, consume bool) {
	if projects, ok := element.(projectPane); ok {
		project := p.Project()
		for _, prevProject := range settings.Projects() {
			if prevProject.Name == project.Name {
				// TODO: Let the user choose a new name
				p.err = fmt.Sprintf("There is already a project named %s", project.Name)
				return true, true
			}
		}
		settings.AddProject(project)
		projects.Add(project)
		return true, true
	}
	return false, false
}