From d533df8a379abd520c7e6527fe636d519eab0caf Mon Sep 17 00:00:00 2001 From: fbecker Date: Tue, 17 May 2011 03:58:59 +0000 Subject: ASSIGNED - bug 344632: Show attachment in task editor link opens web page when no attachment pressent https://bugs.eclipse.org/bugs/show_bug.cgi?id=344632 --- .../src/org/eclipse/mylyn/internal/bugzilla/ui/Messages.java | 4 ++++ .../bugzilla/ui/TaskAttachmentTableEditorHyperlink.java | 11 +++++++++-- .../eclipse/mylyn/internal/bugzilla/ui/messages.properties | 2 ++ 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/Messages.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/Messages.java index 3a9571d0c..73e075954 100644 --- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/Messages.java +++ b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/Messages.java @@ -20,6 +20,10 @@ public class Messages extends NLS { public static String TaskAttachmentHyperlink_Open_Attachment_X_in_Y; + public static String TaskAttachmentTableEditorHyperlink_AttachmentNotFound; + + public static String TaskAttachmentTableEditorHyperlink_QuestionMsg; + public static String TaskAttachmentTableEditorHyperlink_Show_Attachment_X_in_Y; static { diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/TaskAttachmentTableEditorHyperlink.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/TaskAttachmentTableEditorHyperlink.java index 385b49886..e53a8e297 100644 --- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/TaskAttachmentTableEditorHyperlink.java +++ b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/TaskAttachmentTableEditorHyperlink.java @@ -14,14 +14,17 @@ package org.eclipse.mylyn.internal.bugzilla.ui; import java.text.MessageFormat; import org.eclipse.core.runtime.Assert; +import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.jface.text.IRegion; import org.eclipse.jface.text.hyperlink.IHyperlink; import org.eclipse.mylyn.internal.bugzilla.core.IBugzillaConstants; +import org.eclipse.mylyn.internal.provisional.commons.ui.WorkbenchUtil; import org.eclipse.mylyn.tasks.core.TaskRepository; import org.eclipse.mylyn.tasks.core.data.TaskAttribute; import org.eclipse.mylyn.tasks.ui.TasksUiUtil; import org.eclipse.mylyn.tasks.ui.editors.AbstractTaskEditorPage; import org.eclipse.mylyn.tasks.ui.editors.TaskEditor; +import org.eclipse.osgi.util.NLS; import org.eclipse.ui.IEditorPart; import org.eclipse.ui.IWorkbenchPage; import org.eclipse.ui.PlatformUI; @@ -61,8 +64,12 @@ public final class TaskAttachmentTableEditorHyperlink implements IHyperlink { AbstractTaskEditorPage page = getTaskEditorPage(); if (page != null) { if (!page.selectReveal(TaskAttribute.PREFIX_ATTACHMENT + attachmentId)) { - String url = repository.getUrl() + IBugzillaConstants.URL_GET_ATTACHMENT_SUFFIX + attachmentId; - TasksUiUtil.openUrl(url); + String msg = NLS.bind(Messages.TaskAttachmentTableEditorHyperlink_QuestionMsg, attachmentId); + if (MessageDialog.openQuestion(WorkbenchUtil.getShell(), + Messages.TaskAttachmentTableEditorHyperlink_AttachmentNotFound, msg)) { + String url = repository.getUrl() + IBugzillaConstants.URL_GET_ATTACHMENT_SUFFIX + attachmentId; + TasksUiUtil.openUrl(url); + } } } } diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/messages.properties b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/messages.properties index 08f87b54d..3c38989fe 100644 --- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/messages.properties +++ b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/messages.properties @@ -10,4 +10,6 @@ ############################################################################### BugzillaUiPlugin_Configuration_Refresh_Failed=Configuration Refresh Failed TaskAttachmentHyperlink_Open_Attachment_X_in_Y=Open Attachment {0} in {1} +TaskAttachmentTableEditorHyperlink_AttachmentNotFound=Attachment not found\! +TaskAttachmentTableEditorHyperlink_QuestionMsg=Attachment {0} is not attached to the open bug.\n\nOpen attachment in web browser? TaskAttachmentTableEditorHyperlink_Show_Attachment_X_in_Y=Show Attachment {0} in Task Editor -- cgit v1.2.3