Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 77194 Details for
Bug 201464
XPlanner new task editor causes some corruption in parent story
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Patch for ensuring parent story doesn't get corrupted on new task add
clipboard.txt (text/plain), 11.11 KB, created by
Helen
on 2007-08-28 21:05:59 EDT
(
hide
)
Description:
Patch for ensuring parent story doesn't get corrupted on new task add
Filename:
MIME Type:
Creator:
Helen
Created:
2007-08-28 21:05:59 EDT
Size:
11.11 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.mylyn.xplanner.tests >Index: src/org/eclipse/mylyn/xplanner/tests/XPlannerTaskDataHandlerTest.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/sandbox/org.eclipse.mylyn.xplanner.tests/src/org/eclipse/mylyn/xplanner/tests/XPlannerTaskDataHandlerTest.java,v >retrieving revision 1.1 >diff -u -r1.1 XPlannerTaskDataHandlerTest.java >--- src/org/eclipse/mylyn/xplanner/tests/XPlannerTaskDataHandlerTest.java 24 Aug 2007 19:02:03 -0000 1.1 >+++ src/org/eclipse/mylyn/xplanner/tests/XPlannerTaskDataHandlerTest.java 29 Aug 2007 01:03:42 -0000 >@@ -68,6 +68,10 @@ > TaskData taskData = client.getTask(id); > assert(taskData != null); > assert(newTaskName.equals(taskData.getName())); >+ >+ // need to make sure user story did not get corrupted for complete test >+ UserStoryData userStory = client.getUserStory(taskData.getStoryId()); >+ assert(userStory != null); > } > catch (Exception e) { > fail("could not set up task attributes: " + e.getMessage()); >Index: src/org/eclipse/mylyn/xplanner/tests/XPlannerRepositoryUtilsTest.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/sandbox/org.eclipse.mylyn.xplanner.tests/src/org/eclipse/mylyn/xplanner/tests/XPlannerRepositoryUtilsTest.java,v >retrieving revision 1.3 >diff -u -r1.3 XPlannerRepositoryUtilsTest.java >--- src/org/eclipse/mylyn/xplanner/tests/XPlannerRepositoryUtilsTest.java 24 Aug 2007 19:02:03 -0000 1.3 >+++ src/org/eclipse/mylyn/xplanner/tests/XPlannerRepositoryUtilsTest.java 29 Aug 2007 01:03:42 -0000 >@@ -111,4 +111,10 @@ > } > } > >+ public void testEnsureNewTaskDataValid() { >+ TaskData taskData = new TaskData(); >+ XPlannerRepositoryUtils.ensureTaskDataValid(taskData); >+ assert(taskData.getName() != null && taskData.getName().length() > 0); >+ assert(taskData.getDispositionName() != null && taskData.getDispositionName().length() > 0); >+ } > } >#P org.eclipse.mylyn.xplanner.ui >Index: src/org/eclipse/mylyn/xplanner/ui/XPlannerRepositoryUtils.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/sandbox/org.eclipse.mylyn.xplanner.ui/src/org/eclipse/mylyn/xplanner/ui/XPlannerRepositoryUtils.java,v >retrieving revision 1.3 >diff -u -r1.3 XPlannerRepositoryUtils.java >--- src/org/eclipse/mylyn/xplanner/ui/XPlannerRepositoryUtils.java 24 Aug 2007 19:02:02 -0000 1.3 >+++ src/org/eclipse/mylyn/xplanner/ui/XPlannerRepositoryUtils.java 29 Aug 2007 01:03:43 -0000 >@@ -43,6 +43,10 @@ > * @author Helen Bershadskaya > */ > public class XPlannerRepositoryUtils { >+ private static final String TYPE_FEATURE = "Feature"; >+ private static final String NO_TASK_NAME = "<no task name>"; >+ public static final String DISPOSITION_PLANNED = "planned"; >+ > private XPlannerRepositoryUtils() { > > } >@@ -272,9 +276,25 @@ > String completed = repositoryTaskData.getAttributeValue(XPlannerAttributeFactory.ATTRIBUTE_TASK_COMPLETED); > taskData.setCompleted(completed != null && !("0".equals(completed))); > >+ // type >+ taskData.setType(TYPE_FEATURE); >+ > return taskData; > } > >+ // Sanity check to make sure taskdata has minimum settings that will avoid corrupting parent story >+ public static void ensureTaskDataValid(TaskData taskData) { >+ if (taskData != null) { // more sanity, shouldn't happen >+ if (taskData.getDispositionName() == null || taskData.getDispositionName().length() == 0) { >+ taskData.setDispositionName(DISPOSITION_PLANNED); >+ } >+ >+ if (taskData.getName() == null || taskData.getName().length() == 0) { >+ taskData.setName(NO_TASK_NAME); >+ } >+ } >+ } >+ > public static void setupUserStoryAttributes(UserStoryData userStory, RepositoryTaskData repositoryTaskData) > throws CoreException { > >Index: src/org/eclipse/mylyn/xplanner/ui/XPlannerTaskDataHandler.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/sandbox/org.eclipse.mylyn.xplanner.ui/src/org/eclipse/mylyn/xplanner/ui/XPlannerTaskDataHandler.java,v >retrieving revision 1.3 >diff -u -r1.3 XPlannerTaskDataHandler.java >--- src/org/eclipse/mylyn/xplanner/ui/XPlannerTaskDataHandler.java 24 Aug 2007 19:02:02 -0000 1.3 >+++ src/org/eclipse/mylyn/xplanner/ui/XPlannerTaskDataHandler.java 29 Aug 2007 01:03:43 -0000 >@@ -128,6 +128,8 @@ > taskData.setEstimatedHours(Double.valueOf( > repositoryTaskData.getAttribute(XPlannerAttributeFactory.ATTRIBUTE_EST_HOURS_NAME).getValue())); > taskData.setCompleted(XPlannerRepositoryUtils.isCompleted(repositoryTaskData)); >+ >+ XPlannerRepositoryUtils.ensureTaskDataValid(taskData); > client.update(taskData); > } > else { >Index: src/org/eclipse/mylyn/xplanner/ui/editor/NewXPlannerTaskEditor.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/sandbox/org.eclipse.mylyn.xplanner.ui/src/org/eclipse/mylyn/xplanner/ui/editor/NewXPlannerTaskEditor.java,v >retrieving revision 1.1 >diff -u -r1.1 NewXPlannerTaskEditor.java >--- src/org/eclipse/mylyn/xplanner/ui/editor/NewXPlannerTaskEditor.java 24 Aug 2007 19:02:02 -0000 1.1 >+++ src/org/eclipse/mylyn/xplanner/ui/editor/NewXPlannerTaskEditor.java 29 Aug 2007 01:03:43 -0000 >@@ -10,6 +10,7 @@ > > import java.text.MessageFormat; > >+import org.eclipse.jface.dialogs.MessageDialog; > import org.eclipse.mylyn.tasks.core.AbstractTask; > import org.eclipse.mylyn.tasks.core.RepositoryTaskAttribute; > import org.eclipse.mylyn.tasks.core.RepositoryTaskData; >@@ -32,14 +33,12 @@ > > public NewXPlannerTaskEditor(FormEditor editor) { > super(editor); >- > } >-// private Label remainingTimeValueLabel; >-// private Button completedButton; > > public void init(IEditorSite site, IEditorInput input) { > super.init(site, input); > extraControls = new XPlannerTaskEditorExtraControls(this, getRepositoryTaskData()); >+ setExpandAttributeSection(true); > } > > protected void validateInput() { >@@ -109,4 +108,22 @@ > public boolean xplannerAttributeChanged(RepositoryTaskAttribute attribute) { > return attributeChanged(attribute); > } >+ >+ @Override >+ public void submitToRepository() { >+ boolean ok = true; >+ >+ if (summaryText.getText().equals("")) { >+ MessageDialog.openInformation(this.getSite().getShell(), "Submit Error", >+ "Please provide a name for the new task."); >+ summaryText.setFocus(); >+ ok = false; >+ } >+ >+ if (ok) { >+ super.submitToRepository(); >+ } >+ } >+ >+ > } >Index: src/org/eclipse/mylyn/xplanner/ui/editor/XPlannerTaskEditor.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/sandbox/org.eclipse.mylyn.xplanner.ui/src/org/eclipse/mylyn/xplanner/ui/editor/XPlannerTaskEditor.java,v >retrieving revision 1.4 >diff -u -r1.4 XPlannerTaskEditor.java >--- src/org/eclipse/mylyn/xplanner/ui/editor/XPlannerTaskEditor.java 24 Aug 2007 19:02:02 -0000 1.4 >+++ src/org/eclipse/mylyn/xplanner/ui/editor/XPlannerTaskEditor.java 29 Aug 2007 01:03:43 -0000 >@@ -9,6 +9,7 @@ > > import java.text.MessageFormat; > >+import org.eclipse.jface.dialogs.MessageDialog; > import org.eclipse.mylyn.tasks.core.AbstractTask; > import org.eclipse.mylyn.tasks.core.RepositoryTaskAttribute; > import org.eclipse.mylyn.tasks.core.RepositoryTaskData; >@@ -39,6 +40,7 @@ > super.init(site, input); > updateEditorTitle(); > extraControls = new XPlannerTaskEditorExtraControls(this, getRepositoryTaskData()); >+ setExpandAttributeSection(true); > } > > @Override >@@ -128,4 +130,21 @@ > public boolean xplannerAttributeChanged(RepositoryTaskAttribute attribute) { > return attributeChanged(attribute); > } >+ >+ @Override >+ public void submitToRepository() { >+ boolean ok = true; >+ >+ if (summaryText.getText().equals("")) { >+ MessageDialog.openInformation(this.getSite().getShell(), "Submit Error", >+ "Task name cannot be empty."); >+ summaryText.setFocus(); >+ ok = false; >+ } >+ >+ if (ok) { >+ super.submitToRepository(); >+ } >+ } >+ > } >Index: .refactorings/2007/8/35/refactorings.history >=================================================================== >RCS file: .refactorings/2007/8/35/refactorings.history >diff -N .refactorings/2007/8/35/refactorings.history >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ .refactorings/2007/8/35/refactorings.history 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,6 @@ >+<?xml version="1.0" encoding="utf-8"?> >+<session version="1.0"> >+<refactoring comment="Extract constant 'org.eclipse.mylyn.xplanner.ui.XPlannerRepositoryUtils.DISPOSITION_PLANNED' from expression '"planned"' - Original project: 'org.eclipse.mylyn.xplanner.ui' - Constant name: 'DISPOSITION_PLANNED' - Constant expression: '"planned"' - Declared visibility: 'public' - Replace occurrences of expression with constant" description="Extract constant 'DISPOSITION_PLANNED'" flags="786434" id="org.eclipse.jdt.ui.extract.constant" input="/src<org.eclipse.mylyn.xplanner.ui{XPlannerRepositoryUtils.java" name="DISPOSITION_PLANNED" qualify="false" replace="true" selection="12922 9" stamp="1188346840781" version="1.0" visibility="1"/> >+<refactoring comment="Extract constant 'org.eclipse.mylyn.xplanner.ui.XPlannerRepositoryUtils.NO_TASK_NAME' from expression '"<no task name>"' - Original project: 'org.eclipse.mylyn.xplanner.ui' - Constant name: 'NO_TASK_NAME' - Constant expression: '"<no task name>"' - Declared visibility: 'private' - Replace occurrences of expression with constant" description="Extract constant 'NO_TASK_NAME'" flags="786432" id="org.eclipse.jdt.ui.extract.constant" input="/src<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"/> >+<refactoring comment="Extract constant 'org.eclipse.mylyn.xplanner.ui.XPlannerRepositoryUtils.TYPE_FEATURE' from expression '"feature"' - Original project: 'org.eclipse.mylyn.xplanner.ui' - Constant name: 'TYPE_FEATURE' - Constant expression: '"feature"' - Declared visibility: 'private' - Replace occurrences of expression with constant" description="Extract constant 'TYPE_FEATURE'" flags="786432" id="org.eclipse.jdt.ui.extract.constant" input="/src<org.eclipse.mylyn.xplanner.ui{XPlannerRepositoryUtils.java" name="TYPE_FEATURE" qualify="false" replace="true" selection="12485 9" stamp="1188347839906" version="1.0" visibility="2"/> >+</session> >Index: .refactorings/2007/8/35/refactorings.index >=================================================================== >RCS file: .refactorings/2007/8/35/refactorings.index >diff -N .refactorings/2007/8/35/refactorings.index >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ .refactorings/2007/8/35/refactorings.index 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,3 @@ >+1188346840781 Extract constant 'DISPOSITION_PLANNED' >+1188346868984 Extract constant 'NO_TASK_NAME' >+1188347839906 Extract constant 'TYPE_FEATURE'
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 201464
: 77194 |
77195