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 272092
Collapse All | Expand All

(-)src/org/eclipse/mylyn/internal/tasks/ui/editors/PlanningPart.java (-3 / +56 lines)
Lines 40-45 Link Here
40
import org.eclipse.mylyn.tasks.ui.editors.AbstractTaskEditorExtension;
40
import org.eclipse.mylyn.tasks.ui.editors.AbstractTaskEditorExtension;
41
import org.eclipse.mylyn.tasks.ui.editors.TaskFormPage;
41
import org.eclipse.mylyn.tasks.ui.editors.TaskFormPage;
42
import org.eclipse.swt.SWT;
42
import org.eclipse.swt.SWT;
43
import org.eclipse.swt.events.FocusEvent;
44
import org.eclipse.swt.events.FocusListener;
43
import org.eclipse.swt.events.ModifyEvent;
45
import org.eclipse.swt.events.ModifyEvent;
44
import org.eclipse.swt.events.ModifyListener;
46
import org.eclipse.swt.events.ModifyListener;
45
import org.eclipse.swt.events.SelectionAdapter;
47
import org.eclipse.swt.events.SelectionAdapter;
Lines 151-157 Link Here
151
		}
153
		}
152
154
153
		if (getTask().getNotes() != null && notesString != null) {
155
		if (getTask().getNotes() != null && notesString != null) {
154
			return getTask().getNotes().equals(notesString);
156
			return getTask().getNotes().equals(notesString) || notesString.equals(PERSONAL_NOTES);
155
		}
157
		}
156
		return false;
158
		return false;
157
	}
159
	}
Lines 227-233 Link Here
227
		return section;
229
		return section;
228
	}
230
	}
229
231
230
	private void createNotesArea(FormToolkit toolkit, Composite parent, int numColumns) {
232
	private static final String PERSONAL_NOTES = "Personal Notes";
233
234
	private void createNotesArea(final FormToolkit toolkit, Composite parent, int numColumns) {
231
		Composite composite = toolkit.createComposite(parent);
235
		Composite composite = toolkit.createComposite(parent);
232
		GridLayout layout = new GridLayout();
236
		GridLayout layout = new GridLayout();
233
		layout.numColumns = 1;
237
		layout.numColumns = 1;
Lines 236-242 Link Here
236
		GridDataFactory.fillDefaults().span(numColumns, SWT.DEFAULT).grab(true, expandNotesVertically).applyTo(
240
		GridDataFactory.fillDefaults().span(numColumns, SWT.DEFAULT).grab(true, expandNotesVertically).applyTo(
237
				composite);
241
				composite);
238
242
239
240
		if (page != null) {
243
		if (page != null) {
241
			IContextService contextService = (IContextService) page.getEditorSite().getService(IContextService.class);
244
			IContextService contextService = (IContextService) page.getEditorSite().getService(IContextService.class);
242
			if (contextService != null) {
245
			if (contextService != null) {
Lines 252-257 Link Here
252
		}
255
		}
253
		noteEditor.setSpellCheckingEnabled(true);
256
		noteEditor.setSpellCheckingEnabled(true);
254
		noteEditor.createControl(composite, toolkit);
257
		noteEditor.createControl(composite, toolkit);
258
255
		noteEditor.setText(notesString);
259
		noteEditor.setText(notesString);
256
260
257
		noteEditor.getControl().setLayoutData(
261
		noteEditor.getControl().setLayoutData(
Lines 269-277 Link Here
269
				}
273
				}
270
			}
274
			}
271
		});
275
		});
276
		addNotesLabelText(toolkit, composite);
272
		toolkit.paintBordersFor(composite);
277
		toolkit.paintBordersFor(composite);
273
	}
278
	}
274
279
280
	private void addNotesLabelText(final FormToolkit toolkit, Composite composite) {
281
282
		if (notesString.length() == 0) {
283
			notesString = PERSONAL_NOTES;
284
			noteEditor.setText(notesString);
285
		}
286
287
		FocusListener removePersonalNotesFocusListener = new FocusListener() {
288
289
			public void focusGained(FocusEvent e) {
290
				if (noteEditor.getText().equals(PERSONAL_NOTES)) {
291
					noteEditor.setText(""); //$NON-NLS-1$
292
					if (noteEditor.getDefaultViewer() != null) {
293
						noteEditor.getDefaultViewer()
294
								.getTextWidget()
295
								.setForeground(toolkit.getColors().getForeground());
296
					}
297
					if (noteEditor.getEditorViewer() != null) {
298
						noteEditor.getEditorViewer().getTextWidget().setForeground(toolkit.getColors().getForeground());
299
					}
300
				}
301
			}
302
303
			public void focusLost(FocusEvent e) {
304
			}
305
		};
306
		boolean changeColor = false;
307
		if (noteEditor.getText().equals(PERSONAL_NOTES)) {
308
			changeColor = true;
309
		}
310
		if (noteEditor.getDefaultViewer() != null) {
311
			noteEditor.getDefaultViewer().getTextWidget().addFocusListener(removePersonalNotesFocusListener);
312
			if (changeColor) {
313
				noteEditor.getDefaultViewer().getTextWidget().setForeground(
314
						composite.getShell().getDisplay().getSystemColor(SWT.COLOR_GRAY));
315
			}
316
		}
317
318
		if (noteEditor.getEditorViewer() != null) {
319
			noteEditor.getEditorViewer().getTextWidget().addFocusListener(removePersonalNotesFocusListener);
320
			if (changeColor) {
321
				noteEditor.getEditorViewer().getTextWidget().setForeground(
322
						composite.getShell().getDisplay().getSystemColor(SWT.COLOR_GRAY));
323
			}
324
		}
325
326
	}
327
275
	private void createActualTime(FormToolkit toolkit, Composite parent) {
328
	private void createActualTime(FormToolkit toolkit, Composite parent) {
276
		Label label = toolkit.createLabel(parent, Messages.TaskEditorPlanningPart_Active);
329
		Label label = toolkit.createLabel(parent, Messages.TaskEditorPlanningPart_Active);
277
		label.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
330
		label.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));

Return to bug 272092