Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrelves2010-05-31 17:28:39 -0400
committerrelves2010-05-31 17:28:39 -0400
commitb04d08df5fa4a87086d90848603fe13c81baf4ad (patch)
tree49ad139f1a535271794e46c477812dd0e5ffe8b4 /org.eclipse.mylyn.tasks.ui
parentd1aa161b8509a073378439a4f5b026cbce373a24 (diff)
downloadorg.eclipse.mylyn.tasks-b04d08df5fa4a87086d90848603fe13c81baf4ad.tar.gz
org.eclipse.mylyn.tasks-b04d08df5fa4a87086d90848603fe13c81baf4ad.tar.xz
org.eclipse.mylyn.tasks-b04d08df5fa4a87086d90848603fe13c81baf4ad.zip
NEW - bug 263528: display a repository service message to warn users of problems, updates, and other relevant information
https://bugs.eclipse.org/bugs/show_bug.cgi?id=263528
Diffstat (limited to 'org.eclipse.mylyn.tasks.ui')
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TasksUiPlugin.java36
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/notifications/TaskListServiceMessageControl.java144
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListView.java16
3 files changed, 135 insertions, 61 deletions
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TasksUiPlugin.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TasksUiPlugin.java
index 74c12be45..d22412349 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TasksUiPlugin.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TasksUiPlugin.java
@@ -72,8 +72,8 @@ import org.eclipse.mylyn.internal.tasks.core.TaskActivityManager;
import org.eclipse.mylyn.internal.tasks.core.TaskActivityUtil;
import org.eclipse.mylyn.internal.tasks.core.TaskList;
import org.eclipse.mylyn.internal.tasks.core.TaskRepositoryDelta;
-import org.eclipse.mylyn.internal.tasks.core.TaskRepositoryDelta.Type;
import org.eclipse.mylyn.internal.tasks.core.TaskRepositoryManager;
+import org.eclipse.mylyn.internal.tasks.core.TaskRepositoryDelta.Type;
import org.eclipse.mylyn.internal.tasks.core.data.TaskDataManager;
import org.eclipse.mylyn.internal.tasks.core.data.TaskDataStore;
import org.eclipse.mylyn.internal.tasks.core.externalization.ExternalizationManager;
@@ -91,12 +91,12 @@ import org.eclipse.mylyn.tasks.core.AbstractDuplicateDetector;
import org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector;
import org.eclipse.mylyn.tasks.core.IRepositoryQuery;
import org.eclipse.mylyn.tasks.core.ITask;
-import org.eclipse.mylyn.tasks.core.ITask.PriorityLevel;
import org.eclipse.mylyn.tasks.core.ITaskActivationListener;
import org.eclipse.mylyn.tasks.core.ITaskContainer;
import org.eclipse.mylyn.tasks.core.RepositoryTemplate;
import org.eclipse.mylyn.tasks.core.TaskActivationAdapter;
import org.eclipse.mylyn.tasks.core.TaskRepository;
+import org.eclipse.mylyn.tasks.core.ITask.PriorityLevel;
import org.eclipse.mylyn.tasks.ui.AbstractRepositoryConnectorUi;
import org.eclipse.mylyn.tasks.ui.AbstractTaskRepositoryLinkProvider;
import org.eclipse.mylyn.tasks.ui.TasksUi;
@@ -511,13 +511,11 @@ public class TasksUiPlugin extends AbstractUIPlugin {
return;
}
- boolean enabled = TasksUiPlugin.getDefault()
- .getPreferenceStore()
- .getBoolean(ITasksUiPreferenceConstants.REPOSITORY_SYNCH_SCHEDULE_ENABLED);
+ boolean enabled = TasksUiPlugin.getDefault().getPreferenceStore().getBoolean(
+ ITasksUiPreferenceConstants.REPOSITORY_SYNCH_SCHEDULE_ENABLED);
if (enabled) {
- long interval = TasksUiPlugin.getDefault()
- .getPreferenceStore()
- .getLong(ITasksUiPreferenceConstants.REPOSITORY_SYNCH_SCHEDULE_MILISECONDS);
+ long interval = TasksUiPlugin.getDefault().getPreferenceStore().getLong(
+ ITasksUiPreferenceConstants.REPOSITORY_SYNCH_SCHEDULE_MILISECONDS);
if (initial) {
synchronizationScheduler.setInterval(DELAY_QUERY_REFRESH_ON_STARTUP, interval);
} else {
@@ -888,18 +886,15 @@ public class TasksUiPlugin extends AbstractUIPlugin {
}
}
- if (!MonitorUiPlugin.getDefault()
- .getPreferenceStore()
- .getBoolean(MonitorUiPlugin.ACTIVITY_TRACKING_ENABLED + ".checked")) { //$NON-NLS-1$
+ if (!MonitorUiPlugin.getDefault().getPreferenceStore().getBoolean(
+ MonitorUiPlugin.ACTIVITY_TRACKING_ENABLED + ".checked")) { //$NON-NLS-1$
if (!taskActivityMonitor.getActivationHistory().isEmpty()) {
// tasks have been active before so fore preference enabled
- MonitorUiPlugin.getDefault()
- .getPreferenceStore()
- .setValue(MonitorUiPlugin.ACTIVITY_TRACKING_ENABLED, true);
+ MonitorUiPlugin.getDefault().getPreferenceStore().setValue(MonitorUiPlugin.ACTIVITY_TRACKING_ENABLED,
+ true);
}
- MonitorUiPlugin.getDefault()
- .getPreferenceStore()
- .setValue(MonitorUiPlugin.ACTIVITY_TRACKING_ENABLED + ".checked", true); //$NON-NLS-1$
+ MonitorUiPlugin.getDefault().getPreferenceStore().setValue(
+ MonitorUiPlugin.ACTIVITY_TRACKING_ENABLED + ".checked", true); //$NON-NLS-1$
MonitorUiPlugin.getDefault().savePluginPreferences();
}
@@ -960,7 +955,7 @@ public class TasksUiPlugin extends AbstractUIPlugin {
store.setDefault(ITasksUiPreferenceConstants.AUTO_EXPAND_TASK_LIST, true);
store.setDefault(ITasksUiPreferenceConstants.TASK_LIST_TOOL_TIPS_ENABLED, true);
- store.setDefault(ITasksUiPreferenceConstants.SERVICE_MESSAGE_URL, "http://eclipse.org/mylyn/message.xml"); //$NON-NLS-1$
+ store.setDefault(ITasksUiPreferenceConstants.SERVICE_MESSAGE_URL, "http://eclipse.org/mylyn/messageTest.xml"); //$NON-NLS-1$
}
public static TaskActivityManager getTaskActivityManager() {
@@ -979,9 +974,8 @@ public class TasksUiPlugin extends AbstractUIPlugin {
}
public boolean groupSubtasks(ITaskContainer element) {
- boolean groupSubtasks = TasksUiPlugin.getDefault()
- .getPreferenceStore()
- .getBoolean(ITasksUiPreferenceConstants.GROUP_SUBTASKS);
+ boolean groupSubtasks = TasksUiPlugin.getDefault().getPreferenceStore().getBoolean(
+ ITasksUiPreferenceConstants.GROUP_SUBTASKS);
if (element instanceof ITask) {
AbstractRepositoryConnectorUi connectorUi = TasksUiPlugin.getConnectorUi(((ITask) element).getConnectorKind());
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/notifications/TaskListServiceMessageControl.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/notifications/TaskListServiceMessageControl.java
index 9c6fc95ba..d7a17180f 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/notifications/TaskListServiceMessageControl.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/notifications/TaskListServiceMessageControl.java
@@ -11,10 +11,16 @@
package org.eclipse.mylyn.internal.tasks.ui.notifications;
+import java.util.Collections;
import java.util.Date;
+import org.eclipse.core.commands.Command;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.preference.PreferenceDialog;
import org.eclipse.mylyn.internal.provisional.commons.ui.CommonImages;
import org.eclipse.mylyn.internal.provisional.commons.ui.CommonThemes;
import org.eclipse.mylyn.internal.provisional.commons.ui.GradientCanvas;
@@ -23,11 +29,16 @@ import org.eclipse.mylyn.internal.tasks.core.notifications.ServiceMessage;
import org.eclipse.mylyn.internal.tasks.core.notifications.ServiceMessageEvent;
import org.eclipse.mylyn.internal.tasks.ui.ITasksUiPreferenceConstants;
import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
-import org.eclipse.mylyn.tasks.ui.TasksUiUtil;
+import org.eclipse.mylyn.internal.tasks.ui.actions.AddRepositoryAction;
+import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal;
+import org.eclipse.mylyn.internal.tasks.ui.wizards.Messages;
import org.eclipse.osgi.service.resolver.VersionRange;
+import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.DisposeEvent;
import org.eclipse.swt.events.DisposeListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.FontData;
@@ -38,16 +49,17 @@ import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Link;
import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.dialogs.PreferencesUtil;
import org.eclipse.ui.forms.FormColors;
import org.eclipse.ui.forms.IFormColors;
import org.eclipse.ui.forms.events.HyperlinkAdapter;
import org.eclipse.ui.forms.events.HyperlinkEvent;
-import org.eclipse.ui.forms.events.IHyperlinkListener;
-import org.eclipse.ui.forms.widgets.Hyperlink;
import org.eclipse.ui.forms.widgets.ImageHyperlink;
import org.eclipse.ui.forms.widgets.TableWrapData;
import org.eclipse.ui.forms.widgets.TableWrapLayout;
+import org.eclipse.ui.handlers.IHandlerService;
import org.osgi.framework.Version;
/**
@@ -56,11 +68,11 @@ import org.osgi.framework.Version;
*/
public class TaskListServiceMessageControl implements IServiceMessageListener {
- private ImageHyperlink imageHyperlink;
+ private Label imageLabel;
- private Hyperlink titleHyperlink;
+ private Label titleLabel;
- private Label descriptionLabel;
+ private Link descriptionLabel;
private GridData headData;
@@ -70,35 +82,26 @@ public class TaskListServiceMessageControl implements IServiceMessageListener {
private ImageHyperlink closeLink;
- private ServiceMessage currentMessage;
+ private ImageHyperlink settingsLink;
- private String messageUrl;
+ private ServiceMessage currentMessage;
public TaskListServiceMessageControl(Composite parent) {
this.parent = parent;
}
private void setTitleImage(Image image) {
- imageHyperlink.setImage(image);
+ imageLabel.setImage(image);
}
private void setTitle(String title) {
- titleHyperlink.setText(title);
+ titleLabel.setText(title);
}
private void setDescription(String description) {
descriptionLabel.setText(description);
}
- private void addHyperlinkListener(IHyperlinkListener listener) {
- titleHyperlink.addHyperlinkListener(listener);
- imageHyperlink.addHyperlinkListener(listener);
- }
-
- protected void setMessageUrl(String url) {
- messageUrl = url;
- }
-
public Control createControl(Composite parent) {
FormColors colors = TasksUiPlugin.getDefault().getFormColors(parent.getDisplay());
head = new GradientCanvas(parent, SWT.NONE);
@@ -129,27 +132,58 @@ public class TaskListServiceMessageControl implements IServiceMessageListener {
layout.numColumns = 3;
head.setLayout(layout);
- imageHyperlink = new ImageHyperlink(head, SWT.NONE);
+ imageLabel = new Label(head, SWT.NONE);
- titleHyperlink = new Hyperlink(head, SWT.NONE);
+ titleLabel = new Label(head, SWT.NONE);
- setHeaderFontSizeAndStyle(titleHyperlink);
+ setHeaderFontSizeAndStyle(titleLabel);
- addHyperlinkListener(new HyperlinkAdapter() {
+ Composite buttonsComp = new Composite(head, SWT.NONE);
+ TableWrapData data = new TableWrapData();
+ data.align = TableWrapData.RIGHT;
+ buttonsComp.setLayoutData(data);
+ GridLayout gLayout = new GridLayout(2, false);
+ gLayout.horizontalSpacing = 0;
+ gLayout.verticalSpacing = 0;
+ gLayout.marginHeight = 0;
+ gLayout.marginWidth = 0;
+ gLayout.verticalSpacing = 0;
+
+ buttonsComp.setLayout(gLayout);
+
+ settingsLink = new ImageHyperlink(buttonsComp, SWT.NONE);
+ settingsLink.setImage(CommonImages.getImage(CommonImages.NOTIFICATION_PREFERENCES));
+// TableWrapData data = new TableWrapData();
+// data.align = TableWrapData.RIGHT;
+// settingsLink.setLayoutData(data);
+ settingsLink.addHyperlinkListener(new HyperlinkAdapter() {
@Override
public void linkActivated(HyperlinkEvent e) {
- if (messageUrl != null) {
- TasksUiUtil.openUrl(messageUrl);
+ closeMessage();
+ PreferenceDialog pref = PreferencesUtil.createPreferenceDialogOn(
+ TaskListServiceMessageControl.this.parent.getShell(),
+ "org.eclipse.mylyn.tasks.ui.preferences", null, null); //$NON-NLS-1$
+ if (pref != null) {
+ pref.open();
}
+ }
+ @Override
+ public void linkEntered(HyperlinkEvent e) {
+ settingsLink.setImage(CommonImages.getImage(CommonImages.NOTIFICATION_PREFERENCES_HOVER));
+ }
+
+ @Override
+ public void linkExited(HyperlinkEvent e) {
+ settingsLink.setImage(CommonImages.getImage(CommonImages.NOTIFICATION_PREFERENCES));
}
});
- closeLink = new ImageHyperlink(head, SWT.NONE);
+ closeLink = new ImageHyperlink(buttonsComp, SWT.NONE);
closeLink.setImage(CommonImages.getImage(CommonImages.NOTIFICATION_CLOSE));
- TableWrapData data = new TableWrapData();
- data.align = TableWrapData.RIGHT;
- closeLink.setLayoutData(data);
+// data = new TableWrapData();
+// data.align = TableWrapData.RIGHT;
+// closeLink.setLayoutData(data);
closeLink.addHyperlinkListener(new HyperlinkAdapter() {
@Override
public void linkActivated(HyperlinkEvent e) {
@@ -170,13 +204,48 @@ public class TaskListServiceMessageControl implements IServiceMessageListener {
// spacer
new Label(head, SWT.NONE).setText(" "); //$NON-NLS-1$
- descriptionLabel = new Label(head, SWT.WRAP);
+ descriptionLabel = new Link(head, SWT.WRAP);
+ descriptionLabel.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ if (e.text != null) {
+ if (e.text.toLowerCase().equals("connect")) { //$NON-NLS-1$
+ closeMessage();
+ new AddRepositoryAction().run();
+ } else if (e.text.toLowerCase().equals("discovery")) { //$NON-NLS-1$
+ closeMessage();
+ final Command discoveryWizardCommand = TasksUiInternal.getConfiguredDiscoveryWizardCommand();
+ if (discoveryWizardCommand != null && discoveryWizardCommand.isEnabled()) {
+ IHandlerService handlerService = (IHandlerService) PlatformUI.getWorkbench().getService(
+ IHandlerService.class);
+ try {
+ discoveryWizardCommand.executeWithChecks(TaskListServiceMessageControl.createExecutionEvent(
+ discoveryWizardCommand, handlerService));
+ } catch (Exception e1) {
+ IStatus status = new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN, NLS.bind(
+ Messages.SelectRepositoryConnectorPage_discoveryProblemMessage,
+ new Object[] { e1.getMessage() }), e1);
+ TasksUiInternal.logAndDisplayStatus(
+ Messages.SelectRepositoryConnectorPage_discoveryProblemTitle, status);
+ }
+ }
+ }
+ }
+ }
+ });
+
data = new TableWrapData();
data.colspan = 2;
descriptionLabel.setLayoutData(data);
+
return head;
}
+ static ExecutionEvent createExecutionEvent(Command command, IHandlerService handlerService) {
+ return new ExecutionEvent(command, Collections.emptyMap(), null,
+ TasksUiInternal.createDiscoveryWizardEvaluationContext(handlerService));
+ }
+
private void closeMessage() {
if (currentMessage != null) {
TasksUiPlugin.getDefault().getPreferenceStore().setValue(
@@ -259,22 +328,21 @@ public class TaskListServiceMessageControl implements IServiceMessageListener {
}
}
- protected void setMessage(ServiceMessage message) {
+ public void setMessage(ServiceMessage message) {
if (!parent.isDisposed() && message != null && (head == null || head.isDisposed())) {
createControl(parent);
- IPreferenceStore preferenceStore = TasksUiPlugin.getDefault().getPreferenceStore();
- preferenceStore.setValue(ITasksUiPreferenceConstants.LAST_SERVICE_MESSAGE_ETAG, message.getETag());
- preferenceStore.setValue(ITasksUiPreferenceConstants.LAST_SERVICE_MESSAGE_LAST_MODIFIED,
- message.getLastModified());
+ if (message.getETag() != null && message.getLastModified() != null) {
+ IPreferenceStore preferenceStore = TasksUiPlugin.getDefault().getPreferenceStore();
+ preferenceStore.setValue(ITasksUiPreferenceConstants.LAST_SERVICE_MESSAGE_ETAG, message.getETag());
+ preferenceStore.setValue(ITasksUiPreferenceConstants.LAST_SERVICE_MESSAGE_LAST_MODIFIED,
+ message.getLastModified());
+ }
this.currentMessage = message;
setTitle(message.getTitle());
setDescription(message.getDescription());
setTitleImage(Dialog.getImage(message.getImage()));
- if (message.getUrl() != null) {
- setMessageUrl(message.getUrl());
- }
parent.layout(true);
}
}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListView.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListView.java
index 4a27c28e8..473ba7908 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListView.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListView.java
@@ -35,6 +35,7 @@ import org.eclipse.jface.action.IToolBarManager;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.action.Separator;
import org.eclipse.jface.action.ToolBarManager;
+import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.layout.TreeColumnLayout;
import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.util.LocalSelectionTransfer;
@@ -67,7 +68,7 @@ import org.eclipse.mylyn.internal.tasks.core.AbstractTaskContainer;
import org.eclipse.mylyn.internal.tasks.core.ITaskListChangeListener;
import org.eclipse.mylyn.internal.tasks.core.ITasksCoreConstants;
import org.eclipse.mylyn.internal.tasks.core.TaskContainerDelta;
-import org.eclipse.mylyn.internal.tasks.core.notifications.ServiceMessageManager;
+import org.eclipse.mylyn.internal.tasks.core.notifications.ServiceMessage;
import org.eclipse.mylyn.internal.tasks.ui.AbstractTaskListFilter;
import org.eclipse.mylyn.internal.tasks.ui.CategorizedPresentation;
import org.eclipse.mylyn.internal.tasks.ui.ITasksUiPreferenceConstants;
@@ -942,7 +943,18 @@ public class TaskListView extends ViewPart implements IPropertyChangeListener, I
TasksUiPlugin.getDefault().getPreferenceStore().addPropertyChangeListener(tasksUiPreferenceListener);
serviceMessageControl = new TaskListServiceMessageControl(body);
- ServiceMessageManager manager = TasksUiPlugin.getDefault().getServiceMessageManager();
+ String lastClosedId = TasksUiPlugin.getDefault().getPreferenceStore().getString(
+ ITasksUiPreferenceConstants.LAST_SERVICE_MESSAGE_ID);
+
+ if (lastClosedId.equals("")) { //$NON-NLS-1$
+ ServiceMessage message = new ServiceMessage();
+ message.setDescription("<A href=\"connect\">Connect Mylyn</A> to your task and ALM tools."); //$NON-NLS-1$
+ message.setTitle("Connect Mylyn"); //$NON-NLS-1$
+ message.setImage(Dialog.DLG_IMG_MESSAGE_INFO);
+ message.setId("0"); //$NON-NLS-1$
+ serviceMessageControl.setMessage(message);
+ }
+
TasksUiPlugin.getDefault().getServiceMessageManager().addServiceMessageListener(serviceMessageControl);
// Need to do this because the page, which holds the active working set is not around on creation, see bug 203179

Back to the top