Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 201464
Collapse All | Expand All

(-)src/org/eclipse/mylyn/xplanner/tests/XPlannerTaskDataHandlerTest.java (+4 lines)
Lines 68-73 Link Here
68
			TaskData taskData = client.getTask(id);
68
			TaskData taskData = client.getTask(id);
69
			assert(taskData != null);
69
			assert(taskData != null);
70
			assert(newTaskName.equals(taskData.getName()));
70
			assert(newTaskName.equals(taskData.getName()));
71
			
72
			// need to make sure user story did not get corrupted for complete test
73
			UserStoryData userStory = client.getUserStory(taskData.getStoryId());
74
			assert(userStory != null);
71
		} 
75
		} 
72
		catch (Exception e) {
76
		catch (Exception e) {
73
			fail("could not set up task attributes: " + e.getMessage());
77
			fail("could not set up task attributes: " + e.getMessage());
(-)src/org/eclipse/mylyn/xplanner/tests/XPlannerRepositoryUtilsTest.java (+6 lines)
Lines 111-114 Link Here
111
		}
111
		}
112
	}
112
	}
113
113
114
	public void testEnsureNewTaskDataValid() {
115
		TaskData taskData = new TaskData();
116
		XPlannerRepositoryUtils.ensureTaskDataValid(taskData);
117
		assert(taskData.getName() != null && taskData.getName().length() > 0);
118
		assert(taskData.getDispositionName() != null && taskData.getDispositionName().length() > 0);
119
	}
114
}
120
}
(-)src/org/eclipse/mylyn/xplanner/ui/XPlannerRepositoryUtils.java (+20 lines)
Lines 43-48 Link Here
43
 * @author Helen Bershadskaya
43
 * @author Helen Bershadskaya
44
 */
44
 */
45
public class XPlannerRepositoryUtils {
45
public class XPlannerRepositoryUtils {
46
	private static final String TYPE_FEATURE = "Feature";
47
	private static final String NO_TASK_NAME = "<no task name>";
48
	public static final String DISPOSITION_PLANNED = "planned";
49
	
46
	private XPlannerRepositoryUtils() {
50
	private XPlannerRepositoryUtils() {
47
		
51
		
48
	}
52
	}
Lines 272-280 Link Here
272
		String completed = repositoryTaskData.getAttributeValue(XPlannerAttributeFactory.ATTRIBUTE_TASK_COMPLETED);
276
		String completed = repositoryTaskData.getAttributeValue(XPlannerAttributeFactory.ATTRIBUTE_TASK_COMPLETED);
273
		taskData.setCompleted(completed != null && !("0".equals(completed)));
277
		taskData.setCompleted(completed != null && !("0".equals(completed)));
274
		
278
		
279
		// type
280
		taskData.setType(TYPE_FEATURE);
281
275
		return taskData;
282
		return taskData;
276
	}
283
	}
277
	
284
	
285
	// Sanity check to make sure taskdata has minimum settings that will avoid corrupting parent story
286
	public static void ensureTaskDataValid(TaskData taskData) {
287
		if (taskData != null) {	// more sanity, shouldn't happen
288
			if (taskData.getDispositionName() == null || taskData.getDispositionName().length() == 0) {
289
				taskData.setDispositionName(DISPOSITION_PLANNED);
290
			}
291
			
292
			if (taskData.getName() == null || taskData.getName().length() == 0) {
293
				taskData.setName(NO_TASK_NAME);
294
			}
295
		}
296
	}
297
	
278
	public static void setupUserStoryAttributes(UserStoryData userStory, RepositoryTaskData repositoryTaskData) 
298
	public static void setupUserStoryAttributes(UserStoryData userStory, RepositoryTaskData repositoryTaskData) 
279
		throws CoreException {
299
		throws CoreException {
280
		
300
		
(-)src/org/eclipse/mylyn/xplanner/ui/XPlannerTaskDataHandler.java (+2 lines)
Lines 128-133 Link Here
128
					taskData.setEstimatedHours(Double.valueOf(
128
					taskData.setEstimatedHours(Double.valueOf(
129
							repositoryTaskData.getAttribute(XPlannerAttributeFactory.ATTRIBUTE_EST_HOURS_NAME).getValue()));
129
							repositoryTaskData.getAttribute(XPlannerAttributeFactory.ATTRIBUTE_EST_HOURS_NAME).getValue()));
130
					taskData.setCompleted(XPlannerRepositoryUtils.isCompleted(repositoryTaskData));
130
					taskData.setCompleted(XPlannerRepositoryUtils.isCompleted(repositoryTaskData));
131
					
132
					XPlannerRepositoryUtils.ensureTaskDataValid(taskData);
131
					client.update(taskData);
133
					client.update(taskData);
132
				}
134
				}
133
				else {
135
				else {
(-)src/org/eclipse/mylyn/xplanner/ui/editor/NewXPlannerTaskEditor.java (-3 / +20 lines)
Lines 10-15 Link Here
10
10
11
import java.text.MessageFormat;
11
import java.text.MessageFormat;
12
12
13
import org.eclipse.jface.dialogs.MessageDialog;
13
import org.eclipse.mylyn.tasks.core.AbstractTask;
14
import org.eclipse.mylyn.tasks.core.AbstractTask;
14
import org.eclipse.mylyn.tasks.core.RepositoryTaskAttribute;
15
import org.eclipse.mylyn.tasks.core.RepositoryTaskAttribute;
15
import org.eclipse.mylyn.tasks.core.RepositoryTaskData;
16
import org.eclipse.mylyn.tasks.core.RepositoryTaskData;
Lines 32-45 Link Here
32
	
33
	
33
	public NewXPlannerTaskEditor(FormEditor editor) {
34
	public NewXPlannerTaskEditor(FormEditor editor) {
34
		super(editor);
35
		super(editor);
35
		
36
	}
36
	}
37
//	private Label remainingTimeValueLabel;
38
//	private Button completedButton;
39
37
40
	public void init(IEditorSite site, IEditorInput input) {
38
	public void init(IEditorSite site, IEditorInput input) {
41
		super.init(site, input);
39
		super.init(site, input);
42
		extraControls = new XPlannerTaskEditorExtraControls(this, getRepositoryTaskData());
40
		extraControls = new XPlannerTaskEditorExtraControls(this, getRepositoryTaskData());
41
		setExpandAttributeSection(true);
43
	}
42
	}
44
43
45
	protected void validateInput() {
44
	protected void validateInput() {
Lines 109-112 Link Here
109
	public boolean xplannerAttributeChanged(RepositoryTaskAttribute attribute) {
108
	public boolean xplannerAttributeChanged(RepositoryTaskAttribute attribute) {
110
		return attributeChanged(attribute);
109
		return attributeChanged(attribute);
111
	}
110
	}
111
	
112
	@Override
113
	public void submitToRepository() {
114
		boolean ok = true;
115
		
116
		if (summaryText.getText().equals("")) {
117
			MessageDialog.openInformation(this.getSite().getShell(), "Submit Error",
118
					"Please provide a name for the new task.");
119
			summaryText.setFocus();
120
			ok = false;
121
		}
122
		
123
		if (ok) {
124
			super.submitToRepository();
125
		}
126
	}
127
128
112
}
129
}
(-)src/org/eclipse/mylyn/xplanner/ui/editor/XPlannerTaskEditor.java (+19 lines)
Lines 9-14 Link Here
9
9
10
import java.text.MessageFormat;
10
import java.text.MessageFormat;
11
11
12
import org.eclipse.jface.dialogs.MessageDialog;
12
import org.eclipse.mylyn.tasks.core.AbstractTask;
13
import org.eclipse.mylyn.tasks.core.AbstractTask;
13
import org.eclipse.mylyn.tasks.core.RepositoryTaskAttribute;
14
import org.eclipse.mylyn.tasks.core.RepositoryTaskAttribute;
14
import org.eclipse.mylyn.tasks.core.RepositoryTaskData;
15
import org.eclipse.mylyn.tasks.core.RepositoryTaskData;
Lines 39-44 Link Here
39
		super.init(site, input);
40
		super.init(site, input);
40
		updateEditorTitle();
41
		updateEditorTitle();
41
		extraControls = new XPlannerTaskEditorExtraControls(this, getRepositoryTaskData());
42
		extraControls = new XPlannerTaskEditorExtraControls(this, getRepositoryTaskData());
43
		setExpandAttributeSection(true);
42
	}
44
	}
43
45
44
	@Override
46
	@Override
Lines 128-131 Link Here
128
	public boolean xplannerAttributeChanged(RepositoryTaskAttribute attribute) {
130
	public boolean xplannerAttributeChanged(RepositoryTaskAttribute attribute) {
129
		return attributeChanged(attribute);
131
		return attributeChanged(attribute);
130
	}
132
	}
133
	
134
	@Override
135
	public void submitToRepository() {
136
		boolean ok = true;
137
		
138
		if (summaryText.getText().equals("")) {
139
			MessageDialog.openInformation(this.getSite().getShell(), "Submit Error",
140
					"Task name cannot be empty.");
141
			summaryText.setFocus();
142
			ok = false;
143
		}
144
		
145
		if (ok) {
146
			super.submitToRepository();
147
		}
148
	}
149
131
}
150
}
(-).refactorings/2007/8/35/refactorings.history (+6 lines)
Added Link Here
1
<?xml version="1.0" encoding="utf-8"?>
2
<session version="1.0">
3
<refactoring comment="Extract constant 'org.eclipse.mylyn.xplanner.ui.XPlannerRepositoryUtils.DISPOSITION_PLANNED' from expression '&quot;planned&quot;'&#13;&#10;- Original project: 'org.eclipse.mylyn.xplanner.ui'&#13;&#10;- Constant name: 'DISPOSITION_PLANNED'&#13;&#10;- Constant expression: '&quot;planned&quot;'&#13;&#10;- Declared visibility: 'public'&#13;&#10;- Replace occurrences of expression with constant" description="Extract constant 'DISPOSITION_PLANNED'" flags="786434" id="org.eclipse.jdt.ui.extract.constant" input="/src&lt;org.eclipse.mylyn.xplanner.ui{XPlannerRepositoryUtils.java" name="DISPOSITION_PLANNED" qualify="false" replace="true" selection="12922 9" stamp="1188346840781" version="1.0" visibility="1"/>
4
<refactoring comment="Extract constant 'org.eclipse.mylyn.xplanner.ui.XPlannerRepositoryUtils.NO_TASK_NAME' from expression '&quot;&lt;no task name&gt;&quot;'&#13;&#10;- Original project: 'org.eclipse.mylyn.xplanner.ui'&#13;&#10;- Constant name: 'NO_TASK_NAME'&#13;&#10;- Constant expression: '&quot;&lt;no task name&gt;&quot;'&#13;&#10;- Declared visibility: 'private'&#13;&#10;- Replace occurrences of expression with constant" description="Extract constant 'NO_TASK_NAME'" flags="786432" id="org.eclipse.jdt.ui.extract.constant" input="/src&lt;org.eclipse.mylyn.xplanner.ui{XPlannerRepositoryUtils.java" name="NO_TASK_NAME" qualify="false" replace="true" selection="13113 16" stamp="1188346868984" version="1.0" visibility="2"/>
5
<refactoring comment="Extract constant 'org.eclipse.mylyn.xplanner.ui.XPlannerRepositoryUtils.TYPE_FEATURE' from expression '&quot;feature&quot;'&#13;&#10;- Original project: 'org.eclipse.mylyn.xplanner.ui'&#13;&#10;- Constant name: 'TYPE_FEATURE'&#13;&#10;- Constant expression: '&quot;feature&quot;'&#13;&#10;- Declared visibility: 'private'&#13;&#10;- Replace occurrences of expression with constant" description="Extract constant 'TYPE_FEATURE'" flags="786432" id="org.eclipse.jdt.ui.extract.constant" input="/src&lt;org.eclipse.mylyn.xplanner.ui{XPlannerRepositoryUtils.java" name="TYPE_FEATURE" qualify="false" replace="true" selection="12485 9" stamp="1188347839906" version="1.0" visibility="2"/>
6
</session>
(-).refactorings/2007/8/35/refactorings.index (+3 lines)
Added Link Here
1
1188346840781	Extract constant 'DISPOSITION_PLANNED'
2
1188346868984	Extract constant 'NO_TASK_NAME'
3
1188347839906	Extract constant 'TYPE_FEATURE'

Return to bug 201464