Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 154170 Details for
Bug 216557
[api] add option to "Replace existing attachment of the same name" when attaching files
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
patch
clipboard.txt (text/plain), 25.21 KB, created by
Steffen Pingel
on 2009-12-09 18:02:24 EST
(
hide
)
Description:
patch
Filename:
MIME Type:
Creator:
Steffen Pingel
Created:
2009-12-09 18:02:24 EST
Size:
25.21 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.mylyn.jira.core >Index: src/org/eclipse/mylyn/internal/jira/core/JiraTaskAttachmentHandler.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.jira.core/src/org/eclipse/mylyn/internal/jira/core/JiraTaskAttachmentHandler.java,v >retrieving revision 1.9 >diff -u -r1.9 JiraTaskAttachmentHandler.java >--- src/org/eclipse/mylyn/internal/jira/core/JiraTaskAttachmentHandler.java 3 Dec 2008 05:05:47 -0000 1.9 >+++ src/org/eclipse/mylyn/internal/jira/core/JiraTaskAttachmentHandler.java 9 Dec 2009 23:05:23 -0000 >@@ -32,6 +32,7 @@ > import org.eclipse.mylyn.tasks.core.data.TaskAttachmentMapper; > import org.eclipse.mylyn.tasks.core.data.TaskAttachmentPartSource; > import org.eclipse.mylyn.tasks.core.data.TaskAttribute; >+import org.eclipse.mylyn.tasks.core.data.UnsubmittedTaskAttachment; > > /** > * @author Steffen Pingel >@@ -88,22 +89,12 @@ > monitor = Policy.monitorFor(monitor); > try { > monitor.beginTask(Messages.JiraTaskAttachmentHandler_Sending_attachment, IProgressMonitor.UNKNOWN); >- String contentType = source.getContentType(); >- String filename = source.getName(); >- if (attachmentAttribute != null) { >- TaskAttachmentMapper mapper = TaskAttachmentMapper.createFrom(attachmentAttribute); >- if (mapper.getContentType() != null) { >- contentType = mapper.getContentType(); >- } >- if (mapper.getFileName() != null) { >- filename = mapper.getFileName(); >- } >- } >+ UnsubmittedTaskAttachment attachment = new UnsubmittedTaskAttachment(source, attachmentAttribute); > JiraClient server = JiraClientFactory.getDefault().getJiraClient(repository); > try { > JiraIssue issue = server.getIssueByKey(task.getTaskKey(), monitor); >- server.addAttachment(issue, comment, new TaskAttachmentPartSource(source, filename), contentType, >- monitor); >+ server.addAttachment(issue, comment, new TaskAttachmentPartSource(source, attachment.getFileName()), >+ attachment.getContentType(), monitor); > } catch (JiraException e) { > throw new CoreException(JiraCorePlugin.toStatus(repository, e)); > } >#P org.eclipse.mylyn.tasks.core >Index: src/org/eclipse/mylyn/internal/tasks/core/data/DefaultTaskSchema.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/data/DefaultTaskSchema.java,v >retrieving revision 1.3 >diff -u -r1.3 DefaultTaskSchema.java >--- src/org/eclipse/mylyn/internal/tasks/core/data/DefaultTaskSchema.java 20 Nov 2009 21:35:10 -0000 1.3 >+++ src/org/eclipse/mylyn/internal/tasks/core/data/DefaultTaskSchema.java 9 Dec 2009 23:05:25 -0000 >@@ -147,6 +147,9 @@ > public static final Field ATTACHMENT_IS_PATCH = createField(TaskAttribute.ATTACHMENT_IS_PATCH, > Messages.DefaultTaskSchema_Patch_Label, TaskAttribute.TYPE_BOOLEAN); > >+ public static final Field ATTACHMENT_REPLACE_EXISTING = createField(TaskAttribute.ATTACHMENT_REPLACE_EXISTING, >+ "Replace existing attachment of the same name", TaskAttribute.TYPE_BOOLEAN); >+ > public static final Field ATTACHMENT_SIZE = createField(TaskAttribute.ATTACHMENT_SIZE, > Messages.DefaultTaskSchema_Size_Label, TaskAttribute.TYPE_LONG, Flag.READ_ONLY); > >Index: src/org/eclipse/mylyn/tasks/core/data/TaskAttachmentMapper.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data/TaskAttachmentMapper.java,v >retrieving revision 1.12 >diff -u -r1.12 TaskAttachmentMapper.java >--- src/org/eclipse/mylyn/tasks/core/data/TaskAttachmentMapper.java 19 Nov 2009 02:08:57 -0000 1.12 >+++ src/org/eclipse/mylyn/tasks/core/data/TaskAttachmentMapper.java 9 Dec 2009 23:05:25 -0000 >@@ -24,119 +24,6 @@ > */ > public class TaskAttachmentMapper { > >- private IRepositoryPerson author; >- >- private String comment; >- >- private String contentType; >- >- private Date creationDate; >- >- private Boolean deprecated; >- >- private String description; >- >- private String fileName; >- >- private Long length; >- >- private Boolean patch; >- >- private String url; >- >- private String attachmentId; >- >- public TaskAttachmentMapper() { >- } >- >- public String getAttachmentId() { >- return attachmentId; >- } >- >- public IRepositoryPerson getAuthor() { >- return author; >- } >- >- public String getComment() { >- return comment; >- } >- >- public String getContentType() { >- return contentType; >- } >- >- public Date getCreationDate() { >- return creationDate; >- } >- >- public String getDescription() { >- return description; >- } >- >- public String getFileName() { >- return fileName; >- } >- >- public Long getLength() { >- return length; >- } >- >- public String getUrl() { >- return url; >- } >- >- public Boolean isDeprecated() { >- return deprecated; >- } >- >- public Boolean isPatch() { >- return patch; >- } >- >- public void setAttachmentId(String attachmentId) { >- this.attachmentId = attachmentId; >- } >- >- public void setAuthor(IRepositoryPerson author) { >- this.author = author; >- } >- >- public void setComment(String comment) { >- this.comment = comment; >- } >- >- public void setContentType(String contentType) { >- this.contentType = contentType; >- } >- >- public void setCreationDate(Date creationDate) { >- this.creationDate = creationDate; >- } >- >- public void setDeprecated(Boolean deprecated) { >- this.deprecated = deprecated; >- } >- >- public void setDescription(String description) { >- this.description = description; >- } >- >- public void setFileName(String fileName) { >- this.fileName = fileName; >- } >- >- public void setLength(Long length) { >- this.length = length; >- } >- >- public void setPatch(Boolean patch) { >- this.patch = patch; >- } >- >- public void setUrl(String url) { >- this.url = url; >- } >- > public static TaskAttachmentMapper createFrom(TaskAttribute taskAttribute) { > Assert.isNotNull(taskAttribute); > TaskAttributeMapper mapper = taskAttribute.getTaskData().getAttributeMapper(); >@@ -170,6 +57,10 @@ > if (child != null) { > attachment.setPatch(mapper.getBooleanValue(child)); > } >+ child = taskAttribute.getMappedAttribute(TaskAttribute.ATTACHMENT_REPLACE_EXISTING); >+ if (child != null) { >+ attachment.setReplaceExisting(mapper.getBooleanValue(child)); >+ } > child = taskAttribute.getMappedAttribute(TaskAttribute.ATTACHMENT_SIZE); > if (child != null) { > Long value = mapper.getLongValue(child); >@@ -184,6 +75,64 @@ > return attachment; > } > >+ private String attachmentId; >+ >+ private IRepositoryPerson author; >+ >+ private String comment; >+ >+ private String contentType; >+ >+ private Date creationDate; >+ >+ private Boolean deprecated; >+ >+ private String description; >+ >+ private String fileName; >+ >+ private Long length; >+ >+ private Boolean patch; >+ >+ private Boolean replaceExisting; >+ >+ private String url; >+ >+ public TaskAttachmentMapper() { >+ } >+ >+ public void applyTo(ITaskAttachment taskAttachment) { >+ Assert.isNotNull(taskAttachment); >+ if (getAuthor() != null) { >+ taskAttachment.setAuthor(getAuthor()); >+ } >+ if (getContentType() != null) { >+ taskAttachment.setContentType(getContentType()); >+ } >+ if (getCreationDate() != null) { >+ taskAttachment.setCreationDate(getCreationDate()); >+ } >+ if (getDescription() != null) { >+ taskAttachment.setDescription(getDescription()); >+ } >+ if (getFileName() != null) { >+ taskAttachment.setFileName(getFileName()); >+ } >+ if (isDeprecated() != null) { >+ taskAttachment.setDeprecated(isDeprecated()); >+ } >+ if (isPatch() != null) { >+ taskAttachment.setPatch(isPatch()); >+ } >+ if (getLength() != null) { >+ taskAttachment.setLength(getLength()); >+ } >+ if (url != null) { >+ taskAttachment.setUrl(getUrl()); >+ } >+ } >+ > public void applyTo(TaskAttribute taskAttribute) { > Assert.isNotNull(taskAttribute); > TaskData taskData = taskAttribute.getTaskData(); >@@ -217,6 +166,11 @@ > taskAttribute); > mapper.setValue(child, getFileName()); > } >+ if (getReplaceExisting() != null) { >+ TaskAttribute child = DefaultTaskSchema.getField(TaskAttribute.ATTACHMENT_REPLACE_EXISTING) >+ .createAttribute(taskAttribute); >+ mapper.setBooleanValue(child, getReplaceExisting()); >+ } > if (isDeprecated() != null) { > TaskAttribute child = DefaultTaskSchema.getField(TaskAttribute.ATTACHMENT_IS_DEPRECATED).createAttribute( > taskAttribute); >@@ -239,37 +193,6 @@ > } > } > >- public void applyTo(ITaskAttachment taskAttachment) { >- Assert.isNotNull(taskAttachment); >- if (getAuthor() != null) { >- taskAttachment.setAuthor(getAuthor()); >- } >- if (getContentType() != null) { >- taskAttachment.setContentType(getContentType()); >- } >- if (getCreationDate() != null) { >- taskAttachment.setCreationDate(getCreationDate()); >- } >- if (getDescription() != null) { >- taskAttachment.setDescription(getDescription()); >- } >- if (getFileName() != null) { >- taskAttachment.setFileName(getFileName()); >- } >- if (isDeprecated() != null) { >- taskAttachment.setDeprecated(isDeprecated()); >- } >- if (isPatch() != null) { >- taskAttachment.setPatch(isPatch()); >- } >- if (getLength() != null) { >- taskAttachment.setLength(getLength()); >- } >- if (url != null) { >- taskAttachment.setUrl(getUrl()); >- } >- } >- > @Override > public boolean equals(Object obj) { > if (!(obj instanceof TaskAttachmentMapper)) { >@@ -294,7 +217,113 @@ > if ((other.fileName != null && this.fileName != null) && !other.fileName.equals(this.fileName)) { > return false; > } >+ if ((other.replaceExisting != null && this.replaceExisting != null) >+ && !other.replaceExisting.equals(this.replaceExisting)) { >+ return false; >+ } > return true; > } > >+ public String getAttachmentId() { >+ return attachmentId; >+ } >+ >+ public IRepositoryPerson getAuthor() { >+ return author; >+ } >+ >+ public String getComment() { >+ return comment; >+ } >+ >+ public String getContentType() { >+ return contentType; >+ } >+ >+ public Date getCreationDate() { >+ return creationDate; >+ } >+ >+ public String getDescription() { >+ return description; >+ } >+ >+ public String getFileName() { >+ return fileName; >+ } >+ >+ public Long getLength() { >+ return length; >+ } >+ >+ /** >+ * @since 3.4 >+ */ >+ public Boolean getReplaceExisting() { >+ return replaceExisting; >+ } >+ >+ public String getUrl() { >+ return url; >+ } >+ >+ public Boolean isDeprecated() { >+ return deprecated; >+ } >+ >+ public Boolean isPatch() { >+ return patch; >+ } >+ >+ public void setAttachmentId(String attachmentId) { >+ this.attachmentId = attachmentId; >+ } >+ >+ public void setAuthor(IRepositoryPerson author) { >+ this.author = author; >+ } >+ >+ public void setComment(String comment) { >+ this.comment = comment; >+ } >+ >+ public void setContentType(String contentType) { >+ this.contentType = contentType; >+ } >+ >+ public void setCreationDate(Date creationDate) { >+ this.creationDate = creationDate; >+ } >+ >+ public void setDeprecated(Boolean deprecated) { >+ this.deprecated = deprecated; >+ } >+ >+ public void setDescription(String description) { >+ this.description = description; >+ } >+ >+ public void setFileName(String fileName) { >+ this.fileName = fileName; >+ } >+ >+ public void setLength(Long length) { >+ this.length = length; >+ } >+ >+ public void setPatch(Boolean patch) { >+ this.patch = patch; >+ } >+ >+ /** >+ * @since 3.4 >+ */ >+ public void setReplaceExisting(Boolean replaceExisting) { >+ this.replaceExisting = replaceExisting; >+ } >+ >+ public void setUrl(String url) { >+ this.url = url; >+ } >+ > } >Index: src/org/eclipse/mylyn/tasks/core/data/TaskAttribute.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data/TaskAttribute.java,v >retrieving revision 1.39 >diff -u -r1.39 TaskAttribute.java >--- src/org/eclipse/mylyn/tasks/core/data/TaskAttribute.java 28 Sep 2009 20:30:22 -0000 1.39 >+++ src/org/eclipse/mylyn/tasks/core/data/TaskAttribute.java 9 Dec 2009 23:05:25 -0000 >@@ -49,6 +49,8 @@ > > public static final String ATTACHMENT_IS_PATCH = "task.common.attachment.patch"; //$NON-NLS-1$ > >+ public static final String ATTACHMENT_REPLACE_EXISTING = "task.common.attachment.replaceExisting"; //$NON-NLS-1$ >+ > public static final String ATTACHMENT_SIZE = "task.common.attachment.size"; //$NON-NLS-1$ > > public static final String ATTACHMENT_URL = "task.common.attachment.url"; //$NON-NLS-1$ >Index: src/org/eclipse/mylyn/tasks/core/data/UnsubmittedTaskAttachment.java >=================================================================== >RCS file: src/org/eclipse/mylyn/tasks/core/data/UnsubmittedTaskAttachment.java >diff -N src/org/eclipse/mylyn/tasks/core/data/UnsubmittedTaskAttachment.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/mylyn/tasks/core/data/UnsubmittedTaskAttachment.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,90 @@ >+/******************************************************************************* >+ * Copyright (c) 2009 Tasktop Technologies and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * Tasktop Technologies - initial API and implementation >+ *******************************************************************************/ >+ >+package org.eclipse.mylyn.tasks.core.data; >+ >+import java.io.InputStream; >+ >+import org.eclipse.core.runtime.Assert; >+import org.eclipse.core.runtime.CoreException; >+import org.eclipse.core.runtime.IProgressMonitor; >+ >+/** >+ * @author Steffen Pingel >+ * @since 3.4 >+ */ >+public class UnsubmittedTaskAttachment { >+ >+ private final TaskAttribute attribute; >+ >+ private String contentType; >+ >+ private String description; >+ >+ private String fileName; >+ >+ private boolean replaceExisting; >+ >+ private final AbstractTaskAttachmentSource source; >+ >+ public UnsubmittedTaskAttachment(AbstractTaskAttachmentSource source, TaskAttribute attribute) { >+ Assert.isNotNull(source); >+ this.source = source; >+ this.attribute = attribute; >+ >+ contentType = source.getContentType(); >+ fileName = source.getName(); >+ description = source.getDescription(); >+ if (attribute != null) { >+ TaskAttachmentMapper mapper = TaskAttachmentMapper.createFrom(attribute); >+ if (mapper.getContentType() != null) { >+ contentType = mapper.getContentType(); >+ } >+ if (mapper.getFileName() != null) { >+ fileName = mapper.getFileName(); >+ } >+ if (mapper.getDescription() != null) { >+ description = mapper.getDescription(); >+ } >+ if (mapper.getReplaceExisting() != null) { >+ replaceExisting = mapper.getReplaceExisting(); >+ } >+ } >+ if (description == null) { >+ description = ""; //$NON-NLS-1$ >+ } >+ } >+ >+ public InputStream createInputStream(IProgressMonitor monitor) throws CoreException { >+ return source.createInputStream(monitor); >+ } >+ >+ public String getContentType() { >+ return contentType; >+ } >+ >+ public String getDescription() { >+ return description; >+ } >+ >+ public String getFileName() { >+ return fileName; >+ } >+ >+ public boolean getReplaceExisting() { >+ return replaceExisting; >+ } >+ >+ public AbstractTaskAttachmentSource getSource() { >+ return source; >+ } >+ >+} >#P org.eclipse.mylyn.tasks.ui >Index: src/org/eclipse/mylyn/tasks/ui/wizards/TaskAttachmentPage.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/wizards/TaskAttachmentPage.java,v >retrieving revision 1.25 >diff -u -r1.25 TaskAttachmentPage.java >--- src/org/eclipse/mylyn/tasks/ui/wizards/TaskAttachmentPage.java 18 Sep 2009 06:10:02 -0000 1.25 >+++ src/org/eclipse/mylyn/tasks/ui/wizards/TaskAttachmentPage.java 9 Dec 2009 23:05:28 -0000 >@@ -80,6 +80,10 @@ > > 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 @@ > 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("Replace existing attachment of the same name"); >+ 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 @@ > taskAttachment.setDescription(descriptionText.getText().trim()); > validate(); > } >- > }); > } > >@@ -302,7 +319,21 @@ > 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 @@ > } > } > >+ /** >+ * 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; >+ } >+ > } >#P org.eclipse.mylyn.trac.core >Index: src/org/eclipse/mylyn/internal/trac/core/TracAttachmentHandler.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracAttachmentHandler.java,v >retrieving revision 1.35 >diff -u -r1.35 TracAttachmentHandler.java >--- src/org/eclipse/mylyn/internal/trac/core/TracAttachmentHandler.java 24 Jul 2009 12:21:03 -0000 1.35 >+++ src/org/eclipse/mylyn/internal/trac/core/TracAttachmentHandler.java 9 Dec 2009 23:05:30 -0000 >@@ -27,6 +27,7 @@ > import org.eclipse.mylyn.tasks.core.data.AbstractTaskAttachmentSource; > import org.eclipse.mylyn.tasks.core.data.TaskAttachmentMapper; > import org.eclipse.mylyn.tasks.core.data.TaskAttribute; >+import org.eclipse.mylyn.tasks.core.data.UnsubmittedTaskAttachment; > > /** > * @author Steffen Pingel >@@ -70,28 +71,15 @@ > "Attachments are not supported by this repository access type")); //$NON-NLS-1$ > } > >- String filename = source.getName(); >- String description = source.getDescription(); >- if (attachmentAttribute != null) { >- TaskAttachmentMapper mapper = TaskAttachmentMapper.createFrom(attachmentAttribute); >- if (mapper.getFileName() != null) { >- filename = mapper.getFileName(); >- } >- if (mapper.getDescription() != null) { >- description = mapper.getDescription(); >- } >- } >- if (description == null) { >- description = ""; //$NON-NLS-1$ >- } >- >+ UnsubmittedTaskAttachment attachment = new UnsubmittedTaskAttachment(source, attachmentAttribute); > monitor = Policy.monitorFor(monitor); > try { > monitor.beginTask(Messages.TracAttachmentHandler_Uploading_attachment, IProgressMonitor.UNKNOWN); > try { > ITracClient client = connector.getClientManager().getTracClient(repository); > int id = Integer.parseInt(task.getTaskId()); >- client.putAttachmentData(id, filename, description, source.createInputStream(monitor), monitor); >+ client.putAttachmentData(id, attachment.getFileName(), attachment.getDescription(), >+ attachment.createInputStream(monitor), monitor, attachment.getReplaceExisting()); > if (comment != null && comment.length() > 0) { > TracTicket ticket = new TracTicket(id); > client.updateTicket(ticket, comment, monitor); >Index: src/org/eclipse/mylyn/internal/trac/core/client/ITracClient.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/client/ITracClient.java,v >retrieving revision 1.13 >diff -u -r1.13 ITracClient.java >--- src/org/eclipse/mylyn/internal/trac/core/client/ITracClient.java 29 Aug 2009 06:28:52 -0000 1.13 >+++ src/org/eclipse/mylyn/internal/trac/core/client/ITracClient.java 9 Dec 2009 23:05:30 -0000 >@@ -188,7 +188,7 @@ > > InputStream getAttachmentData(int ticketId, String filename, IProgressMonitor monitor) throws TracException; > >- void putAttachmentData(int ticketId, String name, String description, InputStream source, IProgressMonitor monitor) >+ void putAttachmentData(int ticketId, String name, String description, InputStream source, IProgressMonitor monitor, boolean replace) > throws TracException; > > void deleteAttachment(int ticketId, String filename, IProgressMonitor monitor) throws TracException; >Index: src/org/eclipse/mylyn/internal/trac/core/client/TracWebClient.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/client/TracWebClient.java,v >retrieving revision 1.19 >diff -u -r1.19 TracWebClient.java >--- src/org/eclipse/mylyn/internal/trac/core/client/TracWebClient.java 24 Sep 2009 08:29:45 -0000 1.19 >+++ src/org/eclipse/mylyn/internal/trac/core/client/TracWebClient.java 9 Dec 2009 23:05:30 -0000 >@@ -738,7 +738,7 @@ > } > } > >- public void putAttachmentData(int id, String name, String description, InputStream in, IProgressMonitor monitor) >+ public void putAttachmentData(int id, String name, String description, InputStream in, IProgressMonitor monitor, boolean replace) > throws TracException { > throw new TracException("Unsupported operation"); //$NON-NLS-1$ > } >Index: src/org/eclipse/mylyn/internal/trac/core/client/TracXmlRpcClient.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/client/TracXmlRpcClient.java,v >retrieving revision 1.23 >diff -u -r1.23 TracXmlRpcClient.java >--- src/org/eclipse/mylyn/internal/trac/core/client/TracXmlRpcClient.java 20 Sep 2009 06:57:58 -0000 1.23 >+++ src/org/eclipse/mylyn/internal/trac/core/client/TracXmlRpcClient.java 9 Dec 2009 23:05:30 -0000 >@@ -820,14 +820,14 @@ > } > > public void putAttachmentData(int ticketId, String filename, String description, InputStream in, >- IProgressMonitor monitor) throws TracException { >+ IProgressMonitor monitor, boolean replace) throws TracException { > byte[] data; > try { > data = readData(in, new NullProgressMonitor()); > } catch (IOException e) { > throw new TracException(e); > } >- call(monitor, "ticket.putAttachment", ticketId, filename, description, data, false); //$NON-NLS-1$ >+ call(monitor, "ticket.putAttachment", ticketId, filename, description, data, replace); //$NON-NLS-1$ > } > > private byte[] readData(InputStream in, IProgressMonitor monitor) throws IOException { >#P org.eclipse.mylyn.trac.ui >Index: src/org/eclipse/mylyn/internal/trac/ui/TracConnectorUi.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/TracConnectorUi.java,v >retrieving revision 1.24 >diff -u -r1.24 TracConnectorUi.java >--- src/org/eclipse/mylyn/internal/trac/ui/TracConnectorUi.java 24 Jul 2009 12:20:29 -0000 1.24 >+++ src/org/eclipse/mylyn/internal/trac/ui/TracConnectorUi.java 9 Dec 2009 23:05:31 -0000 >@@ -18,6 +18,7 @@ > import org.eclipse.jface.text.hyperlink.IHyperlink; > import org.eclipse.jface.viewers.IStructuredSelection; > import org.eclipse.jface.wizard.IWizard; >+import org.eclipse.jface.wizard.IWizardPage; > import org.eclipse.mylyn.internal.trac.core.TracCorePlugin; > import org.eclipse.mylyn.internal.trac.core.TracRepositoryConnector; > import org.eclipse.mylyn.internal.trac.core.TracRepositoryConnector.TaskKind; >@@ -29,6 +30,7 @@ > import org.eclipse.mylyn.tasks.core.ITaskComment; > import org.eclipse.mylyn.tasks.core.ITaskMapping; > import org.eclipse.mylyn.tasks.core.TaskRepository; >+import org.eclipse.mylyn.tasks.core.data.TaskAttachmentModel; > import org.eclipse.mylyn.tasks.ui.AbstractRepositoryConnectorUi; > import org.eclipse.mylyn.tasks.ui.LegendElement; > import org.eclipse.mylyn.tasks.ui.wizards.ITaskRepositoryPage; >@@ -36,6 +38,7 @@ > import org.eclipse.mylyn.tasks.ui.wizards.NewTaskWizard; > import org.eclipse.mylyn.tasks.ui.wizards.NewWebTaskWizard; > import org.eclipse.mylyn.tasks.ui.wizards.RepositoryQueryWizard; >+import org.eclipse.mylyn.tasks.ui.wizards.TaskAttachmentPage; > import org.eclipse.osgi.util.NLS; > > /** >@@ -130,4 +133,12 @@ > taskComment.getAuthor().getPersonId()); > } > } >+ >+ @Override >+ public IWizardPage getTaskAttachmentPage(TaskAttachmentModel model) { >+ TaskAttachmentPage page = new TaskAttachmentPage(model); >+ page.setNeedsReplaceExisting(true); >+ return page; >+ } >+ > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 216557
: 154170 |
154171