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 145325 Details for
Bug 250869
[context] do not prompt to download context if only a single one is available
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
updated patch
clipboard.txt (text/plain), 17.12 KB, created by
Steffen Pingel
on 2009-08-21 17:43:40 EDT
(
hide
)
Description:
updated patch
Filename:
MIME Type:
Creator:
Steffen Pingel
Created:
2009-08-21 17:43:40 EDT
Size:
17.12 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.mylyn.context.ui >Index: src/org/eclipse/mylyn/internal/context/ui/actions/ContextClearAction.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.context.ui/src/org/eclipse/mylyn/internal/context/ui/actions/ContextClearAction.java,v >retrieving revision 1.31 >diff -u -r1.31 ContextClearAction.java >--- src/org/eclipse/mylyn/internal/context/ui/actions/ContextClearAction.java 3 Dec 2008 03:14:20 -0000 1.31 >+++ src/org/eclipse/mylyn/internal/context/ui/actions/ContextClearAction.java 21 Aug 2009 21:46:05 -0000 >@@ -15,12 +15,12 @@ > import org.eclipse.jface.dialogs.MessageDialog; > import org.eclipse.mylyn.context.core.ContextCore; > import org.eclipse.mylyn.internal.context.ui.commands.ClearContextHandler; >+import org.eclipse.mylyn.internal.provisional.commons.ui.WorkbenchUtil; > import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal; > import org.eclipse.mylyn.internal.tasks.ui.views.TaskListView; > import org.eclipse.mylyn.tasks.core.ITask; > import org.eclipse.mylyn.tasks.ui.TasksUiImages; > import org.eclipse.ui.IViewPart; >-import org.eclipse.ui.PlatformUI; > > /** > * @author Mik Kersten >@@ -58,9 +58,8 @@ > } > > public boolean run(ITask task) { >- boolean deleteConfirmed = MessageDialog.openQuestion(PlatformUI.getWorkbench() >- .getActiveWorkbenchWindow() >- .getShell(), Messages.ContextClearAction_Confirm_clear_context, >+ boolean deleteConfirmed = MessageDialog.openQuestion(WorkbenchUtil.getShell(), >+ Messages.ContextClearAction_Confirm_clear_context, > Messages.ContextClearAction_Clear_the_context_for_the_selected_task); > if (!deleteConfirmed) { > return false; >Index: src/org/eclipse/mylyn/internal/context/ui/actions/ContextRetrieveAction.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.context.ui/src/org/eclipse/mylyn/internal/context/ui/actions/ContextRetrieveAction.java,v >retrieving revision 1.40 >diff -u -r1.40 ContextRetrieveAction.java >--- src/org/eclipse/mylyn/internal/context/ui/actions/ContextRetrieveAction.java 3 Dec 2008 03:14:20 -0000 1.40 >+++ src/org/eclipse/mylyn/internal/context/ui/actions/ContextRetrieveAction.java 21 Aug 2009 21:46:05 -0000 >@@ -19,15 +19,14 @@ > import org.eclipse.mylyn.internal.context.ui.commands.RetrieveContextAttachmentHandler; > import org.eclipse.mylyn.internal.context.ui.commands.RetrieveContextHandler; > import org.eclipse.mylyn.internal.context.ui.wizards.ContextRetrieveWizard; >+import org.eclipse.mylyn.internal.provisional.commons.ui.WorkbenchUtil; > import org.eclipse.mylyn.internal.tasks.core.AbstractTask; > import org.eclipse.mylyn.internal.tasks.ui.util.AttachmentUtil; > import org.eclipse.mylyn.internal.tasks.ui.views.TaskListView; > import org.eclipse.mylyn.tasks.core.ITask; > import org.eclipse.mylyn.tasks.ui.TasksUiImages; >-import org.eclipse.swt.widgets.Shell; > import org.eclipse.ui.IViewActionDelegate; > import org.eclipse.ui.IViewPart; >-import org.eclipse.ui.PlatformUI; > > /** > * @author Mik Kersten >@@ -67,15 +66,12 @@ > > public void run(ITask task) { > ContextRetrieveWizard wizard = new ContextRetrieveWizard(task); >- Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); >- if (shell != null && !shell.isDisposed()) { >- WizardDialog dialog = new WizardDialog(shell, wizard); >- dialog.create(); >- dialog.setBlockOnOpen(true); >- if (dialog.open() == Window.CANCEL) { >- dialog.close(); >- return; >- } >+ WizardDialog dialog = new WizardDialog(WorkbenchUtil.getShell(), wizard); >+ dialog.create(); >+ dialog.setBlockOnOpen(true); >+ if (dialog.open() == Window.CANCEL) { >+ dialog.close(); >+ return; > } > } > >Index: src/org/eclipse/mylyn/internal/context/ui/actions/ContextAttachAction.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.context.ui/src/org/eclipse/mylyn/internal/context/ui/actions/ContextAttachAction.java,v >retrieving revision 1.38 >diff -u -r1.38 ContextAttachAction.java >--- src/org/eclipse/mylyn/internal/context/ui/actions/ContextAttachAction.java 3 Dec 2008 03:14:20 -0000 1.38 >+++ src/org/eclipse/mylyn/internal/context/ui/actions/ContextAttachAction.java 21 Aug 2009 21:46:05 -0000 >@@ -20,16 +20,15 @@ > import org.eclipse.mylyn.context.core.ContextCore; > import org.eclipse.mylyn.internal.context.ui.commands.AttachContextHandler; > import org.eclipse.mylyn.internal.context.ui.wizards.ContextAttachWizard; >+import org.eclipse.mylyn.internal.provisional.commons.ui.WorkbenchUtil; > import org.eclipse.mylyn.internal.tasks.core.AbstractTask; > import org.eclipse.mylyn.internal.tasks.ui.util.AttachmentUtil; > import org.eclipse.mylyn.internal.tasks.ui.views.TaskListView; > import org.eclipse.mylyn.tasks.core.ITask; > import org.eclipse.mylyn.tasks.core.ITask.SynchronizationState; > import org.eclipse.mylyn.tasks.ui.TasksUiImages; >-import org.eclipse.swt.widgets.Shell; > import org.eclipse.ui.IViewActionDelegate; > import org.eclipse.ui.IViewPart; >-import org.eclipse.ui.PlatformUI; > > /** > * @author Mik Kersten >@@ -71,22 +70,18 @@ > > public void run(ITask task) { > if (task.getSynchronizationState() != SynchronizationState.SYNCHRONIZED) { >- MessageDialog.openInformation(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), >- Messages.ContextAttachAction_Context_Attachment, >+ MessageDialog.openInformation(WorkbenchUtil.getShell(), Messages.ContextAttachAction_Context_Attachment, > Messages.ContextAttachAction_Task_must_be_synchronized_before_attaching_context); > return; > } > > ContextAttachWizard wizard = new ContextAttachWizard(task); >- Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); >- if (shell != null && !shell.isDisposed()) { >- WizardDialog dialog = new WizardDialog(shell, wizard); >- dialog.create(); >- dialog.setBlockOnOpen(true); >- if (dialog.open() == Window.CANCEL) { >- dialog.close(); >- return; >- } >+ WizardDialog dialog = new WizardDialog(WorkbenchUtil.getShell(), wizard); >+ dialog.create(); >+ dialog.setBlockOnOpen(true); >+ if (dialog.open() == Window.CANCEL) { >+ dialog.close(); >+ return; > } > } > >Index: src/org/eclipse/mylyn/internal/context/ui/ContextUiPlugin.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.context.ui/src/org/eclipse/mylyn/internal/context/ui/ContextUiPlugin.java,v >retrieving revision 1.38 >diff -u -r1.38 ContextUiPlugin.java >--- src/org/eclipse/mylyn/internal/context/ui/ContextUiPlugin.java 24 Jul 2009 12:07:34 -0000 1.38 >+++ src/org/eclipse/mylyn/internal/context/ui/ContextUiPlugin.java 21 Aug 2009 21:46:05 -0000 >@@ -30,7 +30,6 @@ > import org.eclipse.core.runtime.IStatus; > import org.eclipse.core.runtime.Platform; > import org.eclipse.core.runtime.Status; >-import org.eclipse.jface.dialogs.MessageDialog; > import org.eclipse.jface.preference.IPreferenceStore; > import org.eclipse.jface.resource.ImageDescriptor; > import org.eclipse.jface.text.TextSelection; >@@ -47,7 +46,9 @@ > import org.eclipse.mylyn.context.core.IInteractionRelation; > import org.eclipse.mylyn.context.ui.AbstractContextUiBridge; > import org.eclipse.mylyn.context.ui.IContextUiStartup; >+import org.eclipse.mylyn.internal.context.ui.wizards.RetrieveLatestContextDialog; > import org.eclipse.mylyn.internal.monitor.ui.MonitorUiPlugin; >+import org.eclipse.mylyn.internal.provisional.commons.ui.WorkbenchUtil; > import org.eclipse.mylyn.monitor.ui.MonitorUi; > import org.eclipse.mylyn.tasks.core.ITask; > import org.eclipse.mylyn.tasks.core.ITaskActivationListener; >@@ -185,7 +186,7 @@ > > private static final ITaskActivationListener TASK_ACTIVATION_LISTENER = new TaskActivationAdapter() { > >- @SuppressWarnings( { "deprecation", "restriction" }) >+ @SuppressWarnings( { "restriction" }) > @Override > public void taskActivated(ITask task) { > if (CoreUtil.TEST_MODE) { >@@ -196,13 +197,7 @@ > boolean hasLocalContext = ContextCore.getContextManager().hasContext(task.getHandleIdentifier()); > if (!hasLocalContext) { > if (org.eclipse.mylyn.internal.tasks.ui.util.AttachmentUtil.hasContextAttachment(task)) { >- boolean getRemote = MessageDialog.openQuestion(PlatformUI.getWorkbench() >- .getActiveWorkbenchWindow() >- .getShell(), Messages.ContextUiPlugin_Task_Activation, >- Messages.ContextUiPlugin_No_local_task_context_exists); >- if (getRemote) { >- new org.eclipse.mylyn.internal.context.ui.actions.ContextRetrieveAction().run(task); >- } >+ RetrieveLatestContextDialog.openQuestion(WorkbenchUtil.getShell(), task); > } > } > } >Index: src/org/eclipse/mylyn/internal/context/ui/wizards/RetrieveLatestContextDialog.java >=================================================================== >RCS file: src/org/eclipse/mylyn/internal/context/ui/wizards/RetrieveLatestContextDialog.java >diff -N src/org/eclipse/mylyn/internal/context/ui/wizards/RetrieveLatestContextDialog.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/mylyn/internal/context/ui/wizards/RetrieveLatestContextDialog.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,177 @@ >+/******************************************************************************* >+ * 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.internal.context.ui.wizards; >+ >+import java.util.Collections; >+import java.util.Date; >+import java.util.List; >+import java.util.Map; >+ >+import org.eclipse.jface.dialogs.IDialogConstants; >+import org.eclipse.jface.dialogs.MessageDialog; >+import org.eclipse.jface.layout.GridDataFactory; >+import org.eclipse.jface.layout.GridLayoutFactory; >+import org.eclipse.jface.wizard.ProgressMonitorPart; >+import org.eclipse.jface.wizard.WizardDialog; >+import org.eclipse.mylyn.internal.provisional.commons.ui.WorkbenchUtil; >+import org.eclipse.mylyn.internal.tasks.ui.util.AttachmentUtil; >+import org.eclipse.mylyn.tasks.core.ITask; >+import org.eclipse.mylyn.tasks.core.ITaskAttachment; >+import org.eclipse.mylyn.tasks.core.TaskRepository; >+import org.eclipse.mylyn.tasks.ui.TasksUi; >+import org.eclipse.osgi.util.NLS; >+import org.eclipse.swt.SWT; >+import org.eclipse.swt.events.SelectionAdapter; >+import org.eclipse.swt.events.SelectionEvent; >+import org.eclipse.swt.graphics.Image; >+import org.eclipse.swt.widgets.Composite; >+import org.eclipse.swt.widgets.Control; >+import org.eclipse.swt.widgets.Link; >+import org.eclipse.swt.widgets.Shell; >+ >+import com.ibm.icu.text.DateFormat; >+ >+/** >+ * @author Steffen Pingel >+ */ >+public class RetrieveLatestContextDialog extends MessageDialog { >+ >+ public static boolean openQuestion(Shell shell, ITask task) { >+ String title = Messages.RetrieveLatestContextDialog_Task_Activation0; >+ TaskRepository repository = TasksUi.getRepositoryManager().getRepository(task.getConnectorKind(), >+ task.getRepositoryUrl()); >+ List<ITaskAttachment> contextAttachments = AttachmentUtil.getContextAttachments(repository, task); >+ Collections.sort(contextAttachments, new TaskAttachmentComparator()); >+ if (contextAttachments.size() > 0) { >+ ITaskAttachment attachment = contextAttachments.get(0); >+ String author = null; >+ if (attachment.getAuthor() != null) { >+ author = (attachment.getAuthor().getName()) != null ? attachment.getAuthor().getName() >+ : attachment.getAuthor().getPersonId(); >+ } >+ if (author == null) { >+ author = Messages.RetrieveLatestContextDialog_Task_ActivationUnknown; >+ } >+ Date date = attachment.getCreationDate(); >+ String dateString = null; >+ if (date != null) { >+ dateString = DateFormat.getDateInstance(DateFormat.LONG).format(date); >+ } >+ if (dateString == null) { >+ dateString = Messages.RetrieveLatestContextDialog_Task_ActivationUnknown; >+ } >+ String message = NLS.bind(Messages.RetrieveLatestContextDialog_Task_ActivationNo_local_context, author, >+ dateString); >+ int kind = QUESTION; >+ int style = SWT.NONE; >+ >+ RetrieveLatestContextDialog dialog = new RetrieveLatestContextDialog(shell, title, null, message, kind, >+ new String[] { IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL }, 0, task, attachment); >+ style &= SWT.SHEET; >+ dialog.setShellStyle(dialog.getShellStyle() | style); >+ return dialog.open() == 0; >+ } >+ return false; >+ } >+ >+ private final ITaskAttachment attachment; >+ >+ private Link link; >+ >+ private ProgressContainer progressContainer; >+ >+ private ProgressMonitorPart progressMonitorPart; >+ >+ private final ITask task; >+ >+ public RetrieveLatestContextDialog(Shell parentShell, String dialogTitle, Image dialogTitleImage, >+ String dialogMessage, int dialogImageType, String[] dialogButtonLabels, int defaultIndex, ITask task, >+ ITaskAttachment attachment) { >+ super(parentShell, dialogTitle, dialogTitleImage, dialogMessage, dialogImageType, dialogButtonLabels, >+ defaultIndex); >+ this.task = task; >+ this.attachment = attachment; >+ } >+ >+ @Override >+ protected void buttonPressed(int buttonId) { >+ if (progressContainer.isActive()) { >+ return; >+ } >+ if (buttonId == 0) { >+ if (!AttachmentUtil.downloadContext(task, attachment, progressContainer)) { >+ // failed >+ return; >+ } >+ } >+ super.buttonPressed(buttonId); >+ } >+ >+ @Override >+ protected Control createButtonBar(Composite parent) { >+ Composite composite = new Composite(parent, SWT.NONE); >+ composite.setLayout(GridLayoutFactory.fillDefaults().numColumns(3).create()); >+ GridDataFactory.fillDefaults().grab(true, false).span(2, 1).applyTo(composite); >+ Control control = createLink(composite); >+ GridDataFactory.fillDefaults().grab(true, false).applyTo(control); >+ super.createButtonBar(composite); >+ return composite; >+ } >+ >+ @Override >+ protected Control createContents(Composite parent) { >+ Control control = super.createContents(parent); >+ progressContainer.setCancelButton(getButton(1)); >+ getButton(0).setFocus(); >+ return control; >+ } >+ >+ @Override >+ protected Control createCustomArea(Composite parent) { >+ progressMonitorPart = new ProgressMonitorPart(parent, null); >+ GridDataFactory.fillDefaults().grab(true, false).applyTo(progressMonitorPart); >+ progressContainer = new ProgressContainer(getShell(), progressMonitorPart) { >+ @Override >+ protected void restoreUiState(Map<Object, Object> state) { >+ link.setEnabled(true); >+ getButton(0).setEnabled(true); >+ getButton(1).setEnabled(true); >+ }; >+ >+ @Override >+ protected void saveUiState(Map<Object, Object> savedState) { >+ link.setEnabled(false); >+ getButton(0).setEnabled(false); >+ }; >+ }; >+ return progressMonitorPart; >+ } >+ >+ protected Control createLink(Composite parent) { >+ link = new Link(parent, SWT.NONE); >+ link.setText(Messages.RetrieveLatestContextDialog_Task_ActivationSelect_from_history); >+ link.addSelectionListener(new SelectionAdapter() { >+ @Override >+ public void widgetSelected(SelectionEvent e) { >+ close(); >+ >+ ContextRetrieveWizard wizard = new ContextRetrieveWizard(task); >+ WizardDialog dialog = new WizardDialog(WorkbenchUtil.getShell(), wizard); >+ dialog.create(); >+ dialog.setBlockOnOpen(true); >+ setReturnCode(dialog.open()); >+ } >+ }); >+ return link; >+ } >+ >+} >Index: src/org/eclipse/mylyn/internal/context/ui/wizards/TaskAttachmentComparator.java >=================================================================== >RCS file: src/org/eclipse/mylyn/internal/context/ui/wizards/TaskAttachmentComparator.java >diff -N src/org/eclipse/mylyn/internal/context/ui/wizards/TaskAttachmentComparator.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/mylyn/internal/context/ui/wizards/TaskAttachmentComparator.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,35 @@ >+/******************************************************************************* >+ * 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.internal.context.ui.wizards; >+ >+import java.util.Comparator; >+import java.util.Date; >+ >+import org.eclipse.mylyn.tasks.core.ITaskAttachment; >+ >+class TaskAttachmentComparator implements Comparator<ITaskAttachment> { >+ public int compare(ITaskAttachment attachment1, ITaskAttachment attachment2) { >+ Date created1 = null; >+ Date created2 = null; >+ created1 = attachment1.getCreationDate(); >+ created2 = attachment2.getCreationDate(); >+ if (created1 != null && created2 != null) { >+ return (-1) * created1.compareTo(created2); >+ } else if (created1 == null && created2 != null) { >+ return 1; >+ } else if (created1 != null && created2 == null) { >+ return -1; >+ } else { >+ return 0; >+ } >+ } >+} >\ No newline at end of file
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 250869
:
145214
|
145215
|
145216
|
145235
|
145236
|
145237
|
145238
|
145239
| 145325