|
Lines 43-48
Link Here
|
| 43 |
import org.eclipse.mylyn.commons.net.UnsupportedRequestException; |
43 |
import org.eclipse.mylyn.commons.net.UnsupportedRequestException; |
| 44 |
import org.eclipse.mylyn.commons.net.WebUtil; |
44 |
import org.eclipse.mylyn.commons.net.WebUtil; |
| 45 |
import org.eclipse.mylyn.internal.trac.core.TracCorePlugin; |
45 |
import org.eclipse.mylyn.internal.trac.core.TracCorePlugin; |
|
|
46 |
import org.eclipse.mylyn.internal.trac.core.model.TracAction; |
| 46 |
import org.eclipse.mylyn.internal.trac.core.model.TracAttachment; |
47 |
import org.eclipse.mylyn.internal.trac.core.model.TracAttachment; |
| 47 |
import org.eclipse.mylyn.internal.trac.core.model.TracComment; |
48 |
import org.eclipse.mylyn.internal.trac.core.model.TracComment; |
| 48 |
import org.eclipse.mylyn.internal.trac.core.model.TracComponent; |
49 |
import org.eclipse.mylyn.internal.trac.core.model.TracComponent; |
|
Lines 362-368
Link Here
|
| 362 |
ticket.addAttachment(parseAttachment((Object[]) item)); |
363 |
ticket.addAttachment(parseAttachment((Object[]) item)); |
| 363 |
} |
364 |
} |
| 364 |
|
365 |
|
| 365 |
String[] actions = getActions(id, monitor); |
366 |
TracAction[] actions = getActions(id, monitor); |
| 366 |
ticket.setActions(actions); |
367 |
ticket.setActions(actions); |
| 367 |
|
368 |
|
| 368 |
updateAttributes(new NullProgressMonitor(), false); |
369 |
updateAttributes(new NullProgressMonitor(), false); |
|
Lines 738-750
Link Here
|
| 738 |
return result; |
739 |
return result; |
| 739 |
} |
740 |
} |
| 740 |
|
741 |
|
| 741 |
public String[] getActions(int id, IProgressMonitor monitor) throws TracException { |
742 |
public TracAction[] getActions(int id, IProgressMonitor monitor) throws TracException { |
| 742 |
Object[] actions = (Object[]) call(monitor, "ticket.getAvailableActions", id); |
743 |
if (isAPIVersionOrHigher(1, 0, 1, monitor)) { |
| 743 |
String[] result = new String[actions.length]; |
744 |
Object[] actions = (Object[]) call(monitor, "ticket.getAvailableActions2", id); |
| 744 |
for (int i = 0; i < result.length; i++) { |
745 |
TracAction[] result = new TracAction[actions.length]; |
| 745 |
result[i] = (String) actions[i]; |
746 |
for (int i = 0; i < result.length; i++) { |
|
|
747 |
Object[] entry = (Object[]) actions[i]; |
| 748 |
TracAction action = new TracAction((String) entry[1]); |
| 749 |
action.setName((String) entry[2]); |
| 750 |
action.setHint((String) entry[3]); |
| 751 |
result[i] = action; |
| 752 |
} |
| 753 |
return result; |
| 754 |
} else { |
| 755 |
Object[] actions = (Object[]) call(monitor, "ticket.getAvailableActions", id); |
| 756 |
TracAction[] result = new TracAction[actions.length]; |
| 757 |
for (int i = 0; i < result.length; i++) { |
| 758 |
result[i] = new TracAction((String) actions[i]); |
| 759 |
} |
| 760 |
return result; |
| 746 |
} |
761 |
} |
| 747 |
return result; |
|
|
| 748 |
} |
762 |
} |
| 749 |
|
763 |
|
| 750 |
public Date getTicketLastChanged(Integer id, IProgressMonitor monitor) throws TracException { |
764 |
public Date getTicketLastChanged(Integer id, IProgressMonitor monitor) throws TracException { |
|
Lines 913-931
Link Here
|
| 913 |
* This implementation uses the wiki.putAttachmentEx() call, which provides a richer functionality specific to Trac. |
927 |
* This implementation uses the wiki.putAttachmentEx() call, which provides a richer functionality specific to Trac. |
| 914 |
* |
928 |
* |
| 915 |
* @param pageName |
929 |
* @param pageName |
| 916 |
* the name of the Wiki page |
930 |
* the name of the Wiki page |
| 917 |
* @param fileName |
931 |
* @param fileName |
| 918 |
* the name of the file to be attached |
932 |
* the name of the file to be attached |
| 919 |
* @param description |
933 |
* @param description |
| 920 |
* the description of the attachment |
934 |
* the description of the attachment |
| 921 |
* @param in |
935 |
* @param in |
| 922 |
* An InputStream of the content of the attachment |
936 |
* An InputStream of the content of the attachment |
| 923 |
* @param replace |
937 |
* @param replace |
| 924 |
* whether to overwrite an existing attachment with the same filename |
938 |
* whether to overwrite an existing attachment with the same filename |
| 925 |
* @return The (possibly transformed) filename of the attachment. If <code>replace</code> is <code>true</code>, the |
939 |
* @return The (possibly transformed) filename of the attachment. If <code>replace</code> is <code>true</code>, the |
| 926 |
* returned name is always the same as the argument <code>fileName</code>; if <code>replace</code> is |
940 |
* returned name is always the same as the argument <code>fileName</code>; if <code>replace</code> is |
| 927 |
* <code>false</code> and an attachment with name <code>fileName</code> already exists, a number is appended to the |
941 |
* <code>false</code> and an attachment with name <code>fileName</code> already exists, a number is appended |
| 928 |
* file name (before suffix) and the generated filename of the attachment is returned. |
942 |
* to the file name (before suffix) and the generated filename of the attachment is returned. |
| 929 |
* @throws TracException |
943 |
* @throws TracException |
| 930 |
*/ |
944 |
*/ |
| 931 |
public String putWikiPageAttachmentData(String pageName, String fileName, String description, InputStream in, |
945 |
public String putWikiPageAttachmentData(String pageName, String fileName, String description, InputStream in, |