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 145215 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]
patch
clipboard.txt (text/plain), 16.25 KB, created by
Steffen Pingel
on 2009-08-20 21:29:53 EDT
(
hide
)
Description:
patch
Filename:
MIME Type:
Creator:
Steffen Pingel
Created:
2009-08-20 21:29:53 EDT
Size:
16.25 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.mylyn.context.ui >Index: src/org/eclipse/mylyn/internal/context/ui/wizards/ContextRetrieveWizardPage.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.context.ui/src/org/eclipse/mylyn/internal/context/ui/wizards/ContextRetrieveWizardPage.java,v >retrieving revision 1.19 >diff -u -r1.19 ContextRetrieveWizardPage.java >--- src/org/eclipse/mylyn/internal/context/ui/wizards/ContextRetrieveWizardPage.java 24 Jul 2009 12:07:35 -0000 1.19 >+++ src/org/eclipse/mylyn/internal/context/ui/wizards/ContextRetrieveWizardPage.java 21 Aug 2009 01:31:37 -0000 >@@ -11,14 +11,16 @@ > > package org.eclipse.mylyn.internal.context.ui.wizards; > >-import com.ibm.icu.text.DateFormat; > import java.util.Collections; > import java.util.Comparator; > import java.util.Date; > import java.util.List; > > import org.eclipse.jface.dialogs.Dialog; >+import org.eclipse.jface.dialogs.IDialogConstants; >+import org.eclipse.jface.layout.GridDataFactory; > import org.eclipse.jface.wizard.WizardPage; >+import org.eclipse.mylyn.context.core.ContextCore; > import org.eclipse.mylyn.internal.tasks.ui.util.AttachmentUtil; > import org.eclipse.mylyn.tasks.core.IRepositoryPerson; > import org.eclipse.mylyn.tasks.core.ITask; >@@ -31,14 +33,21 @@ > import org.eclipse.swt.events.MouseListener; > import org.eclipse.swt.events.SelectionAdapter; > import org.eclipse.swt.events.SelectionEvent; >+import org.eclipse.swt.graphics.Image; >+import org.eclipse.swt.layout.FillLayout; > import org.eclipse.swt.layout.GridData; > import org.eclipse.swt.layout.GridLayout; > import org.eclipse.swt.widgets.Composite; >+import org.eclipse.swt.widgets.Control; >+import org.eclipse.swt.widgets.Label; >+import org.eclipse.swt.widgets.Link; > import org.eclipse.swt.widgets.Table; > import org.eclipse.swt.widgets.TableColumn; > import org.eclipse.swt.widgets.TableItem; > import org.eclipse.swt.widgets.Text; > >+import com.ibm.icu.text.DateFormat; >+ > /** > * @author Rob Elves > * @author Mik Kersten >@@ -54,6 +63,26 @@ > > private ITaskAttachment selectedContextAttachment; > >+ private List<ITaskAttachment> contextAttachments; >+ >+ private 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; >+ } >+ } >+ } >+ > protected ContextRetrieveWizardPage(TaskRepository repository, ITask task) { > super(Messages.ContextRetrieveWizardPage_Select_context); > this.repository = repository; >@@ -63,12 +92,75 @@ > } > > public void createControl(Composite parent) { >+ contextAttachments = AttachmentUtil.getContextAttachments(repository, task); >+ Collections.sort(contextAttachments, new TaskAttachmentComparator()); >+ >+ final Composite composite = new Composite(parent, SWT.NONE); >+ composite.setLayout(new FillLayout()); >+ >+ boolean hasLocalContext = ContextCore.getContextManager().hasContext(task.getHandleIdentifier()); >+ if (!hasLocalContext && contextAttachments.size() > 0) { >+ selectedContextAttachment = contextAttachments.get(0); >+ setMessage("Select a context to activate task"); >+ createMessageControl(composite, "No local task context exists. Retrieve latest from repository?"); >+ } else { >+ createTableControl(composite); >+ } >+ >+ setControl(composite); >+ Dialog.applyDialogFont(composite); >+ } >+ >+ public void createMessageControl(final Composite parent, String message) { >+ final Composite composite = new Composite(parent, SWT.NONE); >+ composite.setLayout(new GridLayout(2, false)); >+ >+ Image image = getShell().getDisplay().getSystemImage(SWT.ICON_QUESTION); >+ if (image != null) { >+ Label imageLabel = new Label(composite, SWT.NULL); >+ image.setBackground(imageLabel.getBackground()); >+ imageLabel.setImage(image); >+ GridDataFactory.fillDefaults().align(SWT.CENTER, SWT.BEGINNING).applyTo(imageLabel); >+ } >+ // create message >+ if (message != null) { >+ Label messageLabel = new Label(composite, SWT.WRAP); >+ messageLabel.setText(message); >+ GridData data = GridDataFactory.fillDefaults().align(SWT.FILL, SWT.BEGINNING).grab(true, false).hint( >+ convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH), SWT.DEFAULT).create(); >+ if (image == null) { >+ data.horizontalSpan = 2; >+ } >+ messageLabel.setData(data); >+ } >+ >+ Link hyperlink = new Link(composite, SWT.NONE); >+ hyperlink.setText("<a>Select from History</a>"); >+ hyperlink.addSelectionListener(new SelectionAdapter() { >+ @Override >+ public void widgetSelected(SelectionEvent e) { >+ Control[] children = parent.getChildren(); >+ for (Control control : children) { >+ control.dispose(); >+ } >+ createTableControl(parent); >+ getShell().pack(); >+ } >+ }); >+ GridDataFactory.fillDefaults().span(2, 1).indent(0, 15).applyTo(hyperlink); >+ } >+ >+ public Composite createTableControl(Composite parent) { > Composite composite = new Composite(parent, SWT.NONE); > composite.setLayout(new GridLayout(1, false)); > >- Text summary = new Text(composite, SWT.NONE); >+ Text summary = new Text(composite, SWT.WRAP); > summary.setText(NLS.bind(Messages.ContextRetrieveWizardPage_Task, labelProvider.getText(task))); > summary.setEditable(false); >+ summary.setBackground(null); >+ GridDataFactory.fillDefaults().align(SWT.FILL, SWT.BEGINNING).grab(true, false).hint( >+ convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH), SWT.DEFAULT).applyTo( >+ summary); > // new Label(composite, SWT.NONE).setText("Repository: " + > // repository.getUrl()); > // new Label(composite, SWT.NONE).setText("Select context below:"); >@@ -106,29 +198,6 @@ > > }); > >- List<ITaskAttachment> contextAttachments = AttachmentUtil.getContextAttachments(repository, task); >- >- Collections.sort(contextAttachments, new 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; >- } >- } >- >- }); >- > TableColumn[] columns = new TableColumn[3]; > columns[0] = new TableColumn(contextTable, SWT.LEFT); > columns[0].setText(Messages.ContextRetrieveWizardPage_Date); >@@ -153,14 +222,13 @@ > } > > contextTable.setLayoutData(new GridData(GridData.FILL_BOTH)); >- setControl(composite); > if (contextAttachments.size() > 0) { > contextTable.setSelection(0); > selectedContextAttachment = contextAttachments.get(0); > getWizard().getContainer().updateButtons(); > } > contextTable.setFocus(); >- Dialog.applyDialogFont(composite); >+ return composite; > } > > public ITaskAttachment getSelectedContext() { >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 01:31:36 -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 01:31:37 -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 01:31:36 -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 01:31:36 -0000 >@@ -30,13 +30,13 @@ > 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; > import org.eclipse.jface.viewers.ILabelProvider; > import org.eclipse.jface.viewers.TreeViewer; > import org.eclipse.jface.viewers.ViewerFilter; >+import org.eclipse.jface.wizard.WizardDialog; > import org.eclipse.mylyn.commons.core.CoreUtil; > import org.eclipse.mylyn.commons.core.StatusHandler; > import org.eclipse.mylyn.context.core.AbstractContextListener; >@@ -47,7 +47,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.ContextRetrieveWizard; > 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; >@@ -196,13 +198,18 @@ > 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); >- } >+// boolean result = MessageDialog.openQuestion(WorkbenchUtil.getShell(), >+// Messages.ContextUiPlugin_Task_Activation, >+// Messages.ContextUiPlugin_No_local_task_context_exists); >+// if (result) { >+ ContextRetrieveWizard wizard = new ContextRetrieveWizard(task); >+ WizardDialog dialog = new WizardDialog(WorkbenchUtil.getShell(), wizard); >+ dialog.create(); >+ dialog.setBlockOnOpen(true); >+ dialog.open(); >+ >+// new org.eclipse.mylyn.internal.context.ui.actions.ContextRetrieveAction().run(task); >+// } > } > } > }
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