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 87931 Details for
Bug 211101
XPlanner's actual time setting should be able to use Mylyn's time tracking mechanism
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 first pass at using Mylyn's time tracking in XPlanner connector
clipboard.txt (text/plain), 40.30 KB, created by
Helen Bershadskaya
on 2008-01-25 19:57:54 EST
(
hide
)
Description:
Patch for first pass at using Mylyn's time tracking in XPlanner connector
Filename:
MIME Type:
Creator:
Helen Bershadskaya
Created:
2008-01-25 19:57:54 EST
Size:
40.30 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.mylyn.xplanner.ui >Index: src/org/eclipse/mylyn/xplanner/ui/XPlannerMylynUIPlugin.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/sandbox/org.eclipse.mylyn.xplanner.ui/src/org/eclipse/mylyn/xplanner/ui/XPlannerMylynUIPlugin.java,v >retrieving revision 1.1 >diff -u -r1.1 XPlannerMylynUIPlugin.java >--- src/org/eclipse/mylyn/xplanner/ui/XPlannerMylynUIPlugin.java 10 Jul 2007 20:01:31 -0000 1.1 >+++ src/org/eclipse/mylyn/xplanner/ui/XPlannerMylynUIPlugin.java 26 Jan 2008 00:49:28 -0000 >@@ -45,10 +45,28 @@ > public final static IStatus NO_LICENSE_STATUS = new Status(IStatus.INFO, XPlannerMylynUIPlugin.PLUGIN_ID, > 0, Messages.MylynXPlannerPlugin_NOT_AVAILABLE_IN_SKU, null); > >+ // Preference setting names >+ public final static String USE_AUTO_TIME_TRACKING_PREFERENCE_NAME = "UseAutoTimeTracking"; >+ >+ public final static String ROUND_AUTO_TIME_TRACKING_TO_HALF_HOUR_PREFERENCE_NAME = "RoundAutoTimeTrackingToHalfHour"; >+ >+ public final static String ADD_AUTO_TRACKED_TIME_TO_REPOSITORY_VALUE_PREFERENCE_NAME = "AddAutoTrackedTimeToRepositoryValue"; >+ > public XPlannerMylynUIPlugin() { > INSTANCE = this; > } > >+ public void start(BundleContext context) throws Exception { >+ super.start(context); >+ setPreferenceDefaults(); >+ } >+ >+ private void setPreferenceDefaults() { >+ getPreferenceStore().setDefault(USE_AUTO_TIME_TRACKING_PREFERENCE_NAME, false); >+ getPreferenceStore().setDefault(ROUND_AUTO_TIME_TRACKING_TO_HALF_HOUR_PREFERENCE_NAME, true); >+ getPreferenceStore().setDefault(ADD_AUTO_TRACKED_TIME_TO_REPOSITORY_VALUE_PREFERENCE_NAME, true); >+ } >+ > public void stop(BundleContext context) throws Exception { > super.stop(context); > INSTANCE = null; >@@ -94,4 +112,12 @@ > public static ImageDescriptor getImageDescriptor(String path) { > return AbstractUIPlugin.imageDescriptorFromPlugin(PLUGIN_ID, path); > } >+ >+ public static void setBooleanPreference(String name, boolean value) { >+ getDefault().getPreferenceStore().setValue(name, value); >+ } >+ >+ public static boolean getBooleanPreference(String name) { >+ return getDefault().getPreferenceStore().getBoolean(name); >+ } > } >Index: META-INF/MANIFEST.MF >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/sandbox/org.eclipse.mylyn.xplanner.ui/META-INF/MANIFEST.MF,v >retrieving revision 1.36 >diff -u -r1.36 MANIFEST.MF >--- META-INF/MANIFEST.MF 4 Jan 2008 02:21:28 -0000 1.36 >+++ META-INF/MANIFEST.MF 26 Jan 2008 00:49:28 -0000 >@@ -21,5 +21,6 @@ > org.eclipse.mylyn.monitor.core > Eclipse-LazyStart: true > Export-Package: org.eclipse.mylyn.xplanner.ui, >+ org.eclipse.mylyn.xplanner.ui.editor, > org.eclipse.mylyn.xplanner.ui.wizard > Bundle-RequiredExecutionEnvironment: J2SE-1.5 >Index: src/org/eclipse/mylyn/xplanner/ui/editor/XPlannerTaskEditorExtraControls.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/sandbox/org.eclipse.mylyn.xplanner.ui/src/org/eclipse/mylyn/xplanner/ui/editor/XPlannerTaskEditorExtraControls.java,v >retrieving revision 1.2 >diff -u -r1.2 XPlannerTaskEditorExtraControls.java >--- src/org/eclipse/mylyn/xplanner/ui/editor/XPlannerTaskEditorExtraControls.java 16 Oct 2007 18:46:24 -0000 1.2 >+++ src/org/eclipse/mylyn/xplanner/ui/editor/XPlannerTaskEditorExtraControls.java 26 Jan 2008 00:49:28 -0000 >@@ -8,8 +8,11 @@ > > package org.eclipse.mylyn.xplanner.ui.editor; > >+import java.text.DecimalFormat; >+ > import org.eclipse.jface.layout.GridDataFactory; > import org.eclipse.jface.resource.JFaceResources; >+import org.eclipse.mylyn.monitor.core.StatusHandler; > import org.eclipse.mylyn.tasks.core.RepositoryTaskAttribute; > import org.eclipse.mylyn.tasks.core.RepositoryTaskData; > import org.eclipse.mylyn.tasks.ui.editors.AbstractRepositoryTaskEditor; >@@ -31,6 +34,8 @@ > private String errorMessage = null; > private Control errorControl = null; > >+ private Double lastRepositoryActualTime = 0.0; >+ > public XPlannerTaskEditorExtraControls(AbstractRepositoryTaskEditor editor, > RepositoryTaskData repositoryTaskData) { > >@@ -149,8 +154,8 @@ > GridDataFactory.fillDefaults().grab(true, false).span(2, 1).align(SWT.END, SWT.CENTER).applyTo(actualTimeLabel); > > // actual hours text >- actualTimeText = toolkit.createText(dataComposite, >- XPlannerRepositoryUtils.getActualHours(repositoryTaskData) + ""); //$NON-NLS-1$ >+ lastRepositoryActualTime = XPlannerRepositoryUtils.getActualHours(repositoryTaskData); >+ actualTimeText = toolkit.createText(dataComposite, lastRepositoryActualTime + ""); //$NON-NLS-1$ > > actualTimeText.addModifyListener(new ModifyListener() { > public void modifyText(ModifyEvent e) { >@@ -166,8 +171,9 @@ > remainingTimeLabel.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT)); > GridDataFactory.fillDefaults().grab(true, false).span(3, 1).align(SWT.END, SWT.CENTER).applyTo(remainingTimeLabel); > >- remainingTimeValueLabel = toolkit.createLabel(dataComposite, >- XPlannerRepositoryUtils.getRemainingHours(repositoryTaskData) + ""); //$NON-NLS-1$ >+ Float remainingHours = new Float(XPlannerRepositoryUtils.getRemainingHours(repositoryTaskData)); >+ String formattedRemainingHours = formatSingleFractionHours(remainingHours); >+ remainingTimeValueLabel = toolkit.createLabel(dataComposite, formattedRemainingHours); > > updateRemainingTimeFont(); > dataSection.setExpanded(true); >@@ -225,4 +231,89 @@ > > return errorMessage; > } >+ >+ protected void updateActualTimeWithElapsed(long newElapsedTime, >+ boolean addToCurrent, boolean roundToHalfHour) { >+ >+ String elapsedHoursString = "0.0"; >+ try { >+ elapsedHoursString = getElapsedHoursAsString(newElapsedTime, addToCurrent, roundToHalfHour); >+ } >+ catch (RuntimeException e1) { >+ StatusHandler.fail(e1, "Could not format elapsed time", true); >+ } >+ >+ actualTimeText.setText(elapsedHoursString); >+ } >+ >+ >+ private static float convertMilliSecondsToHours(long milliSeconds) { >+ Long minutes = ((Long)Long.valueOf("" + milliSeconds))/(1000*60); >+ Float hours = minutes/60F; >+ >+ return hours; >+ } >+ >+ private String getElapsedHoursAsString(long milliSeconds, >+ boolean addToCurrent, boolean roundToHalfHour) { >+ >+ String hoursString; >+ >+ Float hours = convertMilliSecondsToHours(milliSeconds); >+ if (addToCurrent) { >+ hours = new Float(lastRepositoryActualTime + hours); >+ } >+ if (hours == 0) { >+ hoursString = "0.0"; >+ } >+ else { >+ >+ hoursString = formatHours(hours, roundToHalfHour); >+ } >+ >+ return hoursString; >+ } >+ >+ /** >+ * public for testing >+ * rounds to nearest .5 if roundToHalfHour is true, otherwise, keeps input as is with >+ * single fraction digit formatting >+ */ >+ public static String formatHours(Float hours, boolean roundToHalfHour) { >+ Float updatedHours = hours; >+ >+ if (roundToHalfHour) { >+ Float decimal = new Float(Math.floor(hours)); >+ Float fraction = hours - decimal; >+ if (fraction == .5f || fraction == .0f) { >+ updatedHours = hours; >+ } >+ else if (fraction > 0f && fraction < .25f) { >+ updatedHours = decimal; >+ } >+ else if (fraction >= .25f && fraction < .5f) { >+ updatedHours = decimal + .5f; >+ } >+ else if (fraction > .5f && fraction < .75f) { >+ updatedHours = decimal + .5f; >+ } >+ else { // .75 and up >+ updatedHours = decimal + 1; >+ } >+ } >+ >+ return formatSingleFractionHours(updatedHours); >+ } >+ >+ /** >+ * public for testing >+ * Formats input as single digit fraction string >+ */ >+ public static String formatSingleFractionHours(Float updatedHours) { >+ DecimalFormat format = new DecimalFormat("######.#"); >+ format.setMinimumFractionDigits(1); >+ format.setMaximumFractionDigits(1); >+ return format.format(updatedHours); >+ } >+ > } >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.6 >diff -u -r1.6 XPlannerTaskEditor.java >--- src/org/eclipse/mylyn/xplanner/ui/editor/XPlannerTaskEditor.java 16 Oct 2007 18:46:24 -0000 1.6 >+++ src/org/eclipse/mylyn/xplanner/ui/editor/XPlannerTaskEditor.java 26 Jan 2008 00:49:28 -0000 >@@ -10,16 +10,21 @@ > import java.text.MessageFormat; > > import org.eclipse.jface.dialogs.MessageDialog; >+import org.eclipse.jface.layout.GridDataFactory; > import org.eclipse.mylyn.tasks.core.*; >+import org.eclipse.mylyn.tasks.ui.TasksUiPlugin; > import org.eclipse.mylyn.tasks.ui.editors.AbstractRepositoryTaskEditor; > import org.eclipse.mylyn.xplanner.ui.XPlannerMylynUIPlugin; > import org.eclipse.mylyn.xplanner.ui.XPlannerRepositoryUtils; >+import org.eclipse.swt.SWT; >+import org.eclipse.swt.events.SelectionEvent; >+import org.eclipse.swt.events.SelectionListener; >+import org.eclipse.swt.graphics.Point; > import org.eclipse.swt.layout.GridLayout; >-import org.eclipse.swt.widgets.Composite; >-import org.eclipse.swt.widgets.Control; >-import org.eclipse.ui.IEditorInput; >-import org.eclipse.ui.IEditorSite; >+import org.eclipse.swt.widgets.*; >+import org.eclipse.ui.*; > import org.eclipse.ui.forms.editor.FormEditor; >+import org.eclipse.ui.forms.widgets.FormToolkit; > import org.eclipse.ui.forms.widgets.ImageHyperlink; > > /** >@@ -27,9 +32,17 @@ > * @author Helen Bershadskaya > */ > public class XPlannerTaskEditor extends AbstractRepositoryTaskEditor >- implements XPlannerEditorAttributeProvider { >+ implements XPlannerEditorAttributeProvider, ITaskTimingListener, SelectionListener { > > private XPlannerTaskEditorExtraControls extraControls; >+ private Button useTimeTrackingButton; >+ private Button addToCurrentTimeButton; >+ private Button replaceCurrentTimeButton; >+ private Button roundToHalfHourButton; >+ >+ private boolean useAutoTimeTracking; >+ private boolean roundToHalfHour; >+ private boolean addToCurrentTime; > > public XPlannerTaskEditor(FormEditor editor) { > super(editor); >@@ -44,7 +57,7 @@ > > @Override > protected void addRadioButtons(Composite buttonComposite) { >- //TODO -- ? >+ createTimeTrackingPanel(buttonComposite); > } > > @Override >@@ -150,8 +163,180 @@ > } > > if (errorMessage == null) { >+ savePreferenceSettings(); > super.submitToRepository(); >+ > } > } > >+ private void loadValuesFromPreferenceSettings() { >+ // auto tracking >+ boolean useTimeTrackingPreference = XPlannerMylynUIPlugin.getBooleanPreference(XPlannerMylynUIPlugin.USE_AUTO_TIME_TRACKING_PREFERENCE_NAME); >+ useTimeTrackingButton.setSelection(useTimeTrackingPreference); >+ setUseAutoTimeTracking(useTimeTrackingPreference); >+ >+ // rounding >+ boolean roundToHalfHourPreference = XPlannerMylynUIPlugin.getBooleanPreference(XPlannerMylynUIPlugin.ROUND_AUTO_TIME_TRACKING_TO_HALF_HOUR_PREFERENCE_NAME); >+ roundToHalfHourButton.setSelection(roundToHalfHourPreference); >+ setRoundToHalfHour(roundToHalfHourPreference); >+ >+ // add or replace >+ boolean addToCurrentTimePreference = XPlannerMylynUIPlugin.getBooleanPreference(XPlannerMylynUIPlugin.ADD_AUTO_TRACKED_TIME_TO_REPOSITORY_VALUE_PREFERENCE_NAME); >+ addToCurrentTimeButton.setSelection(addToCurrentTimePreference); >+ replaceCurrentTimeButton.setSelection(!addToCurrentTimePreference); >+ setAddToCurrentTime(addToCurrentTimePreference); >+ } >+ >+ private void savePreferenceSettings() { >+ // auto tracking >+ XPlannerMylynUIPlugin.setBooleanPreference( >+ XPlannerMylynUIPlugin.USE_AUTO_TIME_TRACKING_PREFERENCE_NAME, isUseAutoTimeTracking()); >+ >+ // rounding >+ XPlannerMylynUIPlugin.setBooleanPreference( >+ XPlannerMylynUIPlugin.ROUND_AUTO_TIME_TRACKING_TO_HALF_HOUR_PREFERENCE_NAME, isRoundToHalfHour()); >+ >+ // add or replace >+ XPlannerMylynUIPlugin.setBooleanPreference( >+ XPlannerMylynUIPlugin.ADD_AUTO_TRACKED_TIME_TO_REPOSITORY_VALUE_PREFERENCE_NAME, isAddToCurrentTime()); >+ } >+ >+ private void createTimeTrackingPanel(Composite parent) { >+ FormToolkit toolkit = new FormToolkit(getSite().getShell().getDisplay()); >+ Composite timeTrackingComposite = toolkit.createComposite(parent, SWT.NONE); >+ >+ GridDataFactory.fillDefaults().span(4, 1).applyTo(timeTrackingComposite); >+ timeTrackingComposite.setLayout(new GridLayout(1, false)); >+ >+ useTimeTrackingButton = toolkit.createButton(timeTrackingComposite, "Update actual task time from Mylyn's time tracker", SWT.CHECK); >+ GridDataFactory.fillDefaults().span(1, 1).grab(true, false).applyTo(useTimeTrackingButton); >+ useTimeTrackingButton.addSelectionListener(this); >+ >+ roundToHalfHourButton = toolkit.createButton(timeTrackingComposite, "Round time to half hour", SWT.CHECK); >+ GridDataFactory.fillDefaults().indent(new Point(15, 5)).applyTo(roundToHalfHourButton); >+ roundToHalfHourButton.addSelectionListener(this); >+ >+ Composite updateMethodComposite = toolkit.createComposite(timeTrackingComposite); >+ GridDataFactory.fillDefaults().indent(new Point(10, 0)).applyTo(updateMethodComposite); >+ updateMethodComposite.setLayout(new GridLayout(2, true)); >+ addToCurrentTimeButton = toolkit.createButton(updateMethodComposite, "Add to current repository time", SWT.RADIO); >+ GridDataFactory.fillDefaults().applyTo(addToCurrentTimeButton); >+ addToCurrentTimeButton.setSelection(true); // just for a single radio default >+ addToCurrentTimeButton.addSelectionListener(this); >+ >+ replaceCurrentTimeButton = toolkit.createButton(updateMethodComposite, "Replace current repository time", SWT.RADIO); >+ GridDataFactory.fillDefaults().applyTo(replaceCurrentTimeButton); >+ replaceCurrentTimeButton.addSelectionListener(this); >+ >+ TasksUiPlugin.getTaskListManager().addTimingListener(this); >+ loadValuesFromPreferenceSettings(); >+ updateTimeTrackingControls(); >+ } >+ >+ private void updateTimeTrackingControls() { >+ boolean enabled = isUseAutoTimeTracking(); >+ >+ roundToHalfHourButton.setEnabled(enabled); >+ addToCurrentTimeButton.setEnabled(enabled); >+ replaceCurrentTimeButton.setEnabled(enabled); >+ } >+ >+ @Override >+ public void dispose() { >+ savePreferenceSettings(); >+ TasksUiPlugin.getTaskListManager().removeTimingListener(this); >+ super.dispose(); >+ } >+ >+ public void close() { >+ savePreferenceSettings(); >+ super.close(); >+ } >+ >+ /** >+ * ITaskTimingListener Implementation >+ */ >+ public void elapsedTimeUpdated(AbstractTask task, final long newElapsedTime) { >+ // only auto-update actual time if user chose to do so >+ if (!isUseAutoTimeTracking()) { >+ return; >+ } >+ >+ PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() { >+ public void run() { >+ extraControls.updateActualTimeWithElapsed(newElapsedTime, >+ isAddToCurrentTime(), isRoundToHalfHour()); >+ }}); >+ >+ } >+ >+ public void setUseAutoTimeTracking(boolean useTimeTracking) { >+ this.useAutoTimeTracking = useTimeTracking; >+ } >+ >+ public boolean isUseAutoTimeTracking() { >+ return useAutoTimeTracking; >+ } >+ >+ private void forceElapsedTimeUpdated() { >+ AbstractTask task = TasksUiPlugin.getTaskListManager().getTaskList().getTask(getRepositoryTaskData().getHandleIdentifier()); >+ long elapsedTimeMillis = TasksUiPlugin.getTaskActivityManager().getElapsedTime( >+ TasksUiPlugin.getTaskListManager().getTaskList().getTask(getRepositoryTaskData().getHandleIdentifier())); >+ >+ elapsedTimeUpdated(task, elapsedTimeMillis); >+ } >+ >+ public void widgetDefaultSelected(SelectionEvent e) { >+ Object source = e.getSource(); >+ >+ if (source.equals(useTimeTrackingButton)) { >+ updateTimeTrackingControls(); >+ } >+ } >+ >+ public void widgetSelected(SelectionEvent e) { >+ Object source = e.getSource(); >+ >+ if (source.equals(useTimeTrackingButton)) { >+ setUseAutoTimeTracking(useTimeTrackingButton.getSelection()); >+ >+ if (isUseAutoTimeTracking()) { >+ forceElapsedTimeUpdated(); >+ } >+ >+ updateTimeTrackingControls(); >+ } >+ else if (source.equals(roundToHalfHourButton)) { >+ setRoundToHalfHour(roundToHalfHourButton.getSelection()); >+ forceElapsedTimeUpdated(); >+ } >+ else if (source.equals(replaceCurrentTimeButton)) { >+ setAddToCurrentTime(!replaceCurrentTimeButton.getSelection()); >+ if (!isAddToCurrentTime()) { >+ forceElapsedTimeUpdated(); >+ } >+ } >+ else if (source.equals(addToCurrentTimeButton)) { >+ setAddToCurrentTime(addToCurrentTimeButton.getSelection()); >+ if (isAddToCurrentTime()) { >+ forceElapsedTimeUpdated(); >+ } >+ } >+ } >+ >+ private boolean isRoundToHalfHour() { >+ return roundToHalfHour; >+ } >+ >+ private void setRoundToHalfHour(boolean roundToHalfHour) { >+ this.roundToHalfHour = roundToHalfHour; >+ } >+ >+ private boolean isAddToCurrentTime() { >+ return addToCurrentTime; >+ } >+ >+ private void setAddToCurrentTime(boolean addToCurrentTime) { >+ this.addToCurrentTime = addToCurrentTime; >+ } > } >Index: .refactorings/2008/1/4/refactorings.history >=================================================================== >RCS file: .refactorings/2008/1/4/refactorings.history >diff -N .refactorings/2008/1/4/refactorings.history >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ .refactorings/2008/1/4/refactorings.history 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,3 @@ >+<?xml version="1.0" encoding="UTF-8"?> >+<session version="1.0">
<refactoring comment="Extract method 'private String formatHours(Float hours)' from 'org.eclipse.mylyn.xplanner.ui.editor.XPlannerTaskEditor.createTimeTrackingPanel()' to 'org.eclipse.mylyn.xplanner.ui.editor.XPlannerTaskEditor'
- Original project: 'org.eclipse.mylyn.xplanner.ui'
- Method name: 'formatHours'
- Destination type: 'org.eclipse.mylyn.xplanner.ui.editor.XPlannerTaskEditor'
- Declared visibility: 'private'" comments="false" description="Extract method 'formatHours'" destination="0" exceptions="false" flags="786434" id="org.eclipse.jdt.ui.extract.method" input="/src<org.eclipse.mylyn.xplanner.ui.editor{XPlannerTaskEditor.java" name="formatHours" replace="false" selection="7117 150" stamp="1201224117828" version="1.0" visibility="2"/>
<refactoring comment="Encapsulate field 'org.eclipse.mylyn.xplanner.ui.editor.XPlannerTaskEditor.useTimeTracking' in 'org.eclipse.mylyn.xplanner.ui.editor.XPlannerTaskEditor'
- Original project: 'org.eclipse.mylyn.xplanner.ui'
- Original element: 'org.eclipse.mylyn.xplanner.ui.editor.XPlannerTaskEditor.useTimeTracking'
- Getter method name: 'isUseTimeTracking'
- Setter method name: 'setUseTimeTracking'
- Field visibility: 'public'
- Use getter and setter methods in declaring type" comments="false" declaring="true" description="Encapsulate field 'useTimeTracking'" flags="589830" getter="isUseTimeTracking" id="org.eclipse.jdt.ui.self.encapsulate" input="/src<org.eclipse.mylyn.xplanner.ui.editor{XPlannerTaskEditor.java[XPlannerTaskEditor^useTimeTracking" insertion="23" setter="setUseTimeTracking" stamp="1201290848078" version="1.0" visibility="1"/>
<refactoring comment="Rename field 'useTimeTracking' in 'org.eclipse.mylyn.xplanner.ui.editor.XPlannerTaskEditor' to 'useAutoTimeTracking'
- Original project: 'org.eclipse.mylyn.xplanner.ui'
- Original element: 'org.eclipse.mylyn.xplanner.ui.editor.XPlannerTaskEditor.useTimeTracking'
- Renamed element: 'org.eclipse.mylyn.xplanner.ui.editor.XPlannerTaskEditor.useAutoTimeTracking'
- Update references to refactored element
- Update textual occurrences in comments and strings" delegate="false" deprecate="false" description="Rename field 'useTimeTracking'" flags="589826" getter="false" id="org.eclipse.jdt.ui.rename.field" input="/src<org.eclipse.mylyn.xplanner.ui.editor{XPlannerTaskEditor.java[XPlannerTaskEditor^useTimeTracking" name="useAutoTimeTracking" references="true" setter="false" stamp="1201290938125" textual="false" version="1.0"/>
<refactoring comment="Extract method 'private void forceElapsedTimeUpdated()' from 'org.eclipse.mylyn.xplanner.ui.editor.XPlannerTaskEditor.createTimeTrackingPanel().new SelectionListener() {...}.widgetSelected()' to 'org.eclipse.mylyn.xplanner.ui.editor.XPlannerTaskEditor'
- Original project: 'org.eclipse.mylyn.xplanner.ui'
- Method name: 'forceElapsedTimeUpdated'
- Destination type: 'org.eclipse.mylyn.xplanner.ui.editor.XPlannerTaskEditor'
- Declared visibility: 'private'" comments="false" description="Extract method 'forceElapsedTimeUpdated'" destination="1" exceptions="false" flags="786434" id="org.eclipse.jdt.ui.extract.method" input="/src<org.eclipse.mylyn.xplanner.ui.editor{XPlannerTaskEditor.java" name="forceElapsedTimeUpdated" replace="false" selection="6296 389" stamp="1201292079171" version="1.0" visibility="2"/>
<refactoring comment="Extract method 'private String formatSingleFractionHours(Float updatedHours)' from 'org.eclipse.mylyn.xplanner.ui.editor.XPlannerTaskEditorExtraControls.formatHours()' to 'org.eclipse.mylyn.xplanner.ui.editor.XPlannerTaskEditorExtraControls'
- Original project: 'org.eclipse.mylyn.xplanner.ui'
- Method name: 'formatSingleFractionHours'
- Destination type: 'org.eclipse.mylyn.xplanner.ui.editor.XPlannerTaskEditorExtraControls'
- Declared visibility: 'private'" comments="false" description="Extract method 'formatSingleFractionHours'" destination="0" exceptions="false" flags="786434" id="org.eclipse.jdt.ui.extract.method" input="/src<org.eclipse.mylyn.xplanner.ui.editor{XPlannerTaskEditorExtraControls.java" name="formatSingleFractionHours" replace="false" selection="11354 197" stamp="1201293923546" version="1.0" visibility="2"/>
<refactoring comment="Extract method 'private boolean isRoundToHalfHour()' from 'org.eclipse.mylyn.xplanner.ui.editor.XPlannerTaskEditor.savePreferenceSettings()' to 'org.eclipse.mylyn.xplanner.ui.editor.XPlannerTaskEditor'
- Original project: 'org.eclipse.mylyn.xplanner.ui'
- Method name: 'isRoundToHalfHour'
- Destination type: 'org.eclipse.mylyn.xplanner.ui.editor.XPlannerTaskEditor'
- Declared visibility: 'private'
- Replace occurrences of statements with method" comments="false" description="Extract method 'isRoundToHalfHour'" destination="0" exceptions="false" flags="786434" id="org.eclipse.jdt.ui.extract.method" input="/src<org.eclipse.mylyn.xplanner.ui.editor{XPlannerTaskEditor.java" name="isRoundToHalfHour" replace="true" selection="6082 36" stamp="1201301360250" version="1.0" visibility="2"/>
<refactoring comment="Extract method 'private boolean isAddToCurrentTime()' from 'org.eclipse.mylyn.xplanner.ui.editor.XPlannerTaskEditor.savePreferenceSettings()' to 'org.eclipse.mylyn.xplanner.ui.editor.XPlannerTaskEditor'
- Original project: 'org.eclipse.mylyn.xplanner.ui'
- Method name: 'isAddToCurrentTime'
- Destination type: 'org.eclipse.mylyn.xplanner.ui.editor.XPlannerTaskEditor'
- Declared visibility: 'private'
- Replace occurrences of statements with method" comments="false" description="Extract method 'isAddToCurrentTime'" destination="0" exceptions="false" flags="786434" id="org.eclipse.jdt.ui.extract.method" input="/src<org.eclipse.mylyn.xplanner.ui.editor{XPlannerTaskEditor.java" name="isAddToCurrentTime" replace="true" selection="6261 37" stamp="1201301415703" version="1.0" visibility="2"/>
<refactoring comment="Encapsulate field 'org.eclipse.mylyn.xplanner.ui.editor.XPlannerTaskEditor.roundToHalfHour' in 'org.eclipse.mylyn.xplanner.ui.editor.XPlannerTaskEditor'
- Original project: 'org.eclipse.mylyn.xplanner.ui'
- Original element: 'org.eclipse.mylyn.xplanner.ui.editor.XPlannerTaskEditor.roundToHalfHour'
- Getter method name: 'isRoundToHalfHour'
- Setter method name: 'setRoundToHalfHour'
- Field visibility: 'public'
- Use getter and setter methods in declaring type" comments="false" declaring="true" description="Encapsulate field 'roundToHalfHour'" flags="589830" getter="isRoundToHalfHour" id="org.eclipse.jdt.ui.self.encapsulate" input="/src<org.eclipse.mylyn.xplanner.ui.editor{XPlannerTaskEditor.java[XPlannerTaskEditor^roundToHalfHour" insertion="33" setter="setRoundToHalfHour" stamp="1201302132359" version="1.0" visibility="1"/>
<refactoring comment="Encapsulate field 'org.eclipse.mylyn.xplanner.ui.editor.XPlannerTaskEditor.addToCurrentTime' in 'org.eclipse.mylyn.xplanner.ui.editor.XPlannerTaskEditor'
- Original project: 'org.eclipse.mylyn.xplanner.ui'
- Original element: 'org.eclipse.mylyn.xplanner.ui.editor.XPlannerTaskEditor.addToCurrentTime'
- Getter method name: 'isAddToCurrentTime'
- Setter method name: 'setAddToCurrentTime'
- Field visibility: 'public'
- Use getter and setter methods in declaring type" comments="false" declaring="true" description="Encapsulate field 'addToCurrentTime'" flags="589830" getter="isAddToCurrentTime" id="org.eclipse.jdt.ui.self.encapsulate" input="/src<org.eclipse.mylyn.xplanner.ui.editor{XPlannerTaskEditor.java[XPlannerTaskEditor^addToCurrentTime" insertion="34" setter="setAddToCurrentTime" stamp="1201302148093" version="1.0" visibility="1"/>
<refactoring comment="Extract local variable 'roundToHalfHourPreference' from expression 'XPlannerMylynUIPlugin.getBooleanPreference(XPlannerMylynUIPlugin.ROUND_AUTO_TIME_TRACKING_TO_HALF_HOUR_PREFERENCE_NAME)'
- Original project: 'org.eclipse.mylyn.xplanner.ui'
- Variable name: 'roundToHalfHourPreference'
- Destination method: 'org.eclipse.mylyn.xplanner.ui.editor.XPlannerTaskEditor.loadValuesFromPreferenceSettings()'
- Variable expression: 'XPlannerMylynUIPlugin.getBooleanPreference(XPlannerMylynUIPlugin.ROUND_AUTO_TIME_TRACKING_TO_HALF_HOUR_PREFERENCE_NAME)'
- Replace occurrences of expression with variable" description="Extract local variable 'roundToHalfHourPreference'" final="false" id="org.eclipse.jdt.ui.extract.temp" input="/src<org.eclipse.mylyn.xplanner.ui.editor{XPlannerTaskEditor.java" name="roundToHalfHourPreference" replace="true" selection="5595 119" stamp="1201302846625" version="1.0"/>
<refactoring comment="Extract local variable 'addToCurrentTimePreference' from expression 'XPlannerMylynUIPlugin.getBooleanPreference(XPlannerMylynUIPlugin.ADD_AUTO_TRACKED_TIME_TO_REPOSITORY_VALUE_PREFERENCE_NAME)'
- Original project: 'org.eclipse.mylyn.xplanner.ui'
- Variable name: 'addToCurrentTimePreference'
- Destination method: 'org.eclipse.mylyn.xplanner.ui.editor.XPlannerTaskEditor.loadValuesFromPreferenceSettings()'
- Variable expression: 'XPlannerMylynUIPlugin.getBooleanPreference(XPlannerMylynUIPlugin.ADD_AUTO_TRACKED_TIME_TO_REPOSITORY_VALUE_PREFERENCE_NAME)'
- Replace occurrences of expression with variable" description="Extract local variable 'addToCurrentTimePreference'" final="false" id="org.eclipse.jdt.ui.extract.temp" input="/src<org.eclipse.mylyn.xplanner.ui.editor{XPlannerTaskEditor.java" name="addToCurrentTimePreference" replace="true" selection="5897 123" stamp="1201302873859" version="1.0"/> >+</session> >Index: .refactorings/2008/1/4/refactorings.index >=================================================================== >RCS file: .refactorings/2008/1/4/refactorings.index >diff -N .refactorings/2008/1/4/refactorings.index >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ .refactorings/2008/1/4/refactorings.index 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,11 @@ >+1201224117828 Extract method 'formatHours' >+1201290848078 Encapsulate field 'useTimeTracking' >+1201290938125 Rename field 'useTimeTracking' >+1201292079171 Extract method 'forceElapsedTimeUpdated' >+1201293923546 Extract method 'formatSingleFractionHours' >+1201301360250 Extract method 'isRoundToHalfHour' >+1201301415703 Extract method 'isAddToCurrentTime' >+1201302132359 Encapsulate field 'roundToHalfHour' >+1201302148093 Encapsulate field 'addToCurrentTime' >+1201302846625 Extract local variable 'roundToHalfHourPreference' >+1201302873859 Extract local variable 'addToCurrentTimePreference' >Index: .refactorings/2008/1/2/refactorings.index >=================================================================== >RCS file: .refactorings/2008/1/2/refactorings.index >diff -N .refactorings/2008/1/2/refactorings.index >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ .refactorings/2008/1/2/refactorings.index 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,6 @@ >+1199751883234 Convert local variable 'useTimeTrackingButton' to field >+1199751893843 Convert local variable 'spentTimeLabel' to field >+1199751904187 Convert local variable 'currentSpentTimeLabel' to field >+1199751917796 Convert local variable 'trackedSpentTimeText' to field >+1199751927328 Convert local variable 'addToCurrentTimeButton' to field >+1199751938093 Convert local variable 'replaceCurrentTimeButton' to field >Index: .refactorings/2008/1/2/refactorings.history >=================================================================== >RCS file: .refactorings/2008/1/2/refactorings.history >diff -N .refactorings/2008/1/2/refactorings.history >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ .refactorings/2008/1/2/refactorings.history 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,3 @@ >+<?xml version="1.0" encoding="UTF-8"?> >+<session version="1.0">
<refactoring comment="Convert local variable 'org.eclipse.mylyn.xplanner.ui.editor.XPlannerTaskEditor.createTimeTrackingPanel().useTimeTrackingButton' in 'org.eclipse.mylyn.xplanner.ui.editor.XPlannerTaskEditor.createTimeTrackingPanel()' to field
- Original project: 'org.eclipse.mylyn.xplanner.ui'
- Original element: 'org.eclipse.mylyn.xplanner.ui.editor.XPlannerTaskEditor.createTimeTrackingPanel().useTimeTrackingButton'
- Field name: 'useTimeTrackingButton'
- Initialize field in method
- Declared visibility: 'private'" description="Convert local variable 'useTimeTrackingButton' to field" final="false" flags="2" id="org.eclipse.jdt.ui.promote.temp" initialize="1" input="/src<org.eclipse.mylyn.xplanner.ui.editor{XPlannerTaskEditor.java" name="useTimeTrackingButton" selection="5466 0" stamp="1199751883234" static="false" version="1.0" visibility="2"/>
<refactoring comment="Convert local variable 'org.eclipse.mylyn.xplanner.ui.editor.XPlannerTaskEditor.createTimeTrackingPanel().spentTimeLabel' in 'org.eclipse.mylyn.xplanner.ui.editor.XPlannerTaskEditor.createTimeTrackingPanel()' to field
- Original project: 'org.eclipse.mylyn.xplanner.ui'
- Original element: 'org.eclipse.mylyn.xplanner.ui.editor.XPlannerTaskEditor.createTimeTrackingPanel().spentTimeLabel'
- Field name: 'spentTimeLabel'
- Initialize field in method
- Declared visibility: 'private'" description="Convert local variable 'spentTimeLabel' to field" final="false" flags="2" id="org.eclipse.jdt.ui.promote.temp" initialize="1" input="/src<org.eclipse.mylyn.xplanner.ui.editor{XPlannerTaskEditor.java" name="spentTimeLabel" selection="5737 0" stamp="1199751893843" static="false" version="1.0" visibility="2"/>
<refactoring comment="Convert local variable 'org.eclipse.mylyn.xplanner.ui.editor.XPlannerTaskEditor.createTimeTrackingPanel().currentSpentTimeLabel' in 'org.eclipse.mylyn.xplanner.ui.editor.XPlannerTaskEditor.createTimeTrackingPanel()' to field
- Original project: 'org.eclipse.mylyn.xplanner.ui'
- Original element: 'org.eclipse.mylyn.xplanner.ui.editor.XPlannerTaskEditor.createTimeTrackingPanel().currentSpentTimeLabel'
- Field name: 'currentSpentTimeLabel'
- Initialize field in method
- Declared visibility: 'private'" description="Convert local variable 'currentSpentTimeLabel' to field" final="false" flags="2" id="org.eclipse.jdt.ui.promote.temp" initialize="1" input="/src<org.eclipse.mylyn.xplanner.ui.editor{XPlannerTaskEditor.java" name="currentSpentTimeLabel" selection="6037 0" stamp="1199751904187" static="false" version="1.0" visibility="2"/>
<refactoring comment="Convert local variable 'org.eclipse.mylyn.xplanner.ui.editor.XPlannerTaskEditor.createTimeTrackingPanel().trackedSpentTimeText' in 'org.eclipse.mylyn.xplanner.ui.editor.XPlannerTaskEditor.createTimeTrackingPanel()' to field
- Original project: 'org.eclipse.mylyn.xplanner.ui'
- Original element: 'org.eclipse.mylyn.xplanner.ui.editor.XPlannerTaskEditor.createTimeTrackingPanel().trackedSpentTimeText'
- Field name: 'trackedSpentTimeText'
- Initialize field in method
- Declared visibility: 'private'" description="Convert local variable 'trackedSpentTimeText' to field" final="false" flags="2" id="org.eclipse.jdt.ui.promote.temp" initialize="1" input="/src<org.eclipse.mylyn.xplanner.ui.editor{XPlannerTaskEditor.java" name="trackedSpentTimeText" selection="6732 0" stamp="1199751917796" static="false" version="1.0" visibility="2"/>
<refactoring comment="Convert local variable 'org.eclipse.mylyn.xplanner.ui.editor.XPlannerTaskEditor.createTimeTrackingPanel().addToCurrentTimeButton' in 'org.eclipse.mylyn.xplanner.ui.editor.XPlannerTaskEditor.createTimeTrackingPanel()' to field
- Original project: 'org.eclipse.mylyn.xplanner.ui'
- Original element: 'org.eclipse.mylyn.xplanner.ui.editor.XPlannerTaskEditor.createTimeTrackingPanel().addToCurrentTimeButton'
- Field name: 'addToCurrentTimeButton'
- Initialize field in method
- Declared visibility: 'private'" description="Convert local variable 'addToCurrentTimeButton' to field" final="false" flags="2" id="org.eclipse.jdt.ui.promote.temp" initialize="1" input="/src<org.eclipse.mylyn.xplanner.ui.editor{XPlannerTaskEditor.java" name="addToCurrentTimeButton" selection="7078 0" stamp="1199751927328" static="false" version="1.0" visibility="2"/>
<refactoring comment="Convert local variable 'org.eclipse.mylyn.xplanner.ui.editor.XPlannerTaskEditor.createTimeTrackingPanel().replaceCurrentTimeButton' in 'org.eclipse.mylyn.xplanner.ui.editor.XPlannerTaskEditor.createTimeTrackingPanel()' to field
- Original project: 'org.eclipse.mylyn.xplanner.ui'
- Original element: 'org.eclipse.mylyn.xplanner.ui.editor.XPlannerTaskEditor.createTimeTrackingPanel().replaceCurrentTimeButton'
- Field name: 'replaceCurrentTimeButton'
- Initialize field in method
- Declared visibility: 'private'" description="Convert local variable 'replaceCurrentTimeButton' to field" final="false" flags="2" id="org.eclipse.jdt.ui.promote.temp" initialize="1" input="/src<org.eclipse.mylyn.xplanner.ui.editor{XPlannerTaskEditor.java" name="replaceCurrentTimeButton" selection="7295 0" stamp="1199751938093" static="false" version="1.0" visibility="2"/> >+</session> >#P org.eclipse.mylyn.xplanner.tests >Index: src/org/eclipse/mylyn/xplanner/tests/AllXPlannerTests.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/sandbox/org.eclipse.mylyn.xplanner.tests/src/org/eclipse/mylyn/xplanner/tests/AllXPlannerTests.java,v >retrieving revision 1.3 >diff -u -r1.3 AllXPlannerTests.java >--- src/org/eclipse/mylyn/xplanner/tests/AllXPlannerTests.java 24 Aug 2007 19:02:03 -0000 1.3 >+++ src/org/eclipse/mylyn/xplanner/tests/AllXPlannerTests.java 26 Jan 2008 00:49:29 -0000 >@@ -24,6 +24,7 @@ > suite.addTestSuite(XPlannerRepositoryConnectorTest.class); > suite.addTestSuite(XPlannerCustomQueryTest.class); > suite.addTestSuite(XPlannerTaskDataHandlerTest.class); >+ suite.addTestSuite(XPlannerTaskEditorTest.class); > // $JUnit-END$ > return suite; > } >Index: src/org/eclipse/mylyn/xplanner/tests/XPlannerTaskEditorTest.java >=================================================================== >RCS file: src/org/eclipse/mylyn/xplanner/tests/XPlannerTaskEditorTest.java >diff -N src/org/eclipse/mylyn/xplanner/tests/XPlannerTaskEditorTest.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/mylyn/xplanner/tests/XPlannerTaskEditorTest.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,90 @@ >+/******************************************************************************* >+ * Copyright (c) 2007 - 2007 CodeGear and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ *******************************************************************************/ >+package org.eclipse.mylyn.xplanner.tests; >+ >+import junit.framework.TestCase; >+ >+import org.eclipse.mylyn.xplanner.ui.editor.XPlannerTaskEditorExtraControls; >+ >+public class XPlannerTaskEditorTest extends TestCase { >+ >+ protected void setUp() throws Exception { >+ super.setUp(); >+ } >+ >+ protected void tearDown() throws Exception { >+ super.tearDown(); >+ } >+ >+ public void testFormatHoursRoundValueNoRound() { >+ float inputValue = 1.0f; >+ String output = XPlannerTaskEditorExtraControls.formatHours(inputValue, false); >+ assertEquals(output, "1.0"); >+ } >+ >+ public void testFormatHoursRoundValueRound() { >+ float inputValue = 1.0f; >+ String output = XPlannerTaskEditorExtraControls.formatHours(inputValue, true); >+ assertEquals(output, "1.0"); >+ } >+ >+ public void testFormatHoursNotRoundValueRoundHalf() { >+ float inputValue = 1.5f; >+ String output = XPlannerTaskEditorExtraControls.formatHours(inputValue, true); >+ assertEquals(output, "1.5"); >+ } >+ >+ public void testFormatHoursNotRoundValueRound_1_4() { >+ float inputValue = 1.4f; >+ String output = XPlannerTaskEditorExtraControls.formatHours(inputValue, true); >+ assertEquals(output, "1.5"); >+ } >+ >+ public void testFormatHoursNotRoundValueRound_1_2() { >+ float inputValue = 1.2f; >+ String output = XPlannerTaskEditorExtraControls.formatHours(inputValue, true); >+ assertEquals(output, "1.0"); >+ } >+ >+ public void testFormatHoursNotRoundValueRound_1_6() { >+ float inputValue = 1.6f; >+ String output = XPlannerTaskEditorExtraControls.formatHours(inputValue, true); >+ assertEquals(output, "1.5"); >+ } >+ >+ public void testFormatHoursNotRoundValueRound_1_8() { >+ float inputValue = 1.8f; >+ String output = XPlannerTaskEditorExtraControls.formatHours(inputValue, true); >+ assertEquals(output, "2.0"); >+ } >+ >+ public void testFormatHoursNotRoundValueNotRound() { >+ float inputValue = 1.3f; >+ String output = XPlannerTaskEditorExtraControls.formatHours(inputValue, false); >+ assertEquals(output, "1.3"); >+ } >+ >+ public void testFormatHoursNotRoundLongValueNotRound() { >+ float inputValue = 1.345678f; >+ String output = XPlannerTaskEditorExtraControls.formatHours(inputValue, false); >+ assertEquals(output, "1.3"); >+ } >+ >+ public void testFormatSingleFractionHoursNotRoundLongValue() { >+ float inputValue = 1.366666f; >+ String output = XPlannerTaskEditorExtraControls.formatSingleFractionHours(inputValue); >+ assertEquals(output, "1.4"); >+ } >+ >+ public void testFormatSingleFractionHoursRoundValue() { >+ float inputValue = 1f; >+ String output = XPlannerTaskEditorExtraControls.formatSingleFractionHours(inputValue); >+ assertEquals(output, "1.0"); >+ } >+ >+}
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 211101
:
84443
|
84444
|
84445
|
84446
|
84449
| 87931 |
87932
|
87934
|
91469
|
91470