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 195514 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/mylyn/tasks/ui/editors/AbstractNewRepositoryTaskEditor.java (-59 / +32 lines)
Lines 24-30 Link Here
24
import org.eclipse.jface.viewers.SelectionChangedEvent;
24
import org.eclipse.jface.viewers.SelectionChangedEvent;
25
import org.eclipse.jface.viewers.StructuredSelection;
25
import org.eclipse.jface.viewers.StructuredSelection;
26
import org.eclipse.mylyn.internal.tasks.core.TaskCategory;
26
import org.eclipse.mylyn.internal.tasks.core.TaskCategory;
27
import org.eclipse.mylyn.internal.tasks.ui.TaskListColorsAndFonts;
28
import org.eclipse.mylyn.internal.tasks.ui.TasksUiImages;
27
import org.eclipse.mylyn.internal.tasks.ui.TasksUiImages;
29
import org.eclipse.mylyn.internal.tasks.ui.TasksUiPreferenceConstants;
28
import org.eclipse.mylyn.internal.tasks.ui.TasksUiPreferenceConstants;
30
import org.eclipse.mylyn.internal.tasks.ui.editors.RepositoryTaskOutlineNode;
29
import org.eclipse.mylyn.internal.tasks.ui.editors.RepositoryTaskOutlineNode;
Lines 33-49 Link Here
33
import org.eclipse.mylyn.tasks.core.AbstractTask;
32
import org.eclipse.mylyn.tasks.core.AbstractTask;
34
import org.eclipse.mylyn.tasks.core.AbstractTaskCategory;
33
import org.eclipse.mylyn.tasks.core.AbstractTaskCategory;
35
import org.eclipse.mylyn.tasks.core.AbstractTaskContainer;
34
import org.eclipse.mylyn.tasks.core.AbstractTaskContainer;
36
import org.eclipse.mylyn.tasks.core.RepositoryTaskAttribute;
37
import org.eclipse.mylyn.tasks.core.TaskList;
35
import org.eclipse.mylyn.tasks.core.TaskList;
38
import org.eclipse.mylyn.tasks.ui.DatePicker;
36
import org.eclipse.mylyn.tasks.ui.DatePicker;
39
import org.eclipse.mylyn.tasks.ui.TasksUiPlugin;
37
import org.eclipse.mylyn.tasks.ui.TasksUiPlugin;
40
import org.eclipse.swt.SWT;
38
import org.eclipse.swt.SWT;
41
import org.eclipse.swt.custom.CCombo;
39
import org.eclipse.swt.custom.CCombo;
40
import org.eclipse.swt.custom.VerifyKeyListener;
42
import org.eclipse.swt.events.ModifyEvent;
41
import org.eclipse.swt.events.ModifyEvent;
43
import org.eclipse.swt.events.ModifyListener;
42
import org.eclipse.swt.events.ModifyListener;
44
import org.eclipse.swt.events.SelectionAdapter;
43
import org.eclipse.swt.events.SelectionAdapter;
45
import org.eclipse.swt.events.SelectionEvent;
44
import org.eclipse.swt.events.SelectionEvent;
46
import org.eclipse.swt.graphics.Font;
45
import org.eclipse.swt.events.VerifyEvent;
47
import org.eclipse.swt.layout.GridData;
46
import org.eclipse.swt.layout.GridData;
48
import org.eclipse.swt.layout.GridLayout;
47
import org.eclipse.swt.layout.GridLayout;
49
import org.eclipse.swt.widgets.Button;
48
import org.eclipse.swt.widgets.Button;
Lines 63-69 Link Here
63
import org.eclipse.ui.forms.widgets.FormToolkit;
62
import org.eclipse.ui.forms.widgets.FormToolkit;
64
import org.eclipse.ui.forms.widgets.ImageHyperlink;
63
import org.eclipse.ui.forms.widgets.ImageHyperlink;
65
import org.eclipse.ui.forms.widgets.Section;
64
import org.eclipse.ui.forms.widgets.Section;
66
import org.eclipse.ui.themes.IThemeManager;
67
65
68
/**
66
/**
69
 * An editor used to view a locally created bug that does not yet exist on a server.
67
 * An editor used to view a locally created bug that does not yet exist on a server.
Lines 73-79 Link Here
73
 */
71
 */
74
public abstract class AbstractNewRepositoryTaskEditor extends AbstractRepositoryTaskEditor {
72
public abstract class AbstractNewRepositoryTaskEditor extends AbstractRepositoryTaskEditor {
75
73
76
	private static final int DESCRIPTION_WIDTH = 79 * 7; // 500;
74
	/**
75
	 * @author Raphael Ackermann (bug 195514)
76
	 */
77
	protected class TabVerifyKeyListener implements VerifyKeyListener {
78
79
		public void verifyKey(VerifyEvent event) {
80
			// if there is a tab key, do not "execute" it and instead select the Attributes section
81
			if (event.keyCode == SWT.TAB) {
82
				event.doit = false;
83
				selectAttributes();
84
			}
85
		}
86
87
	}
77
88
78
	private static final int DEFAULT_FIELD_WIDTH = 150;
89
	private static final int DEFAULT_FIELD_WIDTH = 150;
79
90
Lines 141-167 Link Here
141
152
142
	}
153
	}
143
154
155
	/**
156
	 * @author Raphael Ackermann (modifications) (bug 195514)
157
	 * @param composite
158
	 */
144
	@Override
159
	@Override
145
	protected void createSummaryLayout(Composite composite) {
160
	protected void createSummaryLayout(Composite composite) {
146
		Composite summaryComposite = getManagedForm().getToolkit().createComposite(composite);
161
		addSummaryText(composite);
147
		GridLayout summaryLayout = new GridLayout(2, false);
162
		if (newSummaryTextViewer != null) {
148
		summaryLayout.verticalSpacing = 0;
163
			newSummaryTextViewer.getTextWidget().addModifyListener(new ModifyListener() {
149
		summaryLayout.marginHeight = 2;
150
		summaryComposite.setLayout(summaryLayout);
151
		GridDataFactory.fillDefaults().grab(true, false).applyTo(summaryComposite);
152
153
		RepositoryTaskAttribute attribute = taskData.getAttribute(RepositoryTaskAttribute.SUMMARY);
154
		if (attribute != null) {
155
			createLabel(summaryComposite, attribute);
156
			summaryText = createTextField(summaryComposite, attribute, SWT.FLAT);
157
			summaryText.setData(FormToolkit.KEY_DRAW_BORDER, FormToolkit.TEXT_BORDER);
158
			IThemeManager themeManager = getSite().getWorkbenchWindow().getWorkbench().getThemeManager();
159
			Font summaryFont = themeManager.getCurrentTheme().getFontRegistry().get(
160
					TaskListColorsAndFonts.TASK_EDITOR_FONT);
161
			summaryText.setFont(summaryFont);
162
163
			GridDataFactory.fillDefaults().grab(true, false).hint(DESCRIPTION_WIDTH, SWT.DEFAULT).applyTo(summaryText);
164
			summaryText.addModifyListener(new ModifyListener() {
165
				public void modifyText(ModifyEvent e) {
164
				public void modifyText(ModifyEvent e) {
166
					String sel = summaryText.getText();
165
					String sel = summaryText.getText();
167
					if (!(newSummary.equals(sel))) {
166
					if (!(newSummary.equals(sel))) {
Lines 170-213 Link Here
170
					}
169
					}
171
				}
170
				}
172
			});
171
			});
172
			newSummaryTextViewer.prependVerifyKeyListener(new TabVerifyKeyListener());
173
		}
173
		}
174
		getManagedForm().getToolkit().paintBordersFor(summaryComposite);
175
	}
174
	}
176
175
177
//	@Override
178
//	protected void addSummaryText(Composite attributesComposite) {
179
//
180
//		Composite summaryComposite = getManagedForm().getToolkit().createComposite(attributesComposite);
181
//		GridLayout summaryLayout = new GridLayout(2, false);
182
//		summaryLayout.verticalSpacing = 0;
183
//		summaryLayout.marginHeight = 2;
184
//		summaryComposite.setLayout(summaryLayout);
185
//		GridDataFactory.fillDefaults().grab(true, false).applyTo(summaryComposite);
186
//
187
//		RepositoryTaskAttribute attribute = taskData.getAttribute(RepositoryTaskAttribute.SUMMARY);
188
//		if (attribute != null) {
189
//			createLabel(summaryComposite, attribute);
190
//			summaryText = createTextField(summaryComposite, attribute, SWT.FLAT);
191
//			summaryText.setData(FormToolkit.KEY_DRAW_BORDER, FormToolkit.TEXT_BORDER);
192
//			IThemeManager themeManager = getSite().getWorkbenchWindow().getWorkbench().getThemeManager();
193
//			Font summaryFont = themeManager.getCurrentTheme().getFontRegistry().get(
194
//					TaskListColorsAndFonts.TASK_EDITOR_FONT);
195
//			summaryText.setFont(summaryFont);
196
//
197
//			GridDataFactory.fillDefaults().grab(true, false).hint(DESCRIPTION_WIDTH, SWT.DEFAULT).applyTo(summaryText);
198
//			summaryText.addModifyListener(new ModifyListener() {
199
//				public void modifyText(ModifyEvent e) {
200
//					String sel = summaryText.getText();
201
//					if (!(newSummary.equals(sel))) {
202
//						newSummary = sel;
203
//						markDirty(true);
204
//					}
205
//				}
206
//			});
207
//		}
208
//		getManagedForm().getToolkit().paintBordersFor(summaryComposite);
209
//	}
210
211
	@Override
176
	@Override
212
	protected void createAttachmentLayout(Composite comp) {
177
	protected void createAttachmentLayout(Composite comp) {
213
		// currently can't attach while creating new bug
178
		// currently can't attach while creating new bug
Lines 349-354 Link Here
349
		return true;
314
		return true;
350
	}
315
	}
351
316
317
	/**
318
	 * @author Raphael Ackermann (bug 198526)
319
	 */
320
	@Override
321
	public void setFocus() {
322
		summaryText.setFocus();
323
	}
324
352
	@Override
325
	@Override
353
	public boolean isSaveAsAllowed() {
326
	public boolean isSaveAsAllowed() {
354
		return false;
327
		return false;
(-)src/org/eclipse/mylyn/tasks/ui/editors/AbstractRepositoryTaskEditor.java (-29 / +66 lines)
Lines 114-119 Link Here
114
import org.eclipse.swt.custom.CCombo;
114
import org.eclipse.swt.custom.CCombo;
115
import org.eclipse.swt.custom.StackLayout;
115
import org.eclipse.swt.custom.StackLayout;
116
import org.eclipse.swt.custom.StyledText;
116
import org.eclipse.swt.custom.StyledText;
117
import org.eclipse.swt.custom.VerifyKeyListener;
117
import org.eclipse.swt.dnd.DND;
118
import org.eclipse.swt.dnd.DND;
118
import org.eclipse.swt.dnd.DropTarget;
119
import org.eclipse.swt.dnd.DropTarget;
119
import org.eclipse.swt.dnd.FileTransfer;
120
import org.eclipse.swt.dnd.FileTransfer;
Lines 124-129 Link Here
124
import org.eclipse.swt.events.SelectionAdapter;
125
import org.eclipse.swt.events.SelectionAdapter;
125
import org.eclipse.swt.events.SelectionEvent;
126
import org.eclipse.swt.events.SelectionEvent;
126
import org.eclipse.swt.events.SelectionListener;
127
import org.eclipse.swt.events.SelectionListener;
128
import org.eclipse.swt.events.VerifyEvent;
127
import org.eclipse.swt.graphics.Color;
129
import org.eclipse.swt.graphics.Color;
128
import org.eclipse.swt.graphics.Cursor;
130
import org.eclipse.swt.graphics.Cursor;
129
import org.eclipse.swt.graphics.Font;
131
import org.eclipse.swt.graphics.Font;
Lines 186-191 Link Here
186
 */
188
 */
187
public abstract class AbstractRepositoryTaskEditor extends TaskFormPage {
189
public abstract class AbstractRepositoryTaskEditor extends TaskFormPage {
188
190
191
	/**
192
	 * @author Raphael Ackermann (bug 195514)
193
	 */
194
	private class TabVerifyKeyListener implements VerifyKeyListener {
195
196
		public void verifyKey(VerifyEvent event) {
197
			// if there is a tab key, do not "execute" it and instead select the Status control
198
			if (event.keyCode == SWT.TAB) {
199
				event.doit = false;
200
				headerInfoComposite.setFocus();
201
			}
202
		}
203
204
	}
205
189
	private static final String ERROR_NOCONNECTIVITY = "Unable to submit at this time. Check connectivity and retry.";
206
	private static final String ERROR_NOCONNECTIVITY = "Unable to submit at this time. Check connectivity and retry.";
190
207
191
	private static final String LABEL_HISTORY = "History";
208
	private static final String LABEL_HISTORY = "History";
Lines 232-237 Link Here
232
249
233
	private static final int DESCRIPTION_HEIGHT = 10 * 14;
250
	private static final int DESCRIPTION_HEIGHT = 10 * 14;
234
251
252
	protected static final int SUMMARY_HEIGHT = 20;
253
235
	private static final String LABEL_BUTTON_SUBMIT = "Submit";
254
	private static final String LABEL_BUTTON_SUBMIT = "Submit";
236
255
237
	private static final String LABEL_COPY_TO_CLIPBOARD = "Copy to Clipboard";
256
	private static final String LABEL_COPY_TO_CLIPBOARD = "Copy to Clipboard";
Lines 250-256 Link Here
250
269
251
	private boolean expandedStateAttributes = false;
270
	private boolean expandedStateAttributes = false;
252
271
253
	protected Text summaryText;
272
	protected StyledText summaryText;
254
273
255
	protected Button submitButton;
274
	protected Button submitButton;
256
275
Lines 264-269 Link Here
264
283
265
	private Composite editorComposite;
284
	private Composite editorComposite;
266
285
286
	protected TextViewer newSummaryTextViewer;
287
267
	private TextViewer newCommentTextViewer;
288
	private TextViewer newCommentTextViewer;
268
289
269
	private org.eclipse.swt.widgets.List ccList;
290
	private org.eclipse.swt.widgets.List ccList;
Lines 695-701 Link Here
695
716
696
		createSummaryLayout(editorComposite);
717
		createSummaryLayout(editorComposite);
697
718
698
		Section attributesSection = createSection(editorComposite, getSectionLabel(SECTION_NAME.ATTRIBTUES_SECTION));
719
		attributesSection = createSection(editorComposite, getSectionLabel(SECTION_NAME.ATTRIBTUES_SECTION));
699
		attributesSection.setExpanded(expandedStateAttributes || hasAttributeChanges);
720
		attributesSection.setExpanded(expandedStateAttributes || hasAttributeChanges);
700
721
701
		Composite toolbarComposite = toolkit.createComposite(attributesSection);
722
		Composite toolbarComposite = toolkit.createComposite(attributesSection);
Lines 807-817 Link Here
807
		}
828
		}
808
	}
829
	}
809
830
831
	/**
832
	 * @author Raphael Ackermann (modifications) (bug 195514)
833
	 * @param composite
834
	 */
810
	protected void createSummaryLayout(Composite composite) {
835
	protected void createSummaryLayout(Composite composite) {
811
812
		addSummaryText(composite);
836
		addSummaryText(composite);
837
		if (newSummaryTextViewer != null) {
838
			newSummaryTextViewer.getTextWidget().addModifyListener(new ModifyListener() {
839
				public void modifyText(ModifyEvent e) {
840
					String sel = summaryText.getText();
841
					RepositoryTaskAttribute a = taskData.getAttribute(RepositoryTaskAttribute.SUMMARY);
842
					if (!(a.getValue().equals(sel))) {
843
						a.setValue(sel);
844
						markDirty(true);
845
					}
846
				}
847
			});
848
			newSummaryTextViewer.prependVerifyKeyListener(new TabVerifyKeyListener());
849
		}
813
850
814
		Composite headerInfoComposite = toolkit.createComposite(composite);
851
		headerInfoComposite = toolkit.createComposite(composite);
815
		GridLayout headerLayout = new GridLayout(11, false);
852
		GridLayout headerLayout = new GridLayout(11, false);
816
		headerLayout.verticalSpacing = 1;
853
		headerLayout.verticalSpacing = 1;
817
		headerLayout.marginHeight = 1;
854
		headerLayout.marginHeight = 1;
Lines 1219-1228 Link Here
1219
	}
1256
	}
1220
1257
1221
	/**
1258
	/**
1222
	 * Adds a text field to display and edit the task's summary.
1259
	 * Adds a text editor with spell checking enabled to display and edit the task's summary.
1223
	 * 
1260
	 * 
1261
	 * @author Raphael Ackermann (modifications) (bug 195514)
1224
	 * @param attributesComposite
1262
	 * @param attributesComposite
1225
	 *            The composite to add the text field to.
1263
	 *            The composite to add the text editor to.
1226
	 */
1264
	 */
1227
	protected void addSummaryText(Composite attributesComposite) {
1265
	protected void addSummaryText(Composite attributesComposite) {
1228
		Composite summaryComposite = toolkit.createComposite(attributesComposite);
1266
		Composite summaryComposite = toolkit.createComposite(attributesComposite);
Lines 1233-1263 Link Here
1233
		GridDataFactory.fillDefaults().grab(true, false).applyTo(summaryComposite);
1271
		GridDataFactory.fillDefaults().grab(true, false).applyTo(summaryComposite);
1234
1272
1235
		if (taskData != null) {
1273
		if (taskData != null) {
1236
			RepositoryTaskAttribute attribute = taskData.getAttribute(RepositoryTaskAttribute.SUMMARY);
1274
			final RepositoryTaskAttribute attribute = taskData.getAttribute(RepositoryTaskAttribute.SUMMARY);
1237
			if (attribute != null) {
1275
			if (attribute != null) {
1238
				// Label summaryLabel = createLabel(summaryComposite,
1276
1239
				// attribute);
1277
				newSummaryTextViewer = addTextEditor(repository, summaryComposite, attribute.getValue(), true, SWT.FLAT);
1240
				// summaryLabel.setFont(TITLE_FONT);
1278
				newSummaryTextViewer.setEditable(true);
1241
				summaryText = createTextField(summaryComposite, attribute, SWT.FLAT);
1279
1242
				IThemeManager themeManager = getSite().getWorkbenchWindow().getWorkbench().getThemeManager();
1280
				GridDataFactory.fillDefaults().grab(true, false).hint(DESCRIPTION_WIDTH, SUMMARY_HEIGHT).applyTo(
1243
				Font summaryFont = themeManager.getCurrentTheme().getFontRegistry().get(
1281
						newSummaryTextViewer.getControl());
1244
						TaskListColorsAndFonts.TASK_EDITOR_FONT);
1282
				newSummaryTextViewer.getControl().setData(FormToolkit.KEY_DRAW_BORDER, FormToolkit.TEXT_BORDER);
1245
				summaryText.setFont(summaryFont);
1246
1247
				GridDataFactory.fillDefaults().grab(true, false).hint(DESCRIPTION_WIDTH, SWT.DEFAULT).applyTo(
1248
						summaryText);
1249
				summaryText.addModifyListener(new ModifyListener() {
1250
					public void modifyText(ModifyEvent e) {
1251
						String sel = summaryText.getText();
1252
						RepositoryTaskAttribute a = taskData.getAttribute(RepositoryTaskAttribute.SUMMARY);
1253
						if (!(a.getValue().equals(sel))) {
1254
							a.setValue(sel);
1255
							markDirty(true);
1256
						}
1257
					}
1258
				});
1259
			}
1283
			}
1260
		}
1284
		}
1285
		summaryText = newSummaryTextViewer.getTextWidget();
1261
		toolkit.paintBordersFor(summaryComposite);
1286
		toolkit.paintBordersFor(summaryComposite);
1262
	}
1287
	}
1263
1288
Lines 2663-2668 Link Here
2663
		focusOn(addCommentsTextBox, false);
2688
		focusOn(addCommentsTextBox, false);
2664
	}
2689
	}
2665
2690
2691
	/**
2692
	 * @author Raphael Ackermann (bug 195514)
2693
	 */
2694
	protected void selectAttributes() {
2695
		focusOn(attributesSection, false);
2696
	}
2697
	
2666
	private void selectDescription() {
2698
	private void selectDescription() {
2667
		focusOn(descriptionTextViewer.getTextWidget(), false);
2699
		focusOn(descriptionTextViewer.getTextWidget(), false);
2668
	}
2700
	}
Lines 2745-2750 Link Here
2745
2777
2746
	private boolean formBusy = false;
2778
	private boolean formBusy = false;
2747
2779
2780
	private Composite headerInfoComposite;
2781
2782
	private Section attributesSection;
2783
2748
	public void close() {
2784
	public void close() {
2749
		Display activeDisplay = getSite().getShell().getDisplay();
2785
		Display activeDisplay = getSite().getShell().getDisplay();
2750
		activeDisplay.asyncExec(new Runnable() {
2786
		activeDisplay.asyncExec(new Runnable() {
Lines 2793-2799 Link Here
2793
		public void handleEvent(Event event) {
2829
		public void handleEvent(Event event) {
2794
			fireSelectionChanged(new SelectionChangedEvent(selectionProvider, new StructuredSelection(
2830
			fireSelectionChanged(new SelectionChangedEvent(selectionProvider, new StructuredSelection(
2795
					new RepositoryTaskSelection(taskData.getId(), taskData.getRepositoryUrl(),
2831
					new RepositoryTaskSelection(taskData.getId(), taskData.getRepositoryUrl(),
2796
							taskData.getRepositoryKind(), "New Comment", false, taskData.getSummary()))));
2832
							taskData.getRepositoryKind(), getSectionLabel(SECTION_NAME.NEWCOMMENT_SECTION), false,
2833
							taskData.getSummary()))));
2797
		}
2834
		}
2798
	}
2835
	}

Return to bug 195514