Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 36af35e2908a83a8b7ea365fc9cf46360cef983a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/*******************************************************************************
 * Copyright (c) 2018 Remain Software
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     wim.jongman@remainsoftware.com - initial API and implementation
 *******************************************************************************/
package org.eclipse.tips.ide.internal;

import org.eclipse.core.runtime.jobs.IJobChangeEvent;
import org.eclipse.core.runtime.jobs.JobChangeAdapter;
import org.eclipse.tips.core.Tip;
import org.eclipse.tips.core.TipProvider;

/**
 *
 * Internal class to listen to async provider load completions.
 *
 */
public class ProviderLoadJobChangeListener extends JobChangeAdapter {

	private IDETipManager fManager;
	private TipProvider fProvider;

	public ProviderLoadJobChangeListener(IDETipManager manager, TipProvider provider) {
		fManager = manager;
		fProvider = provider;
	}

	/**
	 * {@inheritDoc}
	 * <p>
	 * If this provider has new tips then the {@link IDETipManager} gets a callback
	 * to update the UI.
	 *
	 * @see IDETipManager#setNewTips(boolean)
	 */
	@Override
	public void done(IJobChangeEvent event) {
		for (Tip tip : fProvider.getTips(false)) {
			if (!fManager.isRead(tip)) {
				fManager.setNewTips(true);
				return;
			}
		}
	}
}

Back to the top