1 /*
2 * Created on 05.03.2004
3 */
4 package org.xpcards.actions;
5
6 import org.eclipse.swt.widgets.Shell;
7 import org.xpcards.DataEntryDialog;
8 import org.xpcards.XPCards;
9 import org.xpcards.model.Iteration;
10 import org.xpcards.model.ModelElement;
11 import org.xpcards.model.Project;
12
13 /***
14 * @author galu02
15 */
16 public class NewIteration extends AbstractAction {
17
18 public static final String ACTION_ID = "NewIteration";
19
20 /***
21 * @see org.xpcards.actions.AbstractAction#performAction()
22 */
23 public void performAction(final Shell shell, XPCards parent, Object[] args) {
24 ModelElement parentElement = parent.getSelectedModelElement();
25 if (parentElement != null && parentElement instanceof Project ) {
26
27 DataEntryDialog dialog = new DataEntryDialog(shell);
28
29 dialog.setLabels(
30 new String[] { "Iteraton name", "Iteration description" });
31
32 String[] data = dialog.open();
33
34 if (data != null) {
35 Iteration p = new Iteration();
36 p.setName(data[0]);
37 p.setDescription(data[1]);
38
39 if ( parentElement instanceof Project ) {
40 p.setId(((Project)parentElement).createIterationsUniqueIndex(((Project)parentElement).getId() + ":iteration:"));
41 ((Project)parentElement).putIteration(p);
42 // TODO I18n
43 // parent.updatePlanningTab(p, parentElement, ((Project)parentElement).getIterationsCategory());
44 parent.selectModelElement(p);
45 }
46 }
47 }
48 }
49
50 }
This page was automatically generated by Maven