Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorspingel2010-02-03 19:46:07 +0000
committerspingel2010-02-03 19:46:07 +0000
commitfce2363f372bac4d0dac48eecb332708d95f205e (patch)
treea5c11eb6b55a8bef088474e6005c4696352e25eb /org.eclipse.mylyn.tasks.ui
parent31022318b9c4468c0f173d7bb4e29e1f11f20b6d (diff)
downloadorg.eclipse.mylyn.tasks-fce2363f372bac4d0dac48eecb332708d95f205e.tar.gz
org.eclipse.mylyn.tasks-fce2363f372bac4d0dac48eecb332708d95f205e.tar.xz
org.eclipse.mylyn.tasks-fce2363f372bac4d0dac48eecb332708d95f205e.zip
NEW - bug 216557: [patch] add option to "Replace existing attachment of the same name" when attaching files
https://bugs.eclipse.org/bugs/show_bug.cgi?id=216557
Diffstat (limited to 'org.eclipse.mylyn.tasks.ui')
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/wizards/Messages.java2
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/wizards/messages.properties1
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/wizards/TaskAttachmentPage.java57
3 files changed, 59 insertions, 1 deletions
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/wizards/Messages.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/wizards/Messages.java
index 1a60f7f46..d364fd57c 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/wizards/Messages.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/wizards/Messages.java
@@ -263,6 +263,8 @@ public class Messages extends NLS {
public static String TaskAttachmentPage_Patch;
+ public static String TaskAttachmentPage_Replace_existing_attachment_Label;
+
public static String TaskAttachmentPage_Verify_the_content_type_of_the_attachment;
public static String AbstractTaskRepositoryPage_Validation_failed;
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/wizards/messages.properties b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/wizards/messages.properties
index f401a2db6..ef6fd9ef3 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/wizards/messages.properties
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/wizards/messages.properties
@@ -144,6 +144,7 @@ TaskAttachmentPage_Enter_a_description=Enter a description
TaskAttachmentPage_Enter_a_file_name=Enter a file name
TaskAttachmentPage_File=File
TaskAttachmentPage_Patch=Patch
+TaskAttachmentPage_Replace_existing_attachment_Label=Replace existing attachment of the same name
TaskAttachmentPage_Verify_the_content_type_of_the_attachment=Verify the content type of the attachment
AbstractTaskRepositoryPage_Validation_failed=Validation failed
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/wizards/TaskAttachmentPage.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/wizards/TaskAttachmentPage.java
index 2b8f6f677..c39c562de 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/wizards/TaskAttachmentPage.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/wizards/TaskAttachmentPage.java
@@ -80,6 +80,10 @@ public class TaskAttachmentPage extends WizardPage {
private CommonTextSupport textSupport;
+ private boolean needsReplaceExisting;
+
+ private Button replaceExistingButton;
+
public TaskAttachmentPage(TaskAttachmentModel model) {
super("AttachmentDetails"); //$NON-NLS-1$
this.model = model;
@@ -102,6 +106,20 @@ public class TaskAttachmentPage extends WizardPage {
fileNameText = new Text(composite, SWT.BORDER);
fileNameText.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, 2, 1));
+ if (needsReplaceExisting) {
+ new Label(composite, SWT.NONE);
+ replaceExistingButton = new Button(composite, SWT.CHECK);
+ replaceExistingButton.setLayoutData(new GridData(SWT.DEFAULT, SWT.DEFAULT, false, false, 2, 1));
+ replaceExistingButton.setText(Messages.TaskAttachmentPage_Replace_existing_attachment_Label);
+ replaceExistingButton.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ taskAttachment.setReplaceExisting(replaceExistingButton.getSelection());
+ validate();
+ }
+ });
+ }
+
if (needsDescription) {
new Label(composite, SWT.NONE).setText(Messages.TaskAttachmentPage_Description);
descriptionText = new Text(composite, SWT.BORDER);
@@ -111,7 +129,6 @@ public class TaskAttachmentPage extends WizardPage {
taskAttachment.setDescription(descriptionText.getText().trim());
validate();
}
-
});
}
@@ -302,7 +319,21 @@ public class TaskAttachmentPage extends WizardPage {
this.needsDescription = supportsDescription;
}
+ /**
+ * @deprecated Use {@link #needsDescription()} instead
+ */
+ @Deprecated
public boolean supportsDescription() {
+ return needsDescription();
+ }
+
+ /**
+ * Returns true if the page has a description field.
+ *
+ * @since 3.4
+ * @see #setDescription(String)
+ */
+ public boolean needsDescription() {
return needsDescription;
}
@@ -338,4 +369,28 @@ public class TaskAttachmentPage extends WizardPage {
}
}
+ /**
+ * Set to true if the page needs a check box for replacing existing attachments. Must be called before the page is
+ * constructed, it has no effect otherwise.
+ * <p>
+ * This flag is set to false by default.
+ * </p>
+ *
+ * @since 3.4
+ * @see #needsReplaceExisting()
+ */
+ public void setNeedsReplaceExisting(boolean needsReplaceExisting) {
+ this.needsReplaceExisting = needsReplaceExisting;
+ }
+
+ /**
+ * Returns true, if the page has a check box to replace existing attachments.
+ *
+ * @since 3.4
+ * @see #setNeedsReplaceExisting(boolean)
+ */
+ public boolean needsReplaceExisting() {
+ return needsReplaceExisting;
+ }
+
}

Back to the top