|
Lines 31-38
Link Here
|
| 31 |
import org.eclipse.ui.IEditorSite; |
31 |
import org.eclipse.ui.IEditorSite; |
| 32 |
import org.eclipse.ui.PlatformUI; |
32 |
import org.eclipse.ui.PlatformUI; |
| 33 |
import org.eclipse.ui.forms.editor.FormEditor; |
33 |
import org.eclipse.ui.forms.editor.FormEditor; |
|
|
34 |
import org.eclipse.ui.forms.widgets.ExpandableComposite; |
| 34 |
import org.eclipse.ui.forms.widgets.FormToolkit; |
35 |
import org.eclipse.ui.forms.widgets.FormToolkit; |
| 35 |
import org.eclipse.ui.forms.widgets.ImageHyperlink; |
36 |
import org.eclipse.ui.forms.widgets.ImageHyperlink; |
|
|
37 |
import org.eclipse.ui.forms.widgets.Section; |
| 36 |
|
38 |
|
| 37 |
/** |
39 |
/** |
| 38 |
* @author Ravi Kumar |
40 |
* @author Ravi Kumar |
|
Lines 57-62
Link Here
|
| 57 |
|
59 |
|
| 58 |
private boolean addToCurrentTime; |
60 |
private boolean addToCurrentTime; |
| 59 |
|
61 |
|
|
|
62 |
private Section timeTrackingSection; |
| 63 |
|
| 60 |
public XPlannerTaskEditor(FormEditor editor) { |
64 |
public XPlannerTaskEditor(FormEditor editor) { |
| 61 |
super(editor); |
65 |
super(editor); |
| 62 |
} |
66 |
} |
|
Lines 191-196
Link Here
|
| 191 |
boolean useTimeTrackingPreference = XPlannerMylynUIPlugin.getBooleanPreference(XPlannerMylynUIPlugin.USE_AUTO_TIME_TRACKING_PREFERENCE_NAME); |
195 |
boolean useTimeTrackingPreference = XPlannerMylynUIPlugin.getBooleanPreference(XPlannerMylynUIPlugin.USE_AUTO_TIME_TRACKING_PREFERENCE_NAME); |
| 192 |
useTimeTrackingButton.setSelection(useTimeTrackingPreference); |
196 |
useTimeTrackingButton.setSelection(useTimeTrackingPreference); |
| 193 |
setUseAutoTimeTracking(useTimeTrackingPreference); |
197 |
setUseAutoTimeTracking(useTimeTrackingPreference); |
|
|
198 |
updateTimeTrackingSection(); |
| 194 |
|
199 |
|
| 195 |
// rounding |
200 |
// rounding |
| 196 |
boolean roundToHalfHourPreference = XPlannerMylynUIPlugin.getBooleanPreference(XPlannerMylynUIPlugin.ROUND_AUTO_TIME_TRACKING_TO_HALF_HOUR_PREFERENCE_NAME); |
201 |
boolean roundToHalfHourPreference = XPlannerMylynUIPlugin.getBooleanPreference(XPlannerMylynUIPlugin.ROUND_AUTO_TIME_TRACKING_TO_HALF_HOUR_PREFERENCE_NAME); |
|
Lines 204-209
Link Here
|
| 204 |
setAddToCurrentTime(addToCurrentTimePreference); |
209 |
setAddToCurrentTime(addToCurrentTimePreference); |
| 205 |
} |
210 |
} |
| 206 |
|
211 |
|
|
|
212 |
private void updateTimeTrackingSection() { |
| 213 |
timeTrackingSection.setExpanded(useTimeTrackingButton.getSelection()); |
| 214 |
} |
| 215 |
|
| 207 |
private void savePreferenceSettings() { |
216 |
private void savePreferenceSettings() { |
| 208 |
// auto tracking |
217 |
// auto tracking |
| 209 |
XPlannerMylynUIPlugin.setBooleanPreference(XPlannerMylynUIPlugin.USE_AUTO_TIME_TRACKING_PREFERENCE_NAME, |
218 |
XPlannerMylynUIPlugin.setBooleanPreference(XPlannerMylynUIPlugin.USE_AUTO_TIME_TRACKING_PREFERENCE_NAME, |
|
Lines 220-235
Link Here
|
| 220 |
|
229 |
|
| 221 |
private void createTimeTrackingPanel(Composite parent) { |
230 |
private void createTimeTrackingPanel(Composite parent) { |
| 222 |
FormToolkit toolkit = new FormToolkit(getSite().getShell().getDisplay()); |
231 |
FormToolkit toolkit = new FormToolkit(getSite().getShell().getDisplay()); |
| 223 |
Composite timeTrackingComposite = toolkit.createComposite(parent, SWT.NONE); |
232 |
timeTrackingSection = toolkit.createSection(parent, ExpandableComposite.LEFT_TEXT_CLIENT_ALIGNMENT |
|
|
233 |
| ExpandableComposite.TWISTIE | ExpandableComposite.CLIENT_INDENT); |
| 234 |
timeTrackingSection.setLayout(new GridLayout()); |
| 235 |
GridDataFactory.fillDefaults().span(4, 1).applyTo(timeTrackingSection); |
| 236 |
timeTrackingSection.setText(""); |
| 224 |
|
237 |
|
| 225 |
GridDataFactory.fillDefaults().span(4, 1).applyTo(timeTrackingComposite); |
238 |
useTimeTrackingButton = toolkit.createButton(timeTrackingSection, |
| 226 |
timeTrackingComposite.setLayout(new GridLayout(1, false)); |
|
|
| 227 |
|
| 228 |
useTimeTrackingButton = toolkit.createButton(timeTrackingComposite, |
| 229 |
"Update actual task time from Mylyn's time tracker", SWT.CHECK); |
239 |
"Update actual task time from Mylyn's time tracker", SWT.CHECK); |
| 230 |
GridDataFactory.fillDefaults().span(1, 1).grab(true, false).applyTo(useTimeTrackingButton); |
240 |
GridDataFactory.fillDefaults().span(1, 1).grab(true, false).align(SWT.LEFT, SWT.CENTER).applyTo( |
|
|
241 |
useTimeTrackingButton); |
| 242 |
useTimeTrackingButton.addSelectionListener(new SelectionListener() { |
| 243 |
public void widgetDefaultSelected(SelectionEvent e) { |
| 244 |
} |
| 245 |
|
| 246 |
public void widgetSelected(SelectionEvent e) { |
| 247 |
if (e.getSource().equals(useTimeTrackingButton)) { |
| 248 |
updateTimeTrackingSection(); |
| 249 |
} |
| 250 |
} |
| 251 |
|
| 252 |
}); |
| 253 |
|
| 231 |
useTimeTrackingButton.addSelectionListener(this); |
254 |
useTimeTrackingButton.addSelectionListener(this); |
| 232 |
|
255 |
|
|
|
256 |
timeTrackingSection.setTextClient(useTimeTrackingButton); |
| 257 |
|
| 258 |
Composite timeTrackingComposite = toolkit.createComposite(timeTrackingSection, SWT.NONE); |
| 259 |
timeTrackingSection.setClient(timeTrackingComposite); |
| 260 |
|
| 261 |
GridDataFactory.fillDefaults().span(4, 1).applyTo(timeTrackingComposite); |
| 262 |
timeTrackingComposite.setLayout(new GridLayout(1, false)); |
| 263 |
|
| 233 |
roundToHalfHourButton = toolkit.createButton(timeTrackingComposite, "Round time to half hour", SWT.CHECK); |
264 |
roundToHalfHourButton = toolkit.createButton(timeTrackingComposite, "Round time to half hour", SWT.CHECK); |
| 234 |
GridDataFactory.fillDefaults().indent(new Point(15, 5)).applyTo(roundToHalfHourButton); |
265 |
GridDataFactory.fillDefaults().indent(new Point(15, 5)).applyTo(roundToHalfHourButton); |
| 235 |
roundToHalfHourButton.addSelectionListener(this); |
266 |
roundToHalfHourButton.addSelectionListener(this); |