Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 339467
Collapse All | Expand All

(-)src/org/eclipse/mylyn/internal/provisional/commons/ui/ServiceMessageControl.java (-48 / +39 lines)
Lines 100-107 Link Here
100
100
101
	private String eventId;
101
	private String eventId;
102
102
103
	private String preferencesPageId;
104
103
	public ServiceMessageControl(Composite parent) {
105
	public ServiceMessageControl(Composite parent) {
104
		this.parent = parent;
106
		this.parent = parent;
107
		setPreferencesPageId(NOTIFICATIONS_PREF_PAGE);
108
	}
109
110
	public String getPreferencesPageId() {
111
		return preferencesPageId;
112
	}
113
114
	public void setPreferencesPageId(String preferencesPageId) {
115
		this.preferencesPageId = preferencesPageId;
105
	}
116
	}
106
117
107
	/**
118
	/**
Lines 195-249 Link Here
195
206
196
		buttonsComp.setLayout(gLayout);
207
		buttonsComp.setLayout(gLayout);
197
208
198
		// Disabled for initial 3.4 release as per bug#263528
209
		if (getPreferencesPageId() != null) {
199
		//		settingsLink = new ImageHyperlink(buttonsComp, SWT.NONE);
210
			configureLink = new ImageHyperlink(buttonsComp, SWT.NONE);
200
		//		settingsLink.setImage(CommonImages.getImage(CommonImages.NOTIFICATION_PREFERENCES));
211
			configureLink.setImage(CommonImages.getImage(CommonImages.NOTIFICATION_CONFIGURE));
201
		//		settingsLink.addHyperlinkListener(new HyperlinkAdapter() {
212
			configureLink.addHyperlinkListener(new HyperlinkAdapter() {
202
		//			@Override
213
				@Override
203
		//			public void linkActivated(HyperlinkEvent e) {
214
				public void linkEntered(HyperlinkEvent e) {
204
		//				PreferenceDialog pref = PreferencesUtil.createPreferenceDialogOn(
215
					configureLink.setImage(CommonImages.getImage(CommonImages.NOTIFICATION_CONFIGURE_HOVER));
205
		//						TaskListServiceMessageControl.this.parent.getShell(),
216
				}
206
		//						"org.eclipse.mylyn.tasks.ui.preferences", null, null); //$NON-NLS-1$
207
		//				if (pref != null) {
208
		//					pref.open();
209
		//				}
210
		//			}
211
		//
212
		//			@Override
213
		//			public void linkEntered(HyperlinkEvent e) {
214
		//				settingsLink.setImage(CommonImages.getImage(CommonImages.NOTIFICATION_PREFERENCES_HOVER));
215
		//			}
216
		//
217
		//			@Override
218
		//			public void linkExited(HyperlinkEvent e) {
219
		//				settingsLink.setImage(CommonImages.getImage(CommonImages.NOTIFICATION_PREFERENCES));
220
		//			}
221
		//		});
222
		configureLink = new ImageHyperlink(buttonsComp, SWT.NONE);
223
		configureLink.setImage(CommonImages.getImage(CommonImages.NOTIFICATION_CONFIGURE));
224
		configureLink.addHyperlinkListener(new HyperlinkAdapter() {
225
			@Override
226
			public void linkEntered(HyperlinkEvent e) {
227
				configureLink.setImage(CommonImages.getImage(CommonImages.NOTIFICATION_CONFIGURE_HOVER));
228
			}
229
217
230
			@Override
218
				@Override
231
			public void linkExited(HyperlinkEvent e) {
219
				public void linkExited(HyperlinkEvent e) {
232
				configureLink.setImage(CommonImages.getImage(CommonImages.NOTIFICATION_CONFIGURE));
220
					configureLink.setImage(CommonImages.getImage(CommonImages.NOTIFICATION_CONFIGURE));
233
			}
221
				}
234
222
235
			@Override
223
				@Override
236
			public void linkActivated(HyperlinkEvent e) {
224
				public void linkActivated(HyperlinkEvent e) {
237
				PreferenceDialog pd = PreferencesUtil.createPreferenceDialogOn(getShell(), NOTIFICATIONS_PREF_PAGE,
225
					PreferenceDialog pd = PreferencesUtil.createPreferenceDialogOn(getShell(), getPreferencesPageId(),
238
						new String[0], eventId);
226
							new String[0], eventId);
239
				// Only close the message if the did not cancel the operation 
227
					// Only close the message if the did not cancel the operation 
240
				if (pd != null) {
228
					if (pd != null) {
241
					pd.open();
229
						pd.open();
230
					}
242
				}
231
				}
243
			}
232
			});
244
		});
233
			// Initially invisible, must have eventId for this to be of any use.
245
		// Initially invisible, must have eventId for this to be of any use.
234
			configureLink.setVisible(eventId != null);
246
		configureLink.setVisible(eventId != null);
235
		}
247
236
248
		closeLink = new ImageHyperlink(buttonsComp, SWT.NONE);
237
		closeLink = new ImageHyperlink(buttonsComp, SWT.NONE);
249
		closeLink.setImage(CommonImages.getImage(CommonImages.NOTIFICATION_CLOSE));
238
		closeLink.setImage(CommonImages.getImage(CommonImages.NOTIFICATION_CLOSE));
Lines 291-297 Link Here
291
280
292
	protected void setDescription(String description) {
281
	protected void setDescription(String description) {
293
		descriptionLabel.setText(description);
282
		descriptionLabel.setText(description);
294
		parent.layout(true);
283
		parent.layout(true, true);
295
	}
284
	}
296
285
297
	/**
286
	/**
Lines 315-321 Link Here
315
	 */
304
	 */
316
	protected void setEventId(String eventId) {
305
	protected void setEventId(String eventId) {
317
		this.eventId = eventId;
306
		this.eventId = eventId;
318
		configureLink.setVisible(eventId != null);
307
		if (configureLink != null) {
308
			configureLink.setVisible(eventId != null);
309
		}
319
	}
310
	}
320
311
321
	/**
312
	/**
(-)META-INF/MANIFEST.MF (+5 lines)
Lines 19-22 Link Here
19
 org.eclipse.mylyn.tasks.core,
19
 org.eclipse.mylyn.tasks.core,
20
 org.eclipse.mylyn.tasks.core.data,
20
 org.eclipse.mylyn.tasks.core.data,
21
 org.eclipse.mylyn.tasks.core.sync
21
 org.eclipse.mylyn.tasks.core.sync
22
Import-Package: com.sun.syndication.feed;version="0.9.0";resolution:=optional,
23
 com.sun.syndication.feed.module;version="0.9.0";resolution:=optional,
24
 com.sun.syndication.feed.synd;version="0.9.0";resolution:=optional,
25
 com.sun.syndication.io;version="0.9.0";resolution:=optional,
26
 org.jdom;version="1.0.0";resolution:=optional
22
Bundle-Localization: plugin
27
Bundle-Localization: plugin
(-)src/org/eclipse/mylyn/internal/tasks/core/notifications/Environment.java (+171 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2011 Tasktop Technologies and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     Tasktop Technologies - initial API and implementation
10
 *******************************************************************************/
11
12
package org.eclipse.mylyn.internal.tasks.core.notifications;
13
14
import java.util.Collections;
15
import java.util.Dictionary;
16
import java.util.Hashtable;
17
import java.util.List;
18
import java.util.Set;
19
20
import org.eclipse.core.runtime.IProgressMonitor;
21
import org.eclipse.core.runtime.Platform;
22
import org.eclipse.osgi.service.resolver.VersionRange;
23
import org.osgi.framework.Bundle;
24
import org.osgi.framework.Filter;
25
import org.osgi.framework.FrameworkUtil;
26
import org.osgi.framework.InvalidSyntaxException;
27
import org.osgi.framework.Version;
28
29
/**
30
 * @author Steffen Pingel
31
 */
32
public class Environment {
33
34
	private final Dictionary<Object, Object> environment;
35
36
	public Environment() {
37
		environment = new Hashtable<Object, Object>(System.getProperties());
38
	}
39
40
	public Version getFrameworkVersion() {
41
		Bundle bundle = Platform.getBundle("org.eclipse.mylyn"); //$NON-NLS-1$
42
		if (bundle != null) {
43
			return bundle.getVersion();
44
		} else {
45
			return Version.emptyVersion;
46
		}
47
	}
48
49
	public Version getPlatformVersion() {
50
		Bundle bundle = Platform.getBundle("org.eclipse.platform"); //$NON-NLS-1$
51
		if (bundle == null) {
52
			bundle = Platform.getBundle(Platform.PI_RUNTIME);
53
		}
54
		if (bundle != null) {
55
			String versionString = bundle.getHeaders().get(org.osgi.framework.Constants.BUNDLE_VERSION);
56
			try {
57
				return new Version(versionString);
58
			} catch (IllegalArgumentException e) {
59
				// should never happen
60
			}
61
		}
62
		return Version.emptyVersion;
63
	}
64
65
	public Version getRuntimeVersion() {
66
		Version result = parseRuntimeVersion(System.getProperty("java.runtime.version")); //$NON-NLS-1$
67
		if (result == Version.emptyVersion) {
68
			result = parseRuntimeVersion(System.getProperty("java.version")); //$NON-NLS-1$
69
		}
70
		return result;
71
	}
72
73
	@SuppressWarnings({ "unchecked", "rawtypes" })
74
	public boolean matches(FeedEntry entry, IProgressMonitor monitor) {
75
		if (!matchesVersion(entry.getFilter("frameworkVersion"), getFrameworkVersion())) { //$NON-NLS-1$
76
			return false;
77
		}
78
		if (!matchesVersion(entry.getFilter("platformVersion"), getPlatformVersion())) { //$NON-NLS-1$
79
			return false;
80
		}
81
		if (!matchesVersion(entry.getFilter("runtimeVersion"), getRuntimeVersion())) { //$NON-NLS-1$
82
			return false;
83
		}
84
		List<String> filterExpressions = entry.getFilters("filter"); //$NON-NLS-1$
85
		for (String filterExpression : filterExpressions) {
86
			try {
87
				Filter filter = FrameworkUtil.createFilter(filterExpression);
88
				if (!filter.match((Dictionary) environment)) {
89
					return false;
90
				}
91
			} catch (InvalidSyntaxException e) {
92
				// ignore that filter
93
			}
94
		}
95
		List<String> requiredFeatures = entry.getFilters("requires"); //$NON-NLS-1$
96
		for (String requiredFeature : requiredFeatures) {
97
			if (!getInstalledFeatures(monitor).contains(parseFeature(requiredFeature))) {
98
				return false;
99
			}
100
		}
101
		List<String> conflictedFeatures = entry.getFilters("conflicts"); //$NON-NLS-1$
102
		for (String conflictedFeature : conflictedFeatures) {
103
			if (getInstalledFeatures(monitor).contains(parseFeature(conflictedFeature))) {
104
				return false;
105
			}
106
		}
107
		return true;
108
	}
109
110
	private int findLastNumberIndex(String versionString, int secondSeparator) {
111
		int lastDigit = secondSeparator;
112
		for (int i = secondSeparator + 1; i < versionString.length(); i++) {
113
			if (Character.isDigit(versionString.charAt(i))) {
114
				lastDigit++;
115
			} else {
116
				break;
117
			}
118
		}
119
		if (lastDigit == secondSeparator) {
120
			return secondSeparator - 1;
121
		}
122
		return lastDigit;
123
	}
124
125
	public Set<String> getInstalledFeatures(IProgressMonitor monitor) {
126
		return Collections.emptySet();
127
	}
128
129
	private boolean matchesVersion(String expectedVersionRangeExpression, Version actualVersion) {
130
		if (expectedVersionRangeExpression != null) {
131
			try {
132
				VersionRange versionRange = new VersionRange(expectedVersionRangeExpression);
133
				if (!versionRange.isIncluded(actualVersion)) {
134
					return false;
135
				}
136
			} catch (IllegalArgumentException e) {
137
				// ignore
138
			}
139
		}
140
		return true;
141
	}
142
143
	private String parseFeature(String requiredFeature) {
144
		int i = requiredFeature.indexOf(";"); //$NON-NLS-1$
145
		if (i != -1) {
146
			return requiredFeature.substring(0, i);
147
		}
148
		return requiredFeature;
149
	}
150
151
	private Version parseRuntimeVersion(String versionString) {
152
		if (versionString != null) {
153
			int firstSeparator = versionString.indexOf('.');
154
			if (firstSeparator != -1) {
155
				try {
156
					int secondSeparator = versionString.indexOf('.', firstSeparator + 1);
157
					if (secondSeparator != -1) {
158
						return new Version(versionString.substring(0,
159
								findLastNumberIndex(versionString, secondSeparator) + 1));
160
					}
161
					return new Version(versionString.substring(0,
162
							findLastNumberIndex(versionString, firstSeparator) + 1));
163
				} catch (IllegalArgumentException e) {
164
					// ignore
165
				}
166
			}
167
		}
168
		return Version.emptyVersion;
169
	}
170
171
}
(-)src/org/eclipse/mylyn/internal/tasks/core/notifications/FeedEntry.java (+107 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2011 Tasktop Technologies and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     Tasktop Technologies - initial API and implementation
10
 *******************************************************************************/
11
12
package org.eclipse.mylyn.internal.tasks.core.notifications;
13
14
import java.util.ArrayList;
15
import java.util.Iterator;
16
import java.util.List;
17
18
import org.eclipse.core.runtime.Assert;
19
20
import com.sun.syndication.feed.module.DCModule;
21
import com.sun.syndication.feed.module.DCSubject;
22
import com.sun.syndication.feed.synd.SyndEntry;
23
24
/**
25
 * @author Steffen Pingel
26
 */
27
public class FeedEntry extends ServiceMessage {
28
29
	private final SyndEntry source;
30
31
	public FeedEntry(SyndEntry source) {
32
		this.source = source;
33
		setId(source.getUri());
34
		setTitle(source.getTitle());
35
		if (source.getDescription() != null) {
36
			setDescription(source.getDescription().getValue());
37
		}
38
		setUrl(source.getLink());
39
		setImage("dialog_messasge_info_image"); //$NON-NLS-1$
40
	}
41
42
	public FeedEntry() {
43
		this.source = null;
44
	}
45
46
	public SyndEntry getSource() {
47
		return source;
48
	}
49
50
	public List<String> getFilters(String key) {
51
		Assert.isNotNull(key);
52
		List<String> result = new ArrayList<String>();
53
		DCModule module = (DCModule) source.getModule(DCModule.URI);
54
		if (module != null && module.getSubjects() != null) {
55
			for (Iterator<?> it = module.getSubjects().iterator(); it.hasNext();) {
56
				DCSubject category = (DCSubject) it.next();
57
				String value = parseFilter(key, category.getValue());
58
				if (value != null) {
59
					result.add(value);
60
				}
61
			}
62
		}
63
//		for (Iterator<?> it = source.getCategories().iterator(); it.hasNext();) {
64
//			SyndCategory category = (SyndCategory) it.next();
65
//			String value = parseFilter(key, category.getName());
66
//			if (value != null) {
67
//				result.add(value);
68
//			}
69
//		}
70
		return result;
71
	}
72
73
	public String getFilter(String key) {
74
		Assert.isNotNull(key);
75
		DCModule module = (DCModule) source.getModule(DCModule.URI);
76
		if (module != null && module.getSubjects() != null) {
77
			for (Iterator<?> it = module.getSubjects().iterator(); it.hasNext();) {
78
				DCSubject category = (DCSubject) it.next();
79
				String value = parseFilter(key, category.getValue());
80
				if (value != null) {
81
					return value;
82
				}
83
			}
84
		}
85
//		for (Iterator<?> it = source.getCategories().iterator(); it.hasNext();) {
86
//			SyndCategory category = (SyndCategory) it.next();
87
//			String value = parseCategory(key, category.getName());
88
//			if (value != null) {
89
//				return value;
90
//			}
91
//		}
92
		return null;
93
	}
94
95
	private String parseFilter(String key, String category) {
96
		if (category != null) {
97
			int i = category.indexOf("="); //$NON-NLS-1$
98
			if (i != -1) {
99
				if (category.substring(0, i).trim().equals(key)) {
100
					return category.substring(i + 1).trim();
101
				}
102
			}
103
		}
104
		return null;
105
	}
106
107
}
(-)src/org/eclipse/mylyn/internal/tasks/core/notifications/FeedReader.java (+65 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2011 Tasktop Technologies and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     Tasktop Technologies - initial API and implementation
10
 *******************************************************************************/
11
12
package org.eclipse.mylyn.internal.tasks.core.notifications;
13
14
import java.io.InputStream;
15
import java.util.ArrayList;
16
import java.util.Iterator;
17
import java.util.List;
18
19
import org.eclipse.core.runtime.IProgressMonitor;
20
import org.eclipse.core.runtime.IStatus;
21
import org.eclipse.core.runtime.Status;
22
import org.eclipse.mylyn.internal.tasks.core.ITasksCoreConstants;
23
24
import com.sun.syndication.feed.synd.SyndEntry;
25
import com.sun.syndication.feed.synd.SyndFeed;
26
import com.sun.syndication.io.SyndFeedInput;
27
import com.sun.syndication.io.XmlReader;
28
29
/**
30
 * @author Steffen Pingel
31
 */
32
public class FeedReader {
33
34
	private final Environment environment;
35
36
	private final List<FeedEntry> entries;
37
38
	public FeedReader(Environment environment) {
39
		this.environment = environment;
40
		this.entries = new ArrayList<FeedEntry>();
41
	}
42
43
	public IStatus parse(InputStream in, IProgressMonitor monitor) {
44
		SyndFeedInput input = new SyndFeedInput();
45
		try {
46
			SyndFeed feed = input.build(new XmlReader(in));
47
			for (Iterator<?> it = feed.getEntries().iterator(); it.hasNext();) {
48
				SyndEntry syndEntry = (SyndEntry) it.next();
49
				FeedEntry entry = new FeedEntry(syndEntry);
50
				if (environment.matches(entry, monitor)) {
51
					entries.add(entry);
52
				}
53
			}
54
			return Status.OK_STATUS;
55
		} catch (Exception e) {
56
			return new Status(IStatus.ERROR, ITasksCoreConstants.ID_PLUGIN, IStatus.ERROR,
57
					"Failed to parse RSS feed", e); //$NON-NLS-1$ 
58
		}
59
	}
60
61
	public List<FeedEntry> getEntries() {
62
		return entries;
63
	}
64
65
}
(-)src/org/eclipse/mylyn/internal/tasks/core/notifications/ServiceMessage.java (-12 / +27 lines)
Lines 14-23 Link Here
14
/**
14
/**
15
 * @author Robert Elves
15
 * @author Robert Elves
16
 */
16
 */
17
public class ServiceMessage {
17
public class ServiceMessage implements Comparable<ServiceMessage> {
18
18
19
	public enum Element {
19
	public enum Element {
20
		ID, TITLE, DESCRIPTION, URL, IMAGE, VERSION
20
		ID, TITLE, DESCRIPTION, URL, IMAGE
21
	};
21
	};
22
22
23
	private String id;
23
	private String id;
Lines 30-37 Link Here
30
30
31
	private String image;
31
	private String image;
32
32
33
	private String version;
34
35
	private String eTag;
33
	private String eTag;
36
34
37
	private String lastModified;
35
	private String lastModified;
Lines 72-81 Link Here
72
		return lastModified;
70
		return lastModified;
73
	}
71
	}
74
72
75
	public String getVersion() {
76
		return version;
77
	}
78
79
	public void setId(String id) {
73
	public void setId(String id) {
80
		this.id = id;
74
		this.id = id;
81
	}
75
	}
Lines 96-107 Link Here
96
		this.image = image;
90
		this.image = image;
97
	}
91
	}
98
92
99
	public void setVersion(String version) {
100
		this.version = version;
101
	}
102
103
	public boolean isValid() {
93
	public boolean isValid() {
104
		return id != null && title != null && description != null && image != null;
94
		return id != null && title != null && description != null && image != null;
105
	}
95
	}
106
96
97
	public int compareTo(ServiceMessage o) {
98
		return -getId().compareTo(o.getId());
99
	}
100
101
	@Override
102
	public String toString() {
103
		StringBuilder builder = new StringBuilder();
104
		builder.append("ServiceMessage [id="); //$NON-NLS-1$
105
		builder.append(id);
106
		builder.append(", title="); //$NON-NLS-1$
107
		builder.append(title);
108
		builder.append(", description="); //$NON-NLS-1$
109
		builder.append(description);
110
		builder.append(", url="); //$NON-NLS-1$
111
		builder.append(url);
112
		builder.append(", image="); //$NON-NLS-1$
113
		builder.append(image);
114
		builder.append(", eTag="); //$NON-NLS-1$
115
		builder.append(eTag);
116
		builder.append(", lastModified="); //$NON-NLS-1$
117
		builder.append(lastModified);
118
		builder.append("]"); //$NON-NLS-1$
119
		return builder.toString();
120
	}
121
107
}
122
}
(-)src/org/eclipse/mylyn/internal/tasks/core/notifications/ServiceMessageManager.java (-33 / +55 lines)
Lines 8-23 Link Here
8
8
9
package org.eclipse.mylyn.internal.tasks.core.notifications;
9
package org.eclipse.mylyn.internal.tasks.core.notifications;
10
10
11
import java.io.IOException;
11
import java.io.InputStream;
12
import java.io.InputStream;
12
import java.util.ArrayList;
13
import java.util.ArrayList;
13
import java.util.Collections;
14
import java.util.Collections;
14
import java.util.Date;
15
import java.util.List;
15
import java.util.List;
16
import java.util.concurrent.CopyOnWriteArrayList;
16
import java.util.concurrent.CopyOnWriteArrayList;
17
17
18
import javax.xml.parsers.SAXParser;
19
import javax.xml.parsers.SAXParserFactory;
20
21
import org.apache.commons.httpclient.Header;
18
import org.apache.commons.httpclient.Header;
22
import org.apache.commons.httpclient.HostConfiguration;
19
import org.apache.commons.httpclient.HostConfiguration;
23
import org.apache.commons.httpclient.HttpClient;
20
import org.apache.commons.httpclient.HttpClient;
Lines 45-55 Link Here
45
42
46
	protected static final long START_DELAY = 30 * 1000;
43
	protected static final long START_DELAY = 30 * 1000;
47
44
48
	protected static final long RECHECK_DELAY = 24 * 60 * 60 * 1000;
45
	protected static final long RECHECK_DELAY = 14 * 24 * 60 * 60 * 1000;
49
46
50
	private String serviceMessageUrl;
47
	private String serviceMessageUrl;
51
48
52
	private volatile List<ServiceMessage> messages = Collections.emptyList();
49
	private volatile List<? extends ServiceMessage> messages = Collections.emptyList();
53
50
54
	private Job messageCheckJob;
51
	private Job messageCheckJob;
55
52
Lines 63-73 Link Here
63
60
64
	private final long checktime;
61
	private final long checktime;
65
62
66
	public ServiceMessageManager(String serviceMessageUrl, String lastModified, String eTag, long checktime) {
63
	private final Environment environment;
64
65
	public ServiceMessageManager(String serviceMessageUrl, String lastModified, String eTag, long checktime,
66
			Environment environment) {
67
		this.serviceMessageUrl = serviceMessageUrl;
67
		this.serviceMessageUrl = serviceMessageUrl;
68
		this.lastModified = lastModified;
68
		this.lastModified = lastModified;
69
		this.checktime = checktime;
69
		this.checktime = checktime;
70
		this.eTag = eTag;
70
		this.eTag = eTag;
71
		this.environment = environment;
72
	}
73
74
	public ServiceMessageManager(String serviceMessageUrl, String lastModified, String eTag, long checktime) {
75
		this(serviceMessageUrl, lastModified, eTag, checktime, new Environment());
71
	}
76
	}
72
77
73
	public void start() {
78
	public void start() {
Lines 75-82 Link Here
75
			messageCheckJob = new Job("Checking for new service message") { //$NON-NLS-1$
80
			messageCheckJob = new Job("Checking for new service message") { //$NON-NLS-1$
76
				@Override
81
				@Override
77
				protected IStatus run(IProgressMonitor monitor) {
82
				protected IStatus run(IProgressMonitor monitor) {
78
					updateServiceMessage(monitor);
83
					try {
79
					return Status.OK_STATUS;
84
						updateServiceMessage(monitor);
85
						return Status.OK_STATUS;
86
					} catch (Throwable t) {
87
						// fail silently
88
						return Status.CANCEL_STATUS;
89
					}
80
				}
90
				}
81
91
82
			};
92
			};
Lines 95-112 Link Here
95
			messageCheckJob.schedule(START_DELAY);
105
			messageCheckJob.schedule(START_DELAY);
96
		} else {
106
		} else {
97
			long nextCheckTime = checktime + RECHECK_DELAY;
107
			long nextCheckTime = checktime + RECHECK_DELAY;
98
			long now = new Date().getTime();
108
			long now = System.currentTimeMillis();
99
			if (nextCheckTime < now) {
109
			if (nextCheckTime < now) {
100
				messageCheckJob.schedule(START_DELAY);
110
				messageCheckJob.schedule(START_DELAY);
101
			} else if (nextCheckTime > now) {
111
			} else if (nextCheckTime > now) {
102
				if ((nextCheckTime - now) < START_DELAY) {
112
				if (nextCheckTime - now < START_DELAY) {
103
					messageCheckJob.schedule(START_DELAY);
113
					messageCheckJob.schedule(START_DELAY);
104
				} else {
114
				} else {
105
					messageCheckJob.schedule(nextCheckTime - now);
115
					messageCheckJob.schedule(nextCheckTime - now);
106
				}
116
				}
107
			}
117
			}
108
		}
118
		}
109
110
	}
119
	}
111
120
112
	public void stop() {
121
	public void stop() {
Lines 143-158 Link Here
143
		listeners.remove(listener);
152
		listeners.remove(listener);
144
	}
153
	}
145
154
146
	private void notifyListeners(List<ServiceMessage> messages) {
155
	private void notifyListeners(List<? extends ServiceMessage> messages) {
147
		this.messages = messages;
156
		this.messages = messages;
148
		for (final ServiceMessage message : messages) {
157
		for (final ServiceMessage message : messages) {
149
			message.setETag(eTag);
158
			message.setETag(eTag);
150
			message.setLastModified(lastModified);
159
			message.setLastModified(lastModified);
151
		}
160
		}
152
161
162
		ArrayList<ServiceMessage> sortedMessages = new ArrayList<ServiceMessage>(messages);
163
		Collections.sort(messages);
153
		final ServiceMessageEvent event = new ServiceMessageEvent(this, ServiceMessageEvent.EVENT_KIND.MESSAGE_UPDATE,
164
		final ServiceMessageEvent event = new ServiceMessageEvent(this, ServiceMessageEvent.EVENT_KIND.MESSAGE_UPDATE,
154
				messages);
165
				sortedMessages);
155
156
		for (final IServiceMessageListener listener : listeners) {
166
		for (final IServiceMessageListener listener : listeners) {
157
			SafeRunner.run(new ISafeRunnable() {
167
			SafeRunner.run(new ISafeRunnable() {
158
				public void run() throws Exception {
168
				public void run() throws Exception {
Lines 176-182 Link Here
176
	 */
186
	 */
177
	public int updateServiceMessage(IProgressMonitor monitor) {
187
	public int updateServiceMessage(IProgressMonitor monitor) {
178
		int status = -1;
188
		int status = -1;
179
		List<ServiceMessage> messages = null;
189
		List<? extends ServiceMessage> messages = null;
180
		try {
190
		try {
181
			HttpClient httpClient = new HttpClient(WebUtil.getConnectionManager());
191
			HttpClient httpClient = new HttpClient(WebUtil.getConnectionManager());
182
			WebUtil.configureHttpClient(httpClient, null);
192
			WebUtil.configureHttpClient(httpClient, null);
Lines 203-215 Link Here
203
213
204
					InputStream in = WebUtil.getResponseBodyAsStream(method, monitor);
214
					InputStream in = WebUtil.getResponseBodyAsStream(method, monitor);
205
					try {
215
					try {
206
						SAXParserFactory factory = SAXParserFactory.newInstance();
216
						messages = readMessages(in, monitor);
207
						factory.setValidating(false);
208
						SAXParser parser = factory.newSAXParser();
209
210
						ServiceMessageXmlHandler handler = new ServiceMessageXmlHandler();
211
						parser.parse(in, handler);
212
						messages = handler.getMessages();
213
					} finally {
217
					} finally {
214
						in.close();
218
						in.close();
215
					}
219
					}
Lines 218-238 Link Here
218
				} else if (status == HttpStatus.SC_NOT_MODIFIED) {
222
				} else if (status == HttpStatus.SC_NOT_MODIFIED) {
219
					// no new messages
223
					// no new messages
220
				} else {
224
				} else {
221
					if (!statusLogged) {
225
					logStatus(new Status(IStatus.WARNING, ITasksCoreConstants.ID_PLUGIN,
222
						statusLogged = true;
226
							"Http error retrieving service message: " + HttpStatus.getStatusText(status))); //$NON-NLS-1$
223
						StatusHandler.log(new Status(IStatus.WARNING, ITasksCoreConstants.ID_PLUGIN,
224
								"Http error retrieving service message: " + HttpStatus.getStatusText(status))); //$NON-NLS-1$
225
					}
226
				}
227
				}
227
			} finally {
228
			} finally {
228
				WebUtil.releaseConnection(method, monitor);
229
				WebUtil.releaseConnection(method, monitor);
229
			}
230
			}
230
		} catch (Exception e) {
231
		} catch (Exception e) {
231
			if (!statusLogged) {
232
			logStatus(new Status(IStatus.WARNING, ITasksCoreConstants.ID_PLUGIN,
232
				statusLogged = true;
233
					"Http error retrieving service message.", e)); //$NON-NLS-1$
233
				StatusHandler.log(new Status(IStatus.WARNING, ITasksCoreConstants.ID_PLUGIN,
234
						"Http error retrieving service message.", e)); //$NON-NLS-1$
235
			}
236
		}
234
		}
237
235
238
		if (messages != null && messages.size() > 0) {
236
		if (messages != null && messages.size() > 0) {
Lines 241-244 Link Here
241
		return status;
239
		return status;
242
	}
240
	}
243
241
242
	private void logStatus(IStatus status) {
243
		if (!statusLogged) {
244
			statusLogged = true;
245
			//StatusHandler.log(status);
246
		}
247
	}
248
249
//	private List<ServiceMessage> readMessages(InputStream in) throws ParserConfigurationException, SAXException,
250
//			IOException {
251
//		SAXParserFactory factory = SAXParserFactory.newInstance();
252
//		factory.setValidating(false);
253
//		SAXParser parser = factory.newSAXParser();
254
//
255
//		ServiceMessageXmlHandler handler = new ServiceMessageXmlHandler();
256
//		parser.parse(in, handler);
257
//		return handler.getMessages();
258
//	}
259
260
	private List<? extends ServiceMessage> readMessages(InputStream in, IProgressMonitor monitor) throws IOException {
261
		FeedReader reader = new FeedReader(environment);
262
		reader.parse(in, monitor);
263
		return reader.getEntries();
264
	}
265
244
}
266
}
(-)src/org/eclipse/mylyn/internal/tasks/core/notifications/ServiceMessageXmlHandler.java (-3 lines)
Lines 75-83 Link Here
75
				case IMAGE:
75
				case IMAGE:
76
					message.setImage(parsedText);
76
					message.setImage(parsedText);
77
					break;
77
					break;
78
				case VERSION:
79
					message.setVersion(parsedText);
80
					break;
81
				}
78
				}
82
			} catch (IllegalArgumentException e) {
79
			} catch (IllegalArgumentException e) {
83
				// ignore unrecognized elements
80
				// ignore unrecognized elements
(-)META-INF/MANIFEST.MF (+2 lines)
Lines 33-42 Link Here
33
 org.eclipse.equinox.security,
33
 org.eclipse.equinox.security,
34
 org.eclipse.mylyn.tests.util,
34
 org.eclipse.mylyn.tests.util,
35
 org.eclipse.mylyn.tasks.search
35
 org.eclipse.mylyn.tasks.search
36
Import-Package: com.sun.syndication.feed.synd;version="0.9.0";resolution:=optional
36
Export-Package: org.eclipse.mylyn.tasks.tests;x-internal:=true,
37
Export-Package: org.eclipse.mylyn.tasks.tests;x-internal:=true,
37
 org.eclipse.mylyn.tasks.tests.connector;x-internal:=true,
38
 org.eclipse.mylyn.tasks.tests.connector;x-internal:=true,
38
 org.eclipse.mylyn.tasks.tests.core;x-internal:=true,
39
 org.eclipse.mylyn.tasks.tests.core;x-internal:=true,
39
 org.eclipse.mylyn.tasks.tests.data;x-internal:=true,
40
 org.eclipse.mylyn.tasks.tests.data;x-internal:=true,
41
 org.eclipse.mylyn.tasks.tests.support;x-internal:=true,
40
 org.eclipse.mylyn.tasks.tests.ui;x-internal:=true,
42
 org.eclipse.mylyn.tasks.tests.ui;x-internal:=true,
41
 org.eclipse.mylyn.tasks.tests.ui.editor;x-internal:=true,
43
 org.eclipse.mylyn.tasks.tests.ui.editor;x-internal:=true,
42
 org.eclipse.mylyn.tasks.tests.util;x-internal:=true
44
 org.eclipse.mylyn.tasks.tests.util;x-internal:=true
(-)src/org/eclipse/mylyn/tasks/tests/core/EnvironmentTest.java (+142 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2011 Tasktop Technologies.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     Tasktop Technologies - initial API and implementation
10
 *******************************************************************************/
11
12
package org.eclipse.mylyn.tasks.tests.core;
13
14
import java.util.Collections;
15
import java.util.HashMap;
16
import java.util.HashSet;
17
import java.util.List;
18
import java.util.Map;
19
import java.util.Set;
20
21
import junit.framework.TestCase;
22
23
import org.eclipse.core.runtime.IProgressMonitor;
24
import org.eclipse.core.runtime.Platform;
25
import org.eclipse.mylyn.internal.tasks.core.notifications.Environment;
26
import org.eclipse.mylyn.internal.tasks.core.notifications.FeedEntry;
27
import org.eclipse.osgi.service.resolver.VersionRange;
28
import org.osgi.framework.Version;
29
30
/**
31
 * @author Steffen Pingel
32
 */
33
public class EnvironmentTest extends TestCase {
34
35
	private class StubEntry extends FeedEntry {
36
37
		private final Map<String, String> map;
38
39
		public StubEntry(Map<String, String> map) {
40
			this.map = map;
41
		}
42
43
		@Override
44
		public List<String> getFilters(String key) {
45
			String value = getFilter(key);
46
			if (value != null) {
47
				return Collections.singletonList(value);
48
			}
49
			return Collections.emptyList();
50
		}
51
52
		@Override
53
		public String getFilter(String key) {
54
			return map.get(key);
55
		}
56
57
	}
58
59
	private Environment environment;
60
61
	Set<String> installedFeatures;
62
63
	@Override
64
	protected void setUp() throws Exception {
65
		installedFeatures = new HashSet<String>();
66
		environment = new Environment() {
67
			@Override
68
			public Set<String> getInstalledFeatures(IProgressMonitor monitor) {
69
				return installedFeatures;
70
			}
71
		};
72
	}
73
74
	public void testGetRuntimeVersion() {
75
		Version runtimeVersion = environment.getRuntimeVersion();
76
		assertTrue("Expected value between 1.5-1.8, got " + runtimeVersion,
77
				new VersionRange("[1.5.0,1.8.0)").isIncluded(runtimeVersion));
78
	}
79
80
	public void testGetPlatformVersion() {
81
		Version platformVersion = environment.getPlatformVersion();
82
		if (Platform.isRunning()) {
83
			assertTrue("Expected value between 3.4-5.0, got " + platformVersion,
84
					new VersionRange("[3.4.0,5.0.0)").isIncluded(platformVersion));
85
		} else {
86
			assertEquals(Version.emptyVersion, platformVersion);
87
		}
88
	}
89
90
	public void testGetFrameworkVersion() {
91
		Version frameworkVersion = environment.getFrameworkVersion();
92
		if (Platform.isRunning()) {
93
			assertTrue("Expected value > 3.6, got " + frameworkVersion,
94
					new VersionRange("3.6.0").isIncluded(frameworkVersion));
95
		} else {
96
			assertEquals(Version.emptyVersion, frameworkVersion);
97
		}
98
	}
99
100
	public void testMatchesFrameworkVersion() {
101
		Map<String, String> values = new HashMap<String, String>();
102
		assertTrue(environment.matches(new StubEntry(values), null));
103
104
		values.put("frameworkVersion", "[1.0.0,2.0.0)");
105
		assertFalse(environment.matches(new StubEntry(values), null));
106
107
		values.put("frameworkVersion", "[0.0.0,10.0.0)");
108
		assertTrue(environment.matches(new StubEntry(values), null));
109
	}
110
111
	public void testMatchesRequires() {
112
		Map<String, String> values = new HashMap<String, String>();
113
		values.put("requires", "org.eclipse.mylyn");
114
		assertFalse(environment.matches(new StubEntry(values), null));
115
116
		installedFeatures.add("org.eclipse.mylyn");
117
		assertTrue(environment.matches(new StubEntry(values), null));
118
	}
119
120
	public void testMatchesConflicts() {
121
		Map<String, String> values = new HashMap<String, String>();
122
		values.put("conflicts", "org.eclipse.mylyn");
123
		assertTrue(environment.matches(new StubEntry(values), null));
124
125
		installedFeatures.add("org.eclipse.mylyn");
126
		assertFalse(environment.matches(new StubEntry(values), null));
127
	}
128
129
	public void testMatchesRequiresConflicts() {
130
		Map<String, String> values = new HashMap<String, String>();
131
		values.put("requires", "org.eclipse.mylyn");
132
		values.put("conflicts", "org.eclipse.cdt");
133
		assertFalse(environment.matches(new StubEntry(values), null));
134
135
		installedFeatures.add("org.eclipse.mylyn");
136
		assertTrue(environment.matches(new StubEntry(values), null));
137
138
		installedFeatures.add("org.eclipse.cdt");
139
		assertFalse(environment.matches(new StubEntry(values), null));
140
	}
141
142
}
(-)src/org/eclipse/mylyn/tasks/tests/core/FeedReaderTest.java (+66 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2011 Tasktop Technologies.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     Tasktop Technologies - initial API and implementation
10
 *******************************************************************************/
11
12
package org.eclipse.mylyn.tasks.tests.core;
13
14
import java.util.Collections;
15
import java.util.Set;
16
17
import junit.framework.TestCase;
18
19
import org.eclipse.core.runtime.IProgressMonitor;
20
import org.eclipse.core.runtime.Status;
21
import org.eclipse.mylyn.commons.tests.support.CommonTestUtil;
22
import org.eclipse.mylyn.internal.tasks.core.notifications.Environment;
23
import org.eclipse.mylyn.internal.tasks.core.notifications.FeedEntry;
24
import org.eclipse.mylyn.internal.tasks.core.notifications.FeedReader;
25
26
/**
27
 * @author Steffen Pingel
28
 */
29
public class FeedReaderTest extends TestCase {
30
31
	private FeedReader reader;
32
33
	private Environment environment;
34
35
	@Override
36
	protected void setUp() throws Exception {
37
		environment = new Environment() {
38
			@Override
39
			public Set<String> getInstalledFeatures(IProgressMonitor monitor) {
40
				return Collections.singleton("org.eclipse.mylyn");
41
			}
42
		};
43
		reader = new FeedReader(environment);
44
	}
45
46
	public void testParse() throws Exception {
47
		assertEquals(Status.OK_STATUS, reader.parse(
48
				CommonTestUtil.getResource(FeedReaderTest.class, "testdata/FeedReaderTest/update1.xml"), null));
49
		assertEquals(2, reader.getEntries().size());
50
		Collections.sort(reader.getEntries());
51
52
		FeedEntry entry = reader.getEntries().get(0);
53
		assertEquals("New Connectors", entry.getTitle());
54
		assertEquals("[0.0.0,3.7.0)", entry.getFilter("frameworkVersion"));
55
		assertEquals("New connectors are now available. <a href=\"#discovery\">Show connectors</a>.",
56
				entry.getDescription());
57
58
		entry = reader.getEntries().get(1);
59
		assertEquals("Mylyn 3.6 is now available", entry.getTitle());
60
		assertEquals("1.5.0", entry.getFilter("runtimeVersion"));
61
		assertEquals(
62
				"Mylyn 3.7 is now available. <a href=\"http://eclipse.org/mylyn/new/\">See New and Noteworthy</a> for details.",
63
				entry.getDescription());
64
	}
65
66
}
(-)src/org/eclipse/mylyn/tasks/tests/ui/TaskListServiceMessageControlTest.java (+31 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2011 Tasktop Technologies.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     Tasktop Technologies - initial API and implementation
10
 *******************************************************************************/
11
12
package org.eclipse.mylyn.tasks.tests.ui;
13
14
import junit.framework.TestCase;
15
16
import org.eclipse.mylyn.internal.tasks.ui.notifications.TaskListServiceMessageControl;
17
18
/**
19
 * @author Steffen Pingel
20
 */
21
public class TaskListServiceMessageControlTest extends TestCase {
22
23
	public void testGetAction() {
24
		assertEquals("abc", TaskListServiceMessageControl.getAction("ABC"));
25
		assertEquals("abc", TaskListServiceMessageControl.getAction("abc"));
26
		assertEquals("def", TaskListServiceMessageControl.getAction("http://eclipse.org?action=DEF"));
27
		assertEquals("defg", TaskListServiceMessageControl.getAction("http://eclipse.org?action=defg&foo=bar"));
28
		assertEquals(null, TaskListServiceMessageControl.getAction("http://eclipse.org?foo=bar&action=defg"));
29
	}
30
31
}
(-)testdata/FeedReaderTest/update1.xml (+41 lines)
Added Link Here
1
<?xml version="1.0" encoding="UTF-8"?> 
2
<rss version="2.0"
3
	xmlns:dc="http://purl.org/dc/elements/1.1/"
4
	>
5
<channel>
6
<title>Mylyn Updates</title>
7
<link>http://eclipse.org/mylyn</link>
8
<description>Mylyn Updates</description>
9
<lastBuildDate>Fri, 27 May 2011 17:33:37 +0000</lastBuildDate>
10
<language>en</language>
11
<item>
12
<title>Mylyn 3.6 is now available</title>
13
<link>http://eclipse.org/mylyn/new/</link>
14
<pubDate>Thu, 24 Mar 2011 14:00:07 +0000</pubDate>
15
<dc:creator>Steffen Pingel</dc:creator>
16
<dc:subject>runtimeVersion=1.5.0</dc:subject>
17
<dc:subject>requires=org.eclipse.mylyn</dc:subject>
18
<category>Mylyn</category>
19
<guid isPermaLink="false">20110527-0000</guid>
20
<description>Mylyn 3.7 is now available. &lt;a href="http://eclipse.org/mylyn/new/"&gt;See New and Noteworthy&lt;/a&gt; for details.</description>
21
</item>
22
<item>
23
<title>New Connectors</title>
24
<link>http://eclipse.org/mylyn/new/</link>
25
<pubDate>Fri, 27 May 2011 12:00:00 +0000</pubDate>
26
<dc:creator>Steffen Pingel</dc:creator>
27
<dc:subject>frameworkVersion=[0.0.0,3.7.0)</dc:subject>
28
<guid isPermaLink="false">20110527-0001</guid>
29
<description>New connectors are now available. &lt;a href="#discovery"&gt;Show connectors&lt;/a&gt;.</description>
30
</item>
31
<item>
32
<title>Filtered Item</title>
33
<link>http://eclipse.org/mylyn/new/</link>
34
<pubDate>Fri, 27 May 2011 12:00:00 +0000</pubDate>
35
<dc:creator>Steffen Pingel</dc:creator>
36
<dc:subject>frameworkVersion=[1.0.0,2.0.0)</dc:subject>
37
<guid isPermaLink="false">20110527-0002</guid>
38
<description>Specifies an unsatisfiable framework version.</description>
39
</item>
40
</channel>
41
</rss>
(-)META-INF/MANIFEST.MF (-1 / +2 lines)
Lines 26-32 Link Here
26
 org.eclipse.mylyn.commons.net;bundle-version="[3.0.0,4.0.0)",
26
 org.eclipse.mylyn.commons.net;bundle-version="[3.0.0,4.0.0)",
27
 org.eclipse.mylyn.commons.ui;bundle-version="[3.0.0,4.0.0)",
27
 org.eclipse.mylyn.commons.ui;bundle-version="[3.0.0,4.0.0)",
28
 org.eclipse.mylyn.monitor.core;bundle-version="[3.0.0,4.0.0)",
28
 org.eclipse.mylyn.monitor.core;bundle-version="[3.0.0,4.0.0)",
29
 org.eclipse.mylyn.commons.repositories;bundle-version="0.1.0"
29
 org.eclipse.mylyn.commons.repositories;bundle-version="0.1.0",
30
 org.eclipse.mylyn.discovery.ui;bundle-version="3.6.0";resolution:=optional
30
Bundle-ActivationPolicy: lazy
31
Bundle-ActivationPolicy: lazy
31
Bundle-Vendor: %Bundle-Vendor
32
Bundle-Vendor: %Bundle-Vendor
32
Export-Package: org.eclipse.mylyn.internal.provisional.tasks.ui.wizards;x-internal:=true,
33
Export-Package: org.eclipse.mylyn.internal.provisional.tasks.ui.wizards;x-internal:=true,
(-)plugin.xml (-1 / +23 lines)
Lines 2105-2109 Link Here
2105
	      </toolbar>
2105
	      </toolbar>
2106
	    </menuContribution>
2106
	    </menuContribution>
2107
	</extension>
2107
	</extension>
2108
    
2108
   <extension
2109
         point="org.eclipse.ui.commands">
2110
      <command
2111
            description="%command.description"
2112
            id="org.eclipse.mylyn.tasks.ui.discoveryWizardCommand"
2113
            name="%command.name">
2114
      </command>
2115
   </extension>
2116
   <extension
2117
         point="org.eclipse.ui.handlers">
2118
      <handler
2119
            class="org.eclipse.mylyn.internal.tasks.ui.commands.ShowTasksConnectorDiscoveryWizardCommandHandler"
2120
            commandId="org.eclipse.mylyn.tasks.ui.discoveryWizardCommand">
2121
         <enabledWhen>
2122
         	<and>
2123
	     		<test
2124
	     			property="org.eclipse.core.runtime.isBundleInstalled" args="org.eclipse.mylyn.discovery.ui"/>
2125
	     		<test
2126
	     			property="org.eclipse.core.runtime.isBundleInstalled" args="org.eclipse.equinox.p2.repository"/>
2127
	     	</and>
2128
         </enabledWhen>
2129
      </handler>
2130
   </extension>    
2109
</plugin>
2131
</plugin>
(-)src/org/eclipse/mylyn/internal/tasks/ui/TasksUiPlugin.java (-6 / +19 lines)
Lines 58-63 Link Here
58
import org.eclipse.mylyn.internal.commons.identity.gravatar.GravatarConnector;
58
import org.eclipse.mylyn.internal.commons.identity.gravatar.GravatarConnector;
59
import org.eclipse.mylyn.internal.commons.ui.TaskBarManager;
59
import org.eclipse.mylyn.internal.commons.ui.TaskBarManager;
60
import org.eclipse.mylyn.internal.context.core.ContextCorePlugin;
60
import org.eclipse.mylyn.internal.context.core.ContextCorePlugin;
61
import org.eclipse.mylyn.internal.discovery.ui.DiscoveryUi;
61
import org.eclipse.mylyn.internal.monitor.ui.MonitorUiPlugin;
62
import org.eclipse.mylyn.internal.monitor.ui.MonitorUiPlugin;
62
import org.eclipse.mylyn.internal.provisional.commons.ui.AbstractNotification;
63
import org.eclipse.mylyn.internal.provisional.commons.ui.AbstractNotification;
63
import org.eclipse.mylyn.internal.provisional.commons.ui.CommonColors;
64
import org.eclipse.mylyn.internal.provisional.commons.ui.CommonColors;
Lines 83-88 Link Here
83
import org.eclipse.mylyn.internal.tasks.core.externalization.IExternalizationParticipant;
84
import org.eclipse.mylyn.internal.tasks.core.externalization.IExternalizationParticipant;
84
import org.eclipse.mylyn.internal.tasks.core.externalization.TaskListExternalizationParticipant;
85
import org.eclipse.mylyn.internal.tasks.core.externalization.TaskListExternalizationParticipant;
85
import org.eclipse.mylyn.internal.tasks.core.externalization.TaskListExternalizer;
86
import org.eclipse.mylyn.internal.tasks.core.externalization.TaskListExternalizer;
87
import org.eclipse.mylyn.internal.tasks.core.notifications.Environment;
86
import org.eclipse.mylyn.internal.tasks.core.notifications.ServiceMessageManager;
88
import org.eclipse.mylyn.internal.tasks.core.notifications.ServiceMessageManager;
87
import org.eclipse.mylyn.internal.tasks.ui.actions.ActivateTaskDialogAction;
89
import org.eclipse.mylyn.internal.tasks.ui.actions.ActivateTaskDialogAction;
88
import org.eclipse.mylyn.internal.tasks.ui.actions.NewTaskAction;
90
import org.eclipse.mylyn.internal.tasks.ui.actions.NewTaskAction;
Lines 666-677 Link Here
666
668
667
			Long checktime = getPreferenceStore().getLong(ITasksUiPreferenceConstants.LAST_SERVICE_MESSAGE_CHECKTIME);
669
			Long checktime = getPreferenceStore().getLong(ITasksUiPreferenceConstants.LAST_SERVICE_MESSAGE_CHECKTIME);
668
670
669
			serviceMessageManager = new ServiceMessageManager(serviceMessageUrl, lastMod, etag, checktime);
671
			serviceMessageManager = new ServiceMessageManager(serviceMessageUrl, lastMod, etag, checktime,
672
					new Environment() {
673
						private Set<String> installedFeatures;
674
675
						@Override
676
						public Set<String> getInstalledFeatures(IProgressMonitor monitor) {
677
							if (installedFeatures == null) {
678
								installedFeatures = DiscoveryUi.createInstallJob().getInstalledFeatures(monitor);
679
							}
680
							return installedFeatures;
681
						}
682
					});
670
683
671
			// Disabled for initial 3.4 release as per bug#263528
684
			// Disabled for initial 3.4 release as per bug#263528
672
//			if (getPreferenceStore().getBoolean(ITasksUiPreferenceConstants.SERVICE_MESSAGES_ENABLED)) {
685
			if (getPreferenceStore().getBoolean(ITasksUiPreferenceConstants.SERVICE_MESSAGES_ENABLED)) {
673
//				serviceMessageManager.start();
686
				serviceMessageManager.start();
674
//			}
687
			}
675
688
676
			// trigger lazy initialization
689
			// trigger lazy initialization
677
			new TasksUiInitializationJob().schedule();
690
			new TasksUiInitializationJob().schedule();
Lines 943-949 Link Here
943
		store.setDefault(ITasksUiPreferenceConstants.PREF_DATA_DIR, getDefaultDataDirectory());
956
		store.setDefault(ITasksUiPreferenceConstants.PREF_DATA_DIR, getDefaultDataDirectory());
944
		store.setDefault(ITasksUiPreferenceConstants.GROUP_SUBTASKS, true);
957
		store.setDefault(ITasksUiPreferenceConstants.GROUP_SUBTASKS, true);
945
		store.setDefault(ITasksUiPreferenceConstants.NOTIFICATIONS_ENABLED, true);
958
		store.setDefault(ITasksUiPreferenceConstants.NOTIFICATIONS_ENABLED, true);
946
		store.setDefault(ITasksUiPreferenceConstants.SERVICE_MESSAGES_ENABLED, true);
959
		store.setDefault(ITasksUiPreferenceConstants.SERVICE_MESSAGES_ENABLED, false);
947
		store.setDefault(ITasksUiPreferenceConstants.FILTER_PRIORITY, PriorityLevel.P5.toString());
960
		store.setDefault(ITasksUiPreferenceConstants.FILTER_PRIORITY, PriorityLevel.P5.toString());
948
		store.setDefault(ITasksUiPreferenceConstants.EDITOR_TASKS_RICH, true);
961
		store.setDefault(ITasksUiPreferenceConstants.EDITOR_TASKS_RICH, true);
949
		store.setDefault(ITasksUiPreferenceConstants.EDITOR_CURRENT_LINE_HIGHLIGHT, false);
962
		store.setDefault(ITasksUiPreferenceConstants.EDITOR_CURRENT_LINE_HIGHLIGHT, false);
Lines 972-978 Link Here
972
		store.setDefault(ITasksUiPreferenceConstants.AUTO_EXPAND_TASK_LIST, true);
985
		store.setDefault(ITasksUiPreferenceConstants.AUTO_EXPAND_TASK_LIST, true);
973
		store.setDefault(ITasksUiPreferenceConstants.TASK_LIST_TOOL_TIPS_ENABLED, true);
986
		store.setDefault(ITasksUiPreferenceConstants.TASK_LIST_TOOL_TIPS_ENABLED, true);
974
987
975
		store.setDefault(ITasksUiPreferenceConstants.SERVICE_MESSAGE_URL, "http://eclipse.org/mylyn/message.xml"); //$NON-NLS-1$
988
		store.setDefault(ITasksUiPreferenceConstants.SERVICE_MESSAGE_URL, "http://eclipse.org/mylyn/updates.xml"); //$NON-NLS-1$
976
	}
989
	}
977
990
978
	public static TaskActivityManager getTaskActivityManager() {
991
	public static TaskActivityManager getTaskActivityManager() {
(-)src/org/eclipse/mylyn/internal/tasks/ui/commands/ShowTasksConnectorDiscoveryWizardCommandHandler.java (+76 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2009 Tasktop Technologies.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 * 
8
 * Contributors:
9
 *     Tasktop Technologies - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.mylyn.internal.tasks.ui.commands;
12
13
import org.eclipse.core.commands.AbstractHandler;
14
import org.eclipse.core.commands.ExecutionEvent;
15
import org.eclipse.core.commands.ExecutionException;
16
import org.eclipse.jface.dialogs.MessageDialog;
17
import org.eclipse.jface.resource.JFaceResources;
18
import org.eclipse.jface.wizard.WizardDialog;
19
import org.eclipse.mylyn.internal.discovery.ui.wizards.ConnectorDiscoveryWizard;
20
import org.eclipse.mylyn.internal.provisional.commons.ui.WorkbenchUtil;
21
import org.eclipse.mylyn.internal.tasks.ui.ITasksUiPreferenceConstants;
22
import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
23
import org.eclipse.swt.SWT;
24
import org.eclipse.swt.events.SelectionAdapter;
25
import org.eclipse.swt.events.SelectionEvent;
26
import org.eclipse.swt.layout.GridLayout;
27
import org.eclipse.swt.widgets.Button;
28
import org.eclipse.swt.widgets.Composite;
29
30
/**
31
 * A command that causes the {@link ConnectorDiscoveryWizard} to appear in a dialog.
32
 * 
33
 * @author David Green
34
 * @author Steffen Pingel
35
 */
36
public class ShowTasksConnectorDiscoveryWizardCommandHandler extends AbstractHandler {
37
38
	private static final String ID_P2_INSTALL_UI = "org.eclipse.equinox.p2.ui.sdk/org.eclipse.equinox.p2.ui.sdk.install"; //$NON-NLS-1$
39
40
	public Object execute(ExecutionEvent event) throws ExecutionException {
41
42
		// check to make sure that the p2 install ui is enabled
43
		if (WorkbenchUtil.allowUseOf(ID_P2_INSTALL_UI)) {
44
			ConnectorDiscoveryWizard wizard = new ConnectorDiscoveryWizard();
45
			WizardDialog dialog = new WizardDialog(WorkbenchUtil.getShell(), wizard) {
46
				@Override
47
				protected void createButtonsForButtonBar(Composite parent) {
48
					super.createButtonsForButtonBar(parent);
49
					((GridLayout) parent.getLayout()).numColumns++;
50
					final Button button = new Button(parent, SWT.CHECK);
51
					button.setSelection(TasksUiPlugin.getDefault()
52
							.getPreferenceStore()
53
							.getBoolean(ITasksUiPreferenceConstants.SERVICE_MESSAGES_ENABLED));
54
					button.setText("Notify when new connectors are available");
55
					button.setFont(JFaceResources.getDialogFont());
56
					button.addSelectionListener(new SelectionAdapter() {
57
						@Override
58
						public void widgetSelected(SelectionEvent event) {
59
							TasksUiPlugin.getDefault()
60
									.getPreferenceStore()
61
									.setValue(ITasksUiPreferenceConstants.SERVICE_MESSAGES_ENABLED,
62
											button.getSelection());
63
						}
64
					});
65
					button.moveAbove(null);
66
				}
67
			};
68
			dialog.open();
69
		} else {
70
			MessageDialog.openWarning(WorkbenchUtil.getShell(), "Install Connectors",
71
					"Unable to launch connector install since the required platform support is not available.");
72
		}
73
74
		return null;
75
	}
76
}
(-)src/org/eclipse/mylyn/internal/tasks/ui/notifications/TaskListServiceMessageControl.java (-43 / +65 lines)
Lines 12-17 Link Here
12
12
13
package org.eclipse.mylyn.internal.tasks.ui.notifications;
13
package org.eclipse.mylyn.internal.tasks.ui.notifications;
14
14
15
import java.net.MalformedURLException;
16
import java.net.URL;
15
import java.util.Collections;
17
import java.util.Collections;
16
import java.util.Date;
18
import java.util.Date;
17
19
Lines 29-38 Link Here
29
import org.eclipse.mylyn.internal.tasks.ui.ITasksUiPreferenceConstants;
31
import org.eclipse.mylyn.internal.tasks.ui.ITasksUiPreferenceConstants;
30
import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
32
import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
31
import org.eclipse.mylyn.internal.tasks.ui.actions.AddRepositoryAction;
33
import org.eclipse.mylyn.internal.tasks.ui.actions.AddRepositoryAction;
34
import org.eclipse.mylyn.internal.tasks.ui.preferences.TasksUiPreferencePage;
32
import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal;
35
import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal;
33
import org.eclipse.mylyn.internal.tasks.ui.wizards.Messages;
36
import org.eclipse.mylyn.internal.tasks.ui.wizards.Messages;
34
import org.eclipse.mylyn.tasks.ui.TasksUiUtil;
37
import org.eclipse.mylyn.tasks.ui.TasksUiUtil;
35
import org.eclipse.osgi.service.resolver.VersionRange;
36
import org.eclipse.osgi.util.NLS;
38
import org.eclipse.osgi.util.NLS;
37
import org.eclipse.swt.events.SelectionAdapter;
39
import org.eclipse.swt.events.SelectionAdapter;
38
import org.eclipse.swt.events.SelectionEvent;
40
import org.eclipse.swt.events.SelectionEvent;
Lines 41-47 Link Here
41
import org.eclipse.swt.widgets.Display;
43
import org.eclipse.swt.widgets.Display;
42
import org.eclipse.ui.PlatformUI;
44
import org.eclipse.ui.PlatformUI;
43
import org.eclipse.ui.handlers.IHandlerService;
45
import org.eclipse.ui.handlers.IHandlerService;
44
import org.osgi.framework.Version;
45
46
46
/**
47
/**
47
 * @author Robert Elves
48
 * @author Robert Elves
Lines 54-59 Link Here
54
55
55
	public TaskListServiceMessageControl(Composite parent) {
56
	public TaskListServiceMessageControl(Composite parent) {
56
		super(parent);
57
		super(parent);
58
		setPreferencesPageId(TasksUiPreferencePage.ID);
57
	}
59
	}
58
60
59
	static ExecutionEvent createExecutionEvent(Command command, IHandlerService handlerService) {
61
	static ExecutionEvent createExecutionEvent(Command command, IHandlerService handlerService) {
Lines 83-94 Link Here
83
					continue;
85
					continue;
84
				}
86
				}
85
87
86
				if (!lastMessageId.equals(message.getId()) && isForCurrentVersion(message)) {
88
				if (message.getId().compareTo(lastMessageId) > 0) {
87
					Display.getDefault().asyncExec(new Runnable() {
89
					Display.getDefault().asyncExec(new Runnable() {
88
						public void run() {
90
						public void run() {
89
							setMessage(message);
91
							setMessage(message);
92
							// event id is not used but must be set to make configure link visible
93
							setEventId(""); //$NON-NLS-1$
90
						}
94
						}
91
					});
95
					});
96
					break;
92
				}
97
				}
93
			}
98
			}
94
			break;
99
			break;
Lines 98-118 Link Here
98
		}
103
		}
99
	}
104
	}
100
105
101
	private boolean isForCurrentVersion(ServiceMessage message) {
102
		if (message.getVersion() == null) {
103
			return true;
104
		}
105
106
		try {
107
			VersionRange version = new VersionRange(message.getVersion());
108
			String versionString = (String) TasksUiPlugin.getDefault().getBundle().getHeaders().get("Bundle-Version"); //$NON-NLS-1$
109
			return version.isIncluded(new Version(versionString));
110
		} catch (IllegalArgumentException e) {
111
			// invalid version range
112
			return false;
113
		}
114
	}
115
116
	public void setMessage(ServiceMessage message) {
106
	public void setMessage(ServiceMessage message) {
117
		if (message != null) {
107
		if (message != null) {
118
			ensureControl();
108
			ensureControl();
Lines 126-133 Link Here
126
			this.currentMessage = message;
116
			this.currentMessage = message;
127
117
128
			setTitle(message.getTitle());
118
			setTitle(message.getTitle());
129
			setDescription(message.getDescription());
130
			setTitleImage(Dialog.getImage(message.getImage()));
119
			setTitleImage(Dialog.getImage(message.getImage()));
120
			setDescription(message.getDescription());
131
		}
121
		}
132
	}
122
	}
133
123
Lines 136-170 Link Here
136
		return new SelectionAdapter() {
126
		return new SelectionAdapter() {
137
			@Override
127
			@Override
138
			public void widgetSelected(SelectionEvent e) {
128
			public void widgetSelected(SelectionEvent e) {
139
				if (e.text != null) {
129
				if (e.text == null) {
140
					String action = e.text.toLowerCase();
130
					return;
141
					if ("create-local-task".equals(action)) { //$NON-NLS-1$
131
				}
142
						closeMessage();
132
143
						LocalTask task = TasksUiInternal.createNewLocalTask(null);
133
				String action = getAction(e.text);
144
						TasksUiUtil.openTask(task);
134
				if ("create-local-task".equals(action)) { //$NON-NLS-1$
145
					} else if ("connect".equals(action)) { //$NON-NLS-1$
135
					closeMessage();
146
						closeMessage();
136
					LocalTask task = TasksUiInternal.createNewLocalTask(null);
147
						new AddRepositoryAction().run();
137
					TasksUiUtil.openTask(task);
148
					} else if ("discovery".equals(action)) { //$NON-NLS-1$
138
				} else if ("connect".equals(action)) { //$NON-NLS-1$
149
						closeMessage();
139
					closeMessage();
150
						final Command discoveryWizardCommand = TasksUiInternal.getConfiguredDiscoveryWizardCommand();
140
					new AddRepositoryAction().run();
151
						if (discoveryWizardCommand != null && discoveryWizardCommand.isEnabled()) {
141
				} else if ("discovery".equals(action)) { //$NON-NLS-1$
152
							IHandlerService handlerService = (IHandlerService) PlatformUI.getWorkbench().getService(
142
					closeMessage();
153
									IHandlerService.class);
143
					final Command discoveryWizardCommand = TasksUiInternal.getConfiguredDiscoveryWizardCommand();
154
							try {
144
					if (discoveryWizardCommand != null && discoveryWizardCommand.isEnabled()) {
155
								handlerService.executeCommand(discoveryWizardCommand.getId(), null);
145
						IHandlerService handlerService = (IHandlerService) PlatformUI.getWorkbench().getService(
156
							} catch (Exception e1) {
146
								IHandlerService.class);
157
								IStatus status = new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN, NLS.bind(
147
						try {
158
										Messages.SelectRepositoryConnectorPage_discoveryProblemMessage,
148
							handlerService.executeCommand(discoveryWizardCommand.getId(), null);
159
										new Object[] { e1.getMessage() }), e1);
149
						} catch (Exception e1) {
160
								TasksUiInternal.logAndDisplayStatus(
150
							IStatus status = new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN, NLS.bind(
161
										Messages.SelectRepositoryConnectorPage_discoveryProblemTitle, status);
151
									Messages.SelectRepositoryConnectorPage_discoveryProblemMessage,
162
							}
152
									new Object[] { e1.getMessage() }), e1);
153
							TasksUiInternal.logAndDisplayStatus(
154
									Messages.SelectRepositoryConnectorPage_discoveryProblemTitle, status);
163
						}
155
						}
164
					}
156
					}
157
				} else if (TasksUiInternal.isValidUrl(e.text)) {
158
					TasksUiUtil.openUrl(e.text);
165
				}
159
				}
166
			}
160
			}
161
167
		};
162
		};
168
	}
163
	}
169
164
165
	/**
166
	 * Extracts action from query part or a URL if applicable.
167
	 */
168
	public static String getAction(String action) {
169
		if (action.startsWith("http")) { //$NON-NLS-1$
170
			URL url;
171
			try {
172
				url = new URL(action);
173
				String query = url.getQuery();
174
				if (query != null && query.startsWith("action=")) { //$NON-NLS-1$
175
					int i = query.indexOf("&"); //$NON-NLS-1$
176
					if (i != -1) {
177
						action = query.substring(7, i);
178
					} else {
179
						action = query.substring(7);
180
					}
181
				} else {
182
					return null;
183
				}
184
			} catch (MalformedURLException e1) {
185
				// ignore
186
				return null;
187
			}
188
		}
189
		return action.toLowerCase();
190
	}
191
170
}
192
}
(-)src/org/eclipse/mylyn/internal/tasks/ui/preferences/TasksUiPreferencePage.java (-16 / +11 lines)
Lines 111-118 Link Here
111
111
112
	private Button showTaskTrimButton;
112
	private Button showTaskTrimButton;
113
113
114
	// Disabled for initial 3.4 release as per bug#263528
114
	private Button taskListServiceMessageEnabledButton;
115
//	private Button taskListServiceMessageEnabledButton;
116
115
117
	public TasksUiPreferencePage() {
116
	public TasksUiPreferencePage() {
118
		super();
117
		super();
Lines 213-221 Link Here
213
212
214
		getPreferenceStore().setValue(ITasksUiPreferenceConstants.TASK_LIST_TOOL_TIPS_ENABLED,
213
		getPreferenceStore().setValue(ITasksUiPreferenceConstants.TASK_LIST_TOOL_TIPS_ENABLED,
215
				taskListTooltipEnabledButton.getSelection());
214
				taskListTooltipEnabledButton.getSelection());
216
		// Disabled for initial 3.4 release as per bug#263528
215
		getPreferenceStore().setValue(ITasksUiPreferenceConstants.SERVICE_MESSAGES_ENABLED,
217
//		getPreferenceStore().setValue(ITasksUiPreferenceConstants.SERVICE_MESSAGES_ENABLED,
216
				taskListServiceMessageEnabledButton.getSelection());
218
//				taskListServiceMessageEnabledButton.getSelection());
219
		getPreferenceStore().setValue(ITasksUiPreferenceConstants.SHOW_TRIM, showTaskTrimButton.getSelection());
217
		getPreferenceStore().setValue(ITasksUiPreferenceConstants.SHOW_TRIM, showTaskTrimButton.getSelection());
220
218
221
		getPreferenceStore().setValue(ITasksUiPreferenceConstants.WEEK_START_DAY, getWeekStartValue());
219
		getPreferenceStore().setValue(ITasksUiPreferenceConstants.WEEK_START_DAY, getWeekStartValue());
Lines 288-296 Link Here
288
286
289
		taskListTooltipEnabledButton.setSelection(getPreferenceStore().getBoolean(
287
		taskListTooltipEnabledButton.setSelection(getPreferenceStore().getBoolean(
290
				ITasksUiPreferenceConstants.TASK_LIST_TOOL_TIPS_ENABLED));
288
				ITasksUiPreferenceConstants.TASK_LIST_TOOL_TIPS_ENABLED));
291
		// Disabled for initial 3.4 release as per bug#263528
289
		taskListServiceMessageEnabledButton.setSelection(getPreferenceStore().getBoolean(
292
//		taskListServiceMessageEnabledButton.setSelection(getPreferenceStore().getBoolean(
290
				ITasksUiPreferenceConstants.SERVICE_MESSAGES_ENABLED));
293
//				ITasksUiPreferenceConstants.SERVICE_MESSAGES_ENABLED));
294
		showTaskTrimButton.setSelection(getPreferenceStore().getBoolean(ITasksUiPreferenceConstants.SHOW_TRIM));
291
		showTaskTrimButton.setSelection(getPreferenceStore().getBoolean(ITasksUiPreferenceConstants.SHOW_TRIM));
295
292
296
		weekStartCombo.select(getPreferenceStore().getInt(ITasksUiPreferenceConstants.WEEK_START_DAY) - 1);
293
		weekStartCombo.select(getPreferenceStore().getInt(ITasksUiPreferenceConstants.WEEK_START_DAY) - 1);
Lines 328-336 Link Here
328
325
329
		taskListTooltipEnabledButton.setSelection(getPreferenceStore().getDefaultBoolean(
326
		taskListTooltipEnabledButton.setSelection(getPreferenceStore().getDefaultBoolean(
330
				ITasksUiPreferenceConstants.TASK_LIST_TOOL_TIPS_ENABLED));
327
				ITasksUiPreferenceConstants.TASK_LIST_TOOL_TIPS_ENABLED));
331
		// Disabled for initial 3.4 release as per bug#263528
328
		taskListServiceMessageEnabledButton.setSelection(getPreferenceStore().getDefaultBoolean(
332
//		taskListServiceMessageEnabledButton.setSelection(getPreferenceStore().getDefaultBoolean(
329
				ITasksUiPreferenceConstants.SERVICE_MESSAGES_ENABLED));
333
//				ITasksUiPreferenceConstants.SERVICE_MESSAGES_ENABLED));
334
		showTaskTrimButton.setSelection(getPreferenceStore().getDefaultBoolean(ITasksUiPreferenceConstants.SHOW_TRIM));
330
		showTaskTrimButton.setSelection(getPreferenceStore().getDefaultBoolean(ITasksUiPreferenceConstants.SHOW_TRIM));
335
331
336
		// synchQueries.setSelection(getPreferenceStore().getDefaultBoolean(
332
		// synchQueries.setSelection(getPreferenceStore().getDefaultBoolean(
Lines 519-529 Link Here
519
		taskListTooltipEnabledButton.setSelection(getPreferenceStore().getBoolean(
515
		taskListTooltipEnabledButton.setSelection(getPreferenceStore().getBoolean(
520
				ITasksUiPreferenceConstants.TASK_LIST_TOOL_TIPS_ENABLED));
516
				ITasksUiPreferenceConstants.TASK_LIST_TOOL_TIPS_ENABLED));
521
517
522
		// Disabled for initial 3.4 release as per bug#263528
518
		taskListServiceMessageEnabledButton = new Button(group, SWT.CHECK);
523
//		taskListServiceMessageEnabledButton = new Button(group, SWT.CHECK);
519
		taskListServiceMessageEnabledButton.setText("Display notification when new connectors are available"); //$NON-NLS-1$
524
//		taskListServiceMessageEnabledButton.setText(Messages.TasksUiPreferencePage_show_service_messages);
520
		taskListServiceMessageEnabledButton.setSelection(getPreferenceStore().getBoolean(
525
//		taskListServiceMessageEnabledButton.setSelection(getPreferenceStore().getBoolean(
521
				ITasksUiPreferenceConstants.SERVICE_MESSAGES_ENABLED));
526
//				ITasksUiPreferenceConstants.SERVICE_MESSAGES_ENABLED));
527
	}
522
	}
528
523
529
	private void createTaskActivityGroup(Composite container) {
524
	private void createTaskActivityGroup(Composite container) {
(-)src/org/eclipse/mylyn/internal/tasks/ui/util/TasksUiInternal.java (-1 / +1 lines)
Lines 165-171 Link Here
165
	 */
165
	 */
166
	public static Command getConfiguredDiscoveryWizardCommand() {
166
	public static Command getConfiguredDiscoveryWizardCommand() {
167
		ICommandService service = (ICommandService) PlatformUI.getWorkbench().getService(ICommandService.class);
167
		ICommandService service = (ICommandService) PlatformUI.getWorkbench().getService(ICommandService.class);
168
		final Command discoveryWizardCommand = service.getCommand("org.eclipse.mylyn.discovery.ui.discoveryWizardCommand"); //$NON-NLS-1$
168
		final Command discoveryWizardCommand = service.getCommand("org.eclipse.mylyn.tasks.ui.discoveryWizardCommand"); //$NON-NLS-1$
169
		if (discoveryWizardCommand != null) {
169
		if (discoveryWizardCommand != null) {
170
			IHandlerService handlerService = (IHandlerService) PlatformUI.getWorkbench().getService(
170
			IHandlerService handlerService = (IHandlerService) PlatformUI.getWorkbench().getService(
171
					IHandlerService.class);
171
					IHandlerService.class);
(-)src/org/eclipse/mylyn/tests/AllHeadlessStandaloneTest.java (+4 lines)
Lines 21-26 Link Here
21
import org.eclipse.mylyn.tasks.tests.TaskListTest;
21
import org.eclipse.mylyn.tasks.tests.TaskListTest;
22
import org.eclipse.mylyn.tasks.tests.TasksUtilTest;
22
import org.eclipse.mylyn.tasks.tests.TasksUtilTest;
23
import org.eclipse.mylyn.tasks.tests.core.DefaultTaskSchemaTest;
23
import org.eclipse.mylyn.tasks.tests.core.DefaultTaskSchemaTest;
24
import org.eclipse.mylyn.tasks.tests.core.EnvironmentTest;
25
import org.eclipse.mylyn.tasks.tests.core.FeedReaderTest;
24
import org.eclipse.mylyn.tasks.tests.core.ITasksCoreConstantsTest;
26
import org.eclipse.mylyn.tasks.tests.core.ITasksCoreConstantsTest;
25
import org.eclipse.mylyn.tasks.tests.core.TaskListUnmatchedContainerTest;
27
import org.eclipse.mylyn.tasks.tests.core.TaskListUnmatchedContainerTest;
26
import org.eclipse.mylyn.tasks.tests.core.TaskRepositoryLocationTest;
28
import org.eclipse.mylyn.tasks.tests.core.TaskRepositoryLocationTest;
Lines 46-51 Link Here
46
		// commons
48
		// commons
47
		suite.addTestSuite(WebUtilTest.class);
49
		suite.addTestSuite(WebUtilTest.class);
48
		suite.addTestSuite(SslProtocolSocketFactoryTest.class);
50
		suite.addTestSuite(SslProtocolSocketFactoryTest.class);
51
		suite.addTestSuite(FeedReaderTest.class);
52
		suite.addTestSuite(EnvironmentTest.class);
49
53
50
		// context
54
		// context
51
		// disabled due to failure: bug 257972
55
		// disabled due to failure: bug 257972

Return to bug 339467