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 (-22 / +27 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 43-49 Link Here
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;
47
import org.eclipse.swt.layout.GridData;
45
import org.eclipse.swt.layout.GridData;
48
import org.eclipse.swt.layout.GridLayout;
46
import org.eclipse.swt.layout.GridLayout;
49
import org.eclipse.swt.widgets.Button;
47
import org.eclipse.swt.widgets.Button;
Lines 63-69 Link Here
63
import org.eclipse.ui.forms.widgets.FormToolkit;
61
import org.eclipse.ui.forms.widgets.FormToolkit;
64
import org.eclipse.ui.forms.widgets.ImageHyperlink;
62
import org.eclipse.ui.forms.widgets.ImageHyperlink;
65
import org.eclipse.ui.forms.widgets.Section;
63
import org.eclipse.ui.forms.widgets.Section;
66
import org.eclipse.ui.themes.IThemeManager;
67
64
68
/**
65
/**
69
 * An editor used to view a locally created bug that does not yet exist on a server.
66
 * An editor used to view a locally created bug that does not yet exist on a server.
Lines 143-148 Link Here
143
140
144
	@Override
141
	@Override
145
	protected void createSummaryLayout(Composite composite) {
142
	protected void createSummaryLayout(Composite composite) {
143
146
		Composite summaryComposite = getManagedForm().getToolkit().createComposite(composite);
144
		Composite summaryComposite = getManagedForm().getToolkit().createComposite(composite);
147
		GridLayout summaryLayout = new GridLayout(2, false);
145
		GridLayout summaryLayout = new GridLayout(2, false);
148
		summaryLayout.verticalSpacing = 0;
146
		summaryLayout.verticalSpacing = 0;
Lines 150-177 Link Here
150
		summaryComposite.setLayout(summaryLayout);
148
		summaryComposite.setLayout(summaryLayout);
151
		GridDataFactory.fillDefaults().grab(true, false).applyTo(summaryComposite);
149
		GridDataFactory.fillDefaults().grab(true, false).applyTo(summaryComposite);
152
150
153
		RepositoryTaskAttribute attribute = taskData.getAttribute(RepositoryTaskAttribute.SUMMARY);
151
		if (taskData != null) {
154
		if (attribute != null) {
152
			final RepositoryTaskAttribute attribute = taskData.getAttribute(RepositoryTaskAttribute.SUMMARY);
155
			createLabel(summaryComposite, attribute);
153
			if (attribute != null) {
156
			summaryText = createTextField(summaryComposite, attribute, SWT.FLAT);
154
157
			summaryText.setData(FormToolkit.KEY_DRAW_BORDER, FormToolkit.TEXT_BORDER);
155
				newSummaryTextViewer = addTextEditor(repository, summaryComposite, attribute.getValue(), true, SWT.FLAT);
158
			IThemeManager themeManager = getSite().getWorkbenchWindow().getWorkbench().getThemeManager();
156
				newSummaryTextViewer.setEditable(true);
159
			Font summaryFont = themeManager.getCurrentTheme().getFontRegistry().get(
157
160
					TaskListColorsAndFonts.TASK_EDITOR_FONT);
158
				GridDataFactory.fillDefaults().grab(true, false).hint(DESCRIPTION_WIDTH, SUMMARY_HEIGHT).applyTo(
161
			summaryText.setFont(summaryFont);
159
						newSummaryTextViewer.getControl());
162
160
				newSummaryTextViewer.getControl().setData(FormToolkit.KEY_DRAW_BORDER, FormToolkit.TEXT_BORDER);
163
			GridDataFactory.fillDefaults().grab(true, false).hint(DESCRIPTION_WIDTH, SWT.DEFAULT).applyTo(summaryText);
161
164
			summaryText.addModifyListener(new ModifyListener() {
162
				newSummaryTextViewer.getTextWidget().addModifyListener(new ModifyListener() {
165
				public void modifyText(ModifyEvent e) {
163
166
					String sel = summaryText.getText();
164
					public void modifyText(ModifyEvent e) {
167
					if (!(newSummary.equals(sel))) {
165
						String sel = summaryText.getText();
168
						newSummary = sel;
166
						if (!(newSummary.equals(sel))) {
169
						markDirty(true);
167
							newSummary = sel;
168
							markDirty(true);
169
						}
170
					}
170
					}
171
				}
171
				});
172
			});
172
173
				//raphael ackermann: not sure whether a listener is needed here. 
174
				// newSummaryTextViewer.getTextWidget().addListener(SWT.FocusIn, new NewCommentListener());
175
				summaryText = newSummaryTextViewer.getTextWidget();
176
			}
173
		}
177
		}
174
		getManagedForm().getToolkit().paintBordersFor(summaryComposite);
178
		getManagedForm().getToolkit().paintBordersFor(summaryComposite);
179
175
	}
180
	}
176
181
177
//	@Override
182
//	@Override
(-)src/org/eclipse/mylyn/tasks/ui/editors/AbstractRepositoryTaskEditor.java (-45 / +43 lines)
Lines 232-237 Link Here
232
232
233
	private static final int DESCRIPTION_HEIGHT = 10 * 14;
233
	private static final int DESCRIPTION_HEIGHT = 10 * 14;
234
234
235
	protected static final int SUMMARY_HEIGHT = 20;
236
235
	private static final String LABEL_BUTTON_SUBMIT = "Submit";
237
	private static final String LABEL_BUTTON_SUBMIT = "Submit";
236
238
237
	private static final String LABEL_COPY_TO_CLIPBOARD = "Copy to Clipboard";
239
	private static final String LABEL_COPY_TO_CLIPBOARD = "Copy to Clipboard";
Lines 250-256 Link Here
250
252
251
	private boolean expandedStateAttributes = false;
253
	private boolean expandedStateAttributes = false;
252
254
253
	protected Text summaryText;
255
	protected StyledText summaryText;
254
256
255
	protected Button submitButton;
257
	protected Button submitButton;
256
258
Lines 264-269 Link Here
264
266
265
	private Composite editorComposite;
267
	private Composite editorComposite;
266
268
269
	protected TextViewer newSummaryTextViewer;
270
267
	private TextViewer newCommentTextViewer;
271
	private TextViewer newCommentTextViewer;
268
272
269
	private org.eclipse.swt.widgets.List ccList;
273
	private org.eclipse.swt.widgets.List ccList;
Lines 809-815 Link Here
809
813
810
	protected void createSummaryLayout(Composite composite) {
814
	protected void createSummaryLayout(Composite composite) {
811
815
812
		addSummaryText(composite);
816
		Composite summaryComposite = toolkit.createComposite(composite);
817
		GridLayout summaryLayout = new GridLayout(2, false);
818
		summaryLayout.verticalSpacing = 0;
819
		summaryLayout.marginHeight = 2;
820
		summaryComposite.setLayout(summaryLayout);
821
		GridDataFactory.fillDefaults().grab(true, false).applyTo(summaryComposite);
822
823
		if (taskData != null) {
824
			final RepositoryTaskAttribute attribute = taskData.getAttribute(RepositoryTaskAttribute.SUMMARY);
825
			if (attribute != null) {
826
827
				newSummaryTextViewer = addTextEditor(repository, summaryComposite, attribute.getValue(), true, SWT.FLAT);
828
				newSummaryTextViewer.setEditable(true);
829
830
				GridDataFactory.fillDefaults().grab(true, false).hint(DESCRIPTION_WIDTH, SUMMARY_HEIGHT).applyTo(
831
						newSummaryTextViewer.getControl());
832
				newSummaryTextViewer.getControl().setData(FormToolkit.KEY_DRAW_BORDER, FormToolkit.TEXT_BORDER);
833
834
				newSummaryTextViewer.getTextWidget().addModifyListener(new ModifyListener() {
835
836
					public void modifyText(ModifyEvent e) {
837
						String sel = summaryText.getText();
838
						RepositoryTaskAttribute a = taskData.getAttribute(RepositoryTaskAttribute.SUMMARY);
839
						if (!(a.getValue().equals(sel))) {
840
							a.setValue(sel);
841
							markDirty(true);
842
						}
843
					}
844
				});
845
846
				//raphael ackermann: not sure whether a listener is needed here. 
847
				// newSummaryTextViewer.getTextWidget().addListener(SWT.FocusIn, new NewCommentListener());
848
				summaryText = newSummaryTextViewer.getTextWidget();
849
			}
850
		}
851
		toolkit.paintBordersFor(summaryComposite);
813
852
814
		Composite headerInfoComposite = toolkit.createComposite(composite);
853
		Composite headerInfoComposite = toolkit.createComposite(composite);
815
		GridLayout headerLayout = new GridLayout(11, false);
854
		GridLayout headerLayout = new GridLayout(11, false);
Lines 1218-1265 Link Here
1218
		return false;
1257
		return false;
1219
	}
1258
	}
1220
1259
1221
	/**
1222
	 * Adds a text field to display and edit the task's summary.
1223
	 * 
1224
	 * @param attributesComposite
1225
	 *            The composite to add the text field to.
1226
	 */
1227
	protected void addSummaryText(Composite attributesComposite) {
1228
		Composite summaryComposite = toolkit.createComposite(attributesComposite);
1229
		GridLayout summaryLayout = new GridLayout(2, false);
1230
		summaryLayout.verticalSpacing = 0;
1231
		summaryLayout.marginHeight = 2;
1232
		summaryComposite.setLayout(summaryLayout);
1233
		GridDataFactory.fillDefaults().grab(true, false).applyTo(summaryComposite);
1234
1235
		if (taskData != null) {
1236
			RepositoryTaskAttribute attribute = taskData.getAttribute(RepositoryTaskAttribute.SUMMARY);
1237
			if (attribute != null) {
1238
				// Label summaryLabel = createLabel(summaryComposite,
1239
				// attribute);
1240
				// summaryLabel.setFont(TITLE_FONT);
1241
				summaryText = createTextField(summaryComposite, attribute, SWT.FLAT);
1242
				IThemeManager themeManager = getSite().getWorkbenchWindow().getWorkbench().getThemeManager();
1243
				Font summaryFont = themeManager.getCurrentTheme().getFontRegistry().get(
1244
						TaskListColorsAndFonts.TASK_EDITOR_FONT);
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
			}
1260
		}
1261
		toolkit.paintBordersFor(summaryComposite);
1262
	}
1263
1260
1264
	protected boolean supportsAttachmentDelete() {
1261
	protected boolean supportsAttachmentDelete() {
1265
		return false;
1262
		return false;
Lines 2789-2795 Link Here
2789
		public void handleEvent(Event event) {
2786
		public void handleEvent(Event event) {
2790
			fireSelectionChanged(new SelectionChangedEvent(selectionProvider, new StructuredSelection(
2787
			fireSelectionChanged(new SelectionChangedEvent(selectionProvider, new StructuredSelection(
2791
					new RepositoryTaskSelection(taskData.getId(), taskData.getRepositoryUrl(),
2788
					new RepositoryTaskSelection(taskData.getId(), taskData.getRepositoryUrl(),
2792
							taskData.getRepositoryKind(), "New Comment", false, taskData.getSummary()))));
2789
							taskData.getRepositoryKind(), getSectionLabel(SECTION_NAME.NEWCOMMENT_SECTION), false,
2790
							taskData.getSummary()))));
2793
		}
2791
		}
2794
	}
2792
	}

Return to bug 195514