|
Lines 12-17
Link Here
|
| 12 |
package org.eclipse.mylyn.internal.bugzilla.ide.actions; |
12 |
package org.eclipse.mylyn.internal.bugzilla.ide.actions; |
| 13 |
|
13 |
|
| 14 |
import org.eclipse.jface.action.IAction; |
14 |
import org.eclipse.jface.action.IAction; |
|
|
15 |
import org.eclipse.jface.dialogs.MessageDialog; |
| 15 |
import org.eclipse.jface.viewers.ISelection; |
16 |
import org.eclipse.jface.viewers.ISelection; |
| 16 |
import org.eclipse.jface.viewers.IStructuredSelection; |
17 |
import org.eclipse.jface.viewers.IStructuredSelection; |
| 17 |
import org.eclipse.mylyn.tasks.core.TaskSelection; |
18 |
import org.eclipse.mylyn.tasks.core.TaskSelection; |
|
Lines 35-45
Link Here
|
| 35 |
private LogEntry entry; |
36 |
private LogEntry entry; |
| 36 |
|
37 |
|
| 37 |
public void run() { |
38 |
public void run() { |
| 38 |
createTask(entry); |
39 |
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); |
| 39 |
} |
40 |
boolean includeChildren = false; |
|
|
41 |
|
| 42 |
if (entry.hasChildren() && MessageDialog.openQuestion(shell, "Report Bug", "Include subentries too?")) { |
| 43 |
includeChildren = true; |
| 44 |
} |
| 40 |
|
45 |
|
| 41 |
protected void createTask(LogEntry entry) { |
|
|
| 42 |
StringBuilder sb = new StringBuilder(); |
46 |
StringBuilder sb = new StringBuilder(); |
|
|
47 |
buildDescriptionFromLogEntry(entry, sb, includeChildren); |
| 48 |
|
| 49 |
TaskSelection taskSelection = new TaskSelection("", sb.toString()); |
| 50 |
TasksUiUtil.openNewTaskEditor(shell, taskSelection, null); |
| 51 |
} |
| 52 |
|
| 53 |
/** |
| 54 |
* Fills a {@link StringBuilder} with {@link LogEntry} information, optionally including subentries too |
| 55 |
* |
| 56 |
* @param entry |
| 57 |
* The {@link LogEntry} who provides the information |
| 58 |
* @param sb |
| 59 |
* An {@link StringBuilder} to be filled with |
| 60 |
* @param includeChildren |
| 61 |
* Indicates if it should include subentries, if the {@link LogEntry} have any |
| 62 |
*/ |
| 63 |
private void buildDescriptionFromLogEntry(LogEntry entry, StringBuilder sb, boolean includeChildren) { |
| 43 |
sb.append("\n\n-- Error Log --\nDate: "); |
64 |
sb.append("\n\n-- Error Log --\nDate: "); |
| 44 |
sb.append(entry.getDate()); |
65 |
sb.append(entry.getDate()); |
| 45 |
sb.append("\nMessage: "); |
66 |
sb.append("\nMessage: "); |
|
Lines 54-62
Link Here
|
| 54 |
sb.append(entry.getStack()); |
75 |
sb.append(entry.getStack()); |
| 55 |
} |
76 |
} |
| 56 |
|
77 |
|
| 57 |
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); |
78 |
if (includeChildren && entry.hasChildren()) { |
| 58 |
TaskSelection taskSelection = new TaskSelection("", sb.toString()); |
79 |
Object[] children = entry.getChildren(null); |
| 59 |
TasksUiUtil.openNewTaskEditor(shell, taskSelection, null); |
80 |
for (Object child : children) { |
|
|
81 |
if (child instanceof LogEntry) { |
| 82 |
buildDescriptionFromLogEntry((LogEntry) child, sb, includeChildren); |
| 83 |
} |
| 84 |
} |
| 85 |
} |
| 60 |
} |
86 |
} |
| 61 |
|
87 |
|
| 62 |
public void run(IAction action) { |
88 |
public void run(IAction action) { |