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

(-)src/org/eclipse/mylyn/tasks/core/data/TaskAttachmentModel.java (-1 / +1 lines)
Lines 77-83 Link Here
77
	}
77
	}
78
78
79
	public String getContentType() {
79
	public String getContentType() {
80
		if (contentType == null) {
80
		if (contentType == null && getSource() != null) {
81
			return getSource().getContentType();
81
			return getSource().getContentType();
82
		}
82
		}
83
		return contentType;
83
		return contentType;
(-)src/org/eclipse/mylyn/tasks/ui/wizards/TaskAttachmentPage.java (-4 / +7 lines)
Lines 135-143 Link Here
135
		contentTypeList.setLayoutData(new GridData(SWT.DEFAULT, SWT.DEFAULT, false, false, 2, 1));
135
		contentTypeList.setLayoutData(new GridData(SWT.DEFAULT, SWT.DEFAULT, false, false, 2, 1));
136
		Iterator<String> iter = contentTypes.iterator();
136
		Iterator<String> iter = contentTypes.iterator();
137
		int i = 0;
137
		int i = 0;
138
		int selection = 0;
138
		while (iter.hasNext()) {
139
		while (iter.hasNext()) {
139
			String next = iter.next();
140
			String next = iter.next();
140
			contentTypeList.add(next);
141
			contentTypeList.add(next);
142
			if (next.equalsIgnoreCase(model.getContentType())) {
143
				selection = i;
144
			}
141
			i++;
145
			i++;
142
		}
146
		}
143
147
Lines 152-159 Link Here
152
				validate();
156
				validate();
153
			}
157
			}
154
		});
158
		});
155
		contentTypeList.select(0);
159
		contentTypeList.select(selection);
156
		taskAttachment.setContentType(contentTypeList.getItem(0));
160
		taskAttachment.setContentType(contentTypeList.getItem(selection));
157
161
158
		// TODO: is there a better way to pad?
162
		// TODO: is there a better way to pad?
159
		new Label(composite, SWT.NONE);
163
		new Label(composite, SWT.NONE);
Lines 185-192 Link Here
185
			}
189
			}
186
		});
190
		});
187
191
188
		fileNameText.setText(taskAttachment.getFileName() == null ? "" : taskAttachment.getFileName()); //$NON-NLS-1$
189
190
		/* Listener for isPatch */
192
		/* Listener for isPatch */
191
		isPatchButton.addSelectionListener(new SelectionAdapter() {
193
		isPatchButton.addSelectionListener(new SelectionAdapter() {
192
			private int lastSelected;
194
			private int lastSelected;
Lines 292-297 Link Here
292
	@Override
294
	@Override
293
	public void setVisible(boolean visible) {
295
	public void setVisible(boolean visible) {
294
		if (visible) {
296
		if (visible) {
297
			fileNameText.setText(taskAttachment.getFileName() == null ? "" : taskAttachment.getFileName()); //$NON-NLS-1$
295
			if (fileNameText.getText().length() == 0) {
298
			if (fileNameText.getText().length() == 0) {
296
				setFilePath(getModel().getSource().getName());
299
				setFilePath(getModel().getSource().getName());
297
				setContentType(getModel().getSource().getContentType());
300
				setContentType(getModel().getSource().getContentType());
(-)src/org/eclipse/mylyn/internal/tasks/ui/wizards/TaskAttachmentWizard.java (-3 / +7 lines)
Lines 288-306 Link Here
288
		if (model.getSource() == null) {
288
		if (model.getSource() == null) {
289
			if (mode == Mode.SCREENSHOT) {
289
			if (mode == Mode.SCREENSHOT) {
290
				ScreenshotCreationPage page = new ScreenshotCreationPage();
290
				ScreenshotCreationPage page = new ScreenshotCreationPage();
291
				model.setSource(new ImageSource(page));
291
				ImageSource source = new ImageSource(page);
292
				model.setSource(source);
293
				model.setContentType(source.getContentType());
292
				addPage(page);
294
				addPage(page);
293
			} else {
295
			} else {
294
				addPage(new AttachmentSourcePage(model));
296
				addPage(new AttachmentSourcePage(model));
295
			}
297
			}
296
		}
298
		}
299
300
		previewPage = new AttachmentPreviewPage(model);
301
		addPage(previewPage);
302
297
		AbstractRepositoryConnectorUi connectorUi = TasksUiPlugin.getConnectorUi(model.getTaskRepository()
303
		AbstractRepositoryConnectorUi connectorUi = TasksUiPlugin.getConnectorUi(model.getTaskRepository()
298
				.getConnectorKind());
304
				.getConnectorKind());
299
		editPage = connectorUi.getTaskAttachmentPage(model);
305
		editPage = connectorUi.getTaskAttachmentPage(model);
300
		addPage(editPage);
306
		addPage(editPage);
301
307
302
		previewPage = new AttachmentPreviewPage(model);
303
		addPage(previewPage);
304
	}
308
	}
305
309
306
	public Mode getMode() {
310
	public Mode getMode() {

Return to bug 219218