Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrank Becker2013-04-07 14:57:43 -0400
committerGerrit Code Review @ Eclipse.org2013-04-27 19:50:25 -0400
commitcd9abb53f4c6021f16268c24a739e0b6d832c5ee (patch)
treed862602a971118c7915445aa6801357cd2288331 /org.eclipse.mylyn.tasks.ui/src/org
parent6ec57fa25d09e8326cf3d795d02be0666e05f941 (diff)
downloadorg.eclipse.mylyn.tasks-cd9abb53f4c6021f16268c24a739e0b6d832c5ee.tar.gz
org.eclipse.mylyn.tasks-cd9abb53f4c6021f16268c24a739e0b6d832c5ee.tar.xz
org.eclipse.mylyn.tasks-cd9abb53f4c6021f16268c24a739e0b6d832c5ee.zip
404860: very long and/or multiline error messages are not
displayed correctly Change-Id: I1096a243c761d043c8fdef9e742b4278f78b7d2d Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=404860
Diffstat (limited to 'org.eclipse.mylyn.tasks.ui/src/org')
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/TasksUiInternal.java3
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/AbstractTaskEditorPage.java53
2 files changed, 30 insertions, 26 deletions
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/TasksUiInternal.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/TasksUiInternal.java
index a1cbe6835..219132f7e 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/TasksUiInternal.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/TasksUiInternal.java
@@ -558,6 +558,9 @@ public class TasksUiInternal {
if (message == null || message.trim().length() == 0) {
message = Messages.TasksUiInternal_An_unknown_error_occurred;
}
+ if (message.length() > 256) {
+ message = message.substring(0, 256) + "..."; //$NON-NLS-1$
+ }
if (showLinkToErrorLog) {
message += "\n\n" + Messages.TasksUiInternal_See_error_log_for_details; //$NON-NLS-1$
}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/AbstractTaskEditorPage.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/AbstractTaskEditorPage.java
index 9ba55ab8e..5004104d1 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/AbstractTaskEditorPage.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/AbstractTaskEditorPage.java
@@ -1213,48 +1213,49 @@ public abstract class AbstractTaskEditorPage extends TaskFormPage implements ISe
private void handleSubmitError(SubmitJob job) {
if (form != null && !form.isDisposed()) {
final IStatus status = job.getStatus();
+ String message = null;
if (status.getCode() == RepositoryStatus.REPOSITORY_COMMENT_REQUIRED) {
TasksUiInternal.displayStatus(Messages.AbstractTaskEditorPage_Comment_required, status);
AbstractTaskEditorPart newCommentPart = getPart(ID_PART_NEW_COMMENT);
if (newCommentPart != null) {
newCommentPart.setFocus();
}
+ return;
} else if (status.getCode() == RepositoryStatus.ERROR_REPOSITORY_LOGIN) {
if (TasksUiUtil.openEditRepositoryWizard(getTaskRepository()) == Window.OK) {
submitEnabled = true;
doSubmit();
+ return;
} else {
- String message;
- if (status.getMessage().length() > 0) {
- message = Messages.AbstractTaskEditorPage_Submit_failed_ + status.getMessage();
- } else {
- message = Messages.AbstractTaskEditorPage_Submit_failed;
- }
- message = message.replaceAll("\n", " "); //$NON-NLS-1$ //$NON-NLS-2$
- getTaskEditor().setMessage(message, IMessageProvider.ERROR, new HyperlinkAdapter() {
- @Override
- public void linkActivated(HyperlinkEvent e) {
- TasksUiInternal.displayStatus(Messages.AbstractTaskEditorPage_Submit_failed, status);
- }
- });
+ message = getMessageFromStatus(status);
}
+ } else if (status.getCode() == RepositoryStatus.ERROR_IO) {
+ message = ERROR_NOCONNECTIVITY;
} else {
- String message;
- if (status.getCode() == RepositoryStatus.ERROR_IO) {
- message = ERROR_NOCONNECTIVITY;
- } else if (status.getMessage().length() > 0) {
- message = Messages.AbstractTaskEditorPage_Submit_failed_ + status.getMessage();
- } else {
- message = Messages.AbstractTaskEditorPage_Submit_failed;
+ message = getMessageFromStatus(status);
+ }
+ getTaskEditor().setMessage(message, IMessageProvider.ERROR, new HyperlinkAdapter() {
+ @Override
+ public void linkActivated(HyperlinkEvent e) {
+ TasksUiInternal.displayStatus(Messages.AbstractTaskEditorPage_Submit_failed, status);
}
- getTaskEditor().setMessage(message, IMessageProvider.ERROR, new HyperlinkAdapter() {
- @Override
- public void linkActivated(HyperlinkEvent e) {
- TasksUiInternal.displayStatus(Messages.AbstractTaskEditorPage_Submit_failed, status);
- }
- });
+ });
+ }
+ }
+
+ private String getMessageFromStatus(final IStatus status) {
+ String message;
+ if (status.getMessage().length() > 0) {
+ if (status.getMessage().length() < 256) {
+ message = Messages.AbstractTaskEditorPage_Submit_failed_ + status.getMessage();
+ } else {
+ message = Messages.AbstractTaskEditorPage_Submit_failed_ + status.getMessage().substring(0, 256)
+ + "..."; //$NON-NLS-1$
}
+ } else {
+ message = Messages.AbstractTaskEditorPage_Submit_failed;
}
+ return message.replaceAll("\n", " ").replaceAll("\r", " "); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
}
@Override

Back to the top