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

Collapse All | Expand All

(-)src/org/eclipse/mylyn/tasks/ui/editors/RepositoryTaskEditorDropListener.java (-4 / +23 lines)
Lines 110-116 Link Here
110
110
111
			AbstractTaskEditor.setGlobalBusy(true);
111
			AbstractTaskEditor.setGlobalBusy(true);
112
			NewAttachmentWizard naw = new NewAttachmentWizard(this.AbstractTaskEditor.repository, task, text);
112
			NewAttachmentWizard naw = new NewAttachmentWizard(this.AbstractTaskEditor.repository, task, text);
113
			openDialog(naw);
113
			openDialog(naw, null);
114
		}
114
		}
115
		if (fileTransfer.isSupportedType(event.currentDataType)) {
115
		if (fileTransfer.isSupportedType(event.currentDataType)) {
116
			String[] files = (String[]) event.data;
116
			String[] files = (String[]) event.data;
Lines 124-140 Link Here
124
124
125
				NewAttachmentWizard naw = new NewAttachmentWizard(this.AbstractTaskEditor.repository, task, new File(
125
				NewAttachmentWizard naw = new NewAttachmentWizard(this.AbstractTaskEditor.repository, task, new File(
126
						files[0]));
126
						files[0]));
127
				openDialog(naw);
127
				// TODO bug 205238 show error if attempted more than one file to drop
128
128
				String error = null;
129
				if (files.length > 1) {
130
					StringBuilder sb = new StringBuilder();
131
					int remaining = files.length - 1;
132
					sb.append("Only the first file can be attached, please attach the remaining");
133
					if(remaining > 1) {
134
						sb.append(" ");
135
						sb.append(remaining);
136
					}
137
					sb.append(" file");
138
					if(remaining > 1) sb.append("s");
139
					sb.append(" one by one.");
140
					error = sb.toString();
141
				}
142
				openDialog(naw, error);
129
			}
143
			}
130
		}
144
		}
131
	}
145
	}
132
146
133
	private void openDialog(NewAttachmentWizard naw) {
147
	/**
148
	 * @param naw wizard to attach dialog to.
149
	 * @param message error to display or none if <code>null</code>
150
	 */
151
	private void openDialog(NewAttachmentWizard naw, String message) {
134
		AbstractTaskEditor.setGlobalBusy(true);
152
		AbstractTaskEditor.setGlobalBusy(true);
135
		NewAttachmentWizardDialog dialog = new NewAttachmentWizardDialog(control.getShell(), naw, true);
153
		NewAttachmentWizardDialog dialog = new NewAttachmentWizardDialog(control.getShell(), naw, true);
136
		naw.setDialog(dialog);
154
		naw.setDialog(dialog);
137
		dialog.create();
155
		dialog.create();
156
		if(null != message) dialog.setErrorMessage(message);
138
		int result = dialog.open();
157
		int result = dialog.open();
139
		if (result != MessageDialog.OK) {
158
		if (result != MessageDialog.OK) {
140
			AbstractTaskEditor.setGlobalBusy(false);
159
			AbstractTaskEditor.setGlobalBusy(false);

Return to bug 205238